From 8b2d8cff6f939beee2cf59074e0ccb4a2486f051 Mon Sep 17 00:00:00 2001 From: Simon Warta Date: Tue, 11 Oct 2022 16:38:09 +0200 Subject: [PATCH] Add ibc.applications.interchain_accounts types --- CHANGELOG.md | 3 + scripts/codegen.sh | 8 + .../controller/v1/controller.ts | 89 ++++ .../controller/v1/query.ts | 157 ++++++ .../interchain_accounts/host/v1/host.ts | 108 ++++ .../interchain_accounts/host/v1/query.ts | 153 ++++++ .../interchain_accounts/v1/account.ts | 102 ++++ .../interchain_accounts/v1/genesis.ts | 470 ++++++++++++++++++ .../interchain_accounts/v1/metadata.ts | 159 ++++++ .../interchain_accounts/v1/packet.ts | 252 ++++++++++ 10 files changed, 1501 insertions(+) create mode 100644 src/ibc/applications/interchain_accounts/controller/v1/controller.ts create mode 100644 src/ibc/applications/interchain_accounts/controller/v1/query.ts create mode 100644 src/ibc/applications/interchain_accounts/host/v1/host.ts create mode 100644 src/ibc/applications/interchain_accounts/host/v1/query.ts create mode 100644 src/ibc/applications/interchain_accounts/v1/account.ts create mode 100644 src/ibc/applications/interchain_accounts/v1/genesis.ts create mode 100644 src/ibc/applications/interchain_accounts/v1/metadata.ts create mode 100644 src/ibc/applications/interchain_accounts/v1/packet.ts diff --git a/CHANGELOG.md b/CHANGELOG.md index 1d642616..a45ae323 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,9 @@ and this project adheres to - Upgrade ts-proto to 1.126.1 and regenerate code - Upgrade Cosmos SDK protos to 0.45.8 - Upgrade wasmd protos to 0.28.0 +- Add ibc.applications.interchain_accounts types ([#36]) + +[#36]: https://github.com/confio/cosmjs-types/issues/36 ## [0.5.1] diff --git a/scripts/codegen.sh b/scripts/codegen.sh index 2ceac92d..c076ab78 100755 --- a/scripts/codegen.sh +++ b/scripts/codegen.sh @@ -79,6 +79,14 @@ protoc \ "$COSMOS_DIR/upgrade/v1beta1/upgrade.proto" \ "$COSMOS_DIR/vesting/v1beta1/tx.proto" \ "$COSMOS_DIR/vesting/v1beta1/vesting.proto" \ + "$IBC_DIR/applications/interchain_accounts/controller/v1/controller.proto" \ + "$IBC_DIR/applications/interchain_accounts/controller/v1/query.proto" \ + "$IBC_DIR/applications/interchain_accounts/host/v1/host.proto" \ + "$IBC_DIR/applications/interchain_accounts/host/v1/query.proto" \ + "$IBC_DIR/applications/interchain_accounts/v1/account.proto" \ + "$IBC_DIR/applications/interchain_accounts/v1/genesis.proto" \ + "$IBC_DIR/applications/interchain_accounts/v1/metadata.proto" \ + "$IBC_DIR/applications/interchain_accounts/v1/packet.proto" \ "$IBC_DIR/applications/transfer/v1/genesis.proto" \ "$IBC_DIR/applications/transfer/v1/query.proto" \ "$IBC_DIR/applications/transfer/v1/transfer.proto" \ diff --git a/src/ibc/applications/interchain_accounts/controller/v1/controller.ts b/src/ibc/applications/interchain_accounts/controller/v1/controller.ts new file mode 100644 index 00000000..f336e668 --- /dev/null +++ b/src/ibc/applications/interchain_accounts/controller/v1/controller.ts @@ -0,0 +1,89 @@ +/* eslint-disable */ +import Long from "long"; +import _m0 from "protobufjs/minimal"; + +export const protobufPackage = "ibc.applications.interchain_accounts.controller.v1"; + +/** + * Params defines the set of on-chain interchain accounts parameters. + * The following parameters may be used to disable the controller submodule. + */ +export interface Params { + /** controller_enabled enables or disables the controller submodule. */ + controllerEnabled: boolean; +} + +function createBaseParams(): Params { + return { controllerEnabled: false }; +} + +export const Params = { + encode(message: Params, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.controllerEnabled === true) { + writer.uint32(8).bool(message.controllerEnabled); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): Params { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.controllerEnabled = reader.bool(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): Params { + return { controllerEnabled: isSet(object.controllerEnabled) ? Boolean(object.controllerEnabled) : false }; + }, + + toJSON(message: Params): unknown { + const obj: any = {}; + message.controllerEnabled !== undefined && (obj.controllerEnabled = message.controllerEnabled); + return obj; + }, + + fromPartial, I>>(object: I): Params { + const message = createBaseParams(); + message.controllerEnabled = object.controllerEnabled ?? false; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin + ? T + : T extends Long + ? string | number | Long + : T extends Array + ? Array> + : T extends ReadonlyArray + ? ReadonlyArray> + : T extends {} + ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin + ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +if (_m0.util.Long !== Long) { + _m0.util.Long = Long as any; + _m0.configure(); +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} diff --git a/src/ibc/applications/interchain_accounts/controller/v1/query.ts b/src/ibc/applications/interchain_accounts/controller/v1/query.ts new file mode 100644 index 00000000..fb9cca29 --- /dev/null +++ b/src/ibc/applications/interchain_accounts/controller/v1/query.ts @@ -0,0 +1,157 @@ +/* eslint-disable */ +import Long from "long"; +import _m0 from "protobufjs/minimal"; +import { Params } from "./controller"; + +export const protobufPackage = "ibc.applications.interchain_accounts.controller.v1"; + +/** QueryParamsRequest is the request type for the Query/Params RPC method. */ +export interface QueryParamsRequest {} + +/** QueryParamsResponse is the response type for the Query/Params RPC method. */ +export interface QueryParamsResponse { + /** params defines the parameters of the module. */ + params?: Params; +} + +function createBaseQueryParamsRequest(): QueryParamsRequest { + return {}; +} + +export const QueryParamsRequest = { + encode(_: QueryParamsRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryParamsRequest { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryParamsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(_: any): QueryParamsRequest { + return {}; + }, + + toJSON(_: QueryParamsRequest): unknown { + const obj: any = {}; + return obj; + }, + + fromPartial, I>>(_: I): QueryParamsRequest { + const message = createBaseQueryParamsRequest(); + return message; + }, +}; + +function createBaseQueryParamsResponse(): QueryParamsResponse { + return { params: undefined }; +} + +export const QueryParamsResponse = { + encode(message: QueryParamsResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryParamsResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryParamsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.params = Params.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): QueryParamsResponse { + return { params: isSet(object.params) ? Params.fromJSON(object.params) : undefined }; + }, + + toJSON(message: QueryParamsResponse): unknown { + const obj: any = {}; + message.params !== undefined && (obj.params = message.params ? Params.toJSON(message.params) : undefined); + return obj; + }, + + fromPartial, I>>(object: I): QueryParamsResponse { + const message = createBaseQueryParamsResponse(); + message.params = + object.params !== undefined && object.params !== null ? Params.fromPartial(object.params) : undefined; + return message; + }, +}; + +/** Query provides defines the gRPC querier service. */ +export interface Query { + /** Params queries all parameters of the ICA controller submodule. */ + Params(request: QueryParamsRequest): Promise; +} + +export class QueryClientImpl implements Query { + private readonly rpc: Rpc; + constructor(rpc: Rpc) { + this.rpc = rpc; + this.Params = this.Params.bind(this); + } + Params(request: QueryParamsRequest): Promise { + const data = QueryParamsRequest.encode(request).finish(); + const promise = this.rpc.request( + "ibc.applications.interchain_accounts.controller.v1.Query", + "Params", + data, + ); + return promise.then((data) => QueryParamsResponse.decode(new _m0.Reader(data))); + } +} + +interface Rpc { + request(service: string, method: string, data: Uint8Array): Promise; +} + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin + ? T + : T extends Long + ? string | number | Long + : T extends Array + ? Array> + : T extends ReadonlyArray + ? ReadonlyArray> + : T extends {} + ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin + ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +if (_m0.util.Long !== Long) { + _m0.util.Long = Long as any; + _m0.configure(); +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} diff --git a/src/ibc/applications/interchain_accounts/host/v1/host.ts b/src/ibc/applications/interchain_accounts/host/v1/host.ts new file mode 100644 index 00000000..ef4bb16e --- /dev/null +++ b/src/ibc/applications/interchain_accounts/host/v1/host.ts @@ -0,0 +1,108 @@ +/* eslint-disable */ +import Long from "long"; +import _m0 from "protobufjs/minimal"; + +export const protobufPackage = "ibc.applications.interchain_accounts.host.v1"; + +/** + * Params defines the set of on-chain interchain accounts parameters. + * The following parameters may be used to disable the host submodule. + */ +export interface Params { + /** host_enabled enables or disables the host submodule. */ + hostEnabled: boolean; + /** allow_messages defines a list of sdk message typeURLs allowed to be executed on a host chain. */ + allowMessages: string[]; +} + +function createBaseParams(): Params { + return { hostEnabled: false, allowMessages: [] }; +} + +export const Params = { + encode(message: Params, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.hostEnabled === true) { + writer.uint32(8).bool(message.hostEnabled); + } + for (const v of message.allowMessages) { + writer.uint32(18).string(v!); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): Params { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.hostEnabled = reader.bool(); + break; + case 2: + message.allowMessages.push(reader.string()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): Params { + return { + hostEnabled: isSet(object.hostEnabled) ? Boolean(object.hostEnabled) : false, + allowMessages: Array.isArray(object?.allowMessages) + ? object.allowMessages.map((e: any) => String(e)) + : [], + }; + }, + + toJSON(message: Params): unknown { + const obj: any = {}; + message.hostEnabled !== undefined && (obj.hostEnabled = message.hostEnabled); + if (message.allowMessages) { + obj.allowMessages = message.allowMessages.map((e) => e); + } else { + obj.allowMessages = []; + } + return obj; + }, + + fromPartial, I>>(object: I): Params { + const message = createBaseParams(); + message.hostEnabled = object.hostEnabled ?? false; + message.allowMessages = object.allowMessages?.map((e) => e) || []; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin + ? T + : T extends Long + ? string | number | Long + : T extends Array + ? Array> + : T extends ReadonlyArray + ? ReadonlyArray> + : T extends {} + ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin + ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +if (_m0.util.Long !== Long) { + _m0.util.Long = Long as any; + _m0.configure(); +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} diff --git a/src/ibc/applications/interchain_accounts/host/v1/query.ts b/src/ibc/applications/interchain_accounts/host/v1/query.ts new file mode 100644 index 00000000..6dee7bd0 --- /dev/null +++ b/src/ibc/applications/interchain_accounts/host/v1/query.ts @@ -0,0 +1,153 @@ +/* eslint-disable */ +import Long from "long"; +import _m0 from "protobufjs/minimal"; +import { Params } from "./host"; + +export const protobufPackage = "ibc.applications.interchain_accounts.host.v1"; + +/** QueryParamsRequest is the request type for the Query/Params RPC method. */ +export interface QueryParamsRequest {} + +/** QueryParamsResponse is the response type for the Query/Params RPC method. */ +export interface QueryParamsResponse { + /** params defines the parameters of the module. */ + params?: Params; +} + +function createBaseQueryParamsRequest(): QueryParamsRequest { + return {}; +} + +export const QueryParamsRequest = { + encode(_: QueryParamsRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryParamsRequest { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryParamsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(_: any): QueryParamsRequest { + return {}; + }, + + toJSON(_: QueryParamsRequest): unknown { + const obj: any = {}; + return obj; + }, + + fromPartial, I>>(_: I): QueryParamsRequest { + const message = createBaseQueryParamsRequest(); + return message; + }, +}; + +function createBaseQueryParamsResponse(): QueryParamsResponse { + return { params: undefined }; +} + +export const QueryParamsResponse = { + encode(message: QueryParamsResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): QueryParamsResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryParamsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.params = Params.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): QueryParamsResponse { + return { params: isSet(object.params) ? Params.fromJSON(object.params) : undefined }; + }, + + toJSON(message: QueryParamsResponse): unknown { + const obj: any = {}; + message.params !== undefined && (obj.params = message.params ? Params.toJSON(message.params) : undefined); + return obj; + }, + + fromPartial, I>>(object: I): QueryParamsResponse { + const message = createBaseQueryParamsResponse(); + message.params = + object.params !== undefined && object.params !== null ? Params.fromPartial(object.params) : undefined; + return message; + }, +}; + +/** Query provides defines the gRPC querier service. */ +export interface Query { + /** Params queries all parameters of the ICA host submodule. */ + Params(request: QueryParamsRequest): Promise; +} + +export class QueryClientImpl implements Query { + private readonly rpc: Rpc; + constructor(rpc: Rpc) { + this.rpc = rpc; + this.Params = this.Params.bind(this); + } + Params(request: QueryParamsRequest): Promise { + const data = QueryParamsRequest.encode(request).finish(); + const promise = this.rpc.request("ibc.applications.interchain_accounts.host.v1.Query", "Params", data); + return promise.then((data) => QueryParamsResponse.decode(new _m0.Reader(data))); + } +} + +interface Rpc { + request(service: string, method: string, data: Uint8Array): Promise; +} + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin + ? T + : T extends Long + ? string | number | Long + : T extends Array + ? Array> + : T extends ReadonlyArray + ? ReadonlyArray> + : T extends {} + ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin + ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +if (_m0.util.Long !== Long) { + _m0.util.Long = Long as any; + _m0.configure(); +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} diff --git a/src/ibc/applications/interchain_accounts/v1/account.ts b/src/ibc/applications/interchain_accounts/v1/account.ts new file mode 100644 index 00000000..33967db3 --- /dev/null +++ b/src/ibc/applications/interchain_accounts/v1/account.ts @@ -0,0 +1,102 @@ +/* eslint-disable */ +import Long from "long"; +import _m0 from "protobufjs/minimal"; +import { BaseAccount } from "../../../../cosmos/auth/v1beta1/auth"; + +export const protobufPackage = "ibc.applications.interchain_accounts.v1"; + +/** An InterchainAccount is defined as a BaseAccount & the address of the account owner on the controller chain */ +export interface InterchainAccount { + baseAccount?: BaseAccount; + accountOwner: string; +} + +function createBaseInterchainAccount(): InterchainAccount { + return { baseAccount: undefined, accountOwner: "" }; +} + +export const InterchainAccount = { + encode(message: InterchainAccount, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.baseAccount !== undefined) { + BaseAccount.encode(message.baseAccount, writer.uint32(10).fork()).ldelim(); + } + if (message.accountOwner !== "") { + writer.uint32(18).string(message.accountOwner); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): InterchainAccount { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseInterchainAccount(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.baseAccount = BaseAccount.decode(reader, reader.uint32()); + break; + case 2: + message.accountOwner = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): InterchainAccount { + return { + baseAccount: isSet(object.baseAccount) ? BaseAccount.fromJSON(object.baseAccount) : undefined, + accountOwner: isSet(object.accountOwner) ? String(object.accountOwner) : "", + }; + }, + + toJSON(message: InterchainAccount): unknown { + const obj: any = {}; + message.baseAccount !== undefined && + (obj.baseAccount = message.baseAccount ? BaseAccount.toJSON(message.baseAccount) : undefined); + message.accountOwner !== undefined && (obj.accountOwner = message.accountOwner); + return obj; + }, + + fromPartial, I>>(object: I): InterchainAccount { + const message = createBaseInterchainAccount(); + message.baseAccount = + object.baseAccount !== undefined && object.baseAccount !== null + ? BaseAccount.fromPartial(object.baseAccount) + : undefined; + message.accountOwner = object.accountOwner ?? ""; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin + ? T + : T extends Long + ? string | number | Long + : T extends Array + ? Array> + : T extends ReadonlyArray + ? ReadonlyArray> + : T extends {} + ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin + ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +if (_m0.util.Long !== Long) { + _m0.util.Long = Long as any; + _m0.configure(); +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} diff --git a/src/ibc/applications/interchain_accounts/v1/genesis.ts b/src/ibc/applications/interchain_accounts/v1/genesis.ts new file mode 100644 index 00000000..54ea9af0 --- /dev/null +++ b/src/ibc/applications/interchain_accounts/v1/genesis.ts @@ -0,0 +1,470 @@ +/* eslint-disable */ +import Long from "long"; +import _m0 from "protobufjs/minimal"; +import { Params } from "../controller/v1/controller"; +import { Params as Params1 } from "../host/v1/host"; + +export const protobufPackage = "ibc.applications.interchain_accounts.v1"; + +/** GenesisState defines the interchain accounts genesis state */ +export interface GenesisState { + controllerGenesisState?: ControllerGenesisState; + hostGenesisState?: HostGenesisState; +} + +/** ControllerGenesisState defines the interchain accounts controller genesis state */ +export interface ControllerGenesisState { + activeChannels: ActiveChannel[]; + interchainAccounts: RegisteredInterchainAccount[]; + ports: string[]; + params?: Params; +} + +/** HostGenesisState defines the interchain accounts host genesis state */ +export interface HostGenesisState { + activeChannels: ActiveChannel[]; + interchainAccounts: RegisteredInterchainAccount[]; + port: string; + params?: Params1; +} + +/** ActiveChannel contains a connection ID, port ID and associated active channel ID */ +export interface ActiveChannel { + connectionId: string; + portId: string; + channelId: string; +} + +/** RegisteredInterchainAccount contains a connection ID, port ID and associated interchain account address */ +export interface RegisteredInterchainAccount { + connectionId: string; + portId: string; + accountAddress: string; +} + +function createBaseGenesisState(): GenesisState { + return { controllerGenesisState: undefined, hostGenesisState: undefined }; +} + +export const GenesisState = { + encode(message: GenesisState, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.controllerGenesisState !== undefined) { + ControllerGenesisState.encode(message.controllerGenesisState, writer.uint32(10).fork()).ldelim(); + } + if (message.hostGenesisState !== undefined) { + HostGenesisState.encode(message.hostGenesisState, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): GenesisState { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGenesisState(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.controllerGenesisState = ControllerGenesisState.decode(reader, reader.uint32()); + break; + case 2: + message.hostGenesisState = HostGenesisState.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): GenesisState { + return { + controllerGenesisState: isSet(object.controllerGenesisState) + ? ControllerGenesisState.fromJSON(object.controllerGenesisState) + : undefined, + hostGenesisState: isSet(object.hostGenesisState) + ? HostGenesisState.fromJSON(object.hostGenesisState) + : undefined, + }; + }, + + toJSON(message: GenesisState): unknown { + const obj: any = {}; + message.controllerGenesisState !== undefined && + (obj.controllerGenesisState = message.controllerGenesisState + ? ControllerGenesisState.toJSON(message.controllerGenesisState) + : undefined); + message.hostGenesisState !== undefined && + (obj.hostGenesisState = message.hostGenesisState + ? HostGenesisState.toJSON(message.hostGenesisState) + : undefined); + return obj; + }, + + fromPartial, I>>(object: I): GenesisState { + const message = createBaseGenesisState(); + message.controllerGenesisState = + object.controllerGenesisState !== undefined && object.controllerGenesisState !== null + ? ControllerGenesisState.fromPartial(object.controllerGenesisState) + : undefined; + message.hostGenesisState = + object.hostGenesisState !== undefined && object.hostGenesisState !== null + ? HostGenesisState.fromPartial(object.hostGenesisState) + : undefined; + return message; + }, +}; + +function createBaseControllerGenesisState(): ControllerGenesisState { + return { activeChannels: [], interchainAccounts: [], ports: [], params: undefined }; +} + +export const ControllerGenesisState = { + encode(message: ControllerGenesisState, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + for (const v of message.activeChannels) { + ActiveChannel.encode(v!, writer.uint32(10).fork()).ldelim(); + } + for (const v of message.interchainAccounts) { + RegisteredInterchainAccount.encode(v!, writer.uint32(18).fork()).ldelim(); + } + for (const v of message.ports) { + writer.uint32(26).string(v!); + } + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(34).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): ControllerGenesisState { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseControllerGenesisState(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.activeChannels.push(ActiveChannel.decode(reader, reader.uint32())); + break; + case 2: + message.interchainAccounts.push(RegisteredInterchainAccount.decode(reader, reader.uint32())); + break; + case 3: + message.ports.push(reader.string()); + break; + case 4: + message.params = Params.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): ControllerGenesisState { + return { + activeChannels: Array.isArray(object?.activeChannels) + ? object.activeChannels.map((e: any) => ActiveChannel.fromJSON(e)) + : [], + interchainAccounts: Array.isArray(object?.interchainAccounts) + ? object.interchainAccounts.map((e: any) => RegisteredInterchainAccount.fromJSON(e)) + : [], + ports: Array.isArray(object?.ports) ? object.ports.map((e: any) => String(e)) : [], + params: isSet(object.params) ? Params.fromJSON(object.params) : undefined, + }; + }, + + toJSON(message: ControllerGenesisState): unknown { + const obj: any = {}; + if (message.activeChannels) { + obj.activeChannels = message.activeChannels.map((e) => (e ? ActiveChannel.toJSON(e) : undefined)); + } else { + obj.activeChannels = []; + } + if (message.interchainAccounts) { + obj.interchainAccounts = message.interchainAccounts.map((e) => + e ? RegisteredInterchainAccount.toJSON(e) : undefined, + ); + } else { + obj.interchainAccounts = []; + } + if (message.ports) { + obj.ports = message.ports.map((e) => e); + } else { + obj.ports = []; + } + message.params !== undefined && (obj.params = message.params ? Params.toJSON(message.params) : undefined); + return obj; + }, + + fromPartial, I>>(object: I): ControllerGenesisState { + const message = createBaseControllerGenesisState(); + message.activeChannels = object.activeChannels?.map((e) => ActiveChannel.fromPartial(e)) || []; + message.interchainAccounts = + object.interchainAccounts?.map((e) => RegisteredInterchainAccount.fromPartial(e)) || []; + message.ports = object.ports?.map((e) => e) || []; + message.params = + object.params !== undefined && object.params !== null ? Params.fromPartial(object.params) : undefined; + return message; + }, +}; + +function createBaseHostGenesisState(): HostGenesisState { + return { activeChannels: [], interchainAccounts: [], port: "", params: undefined }; +} + +export const HostGenesisState = { + encode(message: HostGenesisState, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + for (const v of message.activeChannels) { + ActiveChannel.encode(v!, writer.uint32(10).fork()).ldelim(); + } + for (const v of message.interchainAccounts) { + RegisteredInterchainAccount.encode(v!, writer.uint32(18).fork()).ldelim(); + } + if (message.port !== "") { + writer.uint32(26).string(message.port); + } + if (message.params !== undefined) { + Params1.encode(message.params, writer.uint32(34).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): HostGenesisState { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseHostGenesisState(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.activeChannels.push(ActiveChannel.decode(reader, reader.uint32())); + break; + case 2: + message.interchainAccounts.push(RegisteredInterchainAccount.decode(reader, reader.uint32())); + break; + case 3: + message.port = reader.string(); + break; + case 4: + message.params = Params1.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): HostGenesisState { + return { + activeChannels: Array.isArray(object?.activeChannels) + ? object.activeChannels.map((e: any) => ActiveChannel.fromJSON(e)) + : [], + interchainAccounts: Array.isArray(object?.interchainAccounts) + ? object.interchainAccounts.map((e: any) => RegisteredInterchainAccount.fromJSON(e)) + : [], + port: isSet(object.port) ? String(object.port) : "", + params: isSet(object.params) ? Params1.fromJSON(object.params) : undefined, + }; + }, + + toJSON(message: HostGenesisState): unknown { + const obj: any = {}; + if (message.activeChannels) { + obj.activeChannels = message.activeChannels.map((e) => (e ? ActiveChannel.toJSON(e) : undefined)); + } else { + obj.activeChannels = []; + } + if (message.interchainAccounts) { + obj.interchainAccounts = message.interchainAccounts.map((e) => + e ? RegisteredInterchainAccount.toJSON(e) : undefined, + ); + } else { + obj.interchainAccounts = []; + } + message.port !== undefined && (obj.port = message.port); + message.params !== undefined && + (obj.params = message.params ? Params1.toJSON(message.params) : undefined); + return obj; + }, + + fromPartial, I>>(object: I): HostGenesisState { + const message = createBaseHostGenesisState(); + message.activeChannels = object.activeChannels?.map((e) => ActiveChannel.fromPartial(e)) || []; + message.interchainAccounts = + object.interchainAccounts?.map((e) => RegisteredInterchainAccount.fromPartial(e)) || []; + message.port = object.port ?? ""; + message.params = + object.params !== undefined && object.params !== null ? Params1.fromPartial(object.params) : undefined; + return message; + }, +}; + +function createBaseActiveChannel(): ActiveChannel { + return { connectionId: "", portId: "", channelId: "" }; +} + +export const ActiveChannel = { + encode(message: ActiveChannel, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.connectionId !== "") { + writer.uint32(10).string(message.connectionId); + } + if (message.portId !== "") { + writer.uint32(18).string(message.portId); + } + if (message.channelId !== "") { + writer.uint32(26).string(message.channelId); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): ActiveChannel { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseActiveChannel(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.connectionId = reader.string(); + break; + case 2: + message.portId = reader.string(); + break; + case 3: + message.channelId = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): ActiveChannel { + return { + connectionId: isSet(object.connectionId) ? String(object.connectionId) : "", + portId: isSet(object.portId) ? String(object.portId) : "", + channelId: isSet(object.channelId) ? String(object.channelId) : "", + }; + }, + + toJSON(message: ActiveChannel): unknown { + const obj: any = {}; + message.connectionId !== undefined && (obj.connectionId = message.connectionId); + message.portId !== undefined && (obj.portId = message.portId); + message.channelId !== undefined && (obj.channelId = message.channelId); + return obj; + }, + + fromPartial, I>>(object: I): ActiveChannel { + const message = createBaseActiveChannel(); + message.connectionId = object.connectionId ?? ""; + message.portId = object.portId ?? ""; + message.channelId = object.channelId ?? ""; + return message; + }, +}; + +function createBaseRegisteredInterchainAccount(): RegisteredInterchainAccount { + return { connectionId: "", portId: "", accountAddress: "" }; +} + +export const RegisteredInterchainAccount = { + encode(message: RegisteredInterchainAccount, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.connectionId !== "") { + writer.uint32(10).string(message.connectionId); + } + if (message.portId !== "") { + writer.uint32(18).string(message.portId); + } + if (message.accountAddress !== "") { + writer.uint32(26).string(message.accountAddress); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): RegisteredInterchainAccount { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRegisteredInterchainAccount(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.connectionId = reader.string(); + break; + case 2: + message.portId = reader.string(); + break; + case 3: + message.accountAddress = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): RegisteredInterchainAccount { + return { + connectionId: isSet(object.connectionId) ? String(object.connectionId) : "", + portId: isSet(object.portId) ? String(object.portId) : "", + accountAddress: isSet(object.accountAddress) ? String(object.accountAddress) : "", + }; + }, + + toJSON(message: RegisteredInterchainAccount): unknown { + const obj: any = {}; + message.connectionId !== undefined && (obj.connectionId = message.connectionId); + message.portId !== undefined && (obj.portId = message.portId); + message.accountAddress !== undefined && (obj.accountAddress = message.accountAddress); + return obj; + }, + + fromPartial, I>>( + object: I, + ): RegisteredInterchainAccount { + const message = createBaseRegisteredInterchainAccount(); + message.connectionId = object.connectionId ?? ""; + message.portId = object.portId ?? ""; + message.accountAddress = object.accountAddress ?? ""; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin + ? T + : T extends Long + ? string | number | Long + : T extends Array + ? Array> + : T extends ReadonlyArray + ? ReadonlyArray> + : T extends {} + ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin + ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +if (_m0.util.Long !== Long) { + _m0.util.Long = Long as any; + _m0.configure(); +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} diff --git a/src/ibc/applications/interchain_accounts/v1/metadata.ts b/src/ibc/applications/interchain_accounts/v1/metadata.ts new file mode 100644 index 00000000..12d12dff --- /dev/null +++ b/src/ibc/applications/interchain_accounts/v1/metadata.ts @@ -0,0 +1,159 @@ +/* eslint-disable */ +import Long from "long"; +import _m0 from "protobufjs/minimal"; + +export const protobufPackage = "ibc.applications.interchain_accounts.v1"; + +/** + * Metadata defines a set of protocol specific data encoded into the ICS27 channel version bytestring + * See ICS004: https://github.com/cosmos/ibc/tree/master/spec/core/ics-004-channel-and-packet-semantics#Versioning + */ +export interface Metadata { + /** version defines the ICS27 protocol version */ + version: string; + /** controller_connection_id is the connection identifier associated with the controller chain */ + controllerConnectionId: string; + /** host_connection_id is the connection identifier associated with the host chain */ + hostConnectionId: string; + /** + * address defines the interchain account address to be fulfilled upon the OnChanOpenTry handshake step + * NOTE: the address field is empty on the OnChanOpenInit handshake step + */ + address: string; + /** encoding defines the supported codec format */ + encoding: string; + /** tx_type defines the type of transactions the interchain account can execute */ + txType: string; +} + +function createBaseMetadata(): Metadata { + return { + version: "", + controllerConnectionId: "", + hostConnectionId: "", + address: "", + encoding: "", + txType: "", + }; +} + +export const Metadata = { + encode(message: Metadata, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.version !== "") { + writer.uint32(10).string(message.version); + } + if (message.controllerConnectionId !== "") { + writer.uint32(18).string(message.controllerConnectionId); + } + if (message.hostConnectionId !== "") { + writer.uint32(26).string(message.hostConnectionId); + } + if (message.address !== "") { + writer.uint32(34).string(message.address); + } + if (message.encoding !== "") { + writer.uint32(42).string(message.encoding); + } + if (message.txType !== "") { + writer.uint32(50).string(message.txType); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): Metadata { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMetadata(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.version = reader.string(); + break; + case 2: + message.controllerConnectionId = reader.string(); + break; + case 3: + message.hostConnectionId = reader.string(); + break; + case 4: + message.address = reader.string(); + break; + case 5: + message.encoding = reader.string(); + break; + case 6: + message.txType = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): Metadata { + return { + version: isSet(object.version) ? String(object.version) : "", + controllerConnectionId: isSet(object.controllerConnectionId) + ? String(object.controllerConnectionId) + : "", + hostConnectionId: isSet(object.hostConnectionId) ? String(object.hostConnectionId) : "", + address: isSet(object.address) ? String(object.address) : "", + encoding: isSet(object.encoding) ? String(object.encoding) : "", + txType: isSet(object.txType) ? String(object.txType) : "", + }; + }, + + toJSON(message: Metadata): unknown { + const obj: any = {}; + message.version !== undefined && (obj.version = message.version); + message.controllerConnectionId !== undefined && + (obj.controllerConnectionId = message.controllerConnectionId); + message.hostConnectionId !== undefined && (obj.hostConnectionId = message.hostConnectionId); + message.address !== undefined && (obj.address = message.address); + message.encoding !== undefined && (obj.encoding = message.encoding); + message.txType !== undefined && (obj.txType = message.txType); + return obj; + }, + + fromPartial, I>>(object: I): Metadata { + const message = createBaseMetadata(); + message.version = object.version ?? ""; + message.controllerConnectionId = object.controllerConnectionId ?? ""; + message.hostConnectionId = object.hostConnectionId ?? ""; + message.address = object.address ?? ""; + message.encoding = object.encoding ?? ""; + message.txType = object.txType ?? ""; + return message; + }, +}; + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin + ? T + : T extends Long + ? string | number | Long + : T extends Array + ? Array> + : T extends ReadonlyArray + ? ReadonlyArray> + : T extends {} + ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin + ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +if (_m0.util.Long !== Long) { + _m0.util.Long = Long as any; + _m0.configure(); +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} diff --git a/src/ibc/applications/interchain_accounts/v1/packet.ts b/src/ibc/applications/interchain_accounts/v1/packet.ts new file mode 100644 index 00000000..897a9d29 --- /dev/null +++ b/src/ibc/applications/interchain_accounts/v1/packet.ts @@ -0,0 +1,252 @@ +/* eslint-disable */ +import Long from "long"; +import _m0 from "protobufjs/minimal"; +import { Any } from "../../../../google/protobuf/any"; + +export const protobufPackage = "ibc.applications.interchain_accounts.v1"; + +/** + * Type defines a classification of message issued from a controller chain to its associated interchain accounts + * host + */ +export enum Type { + /** TYPE_UNSPECIFIED - Default zero value enumeration */ + TYPE_UNSPECIFIED = 0, + /** TYPE_EXECUTE_TX - Execute a transaction on an interchain accounts host chain */ + TYPE_EXECUTE_TX = 1, + UNRECOGNIZED = -1, +} + +export function typeFromJSON(object: any): Type { + switch (object) { + case 0: + case "TYPE_UNSPECIFIED": + return Type.TYPE_UNSPECIFIED; + case 1: + case "TYPE_EXECUTE_TX": + return Type.TYPE_EXECUTE_TX; + case -1: + case "UNRECOGNIZED": + default: + return Type.UNRECOGNIZED; + } +} + +export function typeToJSON(object: Type): string { + switch (object) { + case Type.TYPE_UNSPECIFIED: + return "TYPE_UNSPECIFIED"; + case Type.TYPE_EXECUTE_TX: + return "TYPE_EXECUTE_TX"; + case Type.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +/** InterchainAccountPacketData is comprised of a raw transaction, type of transaction and optional memo field. */ +export interface InterchainAccountPacketData { + type: Type; + data: Uint8Array; + memo: string; +} + +/** CosmosTx contains a list of sdk.Msg's. It should be used when sending transactions to an SDK host chain. */ +export interface CosmosTx { + messages: Any[]; +} + +function createBaseInterchainAccountPacketData(): InterchainAccountPacketData { + return { type: 0, data: new Uint8Array(), memo: "" }; +} + +export const InterchainAccountPacketData = { + encode(message: InterchainAccountPacketData, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.type !== 0) { + writer.uint32(8).int32(message.type); + } + if (message.data.length !== 0) { + writer.uint32(18).bytes(message.data); + } + if (message.memo !== "") { + writer.uint32(26).string(message.memo); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): InterchainAccountPacketData { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseInterchainAccountPacketData(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.type = reader.int32() as any; + break; + case 2: + message.data = reader.bytes(); + break; + case 3: + message.memo = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): InterchainAccountPacketData { + return { + type: isSet(object.type) ? typeFromJSON(object.type) : 0, + data: isSet(object.data) ? bytesFromBase64(object.data) : new Uint8Array(), + memo: isSet(object.memo) ? String(object.memo) : "", + }; + }, + + toJSON(message: InterchainAccountPacketData): unknown { + const obj: any = {}; + message.type !== undefined && (obj.type = typeToJSON(message.type)); + message.data !== undefined && + (obj.data = base64FromBytes(message.data !== undefined ? message.data : new Uint8Array())); + message.memo !== undefined && (obj.memo = message.memo); + return obj; + }, + + fromPartial, I>>( + object: I, + ): InterchainAccountPacketData { + const message = createBaseInterchainAccountPacketData(); + message.type = object.type ?? 0; + message.data = object.data ?? new Uint8Array(); + message.memo = object.memo ?? ""; + return message; + }, +}; + +function createBaseCosmosTx(): CosmosTx { + return { messages: [] }; +} + +export const CosmosTx = { + encode(message: CosmosTx, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + for (const v of message.messages) { + Any.encode(v!, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): CosmosTx { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseCosmosTx(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.messages.push(Any.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + + fromJSON(object: any): CosmosTx { + return { + messages: Array.isArray(object?.messages) ? object.messages.map((e: any) => Any.fromJSON(e)) : [], + }; + }, + + toJSON(message: CosmosTx): unknown { + const obj: any = {}; + if (message.messages) { + obj.messages = message.messages.map((e) => (e ? Any.toJSON(e) : undefined)); + } else { + obj.messages = []; + } + return obj; + }, + + fromPartial, I>>(object: I): CosmosTx { + const message = createBaseCosmosTx(); + message.messages = object.messages?.map((e) => Any.fromPartial(e)) || []; + return message; + }, +}; + +declare var self: any | undefined; +declare var window: any | undefined; +declare var global: any | undefined; +var globalThis: any = (() => { + if (typeof globalThis !== "undefined") { + return globalThis; + } + if (typeof self !== "undefined") { + return self; + } + if (typeof window !== "undefined") { + return window; + } + if (typeof global !== "undefined") { + return global; + } + throw "Unable to locate global object"; +})(); + +function bytesFromBase64(b64: string): Uint8Array { + if (globalThis.Buffer) { + return Uint8Array.from(globalThis.Buffer.from(b64, "base64")); + } else { + const bin = globalThis.atob(b64); + const arr = new Uint8Array(bin.length); + for (let i = 0; i < bin.length; ++i) { + arr[i] = bin.charCodeAt(i); + } + return arr; + } +} + +function base64FromBytes(arr: Uint8Array): string { + if (globalThis.Buffer) { + return globalThis.Buffer.from(arr).toString("base64"); + } else { + const bin: string[] = []; + arr.forEach((byte) => { + bin.push(String.fromCharCode(byte)); + }); + return globalThis.btoa(bin.join("")); + } +} + +type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin + ? T + : T extends Long + ? string | number | Long + : T extends Array + ? Array> + : T extends ReadonlyArray + ? ReadonlyArray> + : T extends {} + ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin + ? P + : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +if (_m0.util.Long !== Long) { + _m0.util.Long = Long as any; + _m0.configure(); +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +}