diff --git a/package.json b/package.json index 507cd5341..b141374ba 100644 --- a/package.json +++ b/package.json @@ -40,10 +40,10 @@ "publish-latest": "yarn workspaces foreach --exclude desmjs-documentation --no-private exec npm publish" }, "devDependencies": { - "@cosmjs/cosmwasm-stargate": "0.30.1", - "@cosmjs/crypto": "0.30.1", + "@cosmjs/cosmwasm-stargate": "0.31.0", + "@cosmjs/crypto": "0.31.0", "@cosmjs/encoding": "0.31.0", - "@cosmjs/proto-signing": "0.30.1", + "@cosmjs/proto-signing": "0.31.0", "@cosmjs/utils": "^0.31.0", "@desmoslabs/desmjs": "workspace:packages/core", "@desmoslabs/desmjs-types": "workspace:packages/types", diff --git a/packages/core/package.json b/packages/core/package.json index 123572369..71728c8ef 100644 --- a/packages/core/package.json +++ b/packages/core/package.json @@ -31,14 +31,14 @@ "lint-fix": "yarn lint --fix" }, "dependencies": { - "@cosmjs/amino": "0.30.1", - "@cosmjs/cosmwasm-stargate": "0.30.1", - "@cosmjs/crypto": "0.30.1", + "@cosmjs/amino": "0.31.0", + "@cosmjs/cosmwasm-stargate": "0.31.0", + "@cosmjs/crypto": "0.31.0", "@cosmjs/encoding": "0.31.0", - "@cosmjs/math": "0.30.1", - "@cosmjs/proto-signing": "0.30.1", - "@cosmjs/stargate": "0.30.1", - "@cosmjs/tendermint-rpc": "0.30.1", + "@cosmjs/math": "0.31.0", + "@cosmjs/proto-signing": "0.31.0", + "@cosmjs/stargate": "0.31.0", + "@cosmjs/tendermint-rpc": "0.31.0", "@cosmjs/utils": "^0.31.0", "@desmoslabs/desmjs-types": "workspace:packages/types", "cosmjs-types": "^0.5.2", diff --git a/packages/core/src/aminomessages/index.ts b/packages/core/src/aminomessages/index.ts index 9e6cbd18d..598aad8e0 100644 --- a/packages/core/src/aminomessages/index.ts +++ b/packages/core/src/aminomessages/index.ts @@ -26,6 +26,10 @@ import { createSubspacesConverters, subspacesRegistryTypes } from "./subspaces"; import { createPostsConverters, postsRegistryTypes } from "./posts"; import { createReactionsConverters, reactionsRegistryTypes } from "./reactions"; import { createReportsConverters, reportsRegistryTypes } from "./reports"; +import GovV1Beta1AminoConverter from "../modules/gov/v1beta1/aminoconverter"; +import GovV1AminoConverter from "../modules/gov/v1/aminoconverter"; +import GovV1Registry from "../modules/gov/v1/registry"; +import GovV1Beta1Registry from "../modules/gov/v1beta1/registry"; export * from "./cosmos/authz/messages"; export * from "./cosmos/bank/messages"; @@ -42,6 +46,8 @@ export function createDesmosTypes(): AminoConverters { ...createBankAminoConverters(), ...createDistributionAminoConverters(), ...createGovAminoConverters(), + ...GovV1Beta1AminoConverter, + ...GovV1AminoConverter, ...createStakingAminoConverters(), ...createIbcAminoConverters(), ...createVestingAminoConverters(), @@ -63,6 +69,8 @@ export function createDesmosTypes(): AminoConverters { export const desmosRegistryTypes: ReadonlyArray<[string, GeneratedType]> = [ ...defaultRegistryTypes, + ...GovV1Beta1Registry, + ...GovV1Registry, ...cosmosRegistryTypes, ...desmjsRegistryTypes, diff --git a/packages/core/src/aminomessages/testutils/index.ts b/packages/core/src/aminomessages/testutils/index.ts index 5822823d2..9b6929e72 100644 --- a/packages/core/src/aminomessages/testutils/index.ts +++ b/packages/core/src/aminomessages/testutils/index.ts @@ -21,7 +21,7 @@ export function runConverterTest( ) { return async () => { const converter = converters[data.typeUrl]; - if (!converter || converter === "not_supported_by_chain") { + if (!converter) { fail(`Cannot find converter for msg with type url ${data.typeUrl}`); } diff --git a/packages/core/src/aminotypes.ts b/packages/core/src/aminotypes.ts new file mode 100644 index 000000000..e36321220 --- /dev/null +++ b/packages/core/src/aminotypes.ts @@ -0,0 +1,127 @@ +import { AminoMsg } from "@cosmjs/amino"; +import { EncodeObject, Registry } from "@cosmjs/proto-signing"; +import { + AminoConverter as CosmJSAminoConverter, + AminoTypes as CosmJSAminoTypes, +} from "@cosmjs/stargate"; +import { Any } from "@desmoslabs/desmjs-types/google/protobuf/any"; + +/** + * Interface that represents an object capable of convert + * an {@link EncodeObject} from and to {@link AminoMsg}. + * NOTE: This is an extension of the {@link CosmJSAminoConverter} from + * cosmjs to allow the conversion of objects that have a field with + * type {@link Any} like the MsgExec of the x/authz module. + */ +export interface AminoConverter extends CosmJSAminoConverter { + /** + * Converts an {@link EncodeObject} to its amino representation. + * @param encodeObject - The object to convert to {@link AminoMsg}. + * @param aminoTypes - An object to convert an {@link Any} encoded object + * from and to {@link AminoMsg}. + * NOTE: This is optional to make the interface backward compatible with + * {@link CosmJSAminoConverter}. + */ + readonly toAmino: ( + encodeObject: EncodeObject, + aminoTypes?: AminoTypes + ) => AminoMsg; + /** + * Converts an {@link AminoMsg} to its {@link EncodeObject} representation. + * @param aminoMsg - The object to convert to {@link AminoMsg} + * @param aminoTypes - An object to convert an {@link Any} encoded object + * from and to {@link AminoMsg}. + * NOTE: This is optional to make the interface backward compatible with + * {@link CosmJSAminoConverter}. + */ + readonly fromAmino: ( + aminoMsg: AminoMsg, + aminoTypes?: AminoTypes + ) => EncodeObject; +} + +declare type AminoConverters = Record; + +/** + * Extensions of the {@link CosmJSAminoTypes} that supports + * the amino serialization of messages that have {@link Any} encoed + * messages as child like the MsgExec of the x/authz module. + */ +export class AminoTypes extends CosmJSAminoTypes { + private readonly converters; + + private readonly registry; + + constructor(converters: AminoConverters, registry: Registry) { + super(converters); + this.converters = converters; + this.registry = registry; + } + + public override toAmino({ typeUrl, value }: EncodeObject): AminoMsg { + const converter = this.converters[typeUrl]; + if (!converter) { + throw new Error( + `Type URL '${typeUrl}' does not exist in the Amino message type register. ` + + "If you need support for this message type, you can pass in additional entries to the AminoTypes constructor. " + + "If you think this message type should be included by default, please open an issue at https://github.com/cosmos/cosmjs/issues." + ); + } + + return { + type: converter.aminoType, + value: converter.toAmino(value, this), + }; + } + + public override fromAmino({ type, value }: AminoMsg): EncodeObject { + const matches = Object.entries(this.converters).filter( + ([, converter]) => converter.aminoType === type + ); + + switch (matches.length) { + case 0: { + throw new Error( + `Amino type identifier '${type}' does not exist in the Amino message type register. ` + + "If you need support for this message type, you can pass in additional entries to the AminoTypes constructor. " + + "If you think this message type should be included by default, please open an issue at https://github.com/cosmos/cosmjs/issues." + ); + } + case 1: { + const [typeUrl, converter] = matches[0]; + return { + typeUrl, + value: converter.fromAmino(value, this), + }; + } + default: + throw new Error( + `Multiple types are registered with Amino type identifier '${type}': '${matches + .map(([key]) => key) + .sort() + .join("', '")}'. Thus fromAmino cannot be performed.` + ); + } + } + + /** + * Function to convert a {@link Any} encoded object to its + * amino representation. + * @param anyEncodedObject - The object to convert to amino. + */ + public fromAny(anyEncodedObject: Any): AminoMsg { + return this.toAmino({ + typeUrl: anyEncodedObject.typeUrl, + value: this.registry.decode(anyEncodedObject), + }); + } + + /** + * Function to convert a {@link AminoMsg} to its {@link Any} + * representation. + * @param aminoEncodedObject - The object to convert to {@link Any}. + */ + public toAny(aminoEncodedObject: AminoMsg): Any { + return this.registry.encodeAsAny(this.fromAmino(aminoEncodedObject)); + } +} diff --git a/packages/core/src/cosmjs.ts b/packages/core/src/cosmjs.ts index 9e71585d7..4a0177962 100644 --- a/packages/core/src/cosmjs.ts +++ b/packages/core/src/cosmjs.ts @@ -22,8 +22,6 @@ export { IndexedTx, SearchByHeightQuery, SearchBySentFromOrToQuery, - SearchByTagsQuery, - SearchTxFilter, SearchTxQuery, SequenceResponse, StdFee, diff --git a/packages/core/src/desmosclient.integration.spec.ts b/packages/core/src/desmosclient.integration.spec.ts index 86800f368..9246380df 100644 --- a/packages/core/src/desmosclient.integration.spec.ts +++ b/packages/core/src/desmosclient.integration.spec.ts @@ -8,7 +8,7 @@ import { ChainConfig, Proof, SignatureValueType, - SingleSignature, + SingleSignature } from "@desmoslabs/desmjs-types/desmos/profiles/v3/models_chain_links"; import { Any } from "@desmoslabs/desmjs-types/google/protobuf/any"; import { MsgLinkChainAccount } from "@desmoslabs/desmjs-types/desmos/profiles/v3/msgs_chain_links"; @@ -19,17 +19,21 @@ import { sleep } from "@cosmjs/utils"; import { DesmosClient } from "./desmosclient"; import { OfflineSignerAdapter, Signer, SigningMode } from "./signers"; import { + assertTxSuccess, defaultGasPrice, + getAminoSignerAndClient, + getDirectSignerAndClient, + pollTx, TEST_CHAIN_URL, testUser1, - testUser2, + testUser2 } from "./testutils"; import { getPubKeyBytes, getPubKeyRawBytes, getSignatureBytes, getSignedBytes, - SignatureResult, + SignatureResult } from "./signatureresult"; import { MsgAddReactionEncodeObject, @@ -41,12 +45,9 @@ import { MsgCreateSubspaceEncodeObject, MsgLinkChainAccountEncodeObject, MsgMultiSendEncodeObject, - MsgSaveProfileEncodeObject, + MsgSaveProfileEncodeObject } from "./encodeobjects"; -import { - bech32AddressToAny, - singleSignatureToAny, -} from "./aminomessages/profiles"; +import { bech32AddressToAny, singleSignatureToAny } from "./aminomessages/profiles"; import { postTargetToAny } from "./aminomessages/reports"; import { registeredReactionValueToAny } from "./aminomessages/reactions"; import { @@ -58,71 +59,13 @@ import { MsgCreateReportTypeUrl, MsgCreateSubspaceTypeUrl, MsgMultiSendTypeUrl, - MsgSaveProfileTypeUrl, + MsgSaveProfileTypeUrl } from "./const"; import MsgAuthenticateTypeUrl from "./const/desmjs"; describe("DesmosClient", () => { jest.setTimeout(60 * 1000); - /** - * Builds a Signer and DesmosClient instance based on a test mnemonic. - * The returned signer will sign transactions using the AMINO signing mode. - */ - async function getAminoSignerAndClient(): Promise<[Signer, DesmosClient]> { - const signer = await OfflineSignerAdapter.fromMnemonic( - SigningMode.AMINO, - testUser1.mnemonic - ); - const client = await DesmosClient.connectWithSigner( - TEST_CHAIN_URL, - signer, - { - gasPrice: defaultGasPrice, - gasAdjustment: 1.5, - } - ); - return [signer, client]; - } - - /** - * Builds a Signer and DesmosClient instance based on a test mnemonic. - * The returned signer will sign transactions using the DIRECT signing mode. - */ - async function getDirectSignerAndClient(): Promise<[Signer, DesmosClient]> { - const signer = await OfflineSignerAdapter.fromMnemonic( - SigningMode.DIRECT, - testUser1.mnemonic - ); - const client = await DesmosClient.connectWithSigner( - TEST_CHAIN_URL, - signer, - { - gasPrice: defaultGasPrice, - gasAdjustment: 1.8, - } - ); - return [signer, client]; - } - - async function pollTx(client: DesmosClient, txHash: string): Promise { - let timedOut = false; - const txPollTimeout = setTimeout(() => { - timedOut = true; - }, 60000); - - while (!timedOut) { - const tx = await client.getTx(txHash); - if (tx !== null) { - clearTimeout(txPollTimeout); - return; - } - await sleep(3000); - } - - throw new Error(`Timed out waiting for tx ${txHash}`); - } - describe("SignatureResult utils", () => { async function getSignatureResult(): Promise { const [signer, client] = await getDirectSignerAndClient(); @@ -813,7 +756,7 @@ describe("DesmosClient", () => { }, } as MsgSaveProfileEncodeObject, ]); - const response = await client.broadcastTxSync(signResult.txRaw); + const response = await client.broadcastTxRawSync(signResult.txRaw); await pollTx(client, response.hash); }); @@ -830,7 +773,8 @@ describe("DesmosClient", () => { }, } as MsgSaveProfileEncodeObject, ]); - await client.broadcastTxBlock(signResult.txRaw); + const response = await client.broadcastTxBlock(signResult.txRaw); + assertTxSuccess(response); }); }); }); diff --git a/packages/core/src/desmosclient.ts b/packages/core/src/desmosclient.ts index ccf74343c..0167c3ee7 100644 --- a/packages/core/src/desmosclient.ts +++ b/packages/core/src/desmosclient.ts @@ -1,6 +1,5 @@ import { Account, - AminoTypes, calculateFee, DeliverTxResponse, MsgTransferEncodeObject, @@ -67,6 +66,7 @@ import { BroadcastResponse, SyncBroadcastResponse, } from "./types/responses"; +import { AminoTypes } from "./aminotypes"; export interface SimulateOptions { publicKey?: PublicKey; @@ -222,10 +222,13 @@ export class DesmosClient extends SigningCosmWasmClient { options: Options, signer: Signer = new NoOpSigner() ) { - const { - registry = createDefaultRegistry(), - aminoTypes = new AminoTypes(createDesmosTypes()), - } = options; + const newAminoTypes = new AminoTypes( + createDesmosTypes(), + createDefaultRegistry() + ); + + const { registry = createDefaultRegistry(), aminoTypes = newAminoTypes } = + options; super(client, signer, { registry, @@ -236,7 +239,7 @@ export class DesmosClient extends SigningCosmWasmClient { this.txSigner = signer; this.typesRegistry = registry; - this.types = aminoTypes; + this.types = newAminoTypes; this.options = options; } @@ -706,7 +709,7 @@ export class DesmosClient extends SigningCosmWasmClient { * Broadcast transaction to mempool and wait for response. * @param tx - The transaction to broadcast. */ - public async broadcastTxSync(tx: TxRaw): Promise { + public async broadcastTxRawSync(tx: TxRaw): Promise { const client = this.forceGetTmClient(); const response = await client.broadcastTxSync({ tx: TxRaw.encode(tx).finish(), @@ -748,7 +751,7 @@ export class DesmosClient extends SigningCosmWasmClient { case BroadcastMode.Async: return this.broadcastTxAsync(tx); case BroadcastMode.Sync: - return this.broadcastTxAsync(tx); + return this.broadcastTxRawSync(tx); case BroadcastMode.Block: return this.broadcastTxBlock(tx); default: diff --git a/packages/core/src/modules/gov/v1/aminoconverter.ts b/packages/core/src/modules/gov/v1/aminoconverter.ts new file mode 100644 index 000000000..710242b78 --- /dev/null +++ b/packages/core/src/modules/gov/v1/aminoconverter.ts @@ -0,0 +1,3 @@ +import { AminoConverter } from "@desmoslabs/desmjs-types/cosmos/gov/v1/tx.amino"; + +export default AminoConverter; diff --git a/packages/core/src/modules/gov/v1/broadcast.integration.spec.ts b/packages/core/src/modules/gov/v1/broadcast.integration.spec.ts new file mode 100644 index 000000000..ac29c0e24 --- /dev/null +++ b/packages/core/src/modules/gov/v1/broadcast.integration.spec.ts @@ -0,0 +1,168 @@ +import { + MsgDeposit, + MsgExecLegacyContent, + MsgSubmitProposal, + MsgVote, + MsgVoteWeighted, +} from "@desmoslabs/desmjs-types/cosmos/gov/v1/tx"; +import { coin } from "@cosmjs/amino"; +import { TextProposal } from "@desmoslabs/desmjs-types/cosmos/gov/v1beta1/gov"; +import { VoteOption } from "@desmoslabs/desmjs-types/cosmos/gov/v1/gov"; +import Long from "long"; +import { MsgSend } from "cosmjs-types/cosmos/bank/v1beta1/tx"; +import { + MsgDepositTypeUrl, + MsgExecLegacyContentTypeUrl, + MsgSubmitProposalTypeUrl, + MsgVoteTypeUrl, + MsgVoteWeightedTypeUrl, +} from "./const"; +import { + assertTxSuccess, + getAminoSignerAndClient, + getDirectSignerAndClient, + testUser1, +} from "../../../testutils"; +import { MsgSendTypeUrl } from "../../../const"; +import { TextProposalTypeUrl } from "../v1beta1/const"; + +interface TestCase { + readonly name?: string; + readonly typeUrl: string; + readonly message: any; + readonly signer: string; +} + +describe("Broadcast /cosmos.gov.v1 messages", () => { + jest.setTimeout(60 * 1000); + + const testCases: TestCase[] = [ + { + typeUrl: MsgVoteTypeUrl, + message: MsgVote.fromPartial({ + proposalId: Long.fromNumber(1), + option: VoteOption.VOTE_OPTION_YES, + voter: testUser1.address0, + }), + signer: testUser1.address0, + }, + { + name: `${MsgSubmitProposalTypeUrl} without messages`, + typeUrl: MsgSubmitProposalTypeUrl, + message: MsgSubmitProposal.fromPartial({ + title: "proposal title", + summary: "proposal summary", + metadata: "test metadata", + messages: [], + initialDeposit: [coin(1, "stake")], + proposer: testUser1.address0, + }), + signer: testUser1.address0, + }, + { + name: `${MsgSubmitProposalTypeUrl} with messages`, + typeUrl: MsgSubmitProposalTypeUrl, + message: MsgSubmitProposal.fromPartial({ + title: "proposal title", + summary: "proposal summary", + messages: [ + { + typeUrl: MsgSendTypeUrl, + value: MsgSend.encode( + MsgSend.fromPartial({ + amount: [coin(1, "stake")], + toAddress: testUser1.address1, + fromAddress: "desmos10d07y265gmmuvt4z0w9aw880jnsr700jw674pt", + }) + ).finish(), + }, + ], + initialDeposit: [coin(1, "stake")], + proposer: testUser1.address0, + }), + signer: testUser1.address0, + }, + { + name: `${MsgSubmitProposalTypeUrl} with MsgExecLegacyContent`, + typeUrl: MsgSubmitProposalTypeUrl, + message: MsgSubmitProposal.fromPartial({ + title: "test", + summary: "summary", + messages: [ + { + typeUrl: MsgExecLegacyContentTypeUrl, + value: MsgExecLegacyContent.encode( + MsgExecLegacyContent.fromPartial({ + content: { + typeUrl: TextProposalTypeUrl, + value: TextProposal.encode( + TextProposal.fromPartial({ + title: "test", + description: "description", + }) + ).finish(), + }, + authority: "desmos10d07y265gmmuvt4z0w9aw880jnsr700jw674pt", + }) + ).finish(), + }, + ], + proposer: testUser1.address0, + initialDeposit: [coin(10000, "stake")], + }), + signer: testUser1.address0, + }, + { + typeUrl: MsgDepositTypeUrl, + message: MsgDeposit.fromPartial({ + proposalId: Long.fromNumber(1), + amount: [coin(1, "stake")], + depositor: testUser1.address0, + }), + signer: testUser1.address0, + }, + { + typeUrl: MsgVoteWeightedTypeUrl, + message: MsgVoteWeighted.fromPartial({ + proposalId: Long.fromNumber(1), + options: [ + { + option: VoteOption.VOTE_OPTION_YES, + weight: "1", + }, + ], + voter: testUser1.address0, + }), + signer: testUser1.address0, + }, + ]; + + testCases.forEach((t) => { + it(t.name ?? t.typeUrl, async () => { + const [, directClient] = await getDirectSignerAndClient(); + const [, aminoClient] = await getAminoSignerAndClient(); + + const directSignResult = await directClient.signTx(t.signer, [ + { + typeUrl: t.typeUrl, + value: t.message, + }, + ]); + const directResult = await directClient.broadcastTxBlock( + directSignResult.txRaw + ); + assertTxSuccess(directResult); + + const aminoSignResult = await aminoClient.signTx(t.signer, [ + { + typeUrl: t.typeUrl, + value: t.message, + }, + ]); + const aminoResult = await aminoClient.broadcastTxBlock( + aminoSignResult.txRaw + ); + assertTxSuccess(aminoResult); + }); + }); +}); diff --git a/packages/core/src/modules/gov/v1/const.ts b/packages/core/src/modules/gov/v1/const.ts new file mode 100644 index 000000000..7f8b13b7a --- /dev/null +++ b/packages/core/src/modules/gov/v1/const.ts @@ -0,0 +1,12 @@ +export const MsgSubmitProposalTypeUrl = "/cosmos.gov.v1.MsgSubmitProposal"; +export const MsgSubmitProposalAminoType = "cosmos-sdk/v1/MsgSubmitProposal"; +export const MsgExecLegacyContentTypeUrl = + "/cosmos.gov.v1.MsgExecLegacyContent"; +export const MsgExecLegacyContentAminoType = + "cosmos-sdk/v1/MsgExecLegacyContent"; +export const MsgVoteTypeUrl = "/cosmos.gov.v1.MsgVote"; +export const MsgVoteAminoType = "cosmos-sdk/v1/MsgVote"; +export const MsgVoteWeightedTypeUrl = "/cosmos.gov.v1.MsgVoteWeighted"; +export const MsgVoteWeightedAminoType = "cosmos-sdk/v1/MsgVoteWeighted"; +export const MsgDepositTypeUrl = "/cosmos.gov.v1.MsgDeposit"; +export const MsgDepositAminoType = "cosmos-sdk/v1/MsgDeposit"; diff --git a/packages/core/src/modules/gov/v1/encodeobjects.ts b/packages/core/src/modules/gov/v1/encodeobjects.ts new file mode 100644 index 000000000..850493e94 --- /dev/null +++ b/packages/core/src/modules/gov/v1/encodeobjects.ts @@ -0,0 +1,36 @@ +import { EncodeObject } from "@cosmjs/proto-signing"; +import { + MsgDeposit, + MsgExecLegacyContent, + MsgSubmitProposal, + MsgVote, + MsgVoteWeighted, +} from "@desmoslabs/desmjs-types/cosmos/gov/v1/tx"; +import { + MsgDepositTypeUrl, + MsgExecLegacyContentTypeUrl, + MsgSubmitProposalTypeUrl, + MsgVoteTypeUrl, + MsgVoteWeightedTypeUrl, +} from "./const"; + +export interface MsgSubmitProposalEncodeObject extends EncodeObject { + typeUrl: typeof MsgSubmitProposalTypeUrl; + value: MsgSubmitProposal; +} +export interface MsgExecLegacyContentEncodeObject extends EncodeObject { + typeUrl: typeof MsgExecLegacyContentTypeUrl; + value: MsgExecLegacyContent; +} +export interface MsgVoteEncodeObject extends EncodeObject { + typeUrl: typeof MsgVoteTypeUrl; + value: MsgVote; +} +export interface MsgVoteWeightedEncodeObject extends EncodeObject { + typeUrl: typeof MsgVoteWeightedTypeUrl; + value: MsgVoteWeighted; +} +export interface MsgDepositEncodeObject extends EncodeObject { + typeUrl: typeof MsgDepositTypeUrl; + value: MsgDeposit; +} diff --git a/packages/core/src/modules/gov/v1/registry.ts b/packages/core/src/modules/gov/v1/registry.ts new file mode 100644 index 000000000..b338da0f7 --- /dev/null +++ b/packages/core/src/modules/gov/v1/registry.ts @@ -0,0 +1,3 @@ +import { registry } from "@desmoslabs/desmjs-types/cosmos/gov/v1/tx.registry"; + +export default registry; diff --git a/packages/core/src/modules/gov/v1beta1/aminoconverter.ts b/packages/core/src/modules/gov/v1beta1/aminoconverter.ts new file mode 100644 index 000000000..628ed9841 --- /dev/null +++ b/packages/core/src/modules/gov/v1beta1/aminoconverter.ts @@ -0,0 +1,13 @@ +import { AminoConverter as AminoConverterGenerated } from "@desmoslabs/desmjs-types/cosmos/gov/v1beta1/tx.amino"; +import { TextProposal } from "@desmoslabs/desmjs-types/cosmos/gov/v1beta1/gov"; +import { TextProposalAminoType, TextProposalTypeUrl } from "./const"; + +const AminoConverter = { + ...AminoConverterGenerated, + [TextProposalTypeUrl]: { + aminoType: TextProposalAminoType, + toAmino: TextProposal.toAmino, + fromAmino: TextProposal.fromAmino, + }, +}; +export default AminoConverter; diff --git a/packages/core/src/modules/gov/v1beta1/const.ts b/packages/core/src/modules/gov/v1beta1/const.ts new file mode 100644 index 000000000..74a320ecc --- /dev/null +++ b/packages/core/src/modules/gov/v1beta1/const.ts @@ -0,0 +1,2 @@ +export const TextProposalTypeUrl = "/cosmos.gov.v1beta1.TextProposal"; +export const TextProposalAminoType = "cosmos-sdk/TextProposal"; diff --git a/packages/core/src/modules/gov/v1beta1/registry.ts b/packages/core/src/modules/gov/v1beta1/registry.ts new file mode 100644 index 000000000..c0665d240 --- /dev/null +++ b/packages/core/src/modules/gov/v1beta1/registry.ts @@ -0,0 +1,11 @@ +import { registry as generatedRegistry } from "@desmoslabs/desmjs-types/cosmos/gov/v1beta1/tx.registry"; +import { TextProposal } from "@desmoslabs/desmjs-types/cosmos/gov/v1beta1/gov"; +import { GeneratedType } from "@cosmjs/proto-signing"; +import { TextProposalTypeUrl } from "./const"; + +const registry: ReadonlyArray<[string, GeneratedType]> = [ + ...generatedRegistry, + [TextProposalTypeUrl, TextProposal], +]; + +export default registry; diff --git a/packages/core/src/testutils.ts b/packages/core/src/testutils.ts index a88cacdec..452e37bc8 100644 --- a/packages/core/src/testutils.ts +++ b/packages/core/src/testutils.ts @@ -2,6 +2,9 @@ import { calculateFee, GasPrice } from "@cosmjs/stargate"; import { DirectSecp256k1HdWallet, OfflineSigner } from "@cosmjs/proto-signing"; import { stringToPath } from "@cosmjs/crypto"; import { OfflineAminoSigner, Secp256k1HdWallet } from "@cosmjs/amino"; +import { OfflineSignerAdapter, Signer, SigningMode } from "./signers"; +import { DesmosClient } from "./desmosclient"; +import { BlockBroadcastResponse } from "./types/responses"; export type HdPath = { coinType: number; @@ -106,3 +109,71 @@ export async function delay(ms: number): Promise { setTimeout(r, ms); }); } + +/** + * Builds a Signer and DesmosClient instance based on a test mnemonic. + * The returned signer will sign transactions using the AMINO signing mode. + */ +export async function getAminoSignerAndClient(): Promise< + [Signer, DesmosClient] +> { + const signer = await OfflineSignerAdapter.fromMnemonic( + SigningMode.AMINO, + testUser1.mnemonic + ); + const client = await DesmosClient.connectWithSigner(TEST_CHAIN_URL, signer, { + gasPrice: defaultGasPrice, + gasAdjustment: 1.5, + }); + return [signer, client]; +} + +/** + * Builds a Signer and DesmosClient instance based on a test mnemonic. + * The returned signer will sign transactions using the DIRECT signing mode. + */ +export async function getDirectSignerAndClient(): Promise< + [Signer, DesmosClient] +> { + const signer = await OfflineSignerAdapter.fromMnemonic( + SigningMode.DIRECT, + testUser1.mnemonic + ); + const client = await DesmosClient.connectWithSigner(TEST_CHAIN_URL, signer, { + gasPrice: defaultGasPrice, + gasAdjustment: 1.8, + }); + return [signer, client]; +} + +export async function pollTx( + client: DesmosClient, + txHash: string +): Promise { + let timedOut = false; + const txPollTimeout = setTimeout(() => { + timedOut = true; + }, 60000); + + while (!timedOut) { + // eslint-disable-next-line no-await-in-loop + const tx = await client.getTx(txHash); + if (tx !== null) { + clearTimeout(txPollTimeout); + return; + } + // eslint-disable-next-line no-await-in-loop + await delay(3000); + } + + throw new Error(`Timed out waiting for tx ${txHash}`); +} + +/** + * Ensure that the provided {@link BlockBroadcastResponse} represents a + * transaction that has been broadcasted successfully. + */ +export function assertTxSuccess(response: BlockBroadcastResponse) { + expect(response.checkTx.log).toBe("[]"); + expect(response.checkTx.code).toBe(0); +} diff --git a/packages/keplr/package.json b/packages/keplr/package.json index f39a41ff9..787d11131 100644 --- a/packages/keplr/package.json +++ b/packages/keplr/package.json @@ -28,8 +28,8 @@ "lint-fix": "yarn lint --fix" }, "dependencies": { - "@cosmjs/amino": "0.30.1", - "@cosmjs/proto-signing": "0.30.1", + "@cosmjs/amino": "0.31.0", + "@cosmjs/proto-signing": "0.31.0", "@cosmjs/utils": "^0.31.0", "@desmoslabs/desmjs": "workspace:packages/core", "@keplr-wallet/types": "0.12.12", diff --git a/packages/types/.gitignore b/packages/types/.gitignore index 9bbd1be6e..234d00159 100644 --- a/packages/types/.gitignore +++ b/packages/types/.gitignore @@ -20,3 +20,6 @@ helpers.js.map index.d.ts index.js index.js.map +aminoconverter.d.ts +aminoconverter.js +aminoconverter.js.map diff --git a/packages/types/package.json b/packages/types/package.json index 7145fa8ba..f1d76760a 100644 --- a/packages/types/package.json +++ b/packages/types/package.json @@ -32,24 +32,27 @@ "scripts": { "download-proto": "./script/get-proto.sh", "format": "prettier --write --loglevel warn \"./src/**/*.ts\"", - "codegen": "rm -rf ./src && ./script/codegen.js && yarn format", + "codegen": "rm -rf ./src && ts-node ./script/codegen/index.ts && yarn format", "compile-codegen": "yarn tsc", "generate-code": "yarn download-proto && yarn codegen && yarn compile-codegen", "build": "yarn generate-code" }, "dependencies": { + "@cosmjs/proto-signing": "^0.31.0", "long": "^4.0.0", "protobufjs": "^7.2.3" }, "devDependencies": { "@osmonauts/telescope": "^0.97.0", - "@protobufs/cosmos": "^0.1.0", + "@protobufs/confio": "^0.0.6", "@protobufs/cosmos_proto": "^0.0.10", "@protobufs/gogoproto": "^0.0.10", - "@protobufs/ibc": "^0.1.0", + "@protobufs/google": "^0.0.10", "@types/long": "^4.0.1", "@types/node": "^20.3.1", "prettier": "^2.8.8", + "ts-morph": "^19.0.0", + "ts-node": "^10.9.1", "typescript": "^4.9.5" } -} +} \ No newline at end of file diff --git a/packages/types/script/codegen.js b/packages/types/script/codegen.js deleted file mode 100755 index 11668e4b3..000000000 --- a/packages/types/script/codegen.js +++ /dev/null @@ -1,237 +0,0 @@ -#!/usr/bin/env node - -const { join } = require('path'); -const { writeSync, writeFileSync, appendFileSync, readFileSync, openSync, close } = require('fs'); -const telescope = require('@osmonauts/telescope').default; - -const outPath = join(__dirname, '/../src'); - -function appendImport(file, content) { - // Read the file contents - const data = readFileSync(file); - // Search the last import statement - const last_import_index = data.lastIndexOf("import"); - // Search where the import statement ends - const append_start = data.indexOf(';', last_import_index); - - // Open the file - const fd = openSync(file, 'w+'); - // Write the original imports - writeSync(fd, data, 0, append_start); - // Write the new import statements. - appendFileSync(fd, content, { - encoding: 'utf8', - }) - // Append the old content. - writeSync(fd, data, append_start, data.length - append_start); - // Close the file. - close(fd); -} - -telescope({ - protoDirs: [ - 'proto-files/proto', - 'proto', - ], - outPath: outPath, - options: { - logLevel: 0, - useSDKTypes: false, - tsDisable: { - disableAll: false - }, - eslintDisable: { - disableAll: true - }, - bundle: { - enabled: false - }, - prototypes: { - includePackageVar: true, - methods: { - // There are users who need those functions. CosmJS does not need them directly. - // See https://github.com/cosmos/cosmjs/pull/1329 - fromJSON: true, - toJSON: true, - }, - typingsFormat: { - useDeepPartial: true, - useExact: true, - timestamp: 'timestamp', - duration: 'duration' - }, - excluded: { - packages: [ - // Ignore legacy versions - 'desmos.posts.v1', - 'desmos.posts.v2', - 'desmos.profiles.v1beta1', - 'desmos.profiles.v1', - 'desmos.profiles.v2', - 'desmos.subspaces.v1', - 'desmos.subspaces.v2.*', - - // Ignore unused cosmos deps - 'cosmos.app.*', - 'cosmos.auth.*', - 'cosmos.bank.*', - 'cosmos.base.abci.*', - 'cosmos.base.kv.*', - 'cosmos.base.reflection.*', - 'cosmos.base.snapshots.*', - 'cosmos.base.store.*', - 'cosmos.base.tendermint.*', - 'cosmos.base.reflection.*', - 'cosmos.capability.*', - 'cosmos.crisis.*', - 'cosmos.crypto.ed25519', - 'cosmos.crypto.hd.*', - 'cosmos.crypto.keyring.*', - 'cosmos.crypto.multisig', - 'cosmos.crypto.secp256k1', - 'cosmos.crypto.secp256r1', - 'cosmos.distribution.*', - 'cosmos.evidence.*', - 'cosmos.feegrant.*', - 'cosmos.genutil.*', - 'cosmos.gov.*', - 'cosmos.group.*', - 'cosmos.mint.*', - 'cosmos.msg.*', - 'cosmos.nft.*', - 'cosmos.orm.*', - 'cosmos.params.*', - 'cosmos.slashing.*', - 'cosmos.staking.*', - 'cosmos.tx.v1beta1', - 'cosmos.vesting.*', - - // Ignore unused ibc deps - 'ibc.applications.*', - 'ibc.core.channel.*', - 'ibc.core.commitment.*', - 'ibc.core.connection.*', - 'ibc.core.port.*', - 'ibc.core.types.*', - 'ibc.lightclients.*', - - // Ignore unused tendermint deps - 'tendermint.p2p', - - // Ignore unused tool deps - 'amino', - ] - } - }, - lcdClients: { - enabled: false - }, - rpcClients: { - enabled: true, - inline: true, - extensions: false, - camelCase: false, - enabledServices: [ - 'Msg', - 'Query', - 'Service', - 'ReflectionService', - 'ABCIApplication' - ] - }, - aminoEncoding: { - enabled: false - }, - - } -}).then(() => { - // Fix import in desmos/profiles/v3/msg_server.ts - const profiles_msg_server_import = ` - import { MsgDeleteProfile, MsgDeleteProfileResponse, MsgSaveProfile, MsgSaveProfileResponse } from "./msgs_profile"; - import { - MsgAcceptDTagTransferRequest, - MsgAcceptDTagTransferRequestResponse, - MsgCancelDTagTransferRequest, - MsgCancelDTagTransferRequestResponse, - MsgRefuseDTagTransferRequest, - MsgRefuseDTagTransferRequestResponse, - MsgRequestDTagTransfer, - MsgRequestDTagTransferResponse - } from "./msgs_dtag_requests"; - import { - MsgLinkChainAccount, - MsgLinkChainAccountResponse, - MsgSetDefaultExternalAddress, - MsgSetDefaultExternalAddressResponse, - MsgUnlinkChainAccount, - MsgUnlinkChainAccountResponse - } from "./msgs_chain_links"; - import { - MsgLinkApplication, - MsgLinkApplicationResponse, - MsgUnlinkApplication, - MsgUnlinkApplicationResponse - } from "./msgs_app_links"; - import { - MsgUpdateParams, - MsgUpdateParamsResponse - } from "./msgs_params"; - ` - const profiles_msg_server_file = `${outPath}/desmos/profiles/v3/msg_server.ts`; - appendImport(profiles_msg_server_file, profiles_msg_server_import); - - // Fix import in desmos/profiles/v3/query.ts - const profiles_query_import = ` - import { QueryProfileRequest, QueryProfileResponse } from "./query_profile"; - import { - QueryIncomingDTagTransferRequestsRequest, - QueryIncomingDTagTransferRequestsResponse - } from "./query_dtag_requests"; - import { - QueryChainLinkOwnersRequest, - QueryChainLinkOwnersResponse, - QueryChainLinksRequest, QueryChainLinksResponse, - QueryDefaultExternalAddressesRequest, QueryDefaultExternalAddressesResponse - } from "./query_chain_links"; - import { - QueryApplicationLinkByClientIDRequest, - QueryApplicationLinkByClientIDResponse, - QueryApplicationLinkOwnersRequest, - QueryApplicationLinkOwnersResponse, - QueryApplicationLinksRequest, - QueryApplicationLinksResponse - } from "./query_app_links"; - import { QueryParamsRequest, QueryParamsResponse } from "./query_params"; - `; - const profiles_query_file = `${outPath}/desmos/profiles/v3/query.ts`; - appendImport(profiles_query_file, profiles_query_import); - - // Fix import in desmos/subspaces/v3/msgs.ts - const subspaces_msgs_import = ` - import { - MsgGrantAllowance, MsgGrantAllowanceResponse, - MsgRevokeAllowance, MsgRevokeAllowanceResponse - } from "./msgs_feegrant"; - import { - MsgGrantTreasuryAuthorization, MsgGrantTreasuryAuthorizationResponse, - MsgRevokeTreasuryAuthorization, MsgRevokeTreasuryAuthorizationResponse - } from "./msgs_treasury"; - `; - const subspaces_msgs_file = `${outPath}/desmos/subspaces/v3/msgs.ts`; - appendImport(subspaces_msgs_file, subspaces_msgs_import); - - // Create index.ts - const index_ts = ` - // Auto-generated, see scripts/codegen.js! - - // Exports we want to provide at the root of the "@desmoslabs/desmjs-types" package - - export { DeepPartial, Exact } from "./helpers"; - `; - writeFileSync(`${outPath}/index.ts`, index_ts); - - console.log('✨ All Done!'); -}, (e) => { - console.error(e); - process.exit(1); -}); diff --git a/packages/types/script/codegen/config.ts b/packages/types/script/codegen/config.ts new file mode 100644 index 000000000..20d4f23fc --- /dev/null +++ b/packages/types/script/codegen/config.ts @@ -0,0 +1,141 @@ +import { TelescopeInput } from "@osmonauts/telescope/types/types"; +import { join } from "path"; + +export const OutputPath = join(__dirname, "/../../src"); + +export const TelescopeConfig: TelescopeInput = { + protoDirs: [ + "proto-files", + "proto" + ], + outPath: OutputPath, + options: { + logLevel: 0, + useSDKTypes: false, + tsDisable: { + disableAll: false + }, + eslintDisable: { + disableAll: true + }, + bundle: { + enabled: false + }, + prototypes: { + includePackageVar: true, + methods: { + // There are users who need those functions. CosmJS does not need them directly. + // See https://github.com/cosmos/cosmjs/pull/1329 + fromJSON: true, + toJSON: true + }, + typingsFormat: { + useDeepPartial: true, + useExact: true, + timestamp: "timestamp", + duration: "duration" + }, + excluded: { + packages: [ + // Ignore legacy versions + "desmos.posts.v1", + "desmos.posts.v2", + "desmos.profiles.v1beta1", + "desmos.profiles.v1", + "desmos.profiles.v2", + "desmos.subspaces.v1", + "desmos.subspaces.v2.*", + + "desmos.profiles.v3.client", + "desmos.reactions.v1.client", + + // Ignore unused cosmos deps + "cosmos.app.*", + "cosmos.auth.*", + "cosmos.authz.module.*", + "cosmos.bank.*", + "cosmos.base.abci.*", + "cosmos.base.node.*", + "cosmos.base.kv.*", + "cosmos.base.reflection.*", + "cosmos.base.snapshots.*", + "cosmos.base.store.*", + "cosmos.base.tendermint.*", + "cosmos.base.reflection.*", + "cosmos.capability.*", + "cosmos.crisis.*", + "cosmos.crypto.ed25519", + "cosmos.crypto.hd.*", + "cosmos.crypto.keyring.*", + "cosmos.crypto.multisig", + "cosmos.crypto.secp256k1", + "cosmos.crypto.secp256r1", + "cosmos.distribution.*", + "cosmos.evidence.*", + "cosmos.feegrant.*", + "cosmos.gov.module.*", + "cosmos.genutil.*", + "cosmos.group.*", + "cosmos.ics23.*", + "cosmos.mint.*", + "cosmos.msg.*", + "cosmos.nft.*", + "cosmos.orm.*", + "cosmos.params.*", + "cosmos.query.*", + "cosmos.slashing.*", + "cosmos.staking.*", + "cosmos.tx.v1beta1", + "cosmos.tx.config.*", + "cosmos.upgrade.module.*", + "cosmos.vesting.*", + + // Ignore unused ibc deps + "ibc.applications.*", + "ibc.core.channel.*", + "ibc.core.commitment.*", + "ibc.core.connection.*", + "ibc.core.port.*", + "ibc.core.types.*", + "ibc.lightclients.*", + + // Ignore unused tendermint deps + "tendermint.p2p", + + // Ignore unused tool deps + "amino", + + // Ignore google packages + "google.api", + + // Ignore gogoproto package + "gogoproto" + ] + } + }, + lcdClients: { + enabled: false + }, + rpcClients: { + enabled: true, + inline: true, + extensions: false, + camelCase: false, + enabledServices: [ + 'Msg', + 'Query', + 'Service', + 'ReflectionService', + 'ABCIApplication' + ] + }, + stargateClients: { + enabled: false, + includeCosmosDefaultTypes: false, + }, + aminoEncoding: { + enabled: true, + useRecursiveV2encoding: true + }, + } +} diff --git a/packages/types/script/codegen/index.ts b/packages/types/script/codegen/index.ts new file mode 100644 index 000000000..49aa8918d --- /dev/null +++ b/packages/types/script/codegen/index.ts @@ -0,0 +1,10 @@ +import telescope from "@osmonauts/telescope"; +import { OutputPath, TelescopeConfig } from "./config"; +import { patchModules } from "./patches"; + +telescope(TelescopeConfig) + .then(() => patchModules(OutputPath)) + .then(async () => console.log("✨ All Done!"), (e: any) => { + console.error(e); + process.exit(1); +}); diff --git a/packages/types/script/codegen/patch-utils.ts b/packages/types/script/codegen/patch-utils.ts new file mode 100644 index 000000000..9ff800d39 --- /dev/null +++ b/packages/types/script/codegen/patch-utils.ts @@ -0,0 +1,167 @@ +import * as fs from "fs"; +import { Project, SyntaxKind } from "ts-morph"; + +/** + * Interface that represents a modification that should be performed to + * an object's method. + */ +export interface PatchMethod { + /** + * Name of the object whose method will be changed. + */ + readonly object: string; + /** + * Name of the method that will be changed. + */ + readonly methodName: string; + /** + * New method definition. + */ + readonly newDefinition: string; +} + +/** + * Interface that represents a modification that should be performed to + * an interface's property. + */ +export interface PatchInterface { + /** + * Name of the interface whose property will be changed. + */ + readonly name: string; + /** + * Name of the property that will be changed. + */ + readonly prop: string; + /** + * Name propery deifinition. + */ + readonly newDefinition: string; +} + +/** + * Function to append some imports to a file. + * @param file - File where the imports will be appended. + * @param content - The imports to append to the file. + */ +export function appendImport(file: string, content: string) { + // Read the file contents + const data = fs.readFileSync(file); + // Search the last import statement + const last_import_index = data.lastIndexOf("import"); + if (last_import_index === -1) { + return; + } + + // Search where the import statement ends + const append_start = data.indexOf(";", last_import_index); + + // Open the file + const fd = fs.openSync(file, "w+"); + // Write the original imports + fs.writeSync(fd, data, 0, append_start); + // Write the new import statements. + fs.appendFileSync(fd, content, { + encoding: "utf8" + }); + // Append the old content. + fs.writeSync(fd, data, append_start + 1, data.length - append_start - 1); + // Close the file. + fs.close(fd); +} + +/** + * Function to modify the methods of one or more objects present in a file. + * @param inputFilePath - File that contains the objects to modify. + * @param patches - List of {@link PatchMethod} that will be applied to the file. + */ +export async function patchObjectMethods(inputFilePath: string, patches: PatchMethod[]) { + const code = await fs.promises.readFile(inputFilePath, "utf8"); + + const project = new Project(); + const sourceFile = project.createSourceFile( + inputFilePath, + code, + { overwrite: true } + ); + + const patchMap = patches.reduce>>((previousValue, currentValue) => { + const toPatchMethodsMap = previousValue[currentValue.object] ?? {}; + return { + ...previousValue, + [currentValue.object]: { + ...toPatchMethodsMap, + [currentValue.methodName]: currentValue + } + } + }, {}) + + + const objectLiteralExpressions = sourceFile.getChildrenOfKind(SyntaxKind.VariableStatement); + objectLiteralExpressions.forEach((ole) => { + const methods = ole.getDescendantsOfKind(SyntaxKind.MethodDeclaration) + const objectName = ole.getDescendantsOfKind(SyntaxKind.VariableDeclaration)[0].getName() + const methodToPatchInObject = patchMap[objectName]; + + if (methodToPatchInObject !== undefined) { + methods.forEach(m => { + const methodName = m.getName(); + const patch = methodToPatchInObject[methodName]; + if (patch !== undefined) { + console.log(`updating definition of ${objectName}.${methodName}`); + m.replaceWithText(patch.newDefinition); + } + }) + } + }) + + await sourceFile.save(); +} + +/** + * Function to modify the definition of one or more interface contained in a file. + * @param inputFilePath - File that contains the objects to modify. + * @param patches - List of {@link PatchInterface} that will be applied to the file. + */ +export async function patchInterfaceDefinition(inputFilePath: string, patches: PatchInterface[]) { + const code = await fs.promises.readFile(inputFilePath, "utf8"); + + const project = new Project(); + const sourceFile = project.createSourceFile( + inputFilePath, + code, + { overwrite: true } + ); + + const patchMap = patches.reduce>>((previousValue, currentValue) => { + const toPatchMethodsMap = previousValue[currentValue.name] ?? {}; + return { + ...previousValue, + [currentValue.name]: { + ...toPatchMethodsMap, + [currentValue.prop]: currentValue + } + } + }, {}) + + const interfaceDeclarations = sourceFile.getChildrenOfKind(SyntaxKind.InterfaceDeclaration); + interfaceDeclarations.forEach(id => { + const interfaceName = id.getName(); + const toPatchProperties = patchMap[interfaceName]; + + if (toPatchProperties !== undefined) { + const propertySignatures = id.getChildrenOfKind(SyntaxKind.PropertySignature); + propertySignatures.forEach(p => { + const propertyName = p.getName(); + const patch = toPatchProperties[propertyName]; + + if (patch !== undefined) { + console.log(`updating property ${interfaceName}.${propertyName}`) + p.replaceWithText(patch.newDefinition); + } + }) + } + }) + + await sourceFile.save(); +} diff --git a/packages/types/script/codegen/patches/cosmos/gov/v1/index.ts b/packages/types/script/codegen/patches/cosmos/gov/v1/index.ts new file mode 100644 index 000000000..6eeb30084 --- /dev/null +++ b/packages/types/script/codegen/patches/cosmos/gov/v1/index.ts @@ -0,0 +1,180 @@ +import { appendImport, patchInterfaceDefinition, patchObjectMethods } from "../../../../patch-utils"; + +export async function patchModule(outputPath: string): Promise { + // Patch MsgVote generated fromAmino and toAmino + const govV1TxFile = `${outputPath}/cosmos/gov/v1/tx.ts`; + appendImport(govV1TxFile, ` + import { AminoMsg } from "@cosmjs/amino"; + import { AminoConverter } from "../../../aminoconverter"; + `) + await patchInterfaceDefinition(govV1TxFile, [ + { + name: 'MsgVoteAmino', + prop: 'metadata', + newDefinition: 'metadata?: string;', + }, + { + name: 'MsgSubmitProposalAmino', + prop: 'metadata', + newDefinition: 'metadata?: string;', + }, + { + name: 'MsgSubmitProposalAmino', + prop: 'messages', + newDefinition: 'messages?: AminoMsg[];', + }, + { + name: 'MsgVoteWeightedAmino', + prop: 'metadata', + newDefinition: 'metadata?: string;', + }, + { + name: 'MsgExecLegacyContentAmino', + prop: 'content', + newDefinition: 'content?: AminoMsg;' + } + ]) + await patchObjectMethods(govV1TxFile, [ + { + object: 'MsgVote', + methodName: 'fromAmino', + newDefinition: 'fromAmino(object: MsgVoteAmino): MsgVote {\n' + + ' return {\n' + + ' proposalId: Long.fromString(object.proposal_id),\n' + + ' voter: object.voter,\n' + + ' option: isSet(object.option) ? object.option : 0,\n' + + ' metadata: object.metadata ?? "",\n' + + ' };\n' + + ' }' + }, + { + object: 'MsgVote', + methodName: 'toAmino', + newDefinition: 'toAmino(message: MsgVote): MsgVoteAmino {\n' + + ' const obj: any = {};\n' + + ' obj.proposal_id = message.proposalId\n' + + ' ? message.proposalId.toString()\n' + + ' : undefined;\n' + + ' obj.voter = message.voter;\n' + + ' obj.option = message.option;\n' + + ' obj.metadata = message.metadata === "" ? undefined : message.metadata;\n' + + ' return obj;\n' + + ' }' + }, + { + object: 'MsgSubmitProposal', + methodName: 'fromAmino', + newDefinition: 'fromAmino(object: MsgSubmitProposalAmino, converter?: AminoConverter): MsgSubmitProposal {\n' + + ' if (converter === undefined) {\n' + + ' throw new Error("Can\'t convert to MsgSubmitProposal from amino without an AminoConverter instance");\n' + + ' }\n' + + ' return {\n' + + ' messages: object.messages?.map(m => converter.toAny(m)) ?? [],\n' + + ' initialDeposit: Array.isArray(object?.initial_deposit)\n' + + ' ? object.initial_deposit.map((e: any) => Coin.fromAmino(e))\n' + + ' : [],\n' + + ' proposer: object.proposer,\n' + + ' metadata: object.metadata ?? "",\n' + + ' title: object.title,\n' + + ' summary: object.summary\n' + + ' };\n' + + ' }' + }, + { + object: 'MsgSubmitProposal', + methodName: 'toAmino', + newDefinition: 'toAmino(message: MsgSubmitProposal, converter?: AminoConverter): MsgSubmitProposalAmino {\n' + + ' if (converter === undefined) {\n' + + ' throw new Error("Can\'t convert to MsgSubmitProposal to amino without an AminoConverter instance");\n' + + ' }\n' + + '\n' + + ' const obj: any = {};\n' + + ' if (message.messages && message.messages.length > 0) {\n' + + ' obj.messages = message.messages.map(m => converter.fromAny(m));\n' + + ' }\n' + + ' if (message.initialDeposit) {\n' + + ' obj.initial_deposit = message.initialDeposit.map((e) =>\n' + + ' e ? Coin.toAmino(e) : undefined\n' + + ' );\n' + + ' } else {\n' + + ' obj.initial_deposit = [];\n' + + ' }\n' + + ' obj.proposer = message.proposer;\n' + + ' if (message.metadata !== "") {\n' + + ' obj.metadata = message.metadata;\n' + + ' }\n' + + ' obj.title = message.title;\n' + + ' obj.summary = message.summary;\n' + + ' return obj;\n' + + ' }' + }, + { + object: 'MsgVoteWeighted', + methodName: 'fromAmino', + newDefinition: 'fromAmino(object: MsgVoteWeightedAmino): MsgVoteWeighted {\n' + + ' return {\n' + + ' proposalId: Long.fromString(object.proposal_id),\n' + + ' voter: object.voter,\n' + + ' options: Array.isArray(object?.options)\n' + + ' ? object.options.map((e: any) => WeightedVoteOption.fromAmino(e))\n' + + ' : [],\n' + + ' metadata: object.metadata ?? "",\n' + + ' };\n' + + ' }' + }, + { + object: 'MsgVoteWeighted', + methodName: 'toAmino', + newDefinition: 'toAmino(message: MsgVoteWeighted): MsgVoteWeightedAmino {\n' + + ' const obj: any = {};\n' + + ' obj.proposal_id = message.proposalId\n' + + ' ? message.proposalId.toString()\n' + + ' : undefined;\n' + + ' obj.voter = message.voter;\n' + + ' if (message.options) {\n' + + ' obj.options = message.options.map((e) =>\n' + + ' e ? WeightedVoteOption.toAmino(e) : undefined\n' + + ' );\n' + + ' } else {\n' + + ' obj.options = [];\n' + + ' }\n' + + ' if (message.metadata !== "") {\n' + + ' obj.metadata = message.metadata;\n' + + ' }\n' + + ' return obj;\n' + + ' }' + }, + { + object: 'MsgExecLegacyContent', + methodName: 'fromAmino', + newDefinition: 'fromAmino(object: MsgExecLegacyContentAmino, aminoConverter?: AminoConverter): MsgExecLegacyContent {\n' + + ' if (aminoConverter === undefined) {\n' + + ' throw new Error(\n' + + ' "Can\'t convert to MsgExecLegacyContent from amino without an AminoConverter instance"\n' + + ' );\n' + + ' }\n' + + ' \n' + + ' return {\n' + + ' content: object?.content ? aminoConverter.toAny(object.content) : undefined,\n' + + ' authority: object.authority,\n' + + ' };\n' + + ' }' + }, + { + object: 'MsgExecLegacyContent', + methodName: 'toAmino', + newDefinition: 'toAmino(message: MsgExecLegacyContent, converter?: AminoConverter): MsgExecLegacyContentAmino {\n' + + ' if (converter === undefined) {\n' + + ' throw new Error(\n' + + ' "Can\'t convert to MsgExecLegacyContent from amino without an AminoConverter instance"\n' + + ' );\n' + + ' }\n' + + ' \n' + + ' const obj: any = {};\n' + + ' obj.content = message.content ? converter.fromAny(message.content) : undefined;\n' + + ' obj.authority = message.authority;\n' + + ' return obj;\n' + + ' }' + }, + ]); +} diff --git a/packages/types/script/codegen/patches/desmos/profiles/v3/index.ts b/packages/types/script/codegen/patches/desmos/profiles/v3/index.ts new file mode 100644 index 000000000..671a22c18 --- /dev/null +++ b/packages/types/script/codegen/patches/desmos/profiles/v3/index.ts @@ -0,0 +1,64 @@ +import { appendImport } from "../../../../patch-utils"; + +export function patchModule(outputPath: string) { + // Fix import in desmos/profiles/v3/msg_server.ts + const profiles_msg_server_import = ` + import { MsgDeleteProfile, MsgDeleteProfileResponse, MsgSaveProfile, MsgSaveProfileResponse } from "./msgs_profile"; + import { + MsgAcceptDTagTransferRequest, + MsgAcceptDTagTransferRequestResponse, + MsgCancelDTagTransferRequest, + MsgCancelDTagTransferRequestResponse, + MsgRefuseDTagTransferRequest, + MsgRefuseDTagTransferRequestResponse, + MsgRequestDTagTransfer, + MsgRequestDTagTransferResponse + } from "./msgs_dtag_requests"; + import { + MsgLinkChainAccount, + MsgLinkChainAccountResponse, + MsgSetDefaultExternalAddress, + MsgSetDefaultExternalAddressResponse, + MsgUnlinkChainAccount, + MsgUnlinkChainAccountResponse + } from "./msgs_chain_links"; + import { + MsgLinkApplication, + MsgLinkApplicationResponse, + MsgUnlinkApplication, + MsgUnlinkApplicationResponse + } from "./msgs_app_links"; + import { + MsgUpdateParams, + MsgUpdateParamsResponse + } from "./msgs_params"; + `; + const profiles_msg_server_file = `${outputPath}/desmos/profiles/v3/msg_server.ts`; + appendImport(profiles_msg_server_file, profiles_msg_server_import); + + // Fix import in desmos/profiles/v3/query.ts + const profiles_query_import = ` + import { QueryProfileRequest, QueryProfileResponse } from "./query_profile"; + import { + QueryIncomingDTagTransferRequestsRequest, + QueryIncomingDTagTransferRequestsResponse + } from "./query_dtag_requests"; + import { + QueryChainLinkOwnersRequest, + QueryChainLinkOwnersResponse, + QueryChainLinksRequest, QueryChainLinksResponse, + QueryDefaultExternalAddressesRequest, QueryDefaultExternalAddressesResponse + } from "./query_chain_links"; + import { + QueryApplicationLinkByClientIDRequest, + QueryApplicationLinkByClientIDResponse, + QueryApplicationLinkOwnersRequest, + QueryApplicationLinkOwnersResponse, + QueryApplicationLinksRequest, + QueryApplicationLinksResponse + } from "./query_app_links"; + import { QueryParamsRequest, QueryParamsResponse } from "./query_params"; + `; + const profiles_query_file = `${outputPath}/desmos/profiles/v3/query.ts`; + appendImport(profiles_query_file, profiles_query_import); +} diff --git a/packages/types/script/codegen/patches/desmos/subspaces/v3/index.ts b/packages/types/script/codegen/patches/desmos/subspaces/v3/index.ts new file mode 100644 index 000000000..2360ab1d7 --- /dev/null +++ b/packages/types/script/codegen/patches/desmos/subspaces/v3/index.ts @@ -0,0 +1,17 @@ +import { appendImport } from "../../../../patch-utils"; + +export function patchModule(outputPath: string) { + // Fix import in desmos/subspaces/v3/msgs.ts + const subspaces_msgs_import = ` + import { + MsgGrantAllowance, MsgGrantAllowanceResponse, + MsgRevokeAllowance, MsgRevokeAllowanceResponse + } from "./msgs_feegrant"; + import { + MsgGrantTreasuryAuthorization, MsgGrantTreasuryAuthorizationResponse, + MsgRevokeTreasuryAuthorization, MsgRevokeTreasuryAuthorizationResponse + } from "./msgs_treasury"; + `; + const subspaces_msgs_file = `${outputPath}/desmos/subspaces/v3/msgs.ts`; + appendImport(subspaces_msgs_file, subspaces_msgs_import); +} diff --git a/packages/types/script/codegen/patches/google/protobuf/index.ts b/packages/types/script/codegen/patches/google/protobuf/index.ts new file mode 100644 index 000000000..69c634589 --- /dev/null +++ b/packages/types/script/codegen/patches/google/protobuf/index.ts @@ -0,0 +1,53 @@ +import { patchObjectMethods } from "../../../patch-utils"; + +export async function patchModule(outputPath: string): Promise { + // Patch Any generated fromAmino and toAmino + await patchObjectMethods(`${outputPath}/google/protobuf/any.ts`, [ + { + object: 'Any', + methodName: "toAmino", + newDefinition: "toAmino(message: Any): AnyAmino {\n" + + " return {\n" + + " type: message.typeUrl,\n" + + " value: message.value,\n" + + " }\n" + + " }" + }, + { + object: 'Any', + methodName: "fromAmino", + newDefinition: "fromAmino(object: AnyAmino): Any {\n" + + " return {\n" + + " typeUrl: object.type,\n" + + " value: object.value,\n" + + " };\n" + + " }" + } + ]); + + // Patch timestamp fromAmino and toAmino + await patchObjectMethods(`${outputPath}/google/protobuf/timestamp.ts`, [ + { + object: 'Timestamp', + methodName: "toAmino", + newDefinition: "toAmino(message: Timestamp): TimestampAmino {\n" + + " const millisecondsSinceEpoch = message.seconds.multiply(1000).toNumber();\n" + + " const nanosFraction = Math.round(message.nanos / 1000000)\n" + + " return new Date(millisecondsSinceEpoch + nanosFraction).toISOString();\n" + + " }" + }, + { + object: 'Timestamp', + methodName: "fromAmino", + newDefinition: "fromAmino(object: TimestampAmino): Timestamp {\n" + + " const data = new Date(object);\n" + + " const seconds = Math.trunc(data.getTime() / 1000);\n" + + " const nanos = (data.getTime() % 1000) * 1000000;\n" + + " return {\n" + + " seconds: Long.fromNumber(seconds),\n" + + " nanos,\n" + + " };\n" + + " }" + } + ]); +} diff --git a/packages/types/script/codegen/patches/index.ts b/packages/types/script/codegen/patches/index.ts new file mode 100644 index 000000000..f1a269e78 --- /dev/null +++ b/packages/types/script/codegen/patches/index.ts @@ -0,0 +1,36 @@ +import { patchModule as patchGovV1 } from "./cosmos/gov/v1"; +import { patchModule as patchProfilesV3 } from "./desmos/profiles/v3"; +import { patchModule as patchSubspacesV3 } from "./desmos/subspaces/v3"; +import { patchModule as patchGoogleProtobuf } from "./google/protobuf"; +import * as fs from "fs"; + +export async function patchModules(outputPath: string): Promise { + await patchGovV1(outputPath); + patchProfilesV3(outputPath); + patchSubspacesV3(outputPath); + await patchGoogleProtobuf(outputPath); + + // Create index.ts + const index_ts = ` + // Auto-generated, see scripts/codegen/patches/index.ts! + + // Exports we want to provide at the root of the "@desmoslabs/desmjs-types" package + + export { DeepPartial, Exact } from "./helpers"; + `; + fs.writeFileSync(`${outputPath}/index.ts`, index_ts); + + // Create aminoconverter.ts + const aminoconverter = ` + // Auto-generated, see scripts/codegen/patches/index.ts! + + import { Any } from "./google/protobuf/any"; + import { AminoMsg } from "@cosmjs/amino"; + + export interface AminoConverter { + fromAny(any: Any): AminoMsg + toAny(aminoMsg: AminoMsg): Any + } + `; + fs.writeFileSync(`${outputPath}/aminoconverter.ts`, aminoconverter); +} diff --git a/packages/types/script/get-proto.sh b/packages/types/script/get-proto.sh index 0adfd5f30..a0f0c5a74 100755 --- a/packages/types/script/get-proto.sh +++ b/packages/types/script/get-proto.sh @@ -5,44 +5,103 @@ set -e # Absolute path of this script SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )" - # Temporary directory where will be extracted the proto files TMP_DIR="$SCRIPT_DIR/../tmp" - -# Path where will be downloaded the desmos sources -ZIP_FILE="$SCRIPT_DIR/../desmos-source.zip" - # Directory where will be placed the proto files PROTO_DIR="$SCRIPT_DIR/../proto-files" -# Url from where will be downloaded the desmos proto files -DESMOS_VERSION="5.0.0" -SRC_URL="https://github.com/desmos-labs/desmos/archive/refs/tags/v$DESMOS_VERSION.zip" +# Desmos config +DESMOS_VERSION="5.2.0" +DESMOS_SRC_URL="https://github.com/desmos-labs/desmos/archive/refs/tags/v$DESMOS_VERSION.zip" +DESMOS_ZIP_FILE="$SCRIPT_DIR/../desmos-source.zip" + +# Cosmos config +COSMOS_VERSION="0.47.3" +COSMOS_SRC_URL="https://github.com/cosmos/cosmos-sdk/archive/refs/tags/v$COSMOS_VERSION.zip" +COSMOS_ZIP_FILE="$SCRIPT_DIR/../cosmos-source.zip" + +# IBC config +IBC_VERSION="7.2.0" +IBC_SRC_URL="https://github.com/cosmos/ibc-go/archive/refs/tags/v$IBC_VERSION.zip" +IBC_ZIP_FILE="$SCRIPT_DIR/../ibc-source.zip" + +# ICS config +ICS_VERSION="0.10.0" +ICS_URL="https://github.com/cosmos/ics23/archive/refs/tags/go/v$ICS_VERSION.zip" +ICS_ZIP_FILE="$SCRIPT_DIR/../ics-source.zip" + + +# Download Desmos proto files +wget -q --show-progress $DESMOS_SRC_URL -O "$DESMOS_ZIP_FILE" +# Download Cosmos proto files +# We download the source to be sure to have the correct version instead of what provides telescope. +wget -q --show-progress $COSMOS_SRC_URL -O "$COSMOS_ZIP_FILE" +# Download IBC proto files +# We download the source to be sure to have the correct version instead of what provides telescope. +wget -q --show-progress $IBC_SRC_URL -O "$IBC_ZIP_FILE" +# Download ICS proto files +# We download the source to be sure to have the correct version instead of what provides telescope. +wget -q --show-progress $ICS_URL -O "$ICS_ZIP_FILE" + -# Download the proto files -wget -q --show-progress $SRC_URL -O "$ZIP_FILE" # Create a temp dir where will be extracted the proto files mkdir -p "$TMP_DIR" -# Get the proto from the zip -unzip -qq "$ZIP_FILE" "**.proto" -d "$TMP_DIR" -rm $ZIP_FILE + +# Get proto files from the Desmos zip +unzip -qq "$DESMOS_ZIP_FILE" "**.proto" -d "$TMP_DIR" +rm "$DESMOS_ZIP_FILE" + +# Get proto files from the Cosmos zip +unzip -qq "$COSMOS_ZIP_FILE" "**.proto" -d "$TMP_DIR" +rm "$COSMOS_ZIP_FILE" + +# Get proto files from the ibc zip +unzip -qq "$IBC_ZIP_FILE" "**.proto" -d "$TMP_DIR" +rm "$IBC_ZIP_FILE" + +# Get proto files from the ics zip +unzip -qq "$ICS_ZIP_FILE" "**.proto" -d "$TMP_DIR" +rm "$ICS_ZIP_FILE" + # Clear the directory where will be extracted the proto files -if [ -d $PROTO_DIR ]; then - rm -R $PROTO_DIR +if [ -d "$PROTO_DIR" ]; then + rm -R "$PROTO_DIR" fi -mkdir $PROTO_DIR +mkdir "$PROTO_DIR" + +# Move the Desmos proto files into the proto dir +mv "$TMP_DIR/desmos-$DESMOS_VERSION/proto/desmos" "$PROTO_DIR" + +# Create the Cosmos proto dir +COSMOS_PROTO_DIR="$PROTO_DIR/cosmos" +mkdir -p "$COSMOS_PROTO_DIR" -# Mv the proto file into the proto dir -mv "$TMP_DIR/desmos-$DESMOS_VERSION/proto" $PROTO_DIR +# Move the modules proto files +modules=("app" "auth" "authz" "bank" "base" "capability" "crisis" "crypto" "distribution" "evidence" "feegrant" +"genutil" "gov" "group" "mint" "msg" "nft" "orm" "params" "query" "slashing" "staking" "tx" "upgrade" "vesting") +for i in "${modules[@]}" +do + mv "$TMP_DIR/cosmos-sdk-$COSMOS_VERSION/proto/cosmos/$i" "$COSMOS_PROTO_DIR" +done + +# Move the amino proto files +mv "$TMP_DIR/cosmos-sdk-$COSMOS_VERSION/proto/amino" "$PROTO_DIR" + +# Move tendermint proto files +mv "$TMP_DIR/cosmos-sdk-$COSMOS_VERSION/proto/tendermint" "$PROTO_DIR" + +# Move IBC proto files +mv "$TMP_DIR/ibc-go-$IBC_VERSION/proto/ibc" "$PROTO_DIR" + +# Move ICS proto files +mv "$TMP_DIR/ics23-go-v$ICS_VERSION/proto/cosmos/ics23" "$PROTO_DIR/cosmos" # Install needed third party proto files by telescope -yarn telescope install @protobufs/cosmos @protobufs/cosmos_proto @protobufs/ibc +yarn telescope install @protobufs/cosmos_proto @protobufs/confio @protobufs/google @protobufs/gogoproto # Mv the proto files downloaded by telescope into the proto dir -find "proto" -mindepth 1 -maxdepth 1 -type d ! -name "desmjs" -exec mv -t "$PROTO_DIR/proto/" {} + - -# Clean up tmp dir -rm -Rf $TMP_DIR +find "proto" -mindepth 1 -maxdepth 1 -type d ! -name "desmjs" -exec mv -t "$PROTO_DIR" {} + -echo "Proto file obtained successfully!" +rm -Rf "$TMP_DIR" +echo "Proto files obtained successfully!" diff --git a/packages/types/src/aminoconverter.ts b/packages/types/src/aminoconverter.ts new file mode 100644 index 000000000..2a88cdbf6 --- /dev/null +++ b/packages/types/src/aminoconverter.ts @@ -0,0 +1,9 @@ +// Auto-generated, see scripts/codegen/patches/index.ts! + +import { Any } from "./google/protobuf/any"; +import { AminoMsg } from "@cosmjs/amino"; + +export interface AminoConverter { + fromAny(any: Any): AminoMsg; + toAny(aminoMsg: AminoMsg): Any; +} diff --git a/packages/types/src/confio/proofs.ts b/packages/types/src/confio/proofs.ts index 0d7bb89fd..68478fc31 100644 --- a/packages/types/src/confio/proofs.ts +++ b/packages/types/src/confio/proofs.ts @@ -19,6 +19,7 @@ export enum HashOp { BITCOIN = 5, UNRECOGNIZED = -1, } +export const HashOpAmino = HashOp; export function hashOpFromJSON(object: any): HashOp { switch (object) { case 0: @@ -91,6 +92,7 @@ export enum LengthOp { REQUIRE_64_BYTES = 8, UNRECOGNIZED = -1, } +export const LengthOpAmino = LengthOp; export function lengthOpFromJSON(object: any): LengthOp { switch (object) { case 0: @@ -178,6 +180,41 @@ export interface ExistenceProof { leaf?: LeafOp; path: InnerOp[]; } +export interface ExistenceProofProtoMsg { + typeUrl: "/ics23.ExistenceProof"; + value: Uint8Array; +} +/** + * ExistenceProof takes a key and a value and a set of steps to perform on it. + * The result of peforming all these steps will provide a "root hash", which can + * be compared to the value in a header. + * + * Since it is computationally infeasible to produce a hash collission for any of the used + * cryptographic hash functions, if someone can provide a series of operations to transform + * a given key and value into a root hash that matches some trusted root, these key and values + * must be in the referenced merkle tree. + * + * The only possible issue is maliablity in LeafOp, such as providing extra prefix data, + * which should be controlled by a spec. Eg. with lengthOp as NONE, + * prefix = FOO, key = BAR, value = CHOICE + * and + * prefix = F, key = OOBAR, value = CHOICE + * would produce the same value. + * + * 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. + */ +export interface ExistenceProofAmino { + key: Uint8Array; + value: Uint8Array; + leaf?: LeafOpAmino; + path: InnerOpAmino[]; +} +export interface ExistenceProofAminoMsg { + type: "/ics23.ExistenceProof"; + value: ExistenceProofAmino; +} /** * NonExistenceProof takes a proof of two neighbors, one left of the desired key, * one right of the desired key. If both proofs are valid AND they are neighbors, @@ -189,6 +226,25 @@ export interface NonExistenceProof { left?: ExistenceProof; right?: ExistenceProof; } +export interface NonExistenceProofProtoMsg { + typeUrl: "/ics23.NonExistenceProof"; + value: Uint8Array; +} +/** + * NonExistenceProof takes a proof of two neighbors, one left of the desired key, + * one right of the desired key. If both proofs are valid AND they are neighbors, + * then there is no valid proof for the given key. + */ +export interface NonExistenceProofAmino { + /** TODO: remove this as unnecessary??? we prove a range */ + key: Uint8Array; + left?: ExistenceProofAmino; + right?: ExistenceProofAmino; +} +export interface NonExistenceProofAminoMsg { + type: "/ics23.NonExistenceProof"; + value: NonExistenceProofAmino; +} /** CommitmentProof is either an ExistenceProof or a NonExistenceProof, or a Batch of such messages */ export interface CommitmentProof { exist?: ExistenceProof; @@ -196,6 +252,21 @@ export interface CommitmentProof { batch?: BatchProof; compressed?: CompressedBatchProof; } +export interface CommitmentProofProtoMsg { + typeUrl: "/ics23.CommitmentProof"; + value: Uint8Array; +} +/** CommitmentProof is either an ExistenceProof or a NonExistenceProof, or a Batch of such messages */ +export interface CommitmentProofAmino { + exist?: ExistenceProofAmino; + nonexist?: NonExistenceProofAmino; + batch?: BatchProofAmino; + compressed?: CompressedBatchProofAmino; +} +export interface CommitmentProofAminoMsg { + type: "/ics23.CommitmentProof"; + value: CommitmentProofAmino; +} /** * LeafOp represents the raw key-value data we wish to prove, and * must be flexible to represent the internal transformation from @@ -223,6 +294,41 @@ export interface LeafOp { */ prefix: Uint8Array; } +export interface LeafOpProtoMsg { + typeUrl: "/ics23.LeafOp"; + value: Uint8Array; +} +/** + * LeafOp represents the raw key-value data we wish to prove, and + * must be flexible to represent the internal transformation from + * the original key-value pairs into the basis hash, for many existing + * merkle trees. + * + * key and value are passed in. So that the signature of this operation is: + * leafOp(key, value) -> output + * + * To process this, first prehash the keys and values if needed (ANY means no hash in this case): + * hkey = prehashKey(key) + * hvalue = prehashValue(value) + * + * Then combine the bytes, and hash it + * output = hash(prefix || length(hkey) || hkey || length(hvalue) || hvalue) + */ +export interface LeafOpAmino { + hash: HashOp; + prehash_key: HashOp; + prehash_value: HashOp; + length: LengthOp; + /** + * prefix is a fixed bytes that may optionally be included at the beginning to differentiate + * a leaf node from an inner node. + */ + prefix: Uint8Array; +} +export interface LeafOpAminoMsg { + type: "/ics23.LeafOp"; + value: LeafOpAmino; +} /** * InnerOp represents a merkle-proof step that is not a leaf. * It represents concatenating two children and hashing them to provide the next result. @@ -245,6 +351,36 @@ export interface InnerOp { prefix: Uint8Array; suffix: Uint8Array; } +export interface InnerOpProtoMsg { + typeUrl: "/ics23.InnerOp"; + value: Uint8Array; +} +/** + * InnerOp represents a merkle-proof step that is not a leaf. + * It represents concatenating two children and hashing them to provide the next result. + * + * The result of the previous step is passed in, so the signature of this op is: + * innerOp(child) -> output + * + * The result of applying InnerOp should be: + * output = op.hash(op.prefix || child || op.suffix) + * + * where the || operator is concatenation of binary data, + * and child is the result of hashing all the tree below this step. + * + * Any special data, like prepending child with the length, or prepending the entire operation with + * some value to differentiate from leaf nodes, should be included in prefix and suffix. + * If either of prefix or suffix is empty, we just treat it as an empty string + */ +export interface InnerOpAmino { + hash: HashOp; + prefix: Uint8Array; + suffix: Uint8Array; +} +export interface InnerOpAminoMsg { + type: "/ics23.InnerOp"; + value: InnerOpAmino; +} /** * ProofSpec defines what the expected parameters are for a given proof type. * This can be stored in the client and used to validate any incoming proofs. @@ -269,6 +405,38 @@ export interface ProofSpec { /** min_depth (if > 0) is the minimum number of InnerOps allowed (mainly for fixed-depth tries) */ minDepth: number; } +export interface ProofSpecProtoMsg { + typeUrl: "/ics23.ProofSpec"; + value: Uint8Array; +} +/** + * ProofSpec defines what the expected parameters are for a given proof type. + * This can be stored in the client and used to validate any incoming proofs. + * + * verify(ProofSpec, Proof) -> Proof | Error + * + * As demonstrated in tests, if we don't fix the algorithm used to calculate the + * LeafHash for a given tree, there are many possible key-value pairs that can + * generate a given hash (by interpretting the preimage differently). + * We need this for proper security, requires client knows a priori what + * tree format server uses. But not in code, rather a configuration object. + */ +export interface ProofSpecAmino { + /** + * any field in the ExistenceProof must be the same as in this spec. + * except Prefix, which is just the first bytes of prefix (spec can be longer) + */ + leaf_spec?: LeafOpAmino; + inner_spec?: InnerSpecAmino; + /** max_depth (if > 0) is the maximum number of InnerOps allowed (mainly for fixed-depth tries) */ + max_depth: number; + /** min_depth (if > 0) is the minimum number of InnerOps allowed (mainly for fixed-depth tries) */ + min_depth: number; +} +export interface ProofSpecAminoMsg { + type: "/ics23.ProofSpec"; + value: ProofSpecAmino; +} /** * InnerSpec contains all store-specific structure info to determine if two proofs from a * given store are neighbors. @@ -294,24 +462,107 @@ export interface InnerSpec { /** hash is the algorithm that must be used for each InnerOp */ hash: HashOp; } +export interface InnerSpecProtoMsg { + typeUrl: "/ics23.InnerSpec"; + value: Uint8Array; +} +/** + * InnerSpec contains all store-specific structure info to determine if two proofs from a + * given store are neighbors. + * + * This enables: + * + * isLeftMost(spec: InnerSpec, op: InnerOp) + * isRightMost(spec: InnerSpec, op: InnerOp) + * isLeftNeighbor(spec: InnerSpec, left: InnerOp, right: InnerOp) + */ +export interface InnerSpecAmino { + /** + * Child order is the ordering of the children node, must count from 0 + * iavl tree is [0, 1] (left then right) + * merk is [0, 2, 1] (left, right, here) + */ + child_order: number[]; + child_size: number; + min_prefix_length: number; + max_prefix_length: number; + /** empty child is the prehash image that is used when one child is nil (eg. 20 bytes of 0) */ + empty_child: Uint8Array; + /** hash is the algorithm that must be used for each InnerOp */ + hash: HashOp; +} +export interface InnerSpecAminoMsg { + type: "/ics23.InnerSpec"; + value: InnerSpecAmino; +} /** BatchProof is a group of multiple proof types than can be compressed */ export interface BatchProof { entries: BatchEntry[]; } +export interface BatchProofProtoMsg { + typeUrl: "/ics23.BatchProof"; + value: Uint8Array; +} +/** BatchProof is a group of multiple proof types than can be compressed */ +export interface BatchProofAmino { + entries: BatchEntryAmino[]; +} +export interface BatchProofAminoMsg { + type: "/ics23.BatchProof"; + value: BatchProofAmino; +} /** Use BatchEntry not CommitmentProof, to avoid recursion */ export interface BatchEntry { exist?: ExistenceProof; nonexist?: NonExistenceProof; } +export interface BatchEntryProtoMsg { + typeUrl: "/ics23.BatchEntry"; + value: Uint8Array; +} +/** Use BatchEntry not CommitmentProof, to avoid recursion */ +export interface BatchEntryAmino { + exist?: ExistenceProofAmino; + nonexist?: NonExistenceProofAmino; +} +export interface BatchEntryAminoMsg { + type: "/ics23.BatchEntry"; + value: BatchEntryAmino; +} export interface CompressedBatchProof { entries: CompressedBatchEntry[]; lookupInners: InnerOp[]; } +export interface CompressedBatchProofProtoMsg { + typeUrl: "/ics23.CompressedBatchProof"; + value: Uint8Array; +} +export interface CompressedBatchProofAmino { + entries: CompressedBatchEntryAmino[]; + lookup_inners: InnerOpAmino[]; +} +export interface CompressedBatchProofAminoMsg { + type: "/ics23.CompressedBatchProof"; + value: CompressedBatchProofAmino; +} /** Use BatchEntry not CommitmentProof, to avoid recursion */ export interface CompressedBatchEntry { exist?: CompressedExistenceProof; nonexist?: CompressedNonExistenceProof; } +export interface CompressedBatchEntryProtoMsg { + typeUrl: "/ics23.CompressedBatchEntry"; + value: Uint8Array; +} +/** Use BatchEntry not CommitmentProof, to avoid recursion */ +export interface CompressedBatchEntryAmino { + exist?: CompressedExistenceProofAmino; + nonexist?: CompressedNonExistenceProofAmino; +} +export interface CompressedBatchEntryAminoMsg { + type: "/ics23.CompressedBatchEntry"; + value: CompressedBatchEntryAmino; +} export interface CompressedExistenceProof { key: Uint8Array; value: Uint8Array; @@ -319,12 +570,41 @@ export interface CompressedExistenceProof { /** these are indexes into the lookup_inners table in CompressedBatchProof */ path: number[]; } +export interface CompressedExistenceProofProtoMsg { + typeUrl: "/ics23.CompressedExistenceProof"; + value: Uint8Array; +} +export interface CompressedExistenceProofAmino { + key: Uint8Array; + value: Uint8Array; + leaf?: LeafOpAmino; + /** these are indexes into the lookup_inners table in CompressedBatchProof */ + path: number[]; +} +export interface CompressedExistenceProofAminoMsg { + type: "/ics23.CompressedExistenceProof"; + value: CompressedExistenceProofAmino; +} export interface CompressedNonExistenceProof { /** TODO: remove this as unnecessary??? we prove a range */ key: Uint8Array; left?: CompressedExistenceProof; right?: CompressedExistenceProof; } +export interface CompressedNonExistenceProofProtoMsg { + typeUrl: "/ics23.CompressedNonExistenceProof"; + value: Uint8Array; +} +export interface CompressedNonExistenceProofAmino { + /** TODO: remove this as unnecessary??? we prove a range */ + key: Uint8Array; + left?: CompressedExistenceProofAmino; + right?: CompressedExistenceProofAmino; +} +export interface CompressedNonExistenceProofAminoMsg { + type: "/ics23.CompressedNonExistenceProof"; + value: CompressedNonExistenceProofAmino; +} function createBaseExistenceProof(): ExistenceProof { return { key: new Uint8Array(), @@ -422,6 +702,43 @@ export const ExistenceProof = { message.path = object.path?.map((e) => InnerOp.fromPartial(e)) || []; return message; }, + fromAmino(object: ExistenceProofAmino): ExistenceProof { + return { + key: object.key, + value: object.value, + leaf: object?.leaf ? LeafOp.fromAmino(object.leaf) : undefined, + path: Array.isArray(object?.path) + ? object.path.map((e: any) => InnerOp.fromAmino(e)) + : [], + }; + }, + toAmino(message: ExistenceProof): ExistenceProofAmino { + const obj: any = {}; + obj.key = message.key; + obj.value = message.value; + obj.leaf = message.leaf ? LeafOp.toAmino(message.leaf) : undefined; + if (message.path) { + obj.path = message.path.map((e) => (e ? InnerOp.toAmino(e) : undefined)); + } else { + obj.path = []; + } + return obj; + }, + fromAminoMsg(object: ExistenceProofAminoMsg): ExistenceProof { + return ExistenceProof.fromAmino(object.value); + }, + fromProtoMsg(message: ExistenceProofProtoMsg): ExistenceProof { + return ExistenceProof.decode(message.value); + }, + toProto(message: ExistenceProof): Uint8Array { + return ExistenceProof.encode(message).finish(); + }, + toProtoMsg(message: ExistenceProof): ExistenceProofProtoMsg { + return { + typeUrl: "/ics23.ExistenceProof", + value: ExistenceProof.encode(message).finish(), + }; + }, }; function createBaseNonExistenceProof(): NonExistenceProof { return { @@ -511,6 +828,37 @@ export const NonExistenceProof = { : undefined; return message; }, + fromAmino(object: NonExistenceProofAmino): NonExistenceProof { + return { + key: object.key, + left: object?.left ? ExistenceProof.fromAmino(object.left) : undefined, + right: object?.right ? ExistenceProof.fromAmino(object.right) : undefined, + }; + }, + toAmino(message: NonExistenceProof): NonExistenceProofAmino { + const obj: any = {}; + obj.key = message.key; + obj.left = message.left ? ExistenceProof.toAmino(message.left) : undefined; + obj.right = message.right + ? ExistenceProof.toAmino(message.right) + : undefined; + return obj; + }, + fromAminoMsg(object: NonExistenceProofAminoMsg): NonExistenceProof { + return NonExistenceProof.fromAmino(object.value); + }, + fromProtoMsg(message: NonExistenceProofProtoMsg): NonExistenceProof { + return NonExistenceProof.decode(message.value); + }, + toProto(message: NonExistenceProof): Uint8Array { + return NonExistenceProof.encode(message).finish(); + }, + toProtoMsg(message: NonExistenceProof): NonExistenceProofProtoMsg { + return { + typeUrl: "/ics23.NonExistenceProof", + value: NonExistenceProof.encode(message).finish(), + }; + }, }; function createBaseCommitmentProof(): CommitmentProof { return { @@ -632,6 +980,47 @@ export const CommitmentProof = { : undefined; return message; }, + fromAmino(object: CommitmentProofAmino): CommitmentProof { + return { + exist: object?.exist ? ExistenceProof.fromAmino(object.exist) : undefined, + nonexist: object?.nonexist + ? NonExistenceProof.fromAmino(object.nonexist) + : undefined, + batch: object?.batch ? BatchProof.fromAmino(object.batch) : undefined, + compressed: object?.compressed + ? CompressedBatchProof.fromAmino(object.compressed) + : undefined, + }; + }, + toAmino(message: CommitmentProof): CommitmentProofAmino { + const obj: any = {}; + obj.exist = message.exist + ? ExistenceProof.toAmino(message.exist) + : undefined; + obj.nonexist = message.nonexist + ? NonExistenceProof.toAmino(message.nonexist) + : undefined; + obj.batch = message.batch ? BatchProof.toAmino(message.batch) : undefined; + obj.compressed = message.compressed + ? CompressedBatchProof.toAmino(message.compressed) + : undefined; + return obj; + }, + fromAminoMsg(object: CommitmentProofAminoMsg): CommitmentProof { + return CommitmentProof.fromAmino(object.value); + }, + fromProtoMsg(message: CommitmentProofProtoMsg): CommitmentProof { + return CommitmentProof.decode(message.value); + }, + toProto(message: CommitmentProof): Uint8Array { + return CommitmentProof.encode(message).finish(); + }, + toProtoMsg(message: CommitmentProof): CommitmentProofProtoMsg { + return { + typeUrl: "/ics23.CommitmentProof", + value: CommitmentProof.encode(message).finish(), + }; + }, }; function createBaseLeafOp(): LeafOp { return { @@ -732,6 +1121,43 @@ export const LeafOp = { message.prefix = object.prefix ?? new Uint8Array(); return message; }, + fromAmino(object: LeafOpAmino): LeafOp { + return { + hash: isSet(object.hash) ? hashOpFromJSON(object.hash) : 0, + prehashKey: isSet(object.prehash_key) + ? hashOpFromJSON(object.prehash_key) + : 0, + prehashValue: isSet(object.prehash_value) + ? hashOpFromJSON(object.prehash_value) + : 0, + length: isSet(object.length) ? lengthOpFromJSON(object.length) : 0, + prefix: object.prefix, + }; + }, + toAmino(message: LeafOp): LeafOpAmino { + const obj: any = {}; + obj.hash = message.hash; + obj.prehash_key = message.prehashKey; + obj.prehash_value = message.prehashValue; + obj.length = message.length; + obj.prefix = message.prefix; + return obj; + }, + fromAminoMsg(object: LeafOpAminoMsg): LeafOp { + return LeafOp.fromAmino(object.value); + }, + fromProtoMsg(message: LeafOpProtoMsg): LeafOp { + return LeafOp.decode(message.value); + }, + toProto(message: LeafOp): Uint8Array { + return LeafOp.encode(message).finish(); + }, + toProtoMsg(message: LeafOp): LeafOpProtoMsg { + return { + typeUrl: "/ics23.LeafOp", + value: LeafOp.encode(message).finish(), + }; + }, }; function createBaseInnerOp(): InnerOp { return { @@ -810,6 +1236,35 @@ export const InnerOp = { message.suffix = object.suffix ?? new Uint8Array(); return message; }, + fromAmino(object: InnerOpAmino): InnerOp { + return { + hash: isSet(object.hash) ? hashOpFromJSON(object.hash) : 0, + prefix: object.prefix, + suffix: object.suffix, + }; + }, + toAmino(message: InnerOp): InnerOpAmino { + const obj: any = {}; + obj.hash = message.hash; + obj.prefix = message.prefix; + obj.suffix = message.suffix; + return obj; + }, + fromAminoMsg(object: InnerOpAminoMsg): InnerOp { + return InnerOp.fromAmino(object.value); + }, + fromProtoMsg(message: InnerOpProtoMsg): InnerOp { + return InnerOp.decode(message.value); + }, + toProto(message: InnerOp): Uint8Array { + return InnerOp.encode(message).finish(); + }, + toProtoMsg(message: InnerOp): InnerOpProtoMsg { + return { + typeUrl: "/ics23.InnerOp", + value: InnerOp.encode(message).finish(), + }; + }, }; function createBaseProofSpec(): ProofSpec { return { @@ -908,6 +1363,45 @@ export const ProofSpec = { message.minDepth = object.minDepth ?? 0; return message; }, + fromAmino(object: ProofSpecAmino): ProofSpec { + return { + leafSpec: object?.leaf_spec + ? LeafOp.fromAmino(object.leaf_spec) + : undefined, + innerSpec: object?.inner_spec + ? InnerSpec.fromAmino(object.inner_spec) + : undefined, + maxDepth: object.max_depth, + minDepth: object.min_depth, + }; + }, + toAmino(message: ProofSpec): ProofSpecAmino { + const obj: any = {}; + obj.leaf_spec = message.leafSpec + ? LeafOp.toAmino(message.leafSpec) + : undefined; + obj.inner_spec = message.innerSpec + ? InnerSpec.toAmino(message.innerSpec) + : undefined; + obj.max_depth = message.maxDepth; + obj.min_depth = message.minDepth; + return obj; + }, + fromAminoMsg(object: ProofSpecAminoMsg): ProofSpec { + return ProofSpec.fromAmino(object.value); + }, + fromProtoMsg(message: ProofSpecProtoMsg): ProofSpec { + return ProofSpec.decode(message.value); + }, + toProto(message: ProofSpec): Uint8Array { + return ProofSpec.encode(message).finish(); + }, + toProtoMsg(message: ProofSpec): ProofSpecProtoMsg { + return { + typeUrl: "/ics23.ProofSpec", + value: ProofSpec.encode(message).finish(), + }; + }, }; function createBaseInnerSpec(): InnerSpec { return { @@ -1035,6 +1529,47 @@ export const InnerSpec = { message.hash = object.hash ?? 0; return message; }, + fromAmino(object: InnerSpecAmino): InnerSpec { + return { + childOrder: Array.isArray(object?.child_order) + ? object.child_order.map((e: any) => e) + : [], + childSize: object.child_size, + minPrefixLength: object.min_prefix_length, + maxPrefixLength: object.max_prefix_length, + emptyChild: object.empty_child, + hash: isSet(object.hash) ? hashOpFromJSON(object.hash) : 0, + }; + }, + toAmino(message: InnerSpec): InnerSpecAmino { + const obj: any = {}; + if (message.childOrder) { + obj.child_order = message.childOrder.map((e) => e); + } else { + obj.child_order = []; + } + obj.child_size = message.childSize; + obj.min_prefix_length = message.minPrefixLength; + obj.max_prefix_length = message.maxPrefixLength; + obj.empty_child = message.emptyChild; + obj.hash = message.hash; + return obj; + }, + fromAminoMsg(object: InnerSpecAminoMsg): InnerSpec { + return InnerSpec.fromAmino(object.value); + }, + fromProtoMsg(message: InnerSpecProtoMsg): InnerSpec { + return InnerSpec.decode(message.value); + }, + toProto(message: InnerSpec): Uint8Array { + return InnerSpec.encode(message).finish(); + }, + toProtoMsg(message: InnerSpec): InnerSpecProtoMsg { + return { + typeUrl: "/ics23.InnerSpec", + value: InnerSpec.encode(message).finish(), + }; + }, }; function createBaseBatchProof(): BatchProof { return { @@ -1094,6 +1629,39 @@ export const BatchProof = { object.entries?.map((e) => BatchEntry.fromPartial(e)) || []; return message; }, + fromAmino(object: BatchProofAmino): BatchProof { + return { + entries: Array.isArray(object?.entries) + ? object.entries.map((e: any) => BatchEntry.fromAmino(e)) + : [], + }; + }, + toAmino(message: BatchProof): BatchProofAmino { + const obj: any = {}; + if (message.entries) { + obj.entries = message.entries.map((e) => + e ? BatchEntry.toAmino(e) : undefined + ); + } else { + obj.entries = []; + } + return obj; + }, + fromAminoMsg(object: BatchProofAminoMsg): BatchProof { + return BatchProof.fromAmino(object.value); + }, + fromProtoMsg(message: BatchProofProtoMsg): BatchProof { + return BatchProof.decode(message.value); + }, + toProto(message: BatchProof): Uint8Array { + return BatchProof.encode(message).finish(); + }, + toProtoMsg(message: BatchProof): BatchProofProtoMsg { + return { + typeUrl: "/ics23.BatchProof", + value: BatchProof.encode(message).finish(), + }; + }, }; function createBaseBatchEntry(): BatchEntry { return { @@ -1173,6 +1741,39 @@ export const BatchEntry = { : undefined; return message; }, + fromAmino(object: BatchEntryAmino): BatchEntry { + return { + exist: object?.exist ? ExistenceProof.fromAmino(object.exist) : undefined, + nonexist: object?.nonexist + ? NonExistenceProof.fromAmino(object.nonexist) + : undefined, + }; + }, + toAmino(message: BatchEntry): BatchEntryAmino { + const obj: any = {}; + obj.exist = message.exist + ? ExistenceProof.toAmino(message.exist) + : undefined; + obj.nonexist = message.nonexist + ? NonExistenceProof.toAmino(message.nonexist) + : undefined; + return obj; + }, + fromAminoMsg(object: BatchEntryAminoMsg): BatchEntry { + return BatchEntry.fromAmino(object.value); + }, + fromProtoMsg(message: BatchEntryProtoMsg): BatchEntry { + return BatchEntry.decode(message.value); + }, + toProto(message: BatchEntry): Uint8Array { + return BatchEntry.encode(message).finish(); + }, + toProtoMsg(message: BatchEntry): BatchEntryProtoMsg { + return { + typeUrl: "/ics23.BatchEntry", + value: BatchEntry.encode(message).finish(), + }; + }, }; function createBaseCompressedBatchProof(): CompressedBatchProof { return { @@ -1256,6 +1857,49 @@ export const CompressedBatchProof = { object.lookupInners?.map((e) => InnerOp.fromPartial(e)) || []; return message; }, + fromAmino(object: CompressedBatchProofAmino): CompressedBatchProof { + return { + entries: Array.isArray(object?.entries) + ? object.entries.map((e: any) => CompressedBatchEntry.fromAmino(e)) + : [], + lookupInners: Array.isArray(object?.lookup_inners) + ? object.lookup_inners.map((e: any) => InnerOp.fromAmino(e)) + : [], + }; + }, + toAmino(message: CompressedBatchProof): CompressedBatchProofAmino { + const obj: any = {}; + if (message.entries) { + obj.entries = message.entries.map((e) => + e ? CompressedBatchEntry.toAmino(e) : undefined + ); + } else { + obj.entries = []; + } + if (message.lookupInners) { + obj.lookup_inners = message.lookupInners.map((e) => + e ? InnerOp.toAmino(e) : undefined + ); + } else { + obj.lookup_inners = []; + } + return obj; + }, + fromAminoMsg(object: CompressedBatchProofAminoMsg): CompressedBatchProof { + return CompressedBatchProof.fromAmino(object.value); + }, + fromProtoMsg(message: CompressedBatchProofProtoMsg): CompressedBatchProof { + return CompressedBatchProof.decode(message.value); + }, + toProto(message: CompressedBatchProof): Uint8Array { + return CompressedBatchProof.encode(message).finish(); + }, + toProtoMsg(message: CompressedBatchProof): CompressedBatchProofProtoMsg { + return { + typeUrl: "/ics23.CompressedBatchProof", + value: CompressedBatchProof.encode(message).finish(), + }; + }, }; function createBaseCompressedBatchEntry(): CompressedBatchEntry { return { @@ -1347,6 +1991,41 @@ export const CompressedBatchEntry = { : undefined; return message; }, + fromAmino(object: CompressedBatchEntryAmino): CompressedBatchEntry { + return { + exist: object?.exist + ? CompressedExistenceProof.fromAmino(object.exist) + : undefined, + nonexist: object?.nonexist + ? CompressedNonExistenceProof.fromAmino(object.nonexist) + : undefined, + }; + }, + toAmino(message: CompressedBatchEntry): CompressedBatchEntryAmino { + const obj: any = {}; + obj.exist = message.exist + ? CompressedExistenceProof.toAmino(message.exist) + : undefined; + obj.nonexist = message.nonexist + ? CompressedNonExistenceProof.toAmino(message.nonexist) + : undefined; + return obj; + }, + fromAminoMsg(object: CompressedBatchEntryAminoMsg): CompressedBatchEntry { + return CompressedBatchEntry.fromAmino(object.value); + }, + fromProtoMsg(message: CompressedBatchEntryProtoMsg): CompressedBatchEntry { + return CompressedBatchEntry.decode(message.value); + }, + toProto(message: CompressedBatchEntry): Uint8Array { + return CompressedBatchEntry.encode(message).finish(); + }, + toProtoMsg(message: CompressedBatchEntry): CompressedBatchEntryProtoMsg { + return { + typeUrl: "/ics23.CompressedBatchEntry", + value: CompressedBatchEntry.encode(message).finish(), + }; + }, }; function createBaseCompressedExistenceProof(): CompressedExistenceProof { return { @@ -1457,6 +2136,47 @@ export const CompressedExistenceProof = { message.path = object.path?.map((e) => e) || []; return message; }, + fromAmino(object: CompressedExistenceProofAmino): CompressedExistenceProof { + return { + key: object.key, + value: object.value, + leaf: object?.leaf ? LeafOp.fromAmino(object.leaf) : undefined, + path: Array.isArray(object?.path) ? object.path.map((e: any) => e) : [], + }; + }, + toAmino(message: CompressedExistenceProof): CompressedExistenceProofAmino { + const obj: any = {}; + obj.key = message.key; + obj.value = message.value; + obj.leaf = message.leaf ? LeafOp.toAmino(message.leaf) : undefined; + if (message.path) { + obj.path = message.path.map((e) => e); + } else { + obj.path = []; + } + return obj; + }, + fromAminoMsg( + object: CompressedExistenceProofAminoMsg + ): CompressedExistenceProof { + return CompressedExistenceProof.fromAmino(object.value); + }, + fromProtoMsg( + message: CompressedExistenceProofProtoMsg + ): CompressedExistenceProof { + return CompressedExistenceProof.decode(message.value); + }, + toProto(message: CompressedExistenceProof): Uint8Array { + return CompressedExistenceProof.encode(message).finish(); + }, + toProtoMsg( + message: CompressedExistenceProof + ): CompressedExistenceProofProtoMsg { + return { + typeUrl: "/ics23.CompressedExistenceProof", + value: CompressedExistenceProof.encode(message).finish(), + }; + }, }; function createBaseCompressedNonExistenceProof(): CompressedNonExistenceProof { return { @@ -1561,4 +2281,51 @@ export const CompressedNonExistenceProof = { : undefined; return message; }, + fromAmino( + object: CompressedNonExistenceProofAmino + ): CompressedNonExistenceProof { + return { + key: object.key, + left: object?.left + ? CompressedExistenceProof.fromAmino(object.left) + : undefined, + right: object?.right + ? CompressedExistenceProof.fromAmino(object.right) + : undefined, + }; + }, + toAmino( + message: CompressedNonExistenceProof + ): CompressedNonExistenceProofAmino { + const obj: any = {}; + obj.key = message.key; + obj.left = message.left + ? CompressedExistenceProof.toAmino(message.left) + : undefined; + obj.right = message.right + ? CompressedExistenceProof.toAmino(message.right) + : undefined; + return obj; + }, + fromAminoMsg( + object: CompressedNonExistenceProofAminoMsg + ): CompressedNonExistenceProof { + return CompressedNonExistenceProof.fromAmino(object.value); + }, + fromProtoMsg( + message: CompressedNonExistenceProofProtoMsg + ): CompressedNonExistenceProof { + return CompressedNonExistenceProof.decode(message.value); + }, + toProto(message: CompressedNonExistenceProof): Uint8Array { + return CompressedNonExistenceProof.encode(message).finish(); + }, + toProtoMsg( + message: CompressedNonExistenceProof + ): CompressedNonExistenceProofProtoMsg { + return { + typeUrl: "/ics23.CompressedNonExistenceProof", + value: CompressedNonExistenceProof.encode(message).finish(), + }; + }, }; diff --git a/packages/types/src/cosmos/authz/v1beta1/authz.ts b/packages/types/src/cosmos/authz/v1beta1/authz.ts index 705708fb8..2247588d5 100644 --- a/packages/types/src/cosmos/authz/v1beta1/authz.ts +++ b/packages/types/src/cosmos/authz/v1beta1/authz.ts @@ -1,6 +1,6 @@ /* eslint-disable */ -import { Any } from "../../../google/protobuf/any"; -import { Timestamp } from "../../../google/protobuf/timestamp"; +import { Any, AnyAmino } from "../../../google/protobuf/any"; +import { Timestamp, TimestampAmino } from "../../../google/protobuf/timestamp"; import * as _m0 from "protobufjs/minimal"; import { isSet, @@ -18,6 +18,22 @@ export interface GenericAuthorization { /** Msg, identified by it's type URL, to grant unrestricted permissions to execute */ msg: string; } +export interface GenericAuthorizationProtoMsg { + typeUrl: "/cosmos.authz.v1beta1.GenericAuthorization"; + value: Uint8Array; +} +/** + * GenericAuthorization gives the grantee unrestricted permissions to execute + * the provided method on behalf of the granter's account. + */ +export interface GenericAuthorizationAmino { + /** Msg, identified by it's type URL, to grant unrestricted permissions to execute */ + msg: string; +} +export interface GenericAuthorizationAminoMsg { + type: "cosmos-sdk/GenericAuthorization"; + value: GenericAuthorizationAmino; +} /** * Grant gives permissions to execute * the provide method with expiration time. @@ -31,6 +47,27 @@ export interface Grant { */ expiration?: Timestamp; } +export interface GrantProtoMsg { + typeUrl: "/cosmos.authz.v1beta1.Grant"; + value: Uint8Array; +} +/** + * Grant gives permissions to execute + * the provide method with expiration time. + */ +export interface GrantAmino { + authorization?: AnyAmino; + /** + * 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` + * may apply to invalidate the grant) + */ + expiration?: TimestampAmino; +} +export interface GrantAminoMsg { + type: "cosmos-sdk/Grant"; + value: GrantAmino; +} /** * GrantAuthorization extends a grant with both the addresses of the grantee and granter. * It is used in genesis.proto and query.proto @@ -41,11 +78,42 @@ export interface GrantAuthorization { authorization?: Any; expiration?: Timestamp; } +export interface GrantAuthorizationProtoMsg { + typeUrl: "/cosmos.authz.v1beta1.GrantAuthorization"; + value: Uint8Array; +} +/** + * GrantAuthorization extends a grant with both the addresses of the grantee and granter. + * It is used in genesis.proto and query.proto + */ +export interface GrantAuthorizationAmino { + granter: string; + grantee: string; + authorization?: AnyAmino; + expiration?: TimestampAmino; +} +export interface GrantAuthorizationAminoMsg { + type: "cosmos-sdk/GrantAuthorization"; + value: GrantAuthorizationAmino; +} /** GrantQueueItem contains the list of TypeURL of a sdk.Msg. */ export interface GrantQueueItem { /** msg_type_urls contains the list of TypeURL of a sdk.Msg. */ msgTypeUrls: string[]; } +export interface GrantQueueItemProtoMsg { + typeUrl: "/cosmos.authz.v1beta1.GrantQueueItem"; + value: Uint8Array; +} +/** GrantQueueItem contains the list of TypeURL of a sdk.Msg. */ +export interface GrantQueueItemAmino { + /** msg_type_urls contains the list of TypeURL of a sdk.Msg. */ + msg_type_urls: string[]; +} +export interface GrantQueueItemAminoMsg { + type: "cosmos-sdk/GrantQueueItem"; + value: GrantQueueItemAmino; +} function createBaseGenericAuthorization(): GenericAuthorization { return { msg: "", @@ -98,6 +166,37 @@ export const GenericAuthorization = { message.msg = object.msg ?? ""; return message; }, + fromAmino(object: GenericAuthorizationAmino): GenericAuthorization { + return { + msg: object.msg, + }; + }, + toAmino(message: GenericAuthorization): GenericAuthorizationAmino { + const obj: any = {}; + obj.msg = message.msg; + return obj; + }, + fromAminoMsg(object: GenericAuthorizationAminoMsg): GenericAuthorization { + return GenericAuthorization.fromAmino(object.value); + }, + toAminoMsg(message: GenericAuthorization): GenericAuthorizationAminoMsg { + return { + type: "cosmos-sdk/GenericAuthorization", + value: GenericAuthorization.toAmino(message), + }; + }, + fromProtoMsg(message: GenericAuthorizationProtoMsg): GenericAuthorization { + return GenericAuthorization.decode(message.value); + }, + toProto(message: GenericAuthorization): Uint8Array { + return GenericAuthorization.encode(message).finish(); + }, + toProtoMsg(message: GenericAuthorization): GenericAuthorizationProtoMsg { + return { + typeUrl: "/cosmos.authz.v1beta1.GenericAuthorization", + value: GenericAuthorization.encode(message).finish(), + }; + }, }; function createBaseGrant(): Grant { return { @@ -167,6 +266,47 @@ export const Grant = { : undefined; return message; }, + fromAmino(object: GrantAmino): Grant { + return { + authorization: object?.authorization + ? Any.fromAmino(object.authorization) + : undefined, + expiration: object?.expiration + ? Timestamp.fromAmino(object.expiration) + : undefined, + }; + }, + toAmino(message: Grant): GrantAmino { + const obj: any = {}; + obj.authorization = message.authorization + ? Any.toAmino(message.authorization) + : undefined; + obj.expiration = message.expiration + ? Timestamp.toAmino(message.expiration) + : undefined; + return obj; + }, + fromAminoMsg(object: GrantAminoMsg): Grant { + return Grant.fromAmino(object.value); + }, + toAminoMsg(message: Grant): GrantAminoMsg { + return { + type: "cosmos-sdk/Grant", + value: Grant.toAmino(message), + }; + }, + fromProtoMsg(message: GrantProtoMsg): Grant { + return Grant.decode(message.value); + }, + toProto(message: Grant): Uint8Array { + return Grant.encode(message).finish(); + }, + toProtoMsg(message: Grant): GrantProtoMsg { + return { + typeUrl: "/cosmos.authz.v1beta1.Grant", + value: Grant.encode(message).finish(), + }; + }, }; function createBaseGrantAuthorization(): GrantAuthorization { return { @@ -261,6 +401,51 @@ export const GrantAuthorization = { : undefined; return message; }, + fromAmino(object: GrantAuthorizationAmino): GrantAuthorization { + return { + granter: object.granter, + grantee: object.grantee, + authorization: object?.authorization + ? Any.fromAmino(object.authorization) + : undefined, + expiration: object?.expiration + ? Timestamp.fromAmino(object.expiration) + : undefined, + }; + }, + toAmino(message: GrantAuthorization): GrantAuthorizationAmino { + const obj: any = {}; + obj.granter = message.granter; + obj.grantee = message.grantee; + obj.authorization = message.authorization + ? Any.toAmino(message.authorization) + : undefined; + obj.expiration = message.expiration + ? Timestamp.toAmino(message.expiration) + : undefined; + return obj; + }, + fromAminoMsg(object: GrantAuthorizationAminoMsg): GrantAuthorization { + return GrantAuthorization.fromAmino(object.value); + }, + toAminoMsg(message: GrantAuthorization): GrantAuthorizationAminoMsg { + return { + type: "cosmos-sdk/GrantAuthorization", + value: GrantAuthorization.toAmino(message), + }; + }, + fromProtoMsg(message: GrantAuthorizationProtoMsg): GrantAuthorization { + return GrantAuthorization.decode(message.value); + }, + toProto(message: GrantAuthorization): Uint8Array { + return GrantAuthorization.encode(message).finish(); + }, + toProtoMsg(message: GrantAuthorization): GrantAuthorizationProtoMsg { + return { + typeUrl: "/cosmos.authz.v1beta1.GrantAuthorization", + value: GrantAuthorization.encode(message).finish(), + }; + }, }; function createBaseGrantQueueItem(): GrantQueueItem { return { @@ -317,4 +502,41 @@ export const GrantQueueItem = { message.msgTypeUrls = object.msgTypeUrls?.map((e) => e) || []; return message; }, + fromAmino(object: GrantQueueItemAmino): GrantQueueItem { + return { + msgTypeUrls: Array.isArray(object?.msg_type_urls) + ? object.msg_type_urls.map((e: any) => e) + : [], + }; + }, + toAmino(message: GrantQueueItem): GrantQueueItemAmino { + const obj: any = {}; + if (message.msgTypeUrls) { + obj.msg_type_urls = message.msgTypeUrls.map((e) => e); + } else { + obj.msg_type_urls = []; + } + return obj; + }, + fromAminoMsg(object: GrantQueueItemAminoMsg): GrantQueueItem { + return GrantQueueItem.fromAmino(object.value); + }, + toAminoMsg(message: GrantQueueItem): GrantQueueItemAminoMsg { + return { + type: "cosmos-sdk/GrantQueueItem", + value: GrantQueueItem.toAmino(message), + }; + }, + fromProtoMsg(message: GrantQueueItemProtoMsg): GrantQueueItem { + return GrantQueueItem.decode(message.value); + }, + toProto(message: GrantQueueItem): Uint8Array { + return GrantQueueItem.encode(message).finish(); + }, + toProtoMsg(message: GrantQueueItem): GrantQueueItemProtoMsg { + return { + typeUrl: "/cosmos.authz.v1beta1.GrantQueueItem", + value: GrantQueueItem.encode(message).finish(), + }; + }, }; diff --git a/packages/types/src/cosmos/authz/v1beta1/event.ts b/packages/types/src/cosmos/authz/v1beta1/event.ts index e98bd629b..0e5af5002 100644 --- a/packages/types/src/cosmos/authz/v1beta1/event.ts +++ b/packages/types/src/cosmos/authz/v1beta1/event.ts @@ -11,6 +11,23 @@ export interface EventGrant { /** Grantee account address */ grantee: string; } +export interface EventGrantProtoMsg { + typeUrl: "/cosmos.authz.v1beta1.EventGrant"; + value: Uint8Array; +} +/** EventGrant is emitted on Msg/Grant */ +export interface EventGrantAmino { + /** Msg type URL for which an autorization is granted */ + msg_type_url: string; + /** Granter account address */ + granter: string; + /** Grantee account address */ + grantee: string; +} +export interface EventGrantAminoMsg { + type: "cosmos-sdk/EventGrant"; + value: EventGrantAmino; +} /** EventRevoke is emitted on Msg/Revoke */ export interface EventRevoke { /** Msg type URL for which an autorization is revoked */ @@ -20,6 +37,23 @@ export interface EventRevoke { /** Grantee account address */ grantee: string; } +export interface EventRevokeProtoMsg { + typeUrl: "/cosmos.authz.v1beta1.EventRevoke"; + value: Uint8Array; +} +/** EventRevoke is emitted on Msg/Revoke */ +export interface EventRevokeAmino { + /** Msg type URL for which an autorization is revoked */ + msg_type_url: string; + /** Granter account address */ + granter: string; + /** Grantee account address */ + grantee: string; +} +export interface EventRevokeAminoMsg { + type: "cosmos-sdk/EventRevoke"; + value: EventRevokeAmino; +} function createBaseEventGrant(): EventGrant { return { msgTypeUrl: "", @@ -89,6 +123,41 @@ export const EventGrant = { message.grantee = object.grantee ?? ""; return message; }, + fromAmino(object: EventGrantAmino): EventGrant { + return { + msgTypeUrl: object.msg_type_url, + granter: object.granter, + grantee: object.grantee, + }; + }, + toAmino(message: EventGrant): EventGrantAmino { + const obj: any = {}; + obj.msg_type_url = message.msgTypeUrl; + obj.granter = message.granter; + obj.grantee = message.grantee; + return obj; + }, + fromAminoMsg(object: EventGrantAminoMsg): EventGrant { + return EventGrant.fromAmino(object.value); + }, + toAminoMsg(message: EventGrant): EventGrantAminoMsg { + return { + type: "cosmos-sdk/EventGrant", + value: EventGrant.toAmino(message), + }; + }, + fromProtoMsg(message: EventGrantProtoMsg): EventGrant { + return EventGrant.decode(message.value); + }, + toProto(message: EventGrant): Uint8Array { + return EventGrant.encode(message).finish(); + }, + toProtoMsg(message: EventGrant): EventGrantProtoMsg { + return { + typeUrl: "/cosmos.authz.v1beta1.EventGrant", + value: EventGrant.encode(message).finish(), + }; + }, }; function createBaseEventRevoke(): EventRevoke { return { @@ -159,4 +228,39 @@ export const EventRevoke = { message.grantee = object.grantee ?? ""; return message; }, + fromAmino(object: EventRevokeAmino): EventRevoke { + return { + msgTypeUrl: object.msg_type_url, + granter: object.granter, + grantee: object.grantee, + }; + }, + toAmino(message: EventRevoke): EventRevokeAmino { + const obj: any = {}; + obj.msg_type_url = message.msgTypeUrl; + obj.granter = message.granter; + obj.grantee = message.grantee; + return obj; + }, + fromAminoMsg(object: EventRevokeAminoMsg): EventRevoke { + return EventRevoke.fromAmino(object.value); + }, + toAminoMsg(message: EventRevoke): EventRevokeAminoMsg { + return { + type: "cosmos-sdk/EventRevoke", + value: EventRevoke.toAmino(message), + }; + }, + fromProtoMsg(message: EventRevokeProtoMsg): EventRevoke { + return EventRevoke.decode(message.value); + }, + toProto(message: EventRevoke): Uint8Array { + return EventRevoke.encode(message).finish(); + }, + toProtoMsg(message: EventRevoke): EventRevokeProtoMsg { + return { + typeUrl: "/cosmos.authz.v1beta1.EventRevoke", + value: EventRevoke.encode(message).finish(), + }; + }, }; diff --git a/packages/types/src/cosmos/authz/v1beta1/genesis.ts b/packages/types/src/cosmos/authz/v1beta1/genesis.ts index 94b321735..53c65cb94 100644 --- a/packages/types/src/cosmos/authz/v1beta1/genesis.ts +++ b/packages/types/src/cosmos/authz/v1beta1/genesis.ts @@ -1,5 +1,5 @@ /* eslint-disable */ -import { GrantAuthorization } from "./authz"; +import { GrantAuthorization, GrantAuthorizationAmino } from "./authz"; import * as _m0 from "protobufjs/minimal"; import { DeepPartial, Exact } from "../../../helpers"; export const protobufPackage = "cosmos.authz.v1beta1"; @@ -7,6 +7,18 @@ export const protobufPackage = "cosmos.authz.v1beta1"; export interface GenesisState { authorization: GrantAuthorization[]; } +export interface GenesisStateProtoMsg { + typeUrl: "/cosmos.authz.v1beta1.GenesisState"; + value: Uint8Array; +} +/** GenesisState defines the authz module's genesis state. */ +export interface GenesisStateAmino { + authorization: GrantAuthorizationAmino[]; +} +export interface GenesisStateAminoMsg { + type: "cosmos-sdk/GenesisState"; + value: GenesisStateAmino; +} function createBaseGenesisState(): GenesisState { return { authorization: [], @@ -67,4 +79,43 @@ export const GenesisState = { object.authorization?.map((e) => GrantAuthorization.fromPartial(e)) || []; return message; }, + fromAmino(object: GenesisStateAmino): GenesisState { + return { + authorization: Array.isArray(object?.authorization) + ? object.authorization.map((e: any) => GrantAuthorization.fromAmino(e)) + : [], + }; + }, + toAmino(message: GenesisState): GenesisStateAmino { + const obj: any = {}; + if (message.authorization) { + obj.authorization = message.authorization.map((e) => + e ? GrantAuthorization.toAmino(e) : undefined + ); + } else { + obj.authorization = []; + } + return obj; + }, + fromAminoMsg(object: GenesisStateAminoMsg): GenesisState { + return GenesisState.fromAmino(object.value); + }, + toAminoMsg(message: GenesisState): GenesisStateAminoMsg { + return { + type: "cosmos-sdk/GenesisState", + value: GenesisState.toAmino(message), + }; + }, + fromProtoMsg(message: GenesisStateProtoMsg): GenesisState { + return GenesisState.decode(message.value); + }, + toProto(message: GenesisState): Uint8Array { + return GenesisState.encode(message).finish(); + }, + toProtoMsg(message: GenesisState): GenesisStateProtoMsg { + return { + typeUrl: "/cosmos.authz.v1beta1.GenesisState", + value: GenesisState.encode(message).finish(), + }; + }, }; diff --git a/packages/types/src/cosmos/authz/v1beta1/query.ts b/packages/types/src/cosmos/authz/v1beta1/query.ts index fb271e418..22699033c 100644 --- a/packages/types/src/cosmos/authz/v1beta1/query.ts +++ b/packages/types/src/cosmos/authz/v1beta1/query.ts @@ -1,6 +1,16 @@ /* eslint-disable */ -import { PageRequest, PageResponse } from "../../base/query/v1beta1/pagination"; -import { Grant, GrantAuthorization } from "./authz"; +import { + PageRequest, + PageRequestAmino, + PageResponse, + PageResponseAmino, +} from "../../base/query/v1beta1/pagination"; +import { + Grant, + GrantAmino, + GrantAuthorization, + GrantAuthorizationAmino, +} from "./authz"; import * as _m0 from "protobufjs/minimal"; import { isSet, DeepPartial, Exact, Rpc } from "../../../helpers"; export const protobufPackage = "cosmos.authz.v1beta1"; @@ -13,6 +23,23 @@ export interface QueryGrantsRequest { /** pagination defines an pagination for the request. */ pagination?: PageRequest; } +export interface QueryGrantsRequestProtoMsg { + typeUrl: "/cosmos.authz.v1beta1.QueryGrantsRequest"; + value: Uint8Array; +} +/** QueryGrantsRequest is the request type for the Query/Grants RPC method. */ +export interface QueryGrantsRequestAmino { + granter: string; + grantee: string; + /** Optional, msg_type_url, when set, will query only grants matching given msg type. */ + msg_type_url: string; + /** pagination defines an pagination for the request. */ + pagination?: PageRequestAmino; +} +export interface QueryGrantsRequestAminoMsg { + type: "cosmos-sdk/QueryGrantsRequest"; + value: QueryGrantsRequestAmino; +} /** QueryGrantsResponse is the response type for the Query/Authorizations RPC method. */ export interface QueryGrantsResponse { /** authorizations is a list of grants granted for grantee by granter. */ @@ -20,12 +47,41 @@ export interface QueryGrantsResponse { /** pagination defines an pagination for the response. */ pagination?: PageResponse; } +export interface QueryGrantsResponseProtoMsg { + typeUrl: "/cosmos.authz.v1beta1.QueryGrantsResponse"; + value: Uint8Array; +} +/** QueryGrantsResponse is the response type for the Query/Authorizations RPC method. */ +export interface QueryGrantsResponseAmino { + /** authorizations is a list of grants granted for grantee by granter. */ + grants: GrantAmino[]; + /** pagination defines an pagination for the response. */ + pagination?: PageResponseAmino; +} +export interface QueryGrantsResponseAminoMsg { + type: "cosmos-sdk/QueryGrantsResponse"; + value: QueryGrantsResponseAmino; +} /** QueryGranterGrantsRequest is the request type for the Query/GranterGrants RPC method. */ export interface QueryGranterGrantsRequest { granter: string; /** pagination defines an pagination for the request. */ pagination?: PageRequest; } +export interface QueryGranterGrantsRequestProtoMsg { + typeUrl: "/cosmos.authz.v1beta1.QueryGranterGrantsRequest"; + value: Uint8Array; +} +/** QueryGranterGrantsRequest is the request type for the Query/GranterGrants RPC method. */ +export interface QueryGranterGrantsRequestAmino { + granter: string; + /** pagination defines an pagination for the request. */ + pagination?: PageRequestAmino; +} +export interface QueryGranterGrantsRequestAminoMsg { + type: "cosmos-sdk/QueryGranterGrantsRequest"; + value: QueryGranterGrantsRequestAmino; +} /** QueryGranterGrantsResponse is the response type for the Query/GranterGrants RPC method. */ export interface QueryGranterGrantsResponse { /** grants is a list of grants granted by the granter. */ @@ -33,12 +89,41 @@ export interface QueryGranterGrantsResponse { /** pagination defines an pagination for the response. */ pagination?: PageResponse; } +export interface QueryGranterGrantsResponseProtoMsg { + typeUrl: "/cosmos.authz.v1beta1.QueryGranterGrantsResponse"; + value: Uint8Array; +} +/** QueryGranterGrantsResponse is the response type for the Query/GranterGrants RPC method. */ +export interface QueryGranterGrantsResponseAmino { + /** grants is a list of grants granted by the granter. */ + grants: GrantAuthorizationAmino[]; + /** pagination defines an pagination for the response. */ + pagination?: PageResponseAmino; +} +export interface QueryGranterGrantsResponseAminoMsg { + type: "cosmos-sdk/QueryGranterGrantsResponse"; + value: QueryGranterGrantsResponseAmino; +} /** QueryGranteeGrantsRequest is the request type for the Query/IssuedGrants RPC method. */ export interface QueryGranteeGrantsRequest { grantee: string; /** pagination defines an pagination for the request. */ pagination?: PageRequest; } +export interface QueryGranteeGrantsRequestProtoMsg { + typeUrl: "/cosmos.authz.v1beta1.QueryGranteeGrantsRequest"; + value: Uint8Array; +} +/** QueryGranteeGrantsRequest is the request type for the Query/IssuedGrants RPC method. */ +export interface QueryGranteeGrantsRequestAmino { + grantee: string; + /** pagination defines an pagination for the request. */ + pagination?: PageRequestAmino; +} +export interface QueryGranteeGrantsRequestAminoMsg { + type: "cosmos-sdk/QueryGranteeGrantsRequest"; + value: QueryGranteeGrantsRequestAmino; +} /** QueryGranteeGrantsResponse is the response type for the Query/GranteeGrants RPC method. */ export interface QueryGranteeGrantsResponse { /** grants is a list of grants granted to the grantee. */ @@ -46,6 +131,21 @@ export interface QueryGranteeGrantsResponse { /** pagination defines an pagination for the response. */ pagination?: PageResponse; } +export interface QueryGranteeGrantsResponseProtoMsg { + typeUrl: "/cosmos.authz.v1beta1.QueryGranteeGrantsResponse"; + value: Uint8Array; +} +/** QueryGranteeGrantsResponse is the response type for the Query/GranteeGrants RPC method. */ +export interface QueryGranteeGrantsResponseAmino { + /** grants is a list of grants granted to the grantee. */ + grants: GrantAuthorizationAmino[]; + /** pagination defines an pagination for the response. */ + pagination?: PageResponseAmino; +} +export interface QueryGranteeGrantsResponseAminoMsg { + type: "cosmos-sdk/QueryGranteeGrantsResponse"; + value: QueryGranteeGrantsResponseAmino; +} function createBaseQueryGrantsRequest(): QueryGrantsRequest { return { granter: "", @@ -133,6 +233,47 @@ export const QueryGrantsRequest = { : undefined; return message; }, + fromAmino(object: QueryGrantsRequestAmino): QueryGrantsRequest { + return { + granter: object.granter, + grantee: object.grantee, + msgTypeUrl: object.msg_type_url, + pagination: object?.pagination + ? PageRequest.fromAmino(object.pagination) + : undefined, + }; + }, + toAmino(message: QueryGrantsRequest): QueryGrantsRequestAmino { + const obj: any = {}; + obj.granter = message.granter; + obj.grantee = message.grantee; + obj.msg_type_url = message.msgTypeUrl; + obj.pagination = message.pagination + ? PageRequest.toAmino(message.pagination) + : undefined; + return obj; + }, + fromAminoMsg(object: QueryGrantsRequestAminoMsg): QueryGrantsRequest { + return QueryGrantsRequest.fromAmino(object.value); + }, + toAminoMsg(message: QueryGrantsRequest): QueryGrantsRequestAminoMsg { + return { + type: "cosmos-sdk/QueryGrantsRequest", + value: QueryGrantsRequest.toAmino(message), + }; + }, + fromProtoMsg(message: QueryGrantsRequestProtoMsg): QueryGrantsRequest { + return QueryGrantsRequest.decode(message.value); + }, + toProto(message: QueryGrantsRequest): Uint8Array { + return QueryGrantsRequest.encode(message).finish(); + }, + toProtoMsg(message: QueryGrantsRequest): QueryGrantsRequestProtoMsg { + return { + typeUrl: "/cosmos.authz.v1beta1.QueryGrantsRequest", + value: QueryGrantsRequest.encode(message).finish(), + }; + }, }; function createBaseQueryGrantsResponse(): QueryGrantsResponse { return { @@ -210,6 +351,51 @@ export const QueryGrantsResponse = { : undefined; return message; }, + fromAmino(object: QueryGrantsResponseAmino): QueryGrantsResponse { + return { + grants: Array.isArray(object?.grants) + ? object.grants.map((e: any) => Grant.fromAmino(e)) + : [], + pagination: object?.pagination + ? PageResponse.fromAmino(object.pagination) + : undefined, + }; + }, + toAmino(message: QueryGrantsResponse): QueryGrantsResponseAmino { + const obj: any = {}; + if (message.grants) { + obj.grants = message.grants.map((e) => + e ? Grant.toAmino(e) : undefined + ); + } else { + obj.grants = []; + } + obj.pagination = message.pagination + ? PageResponse.toAmino(message.pagination) + : undefined; + return obj; + }, + fromAminoMsg(object: QueryGrantsResponseAminoMsg): QueryGrantsResponse { + return QueryGrantsResponse.fromAmino(object.value); + }, + toAminoMsg(message: QueryGrantsResponse): QueryGrantsResponseAminoMsg { + return { + type: "cosmos-sdk/QueryGrantsResponse", + value: QueryGrantsResponse.toAmino(message), + }; + }, + fromProtoMsg(message: QueryGrantsResponseProtoMsg): QueryGrantsResponse { + return QueryGrantsResponse.decode(message.value); + }, + toProto(message: QueryGrantsResponse): Uint8Array { + return QueryGrantsResponse.encode(message).finish(); + }, + toProtoMsg(message: QueryGrantsResponse): QueryGrantsResponseProtoMsg { + return { + typeUrl: "/cosmos.authz.v1beta1.QueryGrantsResponse", + value: QueryGrantsResponse.encode(message).finish(), + }; + }, }; function createBaseQueryGranterGrantsRequest(): QueryGranterGrantsRequest { return { @@ -281,6 +467,51 @@ export const QueryGranterGrantsRequest = { : undefined; return message; }, + fromAmino(object: QueryGranterGrantsRequestAmino): QueryGranterGrantsRequest { + return { + granter: object.granter, + pagination: object?.pagination + ? PageRequest.fromAmino(object.pagination) + : undefined, + }; + }, + toAmino(message: QueryGranterGrantsRequest): QueryGranterGrantsRequestAmino { + const obj: any = {}; + obj.granter = message.granter; + obj.pagination = message.pagination + ? PageRequest.toAmino(message.pagination) + : undefined; + return obj; + }, + fromAminoMsg( + object: QueryGranterGrantsRequestAminoMsg + ): QueryGranterGrantsRequest { + return QueryGranterGrantsRequest.fromAmino(object.value); + }, + toAminoMsg( + message: QueryGranterGrantsRequest + ): QueryGranterGrantsRequestAminoMsg { + return { + type: "cosmos-sdk/QueryGranterGrantsRequest", + value: QueryGranterGrantsRequest.toAmino(message), + }; + }, + fromProtoMsg( + message: QueryGranterGrantsRequestProtoMsg + ): QueryGranterGrantsRequest { + return QueryGranterGrantsRequest.decode(message.value); + }, + toProto(message: QueryGranterGrantsRequest): Uint8Array { + return QueryGranterGrantsRequest.encode(message).finish(); + }, + toProtoMsg( + message: QueryGranterGrantsRequest + ): QueryGranterGrantsRequestProtoMsg { + return { + typeUrl: "/cosmos.authz.v1beta1.QueryGranterGrantsRequest", + value: QueryGranterGrantsRequest.encode(message).finish(), + }; + }, }; function createBaseQueryGranterGrantsResponse(): QueryGranterGrantsResponse { return { @@ -366,6 +597,63 @@ export const QueryGranterGrantsResponse = { : undefined; return message; }, + fromAmino( + object: QueryGranterGrantsResponseAmino + ): QueryGranterGrantsResponse { + return { + grants: Array.isArray(object?.grants) + ? object.grants.map((e: any) => GrantAuthorization.fromAmino(e)) + : [], + pagination: object?.pagination + ? PageResponse.fromAmino(object.pagination) + : undefined, + }; + }, + toAmino( + message: QueryGranterGrantsResponse + ): QueryGranterGrantsResponseAmino { + const obj: any = {}; + if (message.grants) { + obj.grants = message.grants.map((e) => + e ? GrantAuthorization.toAmino(e) : undefined + ); + } else { + obj.grants = []; + } + obj.pagination = message.pagination + ? PageResponse.toAmino(message.pagination) + : undefined; + return obj; + }, + fromAminoMsg( + object: QueryGranterGrantsResponseAminoMsg + ): QueryGranterGrantsResponse { + return QueryGranterGrantsResponse.fromAmino(object.value); + }, + toAminoMsg( + message: QueryGranterGrantsResponse + ): QueryGranterGrantsResponseAminoMsg { + return { + type: "cosmos-sdk/QueryGranterGrantsResponse", + value: QueryGranterGrantsResponse.toAmino(message), + }; + }, + fromProtoMsg( + message: QueryGranterGrantsResponseProtoMsg + ): QueryGranterGrantsResponse { + return QueryGranterGrantsResponse.decode(message.value); + }, + toProto(message: QueryGranterGrantsResponse): Uint8Array { + return QueryGranterGrantsResponse.encode(message).finish(); + }, + toProtoMsg( + message: QueryGranterGrantsResponse + ): QueryGranterGrantsResponseProtoMsg { + return { + typeUrl: "/cosmos.authz.v1beta1.QueryGranterGrantsResponse", + value: QueryGranterGrantsResponse.encode(message).finish(), + }; + }, }; function createBaseQueryGranteeGrantsRequest(): QueryGranteeGrantsRequest { return { @@ -437,6 +725,51 @@ export const QueryGranteeGrantsRequest = { : undefined; return message; }, + fromAmino(object: QueryGranteeGrantsRequestAmino): QueryGranteeGrantsRequest { + return { + grantee: object.grantee, + pagination: object?.pagination + ? PageRequest.fromAmino(object.pagination) + : undefined, + }; + }, + toAmino(message: QueryGranteeGrantsRequest): QueryGranteeGrantsRequestAmino { + const obj: any = {}; + obj.grantee = message.grantee; + obj.pagination = message.pagination + ? PageRequest.toAmino(message.pagination) + : undefined; + return obj; + }, + fromAminoMsg( + object: QueryGranteeGrantsRequestAminoMsg + ): QueryGranteeGrantsRequest { + return QueryGranteeGrantsRequest.fromAmino(object.value); + }, + toAminoMsg( + message: QueryGranteeGrantsRequest + ): QueryGranteeGrantsRequestAminoMsg { + return { + type: "cosmos-sdk/QueryGranteeGrantsRequest", + value: QueryGranteeGrantsRequest.toAmino(message), + }; + }, + fromProtoMsg( + message: QueryGranteeGrantsRequestProtoMsg + ): QueryGranteeGrantsRequest { + return QueryGranteeGrantsRequest.decode(message.value); + }, + toProto(message: QueryGranteeGrantsRequest): Uint8Array { + return QueryGranteeGrantsRequest.encode(message).finish(); + }, + toProtoMsg( + message: QueryGranteeGrantsRequest + ): QueryGranteeGrantsRequestProtoMsg { + return { + typeUrl: "/cosmos.authz.v1beta1.QueryGranteeGrantsRequest", + value: QueryGranteeGrantsRequest.encode(message).finish(), + }; + }, }; function createBaseQueryGranteeGrantsResponse(): QueryGranteeGrantsResponse { return { @@ -522,6 +855,63 @@ export const QueryGranteeGrantsResponse = { : undefined; return message; }, + fromAmino( + object: QueryGranteeGrantsResponseAmino + ): QueryGranteeGrantsResponse { + return { + grants: Array.isArray(object?.grants) + ? object.grants.map((e: any) => GrantAuthorization.fromAmino(e)) + : [], + pagination: object?.pagination + ? PageResponse.fromAmino(object.pagination) + : undefined, + }; + }, + toAmino( + message: QueryGranteeGrantsResponse + ): QueryGranteeGrantsResponseAmino { + const obj: any = {}; + if (message.grants) { + obj.grants = message.grants.map((e) => + e ? GrantAuthorization.toAmino(e) : undefined + ); + } else { + obj.grants = []; + } + obj.pagination = message.pagination + ? PageResponse.toAmino(message.pagination) + : undefined; + return obj; + }, + fromAminoMsg( + object: QueryGranteeGrantsResponseAminoMsg + ): QueryGranteeGrantsResponse { + return QueryGranteeGrantsResponse.fromAmino(object.value); + }, + toAminoMsg( + message: QueryGranteeGrantsResponse + ): QueryGranteeGrantsResponseAminoMsg { + return { + type: "cosmos-sdk/QueryGranteeGrantsResponse", + value: QueryGranteeGrantsResponse.toAmino(message), + }; + }, + fromProtoMsg( + message: QueryGranteeGrantsResponseProtoMsg + ): QueryGranteeGrantsResponse { + return QueryGranteeGrantsResponse.decode(message.value); + }, + toProto(message: QueryGranteeGrantsResponse): Uint8Array { + return QueryGranteeGrantsResponse.encode(message).finish(); + }, + toProtoMsg( + message: QueryGranteeGrantsResponse + ): QueryGranteeGrantsResponseProtoMsg { + return { + typeUrl: "/cosmos.authz.v1beta1.QueryGranteeGrantsResponse", + value: QueryGranteeGrantsResponse.encode(message).finish(), + }; + }, }; /** Query defines the gRPC querier service. */ export interface Query { diff --git a/packages/types/src/cosmos/authz/v1beta1/tx.amino.ts b/packages/types/src/cosmos/authz/v1beta1/tx.amino.ts new file mode 100644 index 000000000..c6cd410c1 --- /dev/null +++ b/packages/types/src/cosmos/authz/v1beta1/tx.amino.ts @@ -0,0 +1,19 @@ +/* eslint-disable */ +import { MsgGrant, MsgExec, MsgRevoke } from "./tx"; +export const AminoConverter = { + "/cosmos.authz.v1beta1.MsgGrant": { + aminoType: "cosmos-sdk/MsgGrant", + toAmino: MsgGrant.toAmino, + fromAmino: MsgGrant.fromAmino, + }, + "/cosmos.authz.v1beta1.MsgExec": { + aminoType: "cosmos-sdk/MsgExec", + toAmino: MsgExec.toAmino, + fromAmino: MsgExec.fromAmino, + }, + "/cosmos.authz.v1beta1.MsgRevoke": { + aminoType: "cosmos-sdk/MsgRevoke", + toAmino: MsgRevoke.toAmino, + fromAmino: MsgRevoke.fromAmino, + }, +}; diff --git a/packages/types/src/cosmos/authz/v1beta1/tx.registry.ts b/packages/types/src/cosmos/authz/v1beta1/tx.registry.ts new file mode 100644 index 000000000..bce2ca5bd --- /dev/null +++ b/packages/types/src/cosmos/authz/v1beta1/tx.registry.ts @@ -0,0 +1,115 @@ +/* eslint-disable */ +import { GeneratedType, Registry } from "@cosmjs/proto-signing"; +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 MessageComposer = { + encoded: { + grant(value: MsgGrant) { + return { + typeUrl: "/cosmos.authz.v1beta1.MsgGrant", + value: MsgGrant.encode(value).finish(), + }; + }, + exec(value: MsgExec) { + return { + typeUrl: "/cosmos.authz.v1beta1.MsgExec", + value: MsgExec.encode(value).finish(), + }; + }, + revoke(value: MsgRevoke) { + return { + typeUrl: "/cosmos.authz.v1beta1.MsgRevoke", + value: MsgRevoke.encode(value).finish(), + }; + }, + }, + withTypeUrl: { + grant(value: MsgGrant) { + return { + typeUrl: "/cosmos.authz.v1beta1.MsgGrant", + value, + }; + }, + exec(value: MsgExec) { + return { + typeUrl: "/cosmos.authz.v1beta1.MsgExec", + value, + }; + }, + revoke(value: MsgRevoke) { + return { + typeUrl: "/cosmos.authz.v1beta1.MsgRevoke", + value, + }; + }, + }, + toJSON: { + grant(value: MsgGrant) { + return { + typeUrl: "/cosmos.authz.v1beta1.MsgGrant", + value: MsgGrant.toJSON(value), + }; + }, + exec(value: MsgExec) { + return { + typeUrl: "/cosmos.authz.v1beta1.MsgExec", + value: MsgExec.toJSON(value), + }; + }, + revoke(value: MsgRevoke) { + return { + typeUrl: "/cosmos.authz.v1beta1.MsgRevoke", + value: MsgRevoke.toJSON(value), + }; + }, + }, + fromJSON: { + grant(value: any) { + return { + typeUrl: "/cosmos.authz.v1beta1.MsgGrant", + value: MsgGrant.fromJSON(value), + }; + }, + exec(value: any) { + return { + typeUrl: "/cosmos.authz.v1beta1.MsgExec", + value: MsgExec.fromJSON(value), + }; + }, + revoke(value: any) { + return { + typeUrl: "/cosmos.authz.v1beta1.MsgRevoke", + value: MsgRevoke.fromJSON(value), + }; + }, + }, + fromPartial: { + grant(value: MsgGrant) { + return { + typeUrl: "/cosmos.authz.v1beta1.MsgGrant", + value: MsgGrant.fromPartial(value), + }; + }, + exec(value: MsgExec) { + return { + typeUrl: "/cosmos.authz.v1beta1.MsgExec", + value: MsgExec.fromPartial(value), + }; + }, + revoke(value: MsgRevoke) { + return { + typeUrl: "/cosmos.authz.v1beta1.MsgRevoke", + value: MsgRevoke.fromPartial(value), + }; + }, + }, +}; diff --git a/packages/types/src/cosmos/authz/v1beta1/tx.ts b/packages/types/src/cosmos/authz/v1beta1/tx.ts index 27e3157d0..1c5cba1b6 100644 --- a/packages/types/src/cosmos/authz/v1beta1/tx.ts +++ b/packages/types/src/cosmos/authz/v1beta1/tx.ts @@ -1,6 +1,6 @@ /* eslint-disable */ -import { Grant } from "./authz"; -import { Any } from "../../../google/protobuf/any"; +import { Grant, GrantAmino } from "./authz"; +import { Any, AnyAmino } from "../../../google/protobuf/any"; import * as _m0 from "protobufjs/minimal"; import { isSet, @@ -20,10 +20,39 @@ export interface MsgGrant { grantee: string; grant?: Grant; } +export interface MsgGrantProtoMsg { + typeUrl: "/cosmos.authz.v1beta1.MsgGrant"; + value: Uint8Array; +} +/** + * MsgGrant is a request type for Grant method. It declares authorization to the grantee + * on behalf of the granter with the provided expiration time. + */ +export interface MsgGrantAmino { + granter: string; + grantee: string; + grant?: GrantAmino; +} +export interface MsgGrantAminoMsg { + type: "cosmos-sdk/MsgGrant"; + value: MsgGrantAmino; +} /** MsgExecResponse defines the Msg/MsgExecResponse response type. */ export interface MsgExecResponse { results: Uint8Array[]; } +export interface MsgExecResponseProtoMsg { + typeUrl: "/cosmos.authz.v1beta1.MsgExecResponse"; + value: Uint8Array; +} +/** MsgExecResponse defines the Msg/MsgExecResponse response type. */ +export interface MsgExecResponseAmino { + results: Uint8Array[]; +} +export interface MsgExecResponseAminoMsg { + type: "cosmos-sdk/MsgExecResponse"; + value: MsgExecResponseAmino; +} /** * MsgExec attempts to execute the provided messages using * authorizations granted to the grantee. Each message should have only @@ -32,14 +61,46 @@ export interface MsgExecResponse { export interface MsgExec { grantee: string; /** - * Authorization Msg requests to execute. Each msg must implement Authorization interface + * Execute Msg. * The x/authz will try to find a grant matching (msg.signers[0], grantee, MsgTypeURL(msg)) * triple and validate it. */ msgs: Any[]; } +export interface MsgExecProtoMsg { + typeUrl: "/cosmos.authz.v1beta1.MsgExec"; + value: Uint8Array; +} +/** + * MsgExec 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. + */ +export interface MsgExecAmino { + grantee: string; + /** + * Execute Msg. + * The x/authz will try to find a grant matching (msg.signers[0], grantee, MsgTypeURL(msg)) + * triple and validate it. + */ + msgs: AnyAmino[]; +} +export interface MsgExecAminoMsg { + type: "cosmos-sdk/MsgExec"; + value: MsgExecAmino; +} /** MsgGrantResponse defines the Msg/MsgGrant response type. */ export interface MsgGrantResponse {} +export interface MsgGrantResponseProtoMsg { + typeUrl: "/cosmos.authz.v1beta1.MsgGrantResponse"; + value: Uint8Array; +} +/** MsgGrantResponse defines the Msg/MsgGrant response type. */ +export interface MsgGrantResponseAmino {} +export interface MsgGrantResponseAminoMsg { + type: "cosmos-sdk/MsgGrantResponse"; + value: MsgGrantResponseAmino; +} /** * MsgRevoke revokes any authorization with the provided sdk.Msg type on the * granter's account with that has been granted to the grantee. @@ -49,8 +110,35 @@ export interface MsgRevoke { grantee: string; msgTypeUrl: string; } +export interface MsgRevokeProtoMsg { + typeUrl: "/cosmos.authz.v1beta1.MsgRevoke"; + value: Uint8Array; +} +/** + * MsgRevoke revokes any authorization with the provided sdk.Msg type on the + * granter's account with that has been granted to the grantee. + */ +export interface MsgRevokeAmino { + granter: string; + grantee: string; + msg_type_url: string; +} +export interface MsgRevokeAminoMsg { + type: "cosmos-sdk/MsgRevoke"; + value: MsgRevokeAmino; +} /** MsgRevokeResponse defines the Msg/MsgRevokeResponse response type. */ export interface MsgRevokeResponse {} +export interface MsgRevokeResponseProtoMsg { + typeUrl: "/cosmos.authz.v1beta1.MsgRevokeResponse"; + value: Uint8Array; +} +/** MsgRevokeResponse defines the Msg/MsgRevokeResponse response type. */ +export interface MsgRevokeResponseAmino {} +export interface MsgRevokeResponseAminoMsg { + type: "cosmos-sdk/MsgRevokeResponse"; + value: MsgRevokeResponseAmino; +} function createBaseMsgGrant(): MsgGrant { return { granter: "", @@ -122,6 +210,41 @@ export const MsgGrant = { : undefined; return message; }, + fromAmino(object: MsgGrantAmino): MsgGrant { + return { + granter: object.granter, + grantee: object.grantee, + grant: object?.grant ? Grant.fromAmino(object.grant) : undefined, + }; + }, + toAmino(message: MsgGrant): MsgGrantAmino { + const obj: any = {}; + obj.granter = message.granter; + obj.grantee = message.grantee; + obj.grant = message.grant ? Grant.toAmino(message.grant) : undefined; + return obj; + }, + fromAminoMsg(object: MsgGrantAminoMsg): MsgGrant { + return MsgGrant.fromAmino(object.value); + }, + toAminoMsg(message: MsgGrant): MsgGrantAminoMsg { + return { + type: "cosmos-sdk/MsgGrant", + value: MsgGrant.toAmino(message), + }; + }, + fromProtoMsg(message: MsgGrantProtoMsg): MsgGrant { + return MsgGrant.decode(message.value); + }, + toProto(message: MsgGrant): Uint8Array { + return MsgGrant.encode(message).finish(); + }, + toProtoMsg(message: MsgGrant): MsgGrantProtoMsg { + return { + typeUrl: "/cosmos.authz.v1beta1.MsgGrant", + value: MsgGrant.encode(message).finish(), + }; + }, }; function createBaseMsgExecResponse(): MsgExecResponse { return { @@ -180,6 +303,43 @@ export const MsgExecResponse = { message.results = object.results?.map((e) => e) || []; return message; }, + fromAmino(object: MsgExecResponseAmino): MsgExecResponse { + return { + results: Array.isArray(object?.results) + ? object.results.map((e: any) => e) + : [], + }; + }, + toAmino(message: MsgExecResponse): MsgExecResponseAmino { + const obj: any = {}; + if (message.results) { + obj.results = message.results.map((e) => e); + } else { + obj.results = []; + } + return obj; + }, + fromAminoMsg(object: MsgExecResponseAminoMsg): MsgExecResponse { + return MsgExecResponse.fromAmino(object.value); + }, + toAminoMsg(message: MsgExecResponse): MsgExecResponseAminoMsg { + return { + type: "cosmos-sdk/MsgExecResponse", + value: MsgExecResponse.toAmino(message), + }; + }, + fromProtoMsg(message: MsgExecResponseProtoMsg): MsgExecResponse { + return MsgExecResponse.decode(message.value); + }, + toProto(message: MsgExecResponse): Uint8Array { + return MsgExecResponse.encode(message).finish(); + }, + toProtoMsg(message: MsgExecResponse): MsgExecResponseProtoMsg { + return { + typeUrl: "/cosmos.authz.v1beta1.MsgExecResponse", + value: MsgExecResponse.encode(message).finish(), + }; + }, }; function createBaseMsgExec(): MsgExec { return { @@ -244,6 +404,45 @@ export const MsgExec = { message.msgs = object.msgs?.map((e) => Any.fromPartial(e)) || []; return message; }, + fromAmino(object: MsgExecAmino): MsgExec { + return { + grantee: object.grantee, + msgs: Array.isArray(object?.msgs) + ? object.msgs.map((e: any) => Any.fromAmino(e)) + : [], + }; + }, + toAmino(message: MsgExec): MsgExecAmino { + const obj: any = {}; + obj.grantee = message.grantee; + if (message.msgs) { + obj.msgs = message.msgs.map((e) => (e ? Any.toAmino(e) : undefined)); + } else { + obj.msgs = []; + } + return obj; + }, + fromAminoMsg(object: MsgExecAminoMsg): MsgExec { + return MsgExec.fromAmino(object.value); + }, + toAminoMsg(message: MsgExec): MsgExecAminoMsg { + return { + type: "cosmos-sdk/MsgExec", + value: MsgExec.toAmino(message), + }; + }, + fromProtoMsg(message: MsgExecProtoMsg): MsgExec { + return MsgExec.decode(message.value); + }, + toProto(message: MsgExec): Uint8Array { + return MsgExec.encode(message).finish(); + }, + toProtoMsg(message: MsgExec): MsgExecProtoMsg { + return { + typeUrl: "/cosmos.authz.v1beta1.MsgExec", + value: MsgExec.encode(message).finish(), + }; + }, }; function createBaseMsgGrantResponse(): MsgGrantResponse { return {}; @@ -282,6 +481,34 @@ export const MsgGrantResponse = { const message = createBaseMsgGrantResponse(); return message; }, + fromAmino(_: MsgGrantResponseAmino): MsgGrantResponse { + return {}; + }, + toAmino(_: MsgGrantResponse): MsgGrantResponseAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg(object: MsgGrantResponseAminoMsg): MsgGrantResponse { + return MsgGrantResponse.fromAmino(object.value); + }, + toAminoMsg(message: MsgGrantResponse): MsgGrantResponseAminoMsg { + return { + type: "cosmos-sdk/MsgGrantResponse", + value: MsgGrantResponse.toAmino(message), + }; + }, + fromProtoMsg(message: MsgGrantResponseProtoMsg): MsgGrantResponse { + return MsgGrantResponse.decode(message.value); + }, + toProto(message: MsgGrantResponse): Uint8Array { + return MsgGrantResponse.encode(message).finish(); + }, + toProtoMsg(message: MsgGrantResponse): MsgGrantResponseProtoMsg { + return { + typeUrl: "/cosmos.authz.v1beta1.MsgGrantResponse", + value: MsgGrantResponse.encode(message).finish(), + }; + }, }; function createBaseMsgRevoke(): MsgRevoke { return { @@ -352,6 +579,41 @@ export const MsgRevoke = { message.msgTypeUrl = object.msgTypeUrl ?? ""; return message; }, + fromAmino(object: MsgRevokeAmino): MsgRevoke { + return { + granter: object.granter, + grantee: object.grantee, + msgTypeUrl: object.msg_type_url, + }; + }, + toAmino(message: MsgRevoke): MsgRevokeAmino { + const obj: any = {}; + obj.granter = message.granter; + obj.grantee = message.grantee; + obj.msg_type_url = message.msgTypeUrl; + return obj; + }, + fromAminoMsg(object: MsgRevokeAminoMsg): MsgRevoke { + return MsgRevoke.fromAmino(object.value); + }, + toAminoMsg(message: MsgRevoke): MsgRevokeAminoMsg { + return { + type: "cosmos-sdk/MsgRevoke", + value: MsgRevoke.toAmino(message), + }; + }, + fromProtoMsg(message: MsgRevokeProtoMsg): MsgRevoke { + return MsgRevoke.decode(message.value); + }, + toProto(message: MsgRevoke): Uint8Array { + return MsgRevoke.encode(message).finish(); + }, + toProtoMsg(message: MsgRevoke): MsgRevokeProtoMsg { + return { + typeUrl: "/cosmos.authz.v1beta1.MsgRevoke", + value: MsgRevoke.encode(message).finish(), + }; + }, }; function createBaseMsgRevokeResponse(): MsgRevokeResponse { return {}; @@ -390,6 +652,34 @@ export const MsgRevokeResponse = { const message = createBaseMsgRevokeResponse(); return message; }, + fromAmino(_: MsgRevokeResponseAmino): MsgRevokeResponse { + return {}; + }, + toAmino(_: MsgRevokeResponse): MsgRevokeResponseAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg(object: MsgRevokeResponseAminoMsg): MsgRevokeResponse { + return MsgRevokeResponse.fromAmino(object.value); + }, + toAminoMsg(message: MsgRevokeResponse): MsgRevokeResponseAminoMsg { + return { + type: "cosmos-sdk/MsgRevokeResponse", + value: MsgRevokeResponse.toAmino(message), + }; + }, + fromProtoMsg(message: MsgRevokeResponseProtoMsg): MsgRevokeResponse { + return MsgRevokeResponse.decode(message.value); + }, + toProto(message: MsgRevokeResponse): Uint8Array { + return MsgRevokeResponse.encode(message).finish(); + }, + toProtoMsg(message: MsgRevokeResponse): MsgRevokeResponseProtoMsg { + return { + typeUrl: "/cosmos.authz.v1beta1.MsgRevokeResponse", + value: MsgRevokeResponse.encode(message).finish(), + }; + }, }; /** Msg defines the authz Msg service. */ export interface Msg { diff --git a/packages/types/src/cosmos/base/query/v1beta1/pagination.ts b/packages/types/src/cosmos/base/query/v1beta1/pagination.ts index 10c19879d..f38e7f0b6 100644 --- a/packages/types/src/cosmos/base/query/v1beta1/pagination.ts +++ b/packages/types/src/cosmos/base/query/v1beta1/pagination.ts @@ -50,6 +50,55 @@ export interface PageRequest { */ reverse: boolean; } +export interface PageRequestProtoMsg { + typeUrl: "/cosmos.base.query.v1beta1.PageRequest"; + value: Uint8Array; +} +/** + * PageRequest is to be embedded in gRPC request messages for efficient + * pagination. Ex: + * + * message SomeRequest { + * Foo some_parameter = 1; + * PageRequest pagination = 2; + * } + */ +export interface PageRequestAmino { + /** + * key is a value returned in PageResponse.next_key to begin + * querying the next page most efficiently. Only one of offset or key + * should be set. + */ + key: Uint8Array; + /** + * offset is a numeric offset that can be used when key is unavailable. + * It is less efficient than using key. Only one of offset or key should + * be set. + */ + offset: string; + /** + * limit is the total number of results to be returned in the result page. + * If left empty it will default to a value to be set by each app. + */ + limit: string; + /** + * count_total is set to true to indicate that the result set should include + * a count of the total number of items available for pagination in UIs. + * count_total is only respected when offset is used. It is ignored when key + * is set. + */ + count_total: boolean; + /** + * reverse is set to true if results are to be returned in the descending order. + * + * Since: cosmos-sdk 0.43 + */ + reverse: boolean; +} +export interface PageRequestAminoMsg { + type: "cosmos-sdk/PageRequest"; + value: PageRequestAmino; +} /** * PageResponse is to be embedded in gRPC response messages where the * corresponding request message has used PageRequest. @@ -72,6 +121,36 @@ export interface PageResponse { */ total: Long; } +export interface PageResponseProtoMsg { + typeUrl: "/cosmos.base.query.v1beta1.PageResponse"; + value: Uint8Array; +} +/** + * PageResponse is to be embedded in gRPC response messages where the + * corresponding request message has used PageRequest. + * + * message SomeResponse { + * repeated Bar results = 1; + * PageResponse page = 2; + * } + */ +export interface PageResponseAmino { + /** + * next_key is the key to be passed to PageRequest.key to + * query the next page most efficiently. It will be empty if + * there are no more results. + */ + next_key: Uint8Array; + /** + * total is total number of results available if PageRequest.count_total + * was set, its value is undefined otherwise + */ + total: string; +} +export interface PageResponseAminoMsg { + type: "cosmos-sdk/PageResponse"; + value: PageResponseAmino; +} function createBasePageRequest(): PageRequest { return { key: new Uint8Array(), @@ -172,6 +251,45 @@ export const PageRequest = { message.reverse = object.reverse ?? false; return message; }, + fromAmino(object: PageRequestAmino): PageRequest { + return { + key: object.key, + offset: Long.fromString(object.offset), + limit: Long.fromString(object.limit), + countTotal: object.count_total, + reverse: object.reverse, + }; + }, + toAmino(message: PageRequest): PageRequestAmino { + const obj: any = {}; + obj.key = message.key; + obj.offset = message.offset ? message.offset.toString() : undefined; + obj.limit = message.limit ? message.limit.toString() : undefined; + obj.count_total = message.countTotal; + obj.reverse = message.reverse; + return obj; + }, + fromAminoMsg(object: PageRequestAminoMsg): PageRequest { + return PageRequest.fromAmino(object.value); + }, + toAminoMsg(message: PageRequest): PageRequestAminoMsg { + return { + type: "cosmos-sdk/PageRequest", + value: PageRequest.toAmino(message), + }; + }, + fromProtoMsg(message: PageRequestProtoMsg): PageRequest { + return PageRequest.decode(message.value); + }, + toProto(message: PageRequest): Uint8Array { + return PageRequest.encode(message).finish(); + }, + toProtoMsg(message: PageRequest): PageRequestProtoMsg { + return { + typeUrl: "/cosmos.base.query.v1beta1.PageRequest", + value: PageRequest.encode(message).finish(), + }; + }, }; function createBasePageResponse(): PageResponse { return { @@ -241,4 +359,37 @@ export const PageResponse = { : Long.UZERO; return message; }, + fromAmino(object: PageResponseAmino): PageResponse { + return { + nextKey: object.next_key, + total: Long.fromString(object.total), + }; + }, + toAmino(message: PageResponse): PageResponseAmino { + const obj: any = {}; + obj.next_key = message.nextKey; + obj.total = message.total ? message.total.toString() : undefined; + return obj; + }, + fromAminoMsg(object: PageResponseAminoMsg): PageResponse { + return PageResponse.fromAmino(object.value); + }, + toAminoMsg(message: PageResponse): PageResponseAminoMsg { + return { + type: "cosmos-sdk/PageResponse", + value: PageResponse.toAmino(message), + }; + }, + fromProtoMsg(message: PageResponseProtoMsg): PageResponse { + return PageResponse.decode(message.value); + }, + toProto(message: PageResponse): Uint8Array { + return PageResponse.encode(message).finish(); + }, + toProtoMsg(message: PageResponse): PageResponseProtoMsg { + return { + typeUrl: "/cosmos.base.query.v1beta1.PageResponse", + value: PageResponse.encode(message).finish(), + }; + }, }; diff --git a/packages/types/src/cosmos/base/v1beta1/coin.ts b/packages/types/src/cosmos/base/v1beta1/coin.ts index b2f932f79..9f3b0232d 100644 --- a/packages/types/src/cosmos/base/v1beta1/coin.ts +++ b/packages/types/src/cosmos/base/v1beta1/coin.ts @@ -12,6 +12,24 @@ export interface Coin { denom: string; amount: string; } +export interface CoinProtoMsg { + typeUrl: "/cosmos.base.v1beta1.Coin"; + value: Uint8Array; +} +/** + * 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. + */ +export interface CoinAmino { + denom: string; + amount: string; +} +export interface CoinAminoMsg { + type: "cosmos-sdk/Coin"; + value: CoinAmino; +} /** * DecCoin defines a token with a denomination and a decimal amount. * @@ -22,14 +40,56 @@ export interface DecCoin { denom: string; amount: string; } +export interface DecCoinProtoMsg { + typeUrl: "/cosmos.base.v1beta1.DecCoin"; + value: Uint8Array; +} +/** + * DecCoin defines a token with a denomination and a decimal amount. + * + * NOTE: The amount field is an Dec which implements the custom method + * signatures required by gogoproto. + */ +export interface DecCoinAmino { + denom: string; + amount: string; +} +export interface DecCoinAminoMsg { + type: "cosmos-sdk/DecCoin"; + value: DecCoinAmino; +} /** IntProto defines a Protobuf wrapper around an Int object. */ export interface IntProto { int: string; } +export interface IntProtoProtoMsg { + typeUrl: "/cosmos.base.v1beta1.IntProto"; + value: Uint8Array; +} +/** IntProto defines a Protobuf wrapper around an Int object. */ +export interface IntProtoAmino { + int: string; +} +export interface IntProtoAminoMsg { + type: "cosmos-sdk/IntProto"; + value: IntProtoAmino; +} /** DecProto defines a Protobuf wrapper around a Dec object. */ export interface DecProto { dec: string; } +export interface DecProtoProtoMsg { + typeUrl: "/cosmos.base.v1beta1.DecProto"; + value: Uint8Array; +} +/** DecProto defines a Protobuf wrapper around a Dec object. */ +export interface DecProtoAmino { + dec: string; +} +export interface DecProtoAminoMsg { + type: "cosmos-sdk/DecProto"; + value: DecProtoAmino; +} function createBaseCoin(): Coin { return { denom: "", @@ -84,6 +144,39 @@ export const Coin = { message.amount = object.amount ?? ""; return message; }, + fromAmino(object: CoinAmino): Coin { + return { + denom: object.denom, + amount: object.amount, + }; + }, + toAmino(message: Coin): CoinAmino { + const obj: any = {}; + obj.denom = message.denom; + obj.amount = message.amount; + return obj; + }, + fromAminoMsg(object: CoinAminoMsg): Coin { + return Coin.fromAmino(object.value); + }, + toAminoMsg(message: Coin): CoinAminoMsg { + return { + type: "cosmos-sdk/Coin", + value: Coin.toAmino(message), + }; + }, + fromProtoMsg(message: CoinProtoMsg): Coin { + return Coin.decode(message.value); + }, + toProto(message: Coin): Uint8Array { + return Coin.encode(message).finish(); + }, + toProtoMsg(message: Coin): CoinProtoMsg { + return { + typeUrl: "/cosmos.base.v1beta1.Coin", + value: Coin.encode(message).finish(), + }; + }, }; function createBaseDecCoin(): DecCoin { return { @@ -142,6 +235,39 @@ export const DecCoin = { message.amount = object.amount ?? ""; return message; }, + fromAmino(object: DecCoinAmino): DecCoin { + return { + denom: object.denom, + amount: object.amount, + }; + }, + toAmino(message: DecCoin): DecCoinAmino { + const obj: any = {}; + obj.denom = message.denom; + obj.amount = message.amount; + return obj; + }, + fromAminoMsg(object: DecCoinAminoMsg): DecCoin { + return DecCoin.fromAmino(object.value); + }, + toAminoMsg(message: DecCoin): DecCoinAminoMsg { + return { + type: "cosmos-sdk/DecCoin", + value: DecCoin.toAmino(message), + }; + }, + fromProtoMsg(message: DecCoinProtoMsg): DecCoin { + return DecCoin.decode(message.value); + }, + toProto(message: DecCoin): Uint8Array { + return DecCoin.encode(message).finish(); + }, + toProtoMsg(message: DecCoin): DecCoinProtoMsg { + return { + typeUrl: "/cosmos.base.v1beta1.DecCoin", + value: DecCoin.encode(message).finish(), + }; + }, }; function createBaseIntProto(): IntProto { return { @@ -190,6 +316,37 @@ export const IntProto = { message.int = object.int ?? ""; return message; }, + fromAmino(object: IntProtoAmino): IntProto { + return { + int: object.int, + }; + }, + toAmino(message: IntProto): IntProtoAmino { + const obj: any = {}; + obj.int = message.int; + return obj; + }, + fromAminoMsg(object: IntProtoAminoMsg): IntProto { + return IntProto.fromAmino(object.value); + }, + toAminoMsg(message: IntProto): IntProtoAminoMsg { + return { + type: "cosmos-sdk/IntProto", + value: IntProto.toAmino(message), + }; + }, + fromProtoMsg(message: IntProtoProtoMsg): IntProto { + return IntProto.decode(message.value); + }, + toProto(message: IntProto): Uint8Array { + return IntProto.encode(message).finish(); + }, + toProtoMsg(message: IntProto): IntProtoProtoMsg { + return { + typeUrl: "/cosmos.base.v1beta1.IntProto", + value: IntProto.encode(message).finish(), + }; + }, }; function createBaseDecProto(): DecProto { return { @@ -238,4 +395,35 @@ export const DecProto = { message.dec = object.dec ?? ""; return message; }, + fromAmino(object: DecProtoAmino): DecProto { + return { + dec: object.dec, + }; + }, + toAmino(message: DecProto): DecProtoAmino { + const obj: any = {}; + obj.dec = message.dec; + return obj; + }, + fromAminoMsg(object: DecProtoAminoMsg): DecProto { + return DecProto.fromAmino(object.value); + }, + toAminoMsg(message: DecProto): DecProtoAminoMsg { + return { + type: "cosmos-sdk/DecProto", + value: DecProto.toAmino(message), + }; + }, + fromProtoMsg(message: DecProtoProtoMsg): DecProto { + return DecProto.decode(message.value); + }, + toProto(message: DecProto): Uint8Array { + return DecProto.encode(message).finish(); + }, + toProtoMsg(message: DecProto): DecProtoProtoMsg { + return { + typeUrl: "/cosmos.base.v1beta1.DecProto", + value: DecProto.encode(message).finish(), + }; + }, }; diff --git a/packages/types/src/cosmos/client.ts b/packages/types/src/cosmos/client.ts new file mode 100644 index 000000000..26980e49c --- /dev/null +++ b/packages/types/src/cosmos/client.ts @@ -0,0 +1,55 @@ +/* eslint-disable */ +import { GeneratedType, Registry, OfflineSigner } from "@cosmjs/proto-signing"; +import { AminoTypes, SigningStargateClient } from "@cosmjs/stargate"; +import { HttpEndpoint } from "@cosmjs/tendermint-rpc"; +import * as cosmosAuthzV1beta1TxRegistry from "./authz/v1beta1/tx.registry"; +import * as cosmosGovV1TxRegistry from "./gov/v1/tx.registry"; +import * as cosmosGovV1beta1TxRegistry from "./gov/v1beta1/tx.registry"; +import * as cosmosUpgradeV1beta1TxRegistry from "./upgrade/v1beta1/tx.registry"; +import * as cosmosAuthzV1beta1TxAmino from "./authz/v1beta1/tx.amino"; +import * as cosmosGovV1TxAmino from "./gov/v1/tx.amino"; +import * as cosmosGovV1beta1TxAmino from "./gov/v1beta1/tx.amino"; +import * as cosmosUpgradeV1beta1TxAmino from "./upgrade/v1beta1/tx.amino"; +export const cosmosAminoConverters = { + ...cosmosAuthzV1beta1TxAmino.AminoConverter, + ...cosmosGovV1TxAmino.AminoConverter, + ...cosmosGovV1beta1TxAmino.AminoConverter, + ...cosmosUpgradeV1beta1TxAmino.AminoConverter, +}; +export const cosmosProtoRegistry: ReadonlyArray<[string, GeneratedType]> = [ + ...cosmosAuthzV1beta1TxRegistry.registry, + ...cosmosGovV1TxRegistry.registry, + ...cosmosGovV1beta1TxRegistry.registry, + ...cosmosUpgradeV1beta1TxRegistry.registry, +]; +export const getSigningCosmosClientOptions = (): { + registry: Registry; + aminoTypes: AminoTypes; +} => { + const registry = new Registry([...cosmosProtoRegistry]); + const aminoTypes = new AminoTypes({ + ...cosmosAminoConverters, + }); + return { + registry, + aminoTypes, + }; +}; +export const getSigningCosmosClient = async ({ + rpcEndpoint, + signer, +}: { + rpcEndpoint: string | HttpEndpoint; + signer: OfflineSigner; +}) => { + const { registry, aminoTypes } = getSigningCosmosClientOptions(); + const client = await SigningStargateClient.connectWithSigner( + rpcEndpoint, + signer, + { + registry, + aminoTypes, + } + ); + return client; +}; diff --git a/packages/types/src/cosmos/crypto/multisig/v1beta1/multisig.ts b/packages/types/src/cosmos/crypto/multisig/v1beta1/multisig.ts index fb08a5e03..e22ce564b 100644 --- a/packages/types/src/cosmos/crypto/multisig/v1beta1/multisig.ts +++ b/packages/types/src/cosmos/crypto/multisig/v1beta1/multisig.ts @@ -16,6 +16,22 @@ export const protobufPackage = "cosmos.crypto.multisig.v1beta1"; export interface MultiSignature { signatures: Uint8Array[]; } +export interface MultiSignatureProtoMsg { + typeUrl: "/cosmos.crypto.multisig.v1beta1.MultiSignature"; + value: Uint8Array; +} +/** + * MultiSignature wraps the signatures from a multisig.LegacyAminoPubKey. + * See cosmos.tx.v1betata1.ModeInfo.Multi for how to specify which signers + * signed and with which modes. + */ +export interface MultiSignatureAmino { + signatures: Uint8Array[]; +} +export interface MultiSignatureAminoMsg { + type: "cosmos-sdk/MultiSignature"; + value: MultiSignatureAmino; +} /** * CompactBitArray is an implementation of a space efficient bit array. * This is used to ensure that the encoded data takes up a minimal amount of @@ -26,6 +42,24 @@ export interface CompactBitArray { extraBitsStored: number; elems: Uint8Array; } +export interface CompactBitArrayProtoMsg { + typeUrl: "/cosmos.crypto.multisig.v1beta1.CompactBitArray"; + value: Uint8Array; +} +/** + * CompactBitArray is an implementation of a space efficient bit array. + * This is used to ensure that the encoded data takes up a minimal amount of + * space after proto encoding. + * This is not thread safe, and is not intended for concurrent usage. + */ +export interface CompactBitArrayAmino { + extra_bits_stored: number; + elems: Uint8Array; +} +export interface CompactBitArrayAminoMsg { + type: "cosmos-sdk/CompactBitArray"; + value: CompactBitArrayAmino; +} function createBaseMultiSignature(): MultiSignature { return { signatures: [], @@ -83,6 +117,43 @@ export const MultiSignature = { message.signatures = object.signatures?.map((e) => e) || []; return message; }, + fromAmino(object: MultiSignatureAmino): MultiSignature { + return { + signatures: Array.isArray(object?.signatures) + ? object.signatures.map((e: any) => e) + : [], + }; + }, + toAmino(message: MultiSignature): MultiSignatureAmino { + const obj: any = {}; + if (message.signatures) { + obj.signatures = message.signatures.map((e) => e); + } else { + obj.signatures = []; + } + return obj; + }, + fromAminoMsg(object: MultiSignatureAminoMsg): MultiSignature { + return MultiSignature.fromAmino(object.value); + }, + toAminoMsg(message: MultiSignature): MultiSignatureAminoMsg { + return { + type: "cosmos-sdk/MultiSignature", + value: MultiSignature.toAmino(message), + }; + }, + fromProtoMsg(message: MultiSignatureProtoMsg): MultiSignature { + return MultiSignature.decode(message.value); + }, + toProto(message: MultiSignature): Uint8Array { + return MultiSignature.encode(message).finish(); + }, + toProtoMsg(message: MultiSignature): MultiSignatureProtoMsg { + return { + typeUrl: "/cosmos.crypto.multisig.v1beta1.MultiSignature", + value: MultiSignature.encode(message).finish(), + }; + }, }; function createBaseCompactBitArray(): CompactBitArray { return { @@ -151,4 +222,37 @@ export const CompactBitArray = { message.elems = object.elems ?? new Uint8Array(); return message; }, + fromAmino(object: CompactBitArrayAmino): CompactBitArray { + return { + extraBitsStored: object.extra_bits_stored, + elems: object.elems, + }; + }, + toAmino(message: CompactBitArray): CompactBitArrayAmino { + const obj: any = {}; + obj.extra_bits_stored = message.extraBitsStored; + obj.elems = message.elems; + return obj; + }, + fromAminoMsg(object: CompactBitArrayAminoMsg): CompactBitArray { + return CompactBitArray.fromAmino(object.value); + }, + toAminoMsg(message: CompactBitArray): CompactBitArrayAminoMsg { + return { + type: "cosmos-sdk/CompactBitArray", + value: CompactBitArray.toAmino(message), + }; + }, + fromProtoMsg(message: CompactBitArrayProtoMsg): CompactBitArray { + return CompactBitArray.decode(message.value); + }, + toProto(message: CompactBitArray): Uint8Array { + return CompactBitArray.encode(message).finish(); + }, + toProtoMsg(message: CompactBitArray): CompactBitArrayProtoMsg { + return { + typeUrl: "/cosmos.crypto.multisig.v1beta1.CompactBitArray", + value: CompactBitArray.encode(message).finish(), + }; + }, }; diff --git a/packages/types/src/cosmos/gov/v1/genesis.ts b/packages/types/src/cosmos/gov/v1/genesis.ts new file mode 100644 index 000000000..00b05a12b --- /dev/null +++ b/packages/types/src/cosmos/gov/v1/genesis.ts @@ -0,0 +1,369 @@ +/* eslint-disable */ +import { + Deposit, + DepositAmino, + Vote, + VoteAmino, + Proposal, + ProposalAmino, + DepositParams, + DepositParamsAmino, + VotingParams, + VotingParamsAmino, + TallyParams, + TallyParamsAmino, + Params, + ParamsAmino, +} from "./gov"; +import { Long, isSet, DeepPartial, Exact } from "../../../helpers"; +import * as _m0 from "protobufjs/minimal"; +export const protobufPackage = "cosmos.gov.v1"; +/** GenesisState defines the gov module's genesis state. */ +export interface GenesisState { + /** starting_proposal_id is the ID of the starting proposal. */ + startingProposalId: Long; + /** deposits defines all the deposits present at genesis. */ + deposits: Deposit[]; + /** votes defines all the votes present at genesis. */ + votes: Vote[]; + /** proposals defines all the proposals present at genesis. */ + proposals: Proposal[]; + /** + * Deprecated: Prefer to use `params` instead. + * deposit_params defines all the paramaters of related to deposit. + */ + /** @deprecated */ + depositParams?: DepositParams; + /** + * Deprecated: Prefer to use `params` instead. + * voting_params defines all the paramaters of related to voting. + */ + /** @deprecated */ + votingParams?: VotingParams; + /** + * Deprecated: Prefer to use `params` instead. + * tally_params defines all the paramaters of related to tally. + */ + /** @deprecated */ + tallyParams?: TallyParams; + /** + * params defines all the paramaters of x/gov module. + * + * Since: cosmos-sdk 0.47 + */ + params?: Params; +} +export interface GenesisStateProtoMsg { + typeUrl: "/cosmos.gov.v1.GenesisState"; + value: Uint8Array; +} +/** GenesisState defines the gov module's genesis state. */ +export interface GenesisStateAmino { + /** starting_proposal_id is the ID of the starting proposal. */ + starting_proposal_id: string; + /** deposits defines all the deposits present at genesis. */ + deposits: DepositAmino[]; + /** votes defines all the votes present at genesis. */ + votes: VoteAmino[]; + /** proposals defines all the proposals present at genesis. */ + proposals: ProposalAmino[]; + /** + * Deprecated: Prefer to use `params` instead. + * deposit_params defines all the paramaters of related to deposit. + */ + /** @deprecated */ + deposit_params?: DepositParamsAmino; + /** + * Deprecated: Prefer to use `params` instead. + * voting_params defines all the paramaters of related to voting. + */ + /** @deprecated */ + voting_params?: VotingParamsAmino; + /** + * Deprecated: Prefer to use `params` instead. + * tally_params defines all the paramaters of related to tally. + */ + /** @deprecated */ + tally_params?: TallyParamsAmino; + /** + * params defines all the paramaters of x/gov module. + * + * Since: cosmos-sdk 0.47 + */ + params?: ParamsAmino; +} +export interface GenesisStateAminoMsg { + type: "cosmos-sdk/v1/GenesisState"; + value: GenesisStateAmino; +} +function createBaseGenesisState(): GenesisState { + return { + startingProposalId: Long.UZERO, + deposits: [], + votes: [], + proposals: [], + depositParams: undefined, + votingParams: undefined, + tallyParams: undefined, + params: undefined, + }; +} +export const GenesisState = { + encode( + message: GenesisState, + writer: _m0.Writer = _m0.Writer.create() + ): _m0.Writer { + if (!message.startingProposalId.isZero()) { + writer.uint32(8).uint64(message.startingProposalId); + } + for (const v of message.deposits) { + Deposit.encode(v!, writer.uint32(18).fork()).ldelim(); + } + for (const v of message.votes) { + Vote.encode(v!, writer.uint32(26).fork()).ldelim(); + } + for (const v of message.proposals) { + Proposal.encode(v!, writer.uint32(34).fork()).ldelim(); + } + if (message.depositParams !== undefined) { + DepositParams.encode( + message.depositParams, + writer.uint32(42).fork() + ).ldelim(); + } + if (message.votingParams !== undefined) { + VotingParams.encode( + message.votingParams, + writer.uint32(50).fork() + ).ldelim(); + } + if (message.tallyParams !== undefined) { + TallyParams.encode( + message.tallyParams, + writer.uint32(58).fork() + ).ldelim(); + } + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(66).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.startingProposalId = reader.uint64() as Long; + break; + case 2: + message.deposits.push(Deposit.decode(reader, reader.uint32())); + break; + case 3: + message.votes.push(Vote.decode(reader, reader.uint32())); + break; + case 4: + message.proposals.push(Proposal.decode(reader, reader.uint32())); + break; + case 5: + message.depositParams = DepositParams.decode(reader, reader.uint32()); + break; + case 6: + message.votingParams = VotingParams.decode(reader, reader.uint32()); + break; + case 7: + message.tallyParams = TallyParams.decode(reader, reader.uint32()); + break; + case 8: + message.params = Params.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object: any): GenesisState { + return { + startingProposalId: isSet(object.startingProposalId) + ? Long.fromValue(object.startingProposalId) + : Long.UZERO, + deposits: Array.isArray(object?.deposits) + ? object.deposits.map((e: any) => Deposit.fromJSON(e)) + : [], + votes: Array.isArray(object?.votes) + ? object.votes.map((e: any) => Vote.fromJSON(e)) + : [], + proposals: Array.isArray(object?.proposals) + ? object.proposals.map((e: any) => Proposal.fromJSON(e)) + : [], + depositParams: isSet(object.depositParams) + ? DepositParams.fromJSON(object.depositParams) + : undefined, + votingParams: isSet(object.votingParams) + ? VotingParams.fromJSON(object.votingParams) + : undefined, + tallyParams: isSet(object.tallyParams) + ? TallyParams.fromJSON(object.tallyParams) + : undefined, + params: isSet(object.params) ? Params.fromJSON(object.params) : undefined, + }; + }, + toJSON(message: GenesisState): unknown { + const obj: any = {}; + message.startingProposalId !== undefined && + (obj.startingProposalId = ( + message.startingProposalId || Long.UZERO + ).toString()); + if (message.deposits) { + obj.deposits = message.deposits.map((e) => + e ? Deposit.toJSON(e) : undefined + ); + } else { + obj.deposits = []; + } + if (message.votes) { + obj.votes = message.votes.map((e) => (e ? Vote.toJSON(e) : undefined)); + } else { + obj.votes = []; + } + if (message.proposals) { + obj.proposals = message.proposals.map((e) => + e ? Proposal.toJSON(e) : undefined + ); + } else { + obj.proposals = []; + } + message.depositParams !== undefined && + (obj.depositParams = message.depositParams + ? DepositParams.toJSON(message.depositParams) + : undefined); + message.votingParams !== undefined && + (obj.votingParams = message.votingParams + ? VotingParams.toJSON(message.votingParams) + : undefined); + message.tallyParams !== undefined && + (obj.tallyParams = message.tallyParams + ? TallyParams.toJSON(message.tallyParams) + : undefined); + message.params !== undefined && + (obj.params = message.params ? Params.toJSON(message.params) : undefined); + return obj; + }, + fromPartial, I>>( + object: I + ): GenesisState { + const message = createBaseGenesisState(); + message.startingProposalId = + object.startingProposalId !== undefined && + object.startingProposalId !== null + ? Long.fromValue(object.startingProposalId) + : Long.UZERO; + message.deposits = + object.deposits?.map((e) => Deposit.fromPartial(e)) || []; + message.votes = object.votes?.map((e) => Vote.fromPartial(e)) || []; + message.proposals = + object.proposals?.map((e) => Proposal.fromPartial(e)) || []; + message.depositParams = + object.depositParams !== undefined && object.depositParams !== null + ? DepositParams.fromPartial(object.depositParams) + : undefined; + message.votingParams = + object.votingParams !== undefined && object.votingParams !== null + ? VotingParams.fromPartial(object.votingParams) + : undefined; + message.tallyParams = + object.tallyParams !== undefined && object.tallyParams !== null + ? TallyParams.fromPartial(object.tallyParams) + : undefined; + message.params = + object.params !== undefined && object.params !== null + ? Params.fromPartial(object.params) + : undefined; + return message; + }, + fromAmino(object: GenesisStateAmino): GenesisState { + return { + startingProposalId: Long.fromString(object.starting_proposal_id), + deposits: Array.isArray(object?.deposits) + ? object.deposits.map((e: any) => Deposit.fromAmino(e)) + : [], + votes: Array.isArray(object?.votes) + ? object.votes.map((e: any) => Vote.fromAmino(e)) + : [], + proposals: Array.isArray(object?.proposals) + ? object.proposals.map((e: any) => Proposal.fromAmino(e)) + : [], + depositParams: object?.deposit_params + ? DepositParams.fromAmino(object.deposit_params) + : undefined, + votingParams: object?.voting_params + ? VotingParams.fromAmino(object.voting_params) + : undefined, + tallyParams: object?.tally_params + ? TallyParams.fromAmino(object.tally_params) + : undefined, + params: object?.params ? Params.fromAmino(object.params) : undefined, + }; + }, + toAmino(message: GenesisState): GenesisStateAmino { + const obj: any = {}; + obj.starting_proposal_id = message.startingProposalId + ? message.startingProposalId.toString() + : undefined; + if (message.deposits) { + obj.deposits = message.deposits.map((e) => + e ? Deposit.toAmino(e) : undefined + ); + } else { + obj.deposits = []; + } + if (message.votes) { + obj.votes = message.votes.map((e) => (e ? Vote.toAmino(e) : undefined)); + } else { + obj.votes = []; + } + if (message.proposals) { + obj.proposals = message.proposals.map((e) => + e ? Proposal.toAmino(e) : undefined + ); + } else { + obj.proposals = []; + } + obj.deposit_params = message.depositParams + ? DepositParams.toAmino(message.depositParams) + : undefined; + obj.voting_params = message.votingParams + ? VotingParams.toAmino(message.votingParams) + : undefined; + obj.tally_params = message.tallyParams + ? TallyParams.toAmino(message.tallyParams) + : undefined; + obj.params = message.params ? Params.toAmino(message.params) : undefined; + return obj; + }, + fromAminoMsg(object: GenesisStateAminoMsg): GenesisState { + return GenesisState.fromAmino(object.value); + }, + toAminoMsg(message: GenesisState): GenesisStateAminoMsg { + return { + type: "cosmos-sdk/v1/GenesisState", + value: GenesisState.toAmino(message), + }; + }, + fromProtoMsg(message: GenesisStateProtoMsg): GenesisState { + return GenesisState.decode(message.value); + }, + toProto(message: GenesisState): Uint8Array { + return GenesisState.encode(message).finish(); + }, + toProtoMsg(message: GenesisState): GenesisStateProtoMsg { + return { + typeUrl: "/cosmos.gov.v1.GenesisState", + value: GenesisState.encode(message).finish(), + }; + }, +}; diff --git a/packages/types/src/cosmos/gov/v1/gov.ts b/packages/types/src/cosmos/gov/v1/gov.ts new file mode 100644 index 000000000..94c9bc054 --- /dev/null +++ b/packages/types/src/cosmos/gov/v1/gov.ts @@ -0,0 +1,1913 @@ +/* eslint-disable */ +import { Coin, CoinAmino } from "../../base/v1beta1/coin"; +import { Any, AnyAmino } from "../../../google/protobuf/any"; +import { Timestamp, TimestampAmino } from "../../../google/protobuf/timestamp"; +import { Duration, DurationAmino } from "../../../google/protobuf/duration"; +import { + Long, + isSet, + DeepPartial, + Exact, + fromJsonTimestamp, + fromTimestamp, +} from "../../../helpers"; +import * as _m0 from "protobufjs/minimal"; +export const protobufPackage = "cosmos.gov.v1"; +/** VoteOption enumerates the valid vote options for a given governance proposal. */ +export enum VoteOption { + /** VOTE_OPTION_UNSPECIFIED - VOTE_OPTION_UNSPECIFIED defines a no-op vote option. */ + VOTE_OPTION_UNSPECIFIED = 0, + /** VOTE_OPTION_YES - VOTE_OPTION_YES defines a yes vote option. */ + VOTE_OPTION_YES = 1, + /** VOTE_OPTION_ABSTAIN - VOTE_OPTION_ABSTAIN defines an abstain vote option. */ + VOTE_OPTION_ABSTAIN = 2, + /** VOTE_OPTION_NO - VOTE_OPTION_NO defines a no vote option. */ + VOTE_OPTION_NO = 3, + /** VOTE_OPTION_NO_WITH_VETO - VOTE_OPTION_NO_WITH_VETO defines a no with veto vote option. */ + VOTE_OPTION_NO_WITH_VETO = 4, + UNRECOGNIZED = -1, +} +export const VoteOptionAmino = VoteOption; +export function voteOptionFromJSON(object: any): VoteOption { + switch (object) { + case 0: + case "VOTE_OPTION_UNSPECIFIED": + return VoteOption.VOTE_OPTION_UNSPECIFIED; + case 1: + case "VOTE_OPTION_YES": + return VoteOption.VOTE_OPTION_YES; + case 2: + case "VOTE_OPTION_ABSTAIN": + return VoteOption.VOTE_OPTION_ABSTAIN; + case 3: + case "VOTE_OPTION_NO": + return VoteOption.VOTE_OPTION_NO; + case 4: + case "VOTE_OPTION_NO_WITH_VETO": + return VoteOption.VOTE_OPTION_NO_WITH_VETO; + case -1: + case "UNRECOGNIZED": + default: + return VoteOption.UNRECOGNIZED; + } +} +export function voteOptionToJSON(object: VoteOption): string { + switch (object) { + case VoteOption.VOTE_OPTION_UNSPECIFIED: + return "VOTE_OPTION_UNSPECIFIED"; + case VoteOption.VOTE_OPTION_YES: + return "VOTE_OPTION_YES"; + case VoteOption.VOTE_OPTION_ABSTAIN: + return "VOTE_OPTION_ABSTAIN"; + case VoteOption.VOTE_OPTION_NO: + return "VOTE_OPTION_NO"; + case VoteOption.VOTE_OPTION_NO_WITH_VETO: + return "VOTE_OPTION_NO_WITH_VETO"; + case VoteOption.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} +/** ProposalStatus enumerates the valid statuses of a proposal. */ +export enum ProposalStatus { + /** PROPOSAL_STATUS_UNSPECIFIED - PROPOSAL_STATUS_UNSPECIFIED defines the default proposal status. */ + PROPOSAL_STATUS_UNSPECIFIED = 0, + /** + * PROPOSAL_STATUS_DEPOSIT_PERIOD - PROPOSAL_STATUS_DEPOSIT_PERIOD defines a proposal status during the deposit + * period. + */ + PROPOSAL_STATUS_DEPOSIT_PERIOD = 1, + /** + * PROPOSAL_STATUS_VOTING_PERIOD - PROPOSAL_STATUS_VOTING_PERIOD defines a proposal status during the voting + * period. + */ + PROPOSAL_STATUS_VOTING_PERIOD = 2, + /** + * PROPOSAL_STATUS_PASSED - PROPOSAL_STATUS_PASSED defines a proposal status of a proposal that has + * passed. + */ + PROPOSAL_STATUS_PASSED = 3, + /** + * PROPOSAL_STATUS_REJECTED - PROPOSAL_STATUS_REJECTED defines a proposal status of a proposal that has + * been rejected. + */ + PROPOSAL_STATUS_REJECTED = 4, + /** + * PROPOSAL_STATUS_FAILED - PROPOSAL_STATUS_FAILED defines a proposal status of a proposal that has + * failed. + */ + PROPOSAL_STATUS_FAILED = 5, + UNRECOGNIZED = -1, +} +export const ProposalStatusAmino = ProposalStatus; +export function proposalStatusFromJSON(object: any): ProposalStatus { + switch (object) { + case 0: + case "PROPOSAL_STATUS_UNSPECIFIED": + return ProposalStatus.PROPOSAL_STATUS_UNSPECIFIED; + case 1: + case "PROPOSAL_STATUS_DEPOSIT_PERIOD": + return ProposalStatus.PROPOSAL_STATUS_DEPOSIT_PERIOD; + case 2: + case "PROPOSAL_STATUS_VOTING_PERIOD": + return ProposalStatus.PROPOSAL_STATUS_VOTING_PERIOD; + case 3: + case "PROPOSAL_STATUS_PASSED": + return ProposalStatus.PROPOSAL_STATUS_PASSED; + case 4: + case "PROPOSAL_STATUS_REJECTED": + return ProposalStatus.PROPOSAL_STATUS_REJECTED; + case 5: + case "PROPOSAL_STATUS_FAILED": + return ProposalStatus.PROPOSAL_STATUS_FAILED; + case -1: + case "UNRECOGNIZED": + default: + return ProposalStatus.UNRECOGNIZED; + } +} +export function proposalStatusToJSON(object: ProposalStatus): string { + switch (object) { + case ProposalStatus.PROPOSAL_STATUS_UNSPECIFIED: + return "PROPOSAL_STATUS_UNSPECIFIED"; + case ProposalStatus.PROPOSAL_STATUS_DEPOSIT_PERIOD: + return "PROPOSAL_STATUS_DEPOSIT_PERIOD"; + case ProposalStatus.PROPOSAL_STATUS_VOTING_PERIOD: + return "PROPOSAL_STATUS_VOTING_PERIOD"; + case ProposalStatus.PROPOSAL_STATUS_PASSED: + return "PROPOSAL_STATUS_PASSED"; + case ProposalStatus.PROPOSAL_STATUS_REJECTED: + return "PROPOSAL_STATUS_REJECTED"; + case ProposalStatus.PROPOSAL_STATUS_FAILED: + return "PROPOSAL_STATUS_FAILED"; + case ProposalStatus.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} +/** WeightedVoteOption defines a unit of vote for vote split. */ +export interface WeightedVoteOption { + /** option defines the valid vote options, it must not contain duplicate vote options. */ + option: VoteOption; + /** weight is the vote weight associated with the vote option. */ + weight: string; +} +export interface WeightedVoteOptionProtoMsg { + typeUrl: "/cosmos.gov.v1.WeightedVoteOption"; + value: Uint8Array; +} +/** WeightedVoteOption defines a unit of vote for vote split. */ +export interface WeightedVoteOptionAmino { + /** option defines the valid vote options, it must not contain duplicate vote options. */ + option: VoteOption; + /** weight is the vote weight associated with the vote option. */ + weight: string; +} +export interface WeightedVoteOptionAminoMsg { + type: "cosmos-sdk/v1/WeightedVoteOption"; + value: WeightedVoteOptionAmino; +} +/** + * Deposit defines an amount deposited by an account address to an active + * proposal. + */ +export interface Deposit { + /** proposal_id defines the unique id of the proposal. */ + proposalId: Long; + /** depositor defines the deposit addresses from the proposals. */ + depositor: string; + /** amount to be deposited by depositor. */ + amount: Coin[]; +} +export interface DepositProtoMsg { + typeUrl: "/cosmos.gov.v1.Deposit"; + value: Uint8Array; +} +/** + * Deposit defines an amount deposited by an account address to an active + * proposal. + */ +export interface DepositAmino { + /** proposal_id defines the unique id of the proposal. */ + proposal_id: string; + /** depositor defines the deposit addresses from the proposals. */ + depositor: string; + /** amount to be deposited by depositor. */ + amount: CoinAmino[]; +} +export interface DepositAminoMsg { + type: "cosmos-sdk/v1/Deposit"; + value: DepositAmino; +} +/** Proposal defines the core field members of a governance proposal. */ +export interface Proposal { + /** id defines the unique id of the proposal. */ + id: Long; + /** messages are the arbitrary messages to be executed if the proposal passes. */ + messages: Any[]; + /** status defines the proposal status. */ + status: ProposalStatus; + /** + * final_tally_result is the final tally result of the proposal. When + * querying a proposal via gRPC, this field is not populated until the + * proposal's voting period has ended. + */ + finalTallyResult?: TallyResult; + /** submit_time is the time of proposal submission. */ + submitTime?: Timestamp; + /** deposit_end_time is the end time for deposition. */ + depositEndTime?: Timestamp; + /** total_deposit is the total deposit on the proposal. */ + totalDeposit: Coin[]; + /** voting_start_time is the starting time to vote on a proposal. */ + votingStartTime?: Timestamp; + /** voting_end_time is the end time of voting on a proposal. */ + votingEndTime?: Timestamp; + /** metadata is any arbitrary metadata attached to the proposal. */ + metadata: string; + /** + * title is the title of the proposal + * + * Since: cosmos-sdk 0.47 + */ + title: string; + /** + * summary is a short summary of the proposal + * + * Since: cosmos-sdk 0.47 + */ + summary: string; + /** + * Proposer is the address of the proposal sumbitter + * + * Since: cosmos-sdk 0.47 + */ + proposer: string; +} +export interface ProposalProtoMsg { + typeUrl: "/cosmos.gov.v1.Proposal"; + value: Uint8Array; +} +/** Proposal defines the core field members of a governance proposal. */ +export interface ProposalAmino { + /** id defines the unique id of the proposal. */ + id: string; + /** messages are the arbitrary messages to be executed if the proposal passes. */ + messages: AnyAmino[]; + /** status defines the proposal status. */ + status: ProposalStatus; + /** + * final_tally_result is the final tally result of the proposal. When + * querying a proposal via gRPC, this field is not populated until the + * proposal's voting period has ended. + */ + final_tally_result?: TallyResultAmino; + /** submit_time is the time of proposal submission. */ + submit_time?: TimestampAmino; + /** deposit_end_time is the end time for deposition. */ + deposit_end_time?: TimestampAmino; + /** total_deposit is the total deposit on the proposal. */ + total_deposit: CoinAmino[]; + /** voting_start_time is the starting time to vote on a proposal. */ + voting_start_time?: TimestampAmino; + /** voting_end_time is the end time of voting on a proposal. */ + voting_end_time?: TimestampAmino; + /** metadata is any arbitrary metadata attached to the proposal. */ + metadata: string; + /** + * title is the title of the proposal + * + * Since: cosmos-sdk 0.47 + */ + title: string; + /** + * summary is a short summary of the proposal + * + * Since: cosmos-sdk 0.47 + */ + summary: string; + /** + * Proposer is the address of the proposal sumbitter + * + * Since: cosmos-sdk 0.47 + */ + proposer: string; +} +export interface ProposalAminoMsg { + type: "cosmos-sdk/v1/Proposal"; + value: ProposalAmino; +} +/** TallyResult defines a standard tally for a governance proposal. */ +export interface TallyResult { + /** yes_count is the number of yes votes on a proposal. */ + yesCount: string; + /** abstain_count is the number of abstain votes on a proposal. */ + abstainCount: string; + /** no_count is the number of no votes on a proposal. */ + noCount: string; + /** no_with_veto_count is the number of no with veto votes on a proposal. */ + noWithVetoCount: string; +} +export interface TallyResultProtoMsg { + typeUrl: "/cosmos.gov.v1.TallyResult"; + value: Uint8Array; +} +/** TallyResult defines a standard tally for a governance proposal. */ +export interface TallyResultAmino { + /** yes_count is the number of yes votes on a proposal. */ + yes_count: string; + /** abstain_count is the number of abstain votes on a proposal. */ + abstain_count: string; + /** no_count is the number of no votes on a proposal. */ + no_count: string; + /** no_with_veto_count is the number of no with veto votes on a proposal. */ + no_with_veto_count: string; +} +export interface TallyResultAminoMsg { + type: "cosmos-sdk/v1/TallyResult"; + value: TallyResultAmino; +} +/** + * Vote defines a vote on a governance proposal. + * A Vote consists of a proposal ID, the voter, and the vote option. + */ +export interface Vote { + /** proposal_id defines the unique id of the proposal. */ + proposalId: Long; + /** voter is the voter address of the proposal. */ + voter: string; + /** options is the weighted vote options. */ + options: WeightedVoteOption[]; + /** metadata is any arbitrary metadata to attached to the vote. */ + metadata: string; +} +export interface VoteProtoMsg { + typeUrl: "/cosmos.gov.v1.Vote"; + value: Uint8Array; +} +/** + * Vote defines a vote on a governance proposal. + * A Vote consists of a proposal ID, the voter, and the vote option. + */ +export interface VoteAmino { + /** proposal_id defines the unique id of the proposal. */ + proposal_id: string; + /** voter is the voter address of the proposal. */ + voter: string; + /** options is the weighted vote options. */ + options: WeightedVoteOptionAmino[]; + /** metadata is any arbitrary metadata to attached to the vote. */ + metadata: string; +} +export interface VoteAminoMsg { + type: "cosmos-sdk/v1/Vote"; + value: VoteAmino; +} +/** DepositParams defines the params for deposits on governance proposals. */ +export interface DepositParams { + /** Minimum deposit for a proposal to enter voting period. */ + minDeposit: Coin[]; + /** + * Maximum period for Atom holders to deposit on a proposal. Initial value: 2 + * months. + */ + maxDepositPeriod?: Duration; +} +export interface DepositParamsProtoMsg { + typeUrl: "/cosmos.gov.v1.DepositParams"; + value: Uint8Array; +} +/** DepositParams defines the params for deposits on governance proposals. */ +export interface DepositParamsAmino { + /** Minimum deposit for a proposal to enter voting period. */ + min_deposit: CoinAmino[]; + /** + * Maximum period for Atom holders to deposit on a proposal. Initial value: 2 + * months. + */ + max_deposit_period?: DurationAmino; +} +export interface DepositParamsAminoMsg { + type: "cosmos-sdk/v1/DepositParams"; + value: DepositParamsAmino; +} +/** VotingParams defines the params for voting on governance proposals. */ +export interface VotingParams { + /** Duration of the voting period. */ + votingPeriod?: Duration; +} +export interface VotingParamsProtoMsg { + typeUrl: "/cosmos.gov.v1.VotingParams"; + value: Uint8Array; +} +/** VotingParams defines the params for voting on governance proposals. */ +export interface VotingParamsAmino { + /** Duration of the voting period. */ + voting_period?: DurationAmino; +} +export interface VotingParamsAminoMsg { + type: "cosmos-sdk/v1/VotingParams"; + value: VotingParamsAmino; +} +/** TallyParams defines the params for tallying votes on governance proposals. */ +export interface TallyParams { + /** + * Minimum percentage of total stake needed to vote for a result to be + * considered valid. + */ + quorum: string; + /** Minimum proportion of Yes votes for proposal to pass. Default value: 0.5. */ + threshold: string; + /** + * Minimum value of Veto votes to Total votes ratio for proposal to be + * vetoed. Default value: 1/3. + */ + vetoThreshold: string; +} +export interface TallyParamsProtoMsg { + typeUrl: "/cosmos.gov.v1.TallyParams"; + value: Uint8Array; +} +/** TallyParams defines the params for tallying votes on governance proposals. */ +export interface TallyParamsAmino { + /** + * Minimum percentage of total stake needed to vote for a result to be + * considered valid. + */ + quorum: string; + /** Minimum proportion of Yes votes for proposal to pass. Default value: 0.5. */ + threshold: string; + /** + * Minimum value of Veto votes to Total votes ratio for proposal to be + * vetoed. Default value: 1/3. + */ + veto_threshold: string; +} +export interface TallyParamsAminoMsg { + type: "cosmos-sdk/v1/TallyParams"; + value: TallyParamsAmino; +} +/** + * Params defines the parameters for the x/gov module. + * + * Since: cosmos-sdk 0.47 + */ +export interface Params { + /** Minimum deposit for a proposal to enter voting period. */ + minDeposit: Coin[]; + /** + * Maximum period for Atom holders to deposit on a proposal. Initial value: 2 + * months. + */ + maxDepositPeriod?: Duration; + /** Duration of the voting period. */ + votingPeriod?: Duration; + /** + * Minimum percentage of total stake needed to vote for a result to be + * considered valid. + */ + quorum: string; + /** Minimum proportion of Yes votes for proposal to pass. Default value: 0.5. */ + threshold: string; + /** + * Minimum value of Veto votes to Total votes ratio for proposal to be + * vetoed. Default value: 1/3. + */ + vetoThreshold: string; + /** The ratio representing the proportion of the deposit value that must be paid at proposal submission. */ + minInitialDepositRatio: string; + /** burn deposits if a proposal does not meet quorum */ + burnVoteQuorum: boolean; + /** burn deposits if the proposal does not enter voting period */ + burnProposalDepositPrevote: boolean; + /** burn deposits if quorum with vote type no_veto is met */ + burnVoteVeto: boolean; +} +export interface ParamsProtoMsg { + typeUrl: "/cosmos.gov.v1.Params"; + value: Uint8Array; +} +/** + * Params defines the parameters for the x/gov module. + * + * Since: cosmos-sdk 0.47 + */ +export interface ParamsAmino { + /** Minimum deposit for a proposal to enter voting period. */ + min_deposit: CoinAmino[]; + /** + * Maximum period for Atom holders to deposit on a proposal. Initial value: 2 + * months. + */ + max_deposit_period?: DurationAmino; + /** Duration of the voting period. */ + voting_period?: DurationAmino; + /** + * Minimum percentage of total stake needed to vote for a result to be + * considered valid. + */ + quorum: string; + /** Minimum proportion of Yes votes for proposal to pass. Default value: 0.5. */ + threshold: string; + /** + * Minimum value of Veto votes to Total votes ratio for proposal to be + * vetoed. Default value: 1/3. + */ + veto_threshold: string; + /** The ratio representing the proportion of the deposit value that must be paid at proposal submission. */ + min_initial_deposit_ratio: string; + /** burn deposits if a proposal does not meet quorum */ + burn_vote_quorum: boolean; + /** burn deposits if the proposal does not enter voting period */ + burn_proposal_deposit_prevote: boolean; + /** burn deposits if quorum with vote type no_veto is met */ + burn_vote_veto: boolean; +} +export interface ParamsAminoMsg { + type: "cosmos-sdk/v1/Params"; + value: ParamsAmino; +} +function createBaseWeightedVoteOption(): WeightedVoteOption { + return { + option: 0, + weight: "", + }; +} +export const WeightedVoteOption = { + encode( + message: WeightedVoteOption, + writer: _m0.Writer = _m0.Writer.create() + ): _m0.Writer { + if (message.option !== 0) { + writer.uint32(8).int32(message.option); + } + if (message.weight !== "") { + writer.uint32(18).string(message.weight); + } + return writer; + }, + decode(input: _m0.Reader | Uint8Array, length?: number): WeightedVoteOption { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseWeightedVoteOption(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.option = reader.int32() as any; + break; + case 2: + message.weight = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object: any): WeightedVoteOption { + return { + option: isSet(object.option) ? voteOptionFromJSON(object.option) : 0, + weight: isSet(object.weight) ? String(object.weight) : "", + }; + }, + toJSON(message: WeightedVoteOption): unknown { + const obj: any = {}; + message.option !== undefined && + (obj.option = voteOptionToJSON(message.option)); + message.weight !== undefined && (obj.weight = message.weight); + return obj; + }, + fromPartial, I>>( + object: I + ): WeightedVoteOption { + const message = createBaseWeightedVoteOption(); + message.option = object.option ?? 0; + message.weight = object.weight ?? ""; + return message; + }, + fromAmino(object: WeightedVoteOptionAmino): WeightedVoteOption { + return { + option: isSet(object.option) ? voteOptionFromJSON(object.option) : 0, + weight: object.weight, + }; + }, + toAmino(message: WeightedVoteOption): WeightedVoteOptionAmino { + const obj: any = {}; + obj.option = message.option; + obj.weight = message.weight; + return obj; + }, + fromAminoMsg(object: WeightedVoteOptionAminoMsg): WeightedVoteOption { + return WeightedVoteOption.fromAmino(object.value); + }, + toAminoMsg(message: WeightedVoteOption): WeightedVoteOptionAminoMsg { + return { + type: "cosmos-sdk/v1/WeightedVoteOption", + value: WeightedVoteOption.toAmino(message), + }; + }, + fromProtoMsg(message: WeightedVoteOptionProtoMsg): WeightedVoteOption { + return WeightedVoteOption.decode(message.value); + }, + toProto(message: WeightedVoteOption): Uint8Array { + return WeightedVoteOption.encode(message).finish(); + }, + toProtoMsg(message: WeightedVoteOption): WeightedVoteOptionProtoMsg { + return { + typeUrl: "/cosmos.gov.v1.WeightedVoteOption", + value: WeightedVoteOption.encode(message).finish(), + }; + }, +}; +function createBaseDeposit(): Deposit { + return { + proposalId: Long.UZERO, + depositor: "", + amount: [], + }; +} +export const Deposit = { + encode( + message: Deposit, + writer: _m0.Writer = _m0.Writer.create() + ): _m0.Writer { + if (!message.proposalId.isZero()) { + writer.uint32(8).uint64(message.proposalId); + } + if (message.depositor !== "") { + writer.uint32(18).string(message.depositor); + } + for (const v of message.amount) { + Coin.encode(v!, writer.uint32(26).fork()).ldelim(); + } + return writer; + }, + decode(input: _m0.Reader | Uint8Array, length?: number): Deposit { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDeposit(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.proposalId = reader.uint64() as Long; + break; + case 2: + message.depositor = reader.string(); + break; + case 3: + message.amount.push(Coin.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object: any): Deposit { + return { + proposalId: isSet(object.proposalId) + ? Long.fromValue(object.proposalId) + : Long.UZERO, + depositor: isSet(object.depositor) ? String(object.depositor) : "", + amount: Array.isArray(object?.amount) + ? object.amount.map((e: any) => Coin.fromJSON(e)) + : [], + }; + }, + toJSON(message: Deposit): unknown { + const obj: any = {}; + message.proposalId !== undefined && + (obj.proposalId = (message.proposalId || Long.UZERO).toString()); + message.depositor !== undefined && (obj.depositor = message.depositor); + if (message.amount) { + obj.amount = message.amount.map((e) => (e ? Coin.toJSON(e) : undefined)); + } else { + obj.amount = []; + } + return obj; + }, + fromPartial, I>>(object: I): Deposit { + const message = createBaseDeposit(); + message.proposalId = + object.proposalId !== undefined && object.proposalId !== null + ? Long.fromValue(object.proposalId) + : Long.UZERO; + message.depositor = object.depositor ?? ""; + message.amount = object.amount?.map((e) => Coin.fromPartial(e)) || []; + return message; + }, + fromAmino(object: DepositAmino): Deposit { + return { + proposalId: Long.fromString(object.proposal_id), + depositor: object.depositor, + amount: Array.isArray(object?.amount) + ? object.amount.map((e: any) => Coin.fromAmino(e)) + : [], + }; + }, + toAmino(message: Deposit): DepositAmino { + const obj: any = {}; + obj.proposal_id = message.proposalId + ? message.proposalId.toString() + : undefined; + obj.depositor = message.depositor; + if (message.amount) { + obj.amount = message.amount.map((e) => (e ? Coin.toAmino(e) : undefined)); + } else { + obj.amount = []; + } + return obj; + }, + fromAminoMsg(object: DepositAminoMsg): Deposit { + return Deposit.fromAmino(object.value); + }, + toAminoMsg(message: Deposit): DepositAminoMsg { + return { + type: "cosmos-sdk/v1/Deposit", + value: Deposit.toAmino(message), + }; + }, + fromProtoMsg(message: DepositProtoMsg): Deposit { + return Deposit.decode(message.value); + }, + toProto(message: Deposit): Uint8Array { + return Deposit.encode(message).finish(); + }, + toProtoMsg(message: Deposit): DepositProtoMsg { + return { + typeUrl: "/cosmos.gov.v1.Deposit", + value: Deposit.encode(message).finish(), + }; + }, +}; +function createBaseProposal(): Proposal { + return { + id: Long.UZERO, + messages: [], + status: 0, + finalTallyResult: undefined, + submitTime: undefined, + depositEndTime: undefined, + totalDeposit: [], + votingStartTime: undefined, + votingEndTime: undefined, + metadata: "", + title: "", + summary: "", + proposer: "", + }; +} +export const Proposal = { + encode( + message: Proposal, + writer: _m0.Writer = _m0.Writer.create() + ): _m0.Writer { + if (!message.id.isZero()) { + writer.uint32(8).uint64(message.id); + } + for (const v of message.messages) { + Any.encode(v!, writer.uint32(18).fork()).ldelim(); + } + if (message.status !== 0) { + writer.uint32(24).int32(message.status); + } + if (message.finalTallyResult !== undefined) { + TallyResult.encode( + message.finalTallyResult, + writer.uint32(34).fork() + ).ldelim(); + } + if (message.submitTime !== undefined) { + Timestamp.encode(message.submitTime, writer.uint32(42).fork()).ldelim(); + } + if (message.depositEndTime !== undefined) { + Timestamp.encode( + message.depositEndTime, + writer.uint32(50).fork() + ).ldelim(); + } + for (const v of message.totalDeposit) { + Coin.encode(v!, writer.uint32(58).fork()).ldelim(); + } + if (message.votingStartTime !== undefined) { + Timestamp.encode( + message.votingStartTime, + writer.uint32(66).fork() + ).ldelim(); + } + if (message.votingEndTime !== undefined) { + Timestamp.encode( + message.votingEndTime, + writer.uint32(74).fork() + ).ldelim(); + } + if (message.metadata !== "") { + writer.uint32(82).string(message.metadata); + } + if (message.title !== "") { + writer.uint32(90).string(message.title); + } + if (message.summary !== "") { + writer.uint32(98).string(message.summary); + } + if (message.proposer !== "") { + writer.uint32(106).string(message.proposer); + } + return writer; + }, + decode(input: _m0.Reader | Uint8Array, length?: number): Proposal { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseProposal(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.id = reader.uint64() as Long; + break; + case 2: + message.messages.push(Any.decode(reader, reader.uint32())); + break; + case 3: + message.status = reader.int32() as any; + break; + case 4: + message.finalTallyResult = TallyResult.decode( + reader, + reader.uint32() + ); + break; + case 5: + message.submitTime = Timestamp.decode(reader, reader.uint32()); + break; + case 6: + message.depositEndTime = Timestamp.decode(reader, reader.uint32()); + break; + case 7: + message.totalDeposit.push(Coin.decode(reader, reader.uint32())); + break; + case 8: + message.votingStartTime = Timestamp.decode(reader, reader.uint32()); + break; + case 9: + message.votingEndTime = Timestamp.decode(reader, reader.uint32()); + break; + case 10: + message.metadata = reader.string(); + break; + case 11: + message.title = reader.string(); + break; + case 12: + message.summary = reader.string(); + break; + case 13: + message.proposer = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object: any): Proposal { + return { + id: isSet(object.id) ? Long.fromValue(object.id) : Long.UZERO, + messages: Array.isArray(object?.messages) + ? object.messages.map((e: any) => Any.fromJSON(e)) + : [], + status: isSet(object.status) ? proposalStatusFromJSON(object.status) : 0, + finalTallyResult: isSet(object.finalTallyResult) + ? TallyResult.fromJSON(object.finalTallyResult) + : undefined, + submitTime: isSet(object.submitTime) + ? fromJsonTimestamp(object.submitTime) + : undefined, + depositEndTime: isSet(object.depositEndTime) + ? fromJsonTimestamp(object.depositEndTime) + : undefined, + totalDeposit: Array.isArray(object?.totalDeposit) + ? object.totalDeposit.map((e: any) => Coin.fromJSON(e)) + : [], + votingStartTime: isSet(object.votingStartTime) + ? fromJsonTimestamp(object.votingStartTime) + : undefined, + votingEndTime: isSet(object.votingEndTime) + ? fromJsonTimestamp(object.votingEndTime) + : undefined, + metadata: isSet(object.metadata) ? String(object.metadata) : "", + title: isSet(object.title) ? String(object.title) : "", + summary: isSet(object.summary) ? String(object.summary) : "", + proposer: isSet(object.proposer) ? String(object.proposer) : "", + }; + }, + toJSON(message: Proposal): unknown { + const obj: any = {}; + message.id !== undefined && + (obj.id = (message.id || Long.UZERO).toString()); + if (message.messages) { + obj.messages = message.messages.map((e) => + e ? Any.toJSON(e) : undefined + ); + } else { + obj.messages = []; + } + 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 = fromTimestamp(message.submitTime).toISOString()); + message.depositEndTime !== undefined && + (obj.depositEndTime = fromTimestamp( + message.depositEndTime + ).toISOString()); + if (message.totalDeposit) { + obj.totalDeposit = message.totalDeposit.map((e) => + e ? Coin.toJSON(e) : undefined + ); + } else { + obj.totalDeposit = []; + } + message.votingStartTime !== undefined && + (obj.votingStartTime = fromTimestamp( + message.votingStartTime + ).toISOString()); + message.votingEndTime !== undefined && + (obj.votingEndTime = fromTimestamp(message.votingEndTime).toISOString()); + message.metadata !== undefined && (obj.metadata = message.metadata); + message.title !== undefined && (obj.title = message.title); + message.summary !== undefined && (obj.summary = message.summary); + message.proposer !== undefined && (obj.proposer = message.proposer); + return obj; + }, + fromPartial, I>>(object: I): Proposal { + const message = createBaseProposal(); + message.id = + object.id !== undefined && object.id !== null + ? Long.fromValue(object.id) + : Long.UZERO; + message.messages = object.messages?.map((e) => Any.fromPartial(e)) || []; + message.status = object.status ?? 0; + message.finalTallyResult = + object.finalTallyResult !== undefined && object.finalTallyResult !== null + ? TallyResult.fromPartial(object.finalTallyResult) + : undefined; + message.submitTime = + object.submitTime !== undefined && object.submitTime !== null + ? Timestamp.fromPartial(object.submitTime) + : undefined; + message.depositEndTime = + object.depositEndTime !== undefined && object.depositEndTime !== null + ? Timestamp.fromPartial(object.depositEndTime) + : undefined; + message.totalDeposit = + object.totalDeposit?.map((e) => Coin.fromPartial(e)) || []; + message.votingStartTime = + object.votingStartTime !== undefined && object.votingStartTime !== null + ? Timestamp.fromPartial(object.votingStartTime) + : undefined; + message.votingEndTime = + object.votingEndTime !== undefined && object.votingEndTime !== null + ? Timestamp.fromPartial(object.votingEndTime) + : undefined; + message.metadata = object.metadata ?? ""; + message.title = object.title ?? ""; + message.summary = object.summary ?? ""; + message.proposer = object.proposer ?? ""; + return message; + }, + fromAmino(object: ProposalAmino): Proposal { + return { + id: Long.fromString(object.id), + messages: Array.isArray(object?.messages) + ? object.messages.map((e: any) => Any.fromAmino(e)) + : [], + status: isSet(object.status) ? proposalStatusFromJSON(object.status) : 0, + finalTallyResult: object?.final_tally_result + ? TallyResult.fromAmino(object.final_tally_result) + : undefined, + submitTime: object?.submit_time + ? Timestamp.fromAmino(object.submit_time) + : undefined, + depositEndTime: object?.deposit_end_time + ? Timestamp.fromAmino(object.deposit_end_time) + : undefined, + totalDeposit: Array.isArray(object?.total_deposit) + ? object.total_deposit.map((e: any) => Coin.fromAmino(e)) + : [], + votingStartTime: object?.voting_start_time + ? Timestamp.fromAmino(object.voting_start_time) + : undefined, + votingEndTime: object?.voting_end_time + ? Timestamp.fromAmino(object.voting_end_time) + : undefined, + metadata: object.metadata, + title: object.title, + summary: object.summary, + proposer: object.proposer, + }; + }, + toAmino(message: Proposal): ProposalAmino { + const obj: any = {}; + obj.id = message.id ? message.id.toString() : undefined; + if (message.messages) { + obj.messages = message.messages.map((e) => + e ? Any.toAmino(e) : undefined + ); + } else { + obj.messages = []; + } + obj.status = message.status; + obj.final_tally_result = message.finalTallyResult + ? TallyResult.toAmino(message.finalTallyResult) + : undefined; + obj.submit_time = message.submitTime + ? Timestamp.toAmino(message.submitTime) + : undefined; + obj.deposit_end_time = message.depositEndTime + ? Timestamp.toAmino(message.depositEndTime) + : undefined; + if (message.totalDeposit) { + obj.total_deposit = message.totalDeposit.map((e) => + e ? Coin.toAmino(e) : undefined + ); + } else { + obj.total_deposit = []; + } + obj.voting_start_time = message.votingStartTime + ? Timestamp.toAmino(message.votingStartTime) + : undefined; + obj.voting_end_time = message.votingEndTime + ? Timestamp.toAmino(message.votingEndTime) + : undefined; + obj.metadata = message.metadata; + obj.title = message.title; + obj.summary = message.summary; + obj.proposer = message.proposer; + return obj; + }, + fromAminoMsg(object: ProposalAminoMsg): Proposal { + return Proposal.fromAmino(object.value); + }, + toAminoMsg(message: Proposal): ProposalAminoMsg { + return { + type: "cosmos-sdk/v1/Proposal", + value: Proposal.toAmino(message), + }; + }, + fromProtoMsg(message: ProposalProtoMsg): Proposal { + return Proposal.decode(message.value); + }, + toProto(message: Proposal): Uint8Array { + return Proposal.encode(message).finish(); + }, + toProtoMsg(message: Proposal): ProposalProtoMsg { + return { + typeUrl: "/cosmos.gov.v1.Proposal", + value: Proposal.encode(message).finish(), + }; + }, +}; +function createBaseTallyResult(): TallyResult { + return { + yesCount: "", + abstainCount: "", + noCount: "", + noWithVetoCount: "", + }; +} +export const TallyResult = { + encode( + message: TallyResult, + writer: _m0.Writer = _m0.Writer.create() + ): _m0.Writer { + if (message.yesCount !== "") { + writer.uint32(10).string(message.yesCount); + } + if (message.abstainCount !== "") { + writer.uint32(18).string(message.abstainCount); + } + if (message.noCount !== "") { + writer.uint32(26).string(message.noCount); + } + if (message.noWithVetoCount !== "") { + writer.uint32(34).string(message.noWithVetoCount); + } + return writer; + }, + decode(input: _m0.Reader | Uint8Array, length?: number): TallyResult { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseTallyResult(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.yesCount = reader.string(); + break; + case 2: + message.abstainCount = reader.string(); + break; + case 3: + message.noCount = reader.string(); + break; + case 4: + message.noWithVetoCount = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object: any): TallyResult { + return { + yesCount: isSet(object.yesCount) ? String(object.yesCount) : "", + abstainCount: isSet(object.abstainCount) + ? String(object.abstainCount) + : "", + noCount: isSet(object.noCount) ? String(object.noCount) : "", + noWithVetoCount: isSet(object.noWithVetoCount) + ? String(object.noWithVetoCount) + : "", + }; + }, + toJSON(message: TallyResult): unknown { + const obj: any = {}; + message.yesCount !== undefined && (obj.yesCount = message.yesCount); + message.abstainCount !== undefined && + (obj.abstainCount = message.abstainCount); + message.noCount !== undefined && (obj.noCount = message.noCount); + message.noWithVetoCount !== undefined && + (obj.noWithVetoCount = message.noWithVetoCount); + return obj; + }, + fromPartial, I>>( + object: I + ): TallyResult { + const message = createBaseTallyResult(); + message.yesCount = object.yesCount ?? ""; + message.abstainCount = object.abstainCount ?? ""; + message.noCount = object.noCount ?? ""; + message.noWithVetoCount = object.noWithVetoCount ?? ""; + return message; + }, + fromAmino(object: TallyResultAmino): TallyResult { + return { + yesCount: object.yes_count, + abstainCount: object.abstain_count, + noCount: object.no_count, + noWithVetoCount: object.no_with_veto_count, + }; + }, + toAmino(message: TallyResult): TallyResultAmino { + const obj: any = {}; + obj.yes_count = message.yesCount; + obj.abstain_count = message.abstainCount; + obj.no_count = message.noCount; + obj.no_with_veto_count = message.noWithVetoCount; + return obj; + }, + fromAminoMsg(object: TallyResultAminoMsg): TallyResult { + return TallyResult.fromAmino(object.value); + }, + toAminoMsg(message: TallyResult): TallyResultAminoMsg { + return { + type: "cosmos-sdk/v1/TallyResult", + value: TallyResult.toAmino(message), + }; + }, + fromProtoMsg(message: TallyResultProtoMsg): TallyResult { + return TallyResult.decode(message.value); + }, + toProto(message: TallyResult): Uint8Array { + return TallyResult.encode(message).finish(); + }, + toProtoMsg(message: TallyResult): TallyResultProtoMsg { + return { + typeUrl: "/cosmos.gov.v1.TallyResult", + value: TallyResult.encode(message).finish(), + }; + }, +}; +function createBaseVote(): Vote { + return { + proposalId: Long.UZERO, + voter: "", + options: [], + metadata: "", + }; +} +export const Vote = { + encode(message: Vote, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (!message.proposalId.isZero()) { + writer.uint32(8).uint64(message.proposalId); + } + if (message.voter !== "") { + writer.uint32(18).string(message.voter); + } + for (const v of message.options) { + WeightedVoteOption.encode(v!, writer.uint32(34).fork()).ldelim(); + } + if (message.metadata !== "") { + writer.uint32(42).string(message.metadata); + } + return writer; + }, + decode(input: _m0.Reader | Uint8Array, length?: number): Vote { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseVote(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.proposalId = reader.uint64() as Long; + break; + case 2: + message.voter = reader.string(); + break; + case 4: + message.options.push( + WeightedVoteOption.decode(reader, reader.uint32()) + ); + break; + case 5: + message.metadata = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object: any): Vote { + return { + proposalId: isSet(object.proposalId) + ? Long.fromValue(object.proposalId) + : Long.UZERO, + voter: isSet(object.voter) ? String(object.voter) : "", + options: Array.isArray(object?.options) + ? object.options.map((e: any) => WeightedVoteOption.fromJSON(e)) + : [], + metadata: isSet(object.metadata) ? String(object.metadata) : "", + }; + }, + toJSON(message: Vote): unknown { + const obj: any = {}; + message.proposalId !== undefined && + (obj.proposalId = (message.proposalId || Long.UZERO).toString()); + message.voter !== undefined && (obj.voter = message.voter); + if (message.options) { + obj.options = message.options.map((e) => + e ? WeightedVoteOption.toJSON(e) : undefined + ); + } else { + obj.options = []; + } + message.metadata !== undefined && (obj.metadata = message.metadata); + return obj; + }, + fromPartial, I>>(object: I): Vote { + const message = createBaseVote(); + message.proposalId = + object.proposalId !== undefined && object.proposalId !== null + ? Long.fromValue(object.proposalId) + : Long.UZERO; + message.voter = object.voter ?? ""; + message.options = + object.options?.map((e) => WeightedVoteOption.fromPartial(e)) || []; + message.metadata = object.metadata ?? ""; + return message; + }, + fromAmino(object: VoteAmino): Vote { + return { + proposalId: Long.fromString(object.proposal_id), + voter: object.voter, + options: Array.isArray(object?.options) + ? object.options.map((e: any) => WeightedVoteOption.fromAmino(e)) + : [], + metadata: object.metadata, + }; + }, + toAmino(message: Vote): VoteAmino { + const obj: any = {}; + obj.proposal_id = message.proposalId + ? message.proposalId.toString() + : undefined; + obj.voter = message.voter; + if (message.options) { + obj.options = message.options.map((e) => + e ? WeightedVoteOption.toAmino(e) : undefined + ); + } else { + obj.options = []; + } + obj.metadata = message.metadata; + return obj; + }, + fromAminoMsg(object: VoteAminoMsg): Vote { + return Vote.fromAmino(object.value); + }, + toAminoMsg(message: Vote): VoteAminoMsg { + return { + type: "cosmos-sdk/v1/Vote", + value: Vote.toAmino(message), + }; + }, + fromProtoMsg(message: VoteProtoMsg): Vote { + return Vote.decode(message.value); + }, + toProto(message: Vote): Uint8Array { + return Vote.encode(message).finish(); + }, + toProtoMsg(message: Vote): VoteProtoMsg { + return { + typeUrl: "/cosmos.gov.v1.Vote", + value: Vote.encode(message).finish(), + }; + }, +}; +function createBaseDepositParams(): DepositParams { + return { + minDeposit: [], + maxDepositPeriod: undefined, + }; +} +export const DepositParams = { + encode( + message: DepositParams, + writer: _m0.Writer = _m0.Writer.create() + ): _m0.Writer { + for (const v of message.minDeposit) { + Coin.encode(v!, writer.uint32(10).fork()).ldelim(); + } + if (message.maxDepositPeriod !== undefined) { + Duration.encode( + message.maxDepositPeriod, + writer.uint32(18).fork() + ).ldelim(); + } + return writer; + }, + decode(input: _m0.Reader | Uint8Array, length?: number): DepositParams { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDepositParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.minDeposit.push(Coin.decode(reader, reader.uint32())); + break; + case 2: + message.maxDepositPeriod = Duration.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object: any): DepositParams { + return { + minDeposit: Array.isArray(object?.minDeposit) + ? object.minDeposit.map((e: any) => Coin.fromJSON(e)) + : [], + maxDepositPeriod: isSet(object.maxDepositPeriod) + ? Duration.fromJSON(object.maxDepositPeriod) + : undefined, + }; + }, + toJSON(message: DepositParams): unknown { + const obj: any = {}; + if (message.minDeposit) { + obj.minDeposit = message.minDeposit.map((e) => + e ? Coin.toJSON(e) : undefined + ); + } else { + obj.minDeposit = []; + } + message.maxDepositPeriod !== undefined && + (obj.maxDepositPeriod = message.maxDepositPeriod + ? Duration.toJSON(message.maxDepositPeriod) + : undefined); + return obj; + }, + fromPartial, I>>( + object: I + ): DepositParams { + const message = createBaseDepositParams(); + message.minDeposit = + object.minDeposit?.map((e) => Coin.fromPartial(e)) || []; + message.maxDepositPeriod = + object.maxDepositPeriod !== undefined && object.maxDepositPeriod !== null + ? Duration.fromPartial(object.maxDepositPeriod) + : undefined; + return message; + }, + fromAmino(object: DepositParamsAmino): DepositParams { + return { + minDeposit: Array.isArray(object?.min_deposit) + ? object.min_deposit.map((e: any) => Coin.fromAmino(e)) + : [], + maxDepositPeriod: object?.max_deposit_period + ? Duration.fromAmino(object.max_deposit_period) + : undefined, + }; + }, + toAmino(message: DepositParams): DepositParamsAmino { + const obj: any = {}; + if (message.minDeposit) { + obj.min_deposit = message.minDeposit.map((e) => + e ? Coin.toAmino(e) : undefined + ); + } else { + obj.min_deposit = []; + } + obj.max_deposit_period = message.maxDepositPeriod + ? Duration.toAmino(message.maxDepositPeriod) + : undefined; + return obj; + }, + fromAminoMsg(object: DepositParamsAminoMsg): DepositParams { + return DepositParams.fromAmino(object.value); + }, + toAminoMsg(message: DepositParams): DepositParamsAminoMsg { + return { + type: "cosmos-sdk/v1/DepositParams", + value: DepositParams.toAmino(message), + }; + }, + fromProtoMsg(message: DepositParamsProtoMsg): DepositParams { + return DepositParams.decode(message.value); + }, + toProto(message: DepositParams): Uint8Array { + return DepositParams.encode(message).finish(); + }, + toProtoMsg(message: DepositParams): DepositParamsProtoMsg { + return { + typeUrl: "/cosmos.gov.v1.DepositParams", + value: DepositParams.encode(message).finish(), + }; + }, +}; +function createBaseVotingParams(): VotingParams { + return { + votingPeriod: undefined, + }; +} +export const VotingParams = { + encode( + message: VotingParams, + writer: _m0.Writer = _m0.Writer.create() + ): _m0.Writer { + if (message.votingPeriod !== undefined) { + Duration.encode(message.votingPeriod, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + decode(input: _m0.Reader | Uint8Array, length?: number): VotingParams { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseVotingParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.votingPeriod = Duration.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object: any): VotingParams { + return { + votingPeriod: isSet(object.votingPeriod) + ? Duration.fromJSON(object.votingPeriod) + : undefined, + }; + }, + toJSON(message: VotingParams): unknown { + const obj: any = {}; + message.votingPeriod !== undefined && + (obj.votingPeriod = message.votingPeriod + ? Duration.toJSON(message.votingPeriod) + : undefined); + return obj; + }, + fromPartial, I>>( + object: I + ): VotingParams { + const message = createBaseVotingParams(); + message.votingPeriod = + object.votingPeriod !== undefined && object.votingPeriod !== null + ? Duration.fromPartial(object.votingPeriod) + : undefined; + return message; + }, + fromAmino(object: VotingParamsAmino): VotingParams { + return { + votingPeriod: object?.voting_period + ? Duration.fromAmino(object.voting_period) + : undefined, + }; + }, + toAmino(message: VotingParams): VotingParamsAmino { + const obj: any = {}; + obj.voting_period = message.votingPeriod + ? Duration.toAmino(message.votingPeriod) + : undefined; + return obj; + }, + fromAminoMsg(object: VotingParamsAminoMsg): VotingParams { + return VotingParams.fromAmino(object.value); + }, + toAminoMsg(message: VotingParams): VotingParamsAminoMsg { + return { + type: "cosmos-sdk/v1/VotingParams", + value: VotingParams.toAmino(message), + }; + }, + fromProtoMsg(message: VotingParamsProtoMsg): VotingParams { + return VotingParams.decode(message.value); + }, + toProto(message: VotingParams): Uint8Array { + return VotingParams.encode(message).finish(); + }, + toProtoMsg(message: VotingParams): VotingParamsProtoMsg { + return { + typeUrl: "/cosmos.gov.v1.VotingParams", + value: VotingParams.encode(message).finish(), + }; + }, +}; +function createBaseTallyParams(): TallyParams { + return { + quorum: "", + threshold: "", + vetoThreshold: "", + }; +} +export const TallyParams = { + encode( + message: TallyParams, + writer: _m0.Writer = _m0.Writer.create() + ): _m0.Writer { + if (message.quorum !== "") { + writer.uint32(10).string(message.quorum); + } + if (message.threshold !== "") { + writer.uint32(18).string(message.threshold); + } + if (message.vetoThreshold !== "") { + writer.uint32(26).string(message.vetoThreshold); + } + return writer; + }, + decode(input: _m0.Reader | Uint8Array, length?: number): TallyParams { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseTallyParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.quorum = reader.string(); + break; + case 2: + message.threshold = reader.string(); + break; + case 3: + message.vetoThreshold = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object: any): TallyParams { + return { + quorum: isSet(object.quorum) ? String(object.quorum) : "", + threshold: isSet(object.threshold) ? String(object.threshold) : "", + vetoThreshold: isSet(object.vetoThreshold) + ? String(object.vetoThreshold) + : "", + }; + }, + toJSON(message: TallyParams): unknown { + const obj: any = {}; + message.quorum !== undefined && (obj.quorum = message.quorum); + message.threshold !== undefined && (obj.threshold = message.threshold); + message.vetoThreshold !== undefined && + (obj.vetoThreshold = message.vetoThreshold); + return obj; + }, + fromPartial, I>>( + object: I + ): TallyParams { + const message = createBaseTallyParams(); + message.quorum = object.quorum ?? ""; + message.threshold = object.threshold ?? ""; + message.vetoThreshold = object.vetoThreshold ?? ""; + return message; + }, + fromAmino(object: TallyParamsAmino): TallyParams { + return { + quorum: object.quorum, + threshold: object.threshold, + vetoThreshold: object.veto_threshold, + }; + }, + toAmino(message: TallyParams): TallyParamsAmino { + const obj: any = {}; + obj.quorum = message.quorum; + obj.threshold = message.threshold; + obj.veto_threshold = message.vetoThreshold; + return obj; + }, + fromAminoMsg(object: TallyParamsAminoMsg): TallyParams { + return TallyParams.fromAmino(object.value); + }, + toAminoMsg(message: TallyParams): TallyParamsAminoMsg { + return { + type: "cosmos-sdk/v1/TallyParams", + value: TallyParams.toAmino(message), + }; + }, + fromProtoMsg(message: TallyParamsProtoMsg): TallyParams { + return TallyParams.decode(message.value); + }, + toProto(message: TallyParams): Uint8Array { + return TallyParams.encode(message).finish(); + }, + toProtoMsg(message: TallyParams): TallyParamsProtoMsg { + return { + typeUrl: "/cosmos.gov.v1.TallyParams", + value: TallyParams.encode(message).finish(), + }; + }, +}; +function createBaseParams(): Params { + return { + minDeposit: [], + maxDepositPeriod: undefined, + votingPeriod: undefined, + quorum: "", + threshold: "", + vetoThreshold: "", + minInitialDepositRatio: "", + burnVoteQuorum: false, + burnProposalDepositPrevote: false, + burnVoteVeto: false, + }; +} +export const Params = { + encode( + message: Params, + writer: _m0.Writer = _m0.Writer.create() + ): _m0.Writer { + for (const v of message.minDeposit) { + Coin.encode(v!, writer.uint32(10).fork()).ldelim(); + } + if (message.maxDepositPeriod !== undefined) { + Duration.encode( + message.maxDepositPeriod, + writer.uint32(18).fork() + ).ldelim(); + } + if (message.votingPeriod !== undefined) { + Duration.encode(message.votingPeriod, writer.uint32(26).fork()).ldelim(); + } + if (message.quorum !== "") { + writer.uint32(34).string(message.quorum); + } + if (message.threshold !== "") { + writer.uint32(42).string(message.threshold); + } + if (message.vetoThreshold !== "") { + writer.uint32(50).string(message.vetoThreshold); + } + if (message.minInitialDepositRatio !== "") { + writer.uint32(58).string(message.minInitialDepositRatio); + } + if (message.burnVoteQuorum === true) { + writer.uint32(104).bool(message.burnVoteQuorum); + } + if (message.burnProposalDepositPrevote === true) { + writer.uint32(112).bool(message.burnProposalDepositPrevote); + } + if (message.burnVoteVeto === true) { + writer.uint32(120).bool(message.burnVoteVeto); + } + 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.minDeposit.push(Coin.decode(reader, reader.uint32())); + break; + case 2: + message.maxDepositPeriod = Duration.decode(reader, reader.uint32()); + break; + case 3: + message.votingPeriod = Duration.decode(reader, reader.uint32()); + break; + case 4: + message.quorum = reader.string(); + break; + case 5: + message.threshold = reader.string(); + break; + case 6: + message.vetoThreshold = reader.string(); + break; + case 7: + message.minInitialDepositRatio = reader.string(); + break; + case 13: + message.burnVoteQuorum = reader.bool(); + break; + case 14: + message.burnProposalDepositPrevote = reader.bool(); + break; + case 15: + message.burnVoteVeto = reader.bool(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object: any): Params { + return { + minDeposit: Array.isArray(object?.minDeposit) + ? object.minDeposit.map((e: any) => Coin.fromJSON(e)) + : [], + maxDepositPeriod: isSet(object.maxDepositPeriod) + ? Duration.fromJSON(object.maxDepositPeriod) + : undefined, + votingPeriod: isSet(object.votingPeriod) + ? Duration.fromJSON(object.votingPeriod) + : undefined, + quorum: isSet(object.quorum) ? String(object.quorum) : "", + threshold: isSet(object.threshold) ? String(object.threshold) : "", + vetoThreshold: isSet(object.vetoThreshold) + ? String(object.vetoThreshold) + : "", + minInitialDepositRatio: isSet(object.minInitialDepositRatio) + ? String(object.minInitialDepositRatio) + : "", + burnVoteQuorum: isSet(object.burnVoteQuorum) + ? Boolean(object.burnVoteQuorum) + : false, + burnProposalDepositPrevote: isSet(object.burnProposalDepositPrevote) + ? Boolean(object.burnProposalDepositPrevote) + : false, + burnVoteVeto: isSet(object.burnVoteVeto) + ? Boolean(object.burnVoteVeto) + : false, + }; + }, + toJSON(message: Params): unknown { + const obj: any = {}; + if (message.minDeposit) { + obj.minDeposit = message.minDeposit.map((e) => + e ? Coin.toJSON(e) : undefined + ); + } else { + obj.minDeposit = []; + } + message.maxDepositPeriod !== undefined && + (obj.maxDepositPeriod = message.maxDepositPeriod + ? Duration.toJSON(message.maxDepositPeriod) + : undefined); + message.votingPeriod !== undefined && + (obj.votingPeriod = message.votingPeriod + ? Duration.toJSON(message.votingPeriod) + : undefined); + message.quorum !== undefined && (obj.quorum = message.quorum); + message.threshold !== undefined && (obj.threshold = message.threshold); + message.vetoThreshold !== undefined && + (obj.vetoThreshold = message.vetoThreshold); + message.minInitialDepositRatio !== undefined && + (obj.minInitialDepositRatio = message.minInitialDepositRatio); + message.burnVoteQuorum !== undefined && + (obj.burnVoteQuorum = message.burnVoteQuorum); + message.burnProposalDepositPrevote !== undefined && + (obj.burnProposalDepositPrevote = message.burnProposalDepositPrevote); + message.burnVoteVeto !== undefined && + (obj.burnVoteVeto = message.burnVoteVeto); + return obj; + }, + fromPartial, I>>(object: I): Params { + const message = createBaseParams(); + message.minDeposit = + object.minDeposit?.map((e) => Coin.fromPartial(e)) || []; + message.maxDepositPeriod = + object.maxDepositPeriod !== undefined && object.maxDepositPeriod !== null + ? Duration.fromPartial(object.maxDepositPeriod) + : undefined; + message.votingPeriod = + object.votingPeriod !== undefined && object.votingPeriod !== null + ? Duration.fromPartial(object.votingPeriod) + : undefined; + message.quorum = object.quorum ?? ""; + message.threshold = object.threshold ?? ""; + message.vetoThreshold = object.vetoThreshold ?? ""; + message.minInitialDepositRatio = object.minInitialDepositRatio ?? ""; + message.burnVoteQuorum = object.burnVoteQuorum ?? false; + message.burnProposalDepositPrevote = + object.burnProposalDepositPrevote ?? false; + message.burnVoteVeto = object.burnVoteVeto ?? false; + return message; + }, + fromAmino(object: ParamsAmino): Params { + return { + minDeposit: Array.isArray(object?.min_deposit) + ? object.min_deposit.map((e: any) => Coin.fromAmino(e)) + : [], + maxDepositPeriod: object?.max_deposit_period + ? Duration.fromAmino(object.max_deposit_period) + : undefined, + votingPeriod: object?.voting_period + ? Duration.fromAmino(object.voting_period) + : undefined, + quorum: object.quorum, + threshold: object.threshold, + vetoThreshold: object.veto_threshold, + minInitialDepositRatio: object.min_initial_deposit_ratio, + burnVoteQuorum: object.burn_vote_quorum, + burnProposalDepositPrevote: object.burn_proposal_deposit_prevote, + burnVoteVeto: object.burn_vote_veto, + }; + }, + toAmino(message: Params): ParamsAmino { + const obj: any = {}; + if (message.minDeposit) { + obj.min_deposit = message.minDeposit.map((e) => + e ? Coin.toAmino(e) : undefined + ); + } else { + obj.min_deposit = []; + } + obj.max_deposit_period = message.maxDepositPeriod + ? Duration.toAmino(message.maxDepositPeriod) + : undefined; + obj.voting_period = message.votingPeriod + ? Duration.toAmino(message.votingPeriod) + : undefined; + obj.quorum = message.quorum; + obj.threshold = message.threshold; + obj.veto_threshold = message.vetoThreshold; + obj.min_initial_deposit_ratio = message.minInitialDepositRatio; + obj.burn_vote_quorum = message.burnVoteQuorum; + obj.burn_proposal_deposit_prevote = message.burnProposalDepositPrevote; + obj.burn_vote_veto = message.burnVoteVeto; + return obj; + }, + fromAminoMsg(object: ParamsAminoMsg): Params { + return Params.fromAmino(object.value); + }, + toAminoMsg(message: Params): ParamsAminoMsg { + return { + type: "cosmos-sdk/v1/Params", + value: Params.toAmino(message), + }; + }, + fromProtoMsg(message: ParamsProtoMsg): Params { + return Params.decode(message.value); + }, + toProto(message: Params): Uint8Array { + return Params.encode(message).finish(); + }, + toProtoMsg(message: Params): ParamsProtoMsg { + return { + typeUrl: "/cosmos.gov.v1.Params", + value: Params.encode(message).finish(), + }; + }, +}; diff --git a/packages/types/src/cosmos/gov/v1/query.ts b/packages/types/src/cosmos/gov/v1/query.ts new file mode 100644 index 000000000..a9ea3a7a3 --- /dev/null +++ b/packages/types/src/cosmos/gov/v1/query.ts @@ -0,0 +1,2272 @@ +/* eslint-disable */ +import { + ProposalStatus, + Proposal, + ProposalAmino, + Vote, + VoteAmino, + VotingParams, + VotingParamsAmino, + DepositParams, + DepositParamsAmino, + TallyParams, + TallyParamsAmino, + Params, + ParamsAmino, + Deposit, + DepositAmino, + TallyResult, + TallyResultAmino, + proposalStatusFromJSON, + proposalStatusToJSON, +} from "./gov"; +import { + PageRequest, + PageRequestAmino, + PageResponse, + PageResponseAmino, +} from "../../base/query/v1beta1/pagination"; +import { Long, isSet, DeepPartial, Exact, Rpc } from "../../../helpers"; +import * as _m0 from "protobufjs/minimal"; +export const protobufPackage = "cosmos.gov.v1"; +/** QueryProposalRequest is the request type for the Query/Proposal RPC method. */ +export interface QueryProposalRequest { + /** proposal_id defines the unique id of the proposal. */ + proposalId: Long; +} +export interface QueryProposalRequestProtoMsg { + typeUrl: "/cosmos.gov.v1.QueryProposalRequest"; + value: Uint8Array; +} +/** QueryProposalRequest is the request type for the Query/Proposal RPC method. */ +export interface QueryProposalRequestAmino { + /** proposal_id defines the unique id of the proposal. */ + proposal_id: string; +} +export interface QueryProposalRequestAminoMsg { + type: "cosmos-sdk/v1/QueryProposalRequest"; + value: QueryProposalRequestAmino; +} +/** QueryProposalResponse is the response type for the Query/Proposal RPC method. */ +export interface QueryProposalResponse { + /** proposal is the requested governance proposal. */ + proposal?: Proposal; +} +export interface QueryProposalResponseProtoMsg { + typeUrl: "/cosmos.gov.v1.QueryProposalResponse"; + value: Uint8Array; +} +/** QueryProposalResponse is the response type for the Query/Proposal RPC method. */ +export interface QueryProposalResponseAmino { + /** proposal is the requested governance proposal. */ + proposal?: ProposalAmino; +} +export interface QueryProposalResponseAminoMsg { + type: "cosmos-sdk/v1/QueryProposalResponse"; + value: QueryProposalResponseAmino; +} +/** QueryProposalsRequest is the request type for the Query/Proposals RPC method. */ +export interface QueryProposalsRequest { + /** proposal_status defines the status of the proposals. */ + proposalStatus: ProposalStatus; + /** voter defines the voter address for the proposals. */ + voter: string; + /** depositor defines the deposit addresses from the proposals. */ + depositor: string; + /** pagination defines an optional pagination for the request. */ + pagination?: PageRequest; +} +export interface QueryProposalsRequestProtoMsg { + typeUrl: "/cosmos.gov.v1.QueryProposalsRequest"; + value: Uint8Array; +} +/** QueryProposalsRequest is the request type for the Query/Proposals RPC method. */ +export interface QueryProposalsRequestAmino { + /** proposal_status defines the status of the proposals. */ + proposal_status: ProposalStatus; + /** voter defines the voter address for the proposals. */ + voter: string; + /** depositor defines the deposit addresses from the proposals. */ + depositor: string; + /** pagination defines an optional pagination for the request. */ + pagination?: PageRequestAmino; +} +export interface QueryProposalsRequestAminoMsg { + type: "cosmos-sdk/v1/QueryProposalsRequest"; + value: QueryProposalsRequestAmino; +} +/** + * QueryProposalsResponse is the response type for the Query/Proposals RPC + * method. + */ +export interface QueryProposalsResponse { + /** proposals defines all the requested governance proposals. */ + proposals: Proposal[]; + /** pagination defines the pagination in the response. */ + pagination?: PageResponse; +} +export interface QueryProposalsResponseProtoMsg { + typeUrl: "/cosmos.gov.v1.QueryProposalsResponse"; + value: Uint8Array; +} +/** + * QueryProposalsResponse is the response type for the Query/Proposals RPC + * method. + */ +export interface QueryProposalsResponseAmino { + /** proposals defines all the requested governance proposals. */ + proposals: ProposalAmino[]; + /** pagination defines the pagination in the response. */ + pagination?: PageResponseAmino; +} +export interface QueryProposalsResponseAminoMsg { + type: "cosmos-sdk/v1/QueryProposalsResponse"; + value: QueryProposalsResponseAmino; +} +/** QueryVoteRequest is the request type for the Query/Vote RPC method. */ +export interface QueryVoteRequest { + /** proposal_id defines the unique id of the proposal. */ + proposalId: Long; + /** voter defines the voter address for the proposals. */ + voter: string; +} +export interface QueryVoteRequestProtoMsg { + typeUrl: "/cosmos.gov.v1.QueryVoteRequest"; + value: Uint8Array; +} +/** QueryVoteRequest is the request type for the Query/Vote RPC method. */ +export interface QueryVoteRequestAmino { + /** proposal_id defines the unique id of the proposal. */ + proposal_id: string; + /** voter defines the voter address for the proposals. */ + voter: string; +} +export interface QueryVoteRequestAminoMsg { + type: "cosmos-sdk/v1/QueryVoteRequest"; + value: QueryVoteRequestAmino; +} +/** QueryVoteResponse is the response type for the Query/Vote RPC method. */ +export interface QueryVoteResponse { + /** vote defines the queried vote. */ + vote?: Vote; +} +export interface QueryVoteResponseProtoMsg { + typeUrl: "/cosmos.gov.v1.QueryVoteResponse"; + value: Uint8Array; +} +/** QueryVoteResponse is the response type for the Query/Vote RPC method. */ +export interface QueryVoteResponseAmino { + /** vote defines the queried vote. */ + vote?: VoteAmino; +} +export interface QueryVoteResponseAminoMsg { + type: "cosmos-sdk/v1/QueryVoteResponse"; + value: QueryVoteResponseAmino; +} +/** QueryVotesRequest is the request type for the Query/Votes RPC method. */ +export interface QueryVotesRequest { + /** proposal_id defines the unique id of the proposal. */ + proposalId: Long; + /** pagination defines an optional pagination for the request. */ + pagination?: PageRequest; +} +export interface QueryVotesRequestProtoMsg { + typeUrl: "/cosmos.gov.v1.QueryVotesRequest"; + value: Uint8Array; +} +/** QueryVotesRequest is the request type for the Query/Votes RPC method. */ +export interface QueryVotesRequestAmino { + /** proposal_id defines the unique id of the proposal. */ + proposal_id: string; + /** pagination defines an optional pagination for the request. */ + pagination?: PageRequestAmino; +} +export interface QueryVotesRequestAminoMsg { + type: "cosmos-sdk/v1/QueryVotesRequest"; + value: QueryVotesRequestAmino; +} +/** QueryVotesResponse is the response type for the Query/Votes RPC method. */ +export interface QueryVotesResponse { + /** votes defines the queried votes. */ + votes: Vote[]; + /** pagination defines the pagination in the response. */ + pagination?: PageResponse; +} +export interface QueryVotesResponseProtoMsg { + typeUrl: "/cosmos.gov.v1.QueryVotesResponse"; + value: Uint8Array; +} +/** QueryVotesResponse is the response type for the Query/Votes RPC method. */ +export interface QueryVotesResponseAmino { + /** votes defines the queried votes. */ + votes: VoteAmino[]; + /** pagination defines the pagination in the response. */ + pagination?: PageResponseAmino; +} +export interface QueryVotesResponseAminoMsg { + type: "cosmos-sdk/v1/QueryVotesResponse"; + value: QueryVotesResponseAmino; +} +/** QueryParamsRequest is the request type for the Query/Params RPC method. */ +export interface QueryParamsRequest { + /** + * params_type defines which parameters to query for, can be one of "voting", + * "tallying" or "deposit". + */ + paramsType: string; +} +export interface QueryParamsRequestProtoMsg { + typeUrl: "/cosmos.gov.v1.QueryParamsRequest"; + value: Uint8Array; +} +/** QueryParamsRequest is the request type for the Query/Params RPC method. */ +export interface QueryParamsRequestAmino { + /** + * params_type defines which parameters to query for, can be one of "voting", + * "tallying" or "deposit". + */ + params_type: string; +} +export interface QueryParamsRequestAminoMsg { + type: "cosmos-sdk/v1/QueryParamsRequest"; + value: QueryParamsRequestAmino; +} +/** QueryParamsResponse is the response type for the Query/Params RPC method. */ +export interface QueryParamsResponse { + /** + * Deprecated: Prefer to use `params` instead. + * voting_params defines the parameters related to voting. + */ + /** @deprecated */ + votingParams?: VotingParams; + /** + * Deprecated: Prefer to use `params` instead. + * deposit_params defines the parameters related to deposit. + */ + /** @deprecated */ + depositParams?: DepositParams; + /** + * Deprecated: Prefer to use `params` instead. + * tally_params defines the parameters related to tally. + */ + /** @deprecated */ + tallyParams?: TallyParams; + /** + * params defines all the paramaters of x/gov module. + * + * Since: cosmos-sdk 0.47 + */ + params?: Params; +} +export interface QueryParamsResponseProtoMsg { + typeUrl: "/cosmos.gov.v1.QueryParamsResponse"; + value: Uint8Array; +} +/** QueryParamsResponse is the response type for the Query/Params RPC method. */ +export interface QueryParamsResponseAmino { + /** + * Deprecated: Prefer to use `params` instead. + * voting_params defines the parameters related to voting. + */ + /** @deprecated */ + voting_params?: VotingParamsAmino; + /** + * Deprecated: Prefer to use `params` instead. + * deposit_params defines the parameters related to deposit. + */ + /** @deprecated */ + deposit_params?: DepositParamsAmino; + /** + * Deprecated: Prefer to use `params` instead. + * tally_params defines the parameters related to tally. + */ + /** @deprecated */ + tally_params?: TallyParamsAmino; + /** + * params defines all the paramaters of x/gov module. + * + * Since: cosmos-sdk 0.47 + */ + params?: ParamsAmino; +} +export interface QueryParamsResponseAminoMsg { + type: "cosmos-sdk/v1/QueryParamsResponse"; + value: QueryParamsResponseAmino; +} +/** QueryDepositRequest is the request type for the Query/Deposit RPC method. */ +export interface QueryDepositRequest { + /** proposal_id defines the unique id of the proposal. */ + proposalId: Long; + /** depositor defines the deposit addresses from the proposals. */ + depositor: string; +} +export interface QueryDepositRequestProtoMsg { + typeUrl: "/cosmos.gov.v1.QueryDepositRequest"; + value: Uint8Array; +} +/** QueryDepositRequest is the request type for the Query/Deposit RPC method. */ +export interface QueryDepositRequestAmino { + /** proposal_id defines the unique id of the proposal. */ + proposal_id: string; + /** depositor defines the deposit addresses from the proposals. */ + depositor: string; +} +export interface QueryDepositRequestAminoMsg { + type: "cosmos-sdk/v1/QueryDepositRequest"; + value: QueryDepositRequestAmino; +} +/** QueryDepositResponse is the response type for the Query/Deposit RPC method. */ +export interface QueryDepositResponse { + /** deposit defines the requested deposit. */ + deposit?: Deposit; +} +export interface QueryDepositResponseProtoMsg { + typeUrl: "/cosmos.gov.v1.QueryDepositResponse"; + value: Uint8Array; +} +/** QueryDepositResponse is the response type for the Query/Deposit RPC method. */ +export interface QueryDepositResponseAmino { + /** deposit defines the requested deposit. */ + deposit?: DepositAmino; +} +export interface QueryDepositResponseAminoMsg { + type: "cosmos-sdk/v1/QueryDepositResponse"; + value: QueryDepositResponseAmino; +} +/** QueryDepositsRequest is the request type for the Query/Deposits RPC method. */ +export interface QueryDepositsRequest { + /** proposal_id defines the unique id of the proposal. */ + proposalId: Long; + /** pagination defines an optional pagination for the request. */ + pagination?: PageRequest; +} +export interface QueryDepositsRequestProtoMsg { + typeUrl: "/cosmos.gov.v1.QueryDepositsRequest"; + value: Uint8Array; +} +/** QueryDepositsRequest is the request type for the Query/Deposits RPC method. */ +export interface QueryDepositsRequestAmino { + /** proposal_id defines the unique id of the proposal. */ + proposal_id: string; + /** pagination defines an optional pagination for the request. */ + pagination?: PageRequestAmino; +} +export interface QueryDepositsRequestAminoMsg { + type: "cosmos-sdk/v1/QueryDepositsRequest"; + value: QueryDepositsRequestAmino; +} +/** QueryDepositsResponse is the response type for the Query/Deposits RPC method. */ +export interface QueryDepositsResponse { + /** deposits defines the requested deposits. */ + deposits: Deposit[]; + /** pagination defines the pagination in the response. */ + pagination?: PageResponse; +} +export interface QueryDepositsResponseProtoMsg { + typeUrl: "/cosmos.gov.v1.QueryDepositsResponse"; + value: Uint8Array; +} +/** QueryDepositsResponse is the response type for the Query/Deposits RPC method. */ +export interface QueryDepositsResponseAmino { + /** deposits defines the requested deposits. */ + deposits: DepositAmino[]; + /** pagination defines the pagination in the response. */ + pagination?: PageResponseAmino; +} +export interface QueryDepositsResponseAminoMsg { + type: "cosmos-sdk/v1/QueryDepositsResponse"; + value: QueryDepositsResponseAmino; +} +/** QueryTallyResultRequest is the request type for the Query/Tally RPC method. */ +export interface QueryTallyResultRequest { + /** proposal_id defines the unique id of the proposal. */ + proposalId: Long; +} +export interface QueryTallyResultRequestProtoMsg { + typeUrl: "/cosmos.gov.v1.QueryTallyResultRequest"; + value: Uint8Array; +} +/** QueryTallyResultRequest is the request type for the Query/Tally RPC method. */ +export interface QueryTallyResultRequestAmino { + /** proposal_id defines the unique id of the proposal. */ + proposal_id: string; +} +export interface QueryTallyResultRequestAminoMsg { + type: "cosmos-sdk/v1/QueryTallyResultRequest"; + value: QueryTallyResultRequestAmino; +} +/** QueryTallyResultResponse is the response type for the Query/Tally RPC method. */ +export interface QueryTallyResultResponse { + /** tally defines the requested tally. */ + tally?: TallyResult; +} +export interface QueryTallyResultResponseProtoMsg { + typeUrl: "/cosmos.gov.v1.QueryTallyResultResponse"; + value: Uint8Array; +} +/** QueryTallyResultResponse is the response type for the Query/Tally RPC method. */ +export interface QueryTallyResultResponseAmino { + /** tally defines the requested tally. */ + tally?: TallyResultAmino; +} +export interface QueryTallyResultResponseAminoMsg { + type: "cosmos-sdk/v1/QueryTallyResultResponse"; + value: QueryTallyResultResponseAmino; +} +function createBaseQueryProposalRequest(): QueryProposalRequest { + return { + proposalId: Long.UZERO, + }; +} +export const QueryProposalRequest = { + encode( + message: QueryProposalRequest, + writer: _m0.Writer = _m0.Writer.create() + ): _m0.Writer { + if (!message.proposalId.isZero()) { + writer.uint32(8).uint64(message.proposalId); + } + return writer; + }, + decode( + input: _m0.Reader | Uint8Array, + length?: number + ): QueryProposalRequest { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryProposalRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.proposalId = reader.uint64() as Long; + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object: any): QueryProposalRequest { + return { + proposalId: isSet(object.proposalId) + ? Long.fromValue(object.proposalId) + : Long.UZERO, + }; + }, + toJSON(message: QueryProposalRequest): unknown { + const obj: any = {}; + message.proposalId !== undefined && + (obj.proposalId = (message.proposalId || Long.UZERO).toString()); + return obj; + }, + fromPartial, I>>( + object: I + ): QueryProposalRequest { + const message = createBaseQueryProposalRequest(); + message.proposalId = + object.proposalId !== undefined && object.proposalId !== null + ? Long.fromValue(object.proposalId) + : Long.UZERO; + return message; + }, + fromAmino(object: QueryProposalRequestAmino): QueryProposalRequest { + return { + proposalId: Long.fromString(object.proposal_id), + }; + }, + toAmino(message: QueryProposalRequest): QueryProposalRequestAmino { + const obj: any = {}; + obj.proposal_id = message.proposalId + ? message.proposalId.toString() + : undefined; + return obj; + }, + fromAminoMsg(object: QueryProposalRequestAminoMsg): QueryProposalRequest { + return QueryProposalRequest.fromAmino(object.value); + }, + toAminoMsg(message: QueryProposalRequest): QueryProposalRequestAminoMsg { + return { + type: "cosmos-sdk/v1/QueryProposalRequest", + value: QueryProposalRequest.toAmino(message), + }; + }, + fromProtoMsg(message: QueryProposalRequestProtoMsg): QueryProposalRequest { + return QueryProposalRequest.decode(message.value); + }, + toProto(message: QueryProposalRequest): Uint8Array { + return QueryProposalRequest.encode(message).finish(); + }, + toProtoMsg(message: QueryProposalRequest): QueryProposalRequestProtoMsg { + return { + typeUrl: "/cosmos.gov.v1.QueryProposalRequest", + value: QueryProposalRequest.encode(message).finish(), + }; + }, +}; +function createBaseQueryProposalResponse(): QueryProposalResponse { + return { + proposal: undefined, + }; +} +export const QueryProposalResponse = { + encode( + message: QueryProposalResponse, + writer: _m0.Writer = _m0.Writer.create() + ): _m0.Writer { + if (message.proposal !== undefined) { + Proposal.encode(message.proposal, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + decode( + input: _m0.Reader | Uint8Array, + length?: number + ): QueryProposalResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryProposalResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.proposal = Proposal.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object: any): QueryProposalResponse { + return { + proposal: isSet(object.proposal) + ? Proposal.fromJSON(object.proposal) + : undefined, + }; + }, + toJSON(message: QueryProposalResponse): unknown { + const obj: any = {}; + message.proposal !== undefined && + (obj.proposal = message.proposal + ? Proposal.toJSON(message.proposal) + : undefined); + return obj; + }, + fromPartial, I>>( + object: I + ): QueryProposalResponse { + const message = createBaseQueryProposalResponse(); + message.proposal = + object.proposal !== undefined && object.proposal !== null + ? Proposal.fromPartial(object.proposal) + : undefined; + return message; + }, + fromAmino(object: QueryProposalResponseAmino): QueryProposalResponse { + return { + proposal: object?.proposal + ? Proposal.fromAmino(object.proposal) + : undefined, + }; + }, + toAmino(message: QueryProposalResponse): QueryProposalResponseAmino { + const obj: any = {}; + obj.proposal = message.proposal + ? Proposal.toAmino(message.proposal) + : undefined; + return obj; + }, + fromAminoMsg(object: QueryProposalResponseAminoMsg): QueryProposalResponse { + return QueryProposalResponse.fromAmino(object.value); + }, + toAminoMsg(message: QueryProposalResponse): QueryProposalResponseAminoMsg { + return { + type: "cosmos-sdk/v1/QueryProposalResponse", + value: QueryProposalResponse.toAmino(message), + }; + }, + fromProtoMsg(message: QueryProposalResponseProtoMsg): QueryProposalResponse { + return QueryProposalResponse.decode(message.value); + }, + toProto(message: QueryProposalResponse): Uint8Array { + return QueryProposalResponse.encode(message).finish(); + }, + toProtoMsg(message: QueryProposalResponse): QueryProposalResponseProtoMsg { + return { + typeUrl: "/cosmos.gov.v1.QueryProposalResponse", + value: QueryProposalResponse.encode(message).finish(), + }; + }, +}; +function createBaseQueryProposalsRequest(): QueryProposalsRequest { + return { + proposalStatus: 0, + voter: "", + depositor: "", + pagination: undefined, + }; +} +export const QueryProposalsRequest = { + encode( + message: QueryProposalsRequest, + writer: _m0.Writer = _m0.Writer.create() + ): _m0.Writer { + if (message.proposalStatus !== 0) { + writer.uint32(8).int32(message.proposalStatus); + } + if (message.voter !== "") { + writer.uint32(18).string(message.voter); + } + if (message.depositor !== "") { + writer.uint32(26).string(message.depositor); + } + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(34).fork()).ldelim(); + } + return writer; + }, + decode( + input: _m0.Reader | Uint8Array, + length?: number + ): QueryProposalsRequest { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryProposalsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.proposalStatus = reader.int32() as any; + break; + case 2: + message.voter = reader.string(); + break; + case 3: + message.depositor = reader.string(); + break; + case 4: + message.pagination = PageRequest.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object: any): QueryProposalsRequest { + return { + proposalStatus: isSet(object.proposalStatus) + ? proposalStatusFromJSON(object.proposalStatus) + : 0, + voter: isSet(object.voter) ? String(object.voter) : "", + depositor: isSet(object.depositor) ? String(object.depositor) : "", + pagination: isSet(object.pagination) + ? PageRequest.fromJSON(object.pagination) + : undefined, + }; + }, + toJSON(message: QueryProposalsRequest): unknown { + const obj: any = {}; + message.proposalStatus !== undefined && + (obj.proposalStatus = proposalStatusToJSON(message.proposalStatus)); + message.voter !== undefined && (obj.voter = message.voter); + message.depositor !== undefined && (obj.depositor = message.depositor); + message.pagination !== undefined && + (obj.pagination = message.pagination + ? PageRequest.toJSON(message.pagination) + : undefined); + return obj; + }, + fromPartial, I>>( + object: I + ): QueryProposalsRequest { + const message = createBaseQueryProposalsRequest(); + message.proposalStatus = object.proposalStatus ?? 0; + message.voter = object.voter ?? ""; + message.depositor = object.depositor ?? ""; + message.pagination = + object.pagination !== undefined && object.pagination !== null + ? PageRequest.fromPartial(object.pagination) + : undefined; + return message; + }, + fromAmino(object: QueryProposalsRequestAmino): QueryProposalsRequest { + return { + proposalStatus: isSet(object.proposal_status) + ? proposalStatusFromJSON(object.proposal_status) + : 0, + voter: object.voter, + depositor: object.depositor, + pagination: object?.pagination + ? PageRequest.fromAmino(object.pagination) + : undefined, + }; + }, + toAmino(message: QueryProposalsRequest): QueryProposalsRequestAmino { + const obj: any = {}; + obj.proposal_status = message.proposalStatus; + obj.voter = message.voter; + obj.depositor = message.depositor; + obj.pagination = message.pagination + ? PageRequest.toAmino(message.pagination) + : undefined; + return obj; + }, + fromAminoMsg(object: QueryProposalsRequestAminoMsg): QueryProposalsRequest { + return QueryProposalsRequest.fromAmino(object.value); + }, + toAminoMsg(message: QueryProposalsRequest): QueryProposalsRequestAminoMsg { + return { + type: "cosmos-sdk/v1/QueryProposalsRequest", + value: QueryProposalsRequest.toAmino(message), + }; + }, + fromProtoMsg(message: QueryProposalsRequestProtoMsg): QueryProposalsRequest { + return QueryProposalsRequest.decode(message.value); + }, + toProto(message: QueryProposalsRequest): Uint8Array { + return QueryProposalsRequest.encode(message).finish(); + }, + toProtoMsg(message: QueryProposalsRequest): QueryProposalsRequestProtoMsg { + return { + typeUrl: "/cosmos.gov.v1.QueryProposalsRequest", + value: QueryProposalsRequest.encode(message).finish(), + }; + }, +}; +function createBaseQueryProposalsResponse(): QueryProposalsResponse { + return { + proposals: [], + pagination: undefined, + }; +} +export const QueryProposalsResponse = { + encode( + message: QueryProposalsResponse, + writer: _m0.Writer = _m0.Writer.create() + ): _m0.Writer { + for (const v of message.proposals) { + Proposal.encode(v!, writer.uint32(10).fork()).ldelim(); + } + if (message.pagination !== undefined) { + PageResponse.encode( + message.pagination, + writer.uint32(18).fork() + ).ldelim(); + } + return writer; + }, + decode( + input: _m0.Reader | Uint8Array, + length?: number + ): QueryProposalsResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryProposalsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.proposals.push(Proposal.decode(reader, reader.uint32())); + break; + case 2: + message.pagination = PageResponse.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object: any): QueryProposalsResponse { + return { + proposals: Array.isArray(object?.proposals) + ? object.proposals.map((e: any) => Proposal.fromJSON(e)) + : [], + pagination: isSet(object.pagination) + ? PageResponse.fromJSON(object.pagination) + : undefined, + }; + }, + toJSON(message: QueryProposalsResponse): unknown { + const obj: any = {}; + if (message.proposals) { + obj.proposals = message.proposals.map((e) => + e ? Proposal.toJSON(e) : undefined + ); + } else { + obj.proposals = []; + } + message.pagination !== undefined && + (obj.pagination = message.pagination + ? PageResponse.toJSON(message.pagination) + : undefined); + return obj; + }, + fromPartial, I>>( + object: I + ): QueryProposalsResponse { + const message = createBaseQueryProposalsResponse(); + message.proposals = + object.proposals?.map((e) => Proposal.fromPartial(e)) || []; + message.pagination = + object.pagination !== undefined && object.pagination !== null + ? PageResponse.fromPartial(object.pagination) + : undefined; + return message; + }, + fromAmino(object: QueryProposalsResponseAmino): QueryProposalsResponse { + return { + proposals: Array.isArray(object?.proposals) + ? object.proposals.map((e: any) => Proposal.fromAmino(e)) + : [], + pagination: object?.pagination + ? PageResponse.fromAmino(object.pagination) + : undefined, + }; + }, + toAmino(message: QueryProposalsResponse): QueryProposalsResponseAmino { + const obj: any = {}; + if (message.proposals) { + obj.proposals = message.proposals.map((e) => + e ? Proposal.toAmino(e) : undefined + ); + } else { + obj.proposals = []; + } + obj.pagination = message.pagination + ? PageResponse.toAmino(message.pagination) + : undefined; + return obj; + }, + fromAminoMsg(object: QueryProposalsResponseAminoMsg): QueryProposalsResponse { + return QueryProposalsResponse.fromAmino(object.value); + }, + toAminoMsg(message: QueryProposalsResponse): QueryProposalsResponseAminoMsg { + return { + type: "cosmos-sdk/v1/QueryProposalsResponse", + value: QueryProposalsResponse.toAmino(message), + }; + }, + fromProtoMsg( + message: QueryProposalsResponseProtoMsg + ): QueryProposalsResponse { + return QueryProposalsResponse.decode(message.value); + }, + toProto(message: QueryProposalsResponse): Uint8Array { + return QueryProposalsResponse.encode(message).finish(); + }, + toProtoMsg(message: QueryProposalsResponse): QueryProposalsResponseProtoMsg { + return { + typeUrl: "/cosmos.gov.v1.QueryProposalsResponse", + value: QueryProposalsResponse.encode(message).finish(), + }; + }, +}; +function createBaseQueryVoteRequest(): QueryVoteRequest { + return { + proposalId: Long.UZERO, + voter: "", + }; +} +export const QueryVoteRequest = { + encode( + message: QueryVoteRequest, + writer: _m0.Writer = _m0.Writer.create() + ): _m0.Writer { + if (!message.proposalId.isZero()) { + writer.uint32(8).uint64(message.proposalId); + } + if (message.voter !== "") { + writer.uint32(18).string(message.voter); + } + return writer; + }, + decode(input: _m0.Reader | Uint8Array, length?: number): QueryVoteRequest { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryVoteRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.proposalId = reader.uint64() as Long; + break; + case 2: + message.voter = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object: any): QueryVoteRequest { + return { + proposalId: isSet(object.proposalId) + ? Long.fromValue(object.proposalId) + : Long.UZERO, + voter: isSet(object.voter) ? String(object.voter) : "", + }; + }, + toJSON(message: QueryVoteRequest): unknown { + const obj: any = {}; + message.proposalId !== undefined && + (obj.proposalId = (message.proposalId || Long.UZERO).toString()); + message.voter !== undefined && (obj.voter = message.voter); + return obj; + }, + fromPartial, I>>( + object: I + ): QueryVoteRequest { + const message = createBaseQueryVoteRequest(); + message.proposalId = + object.proposalId !== undefined && object.proposalId !== null + ? Long.fromValue(object.proposalId) + : Long.UZERO; + message.voter = object.voter ?? ""; + return message; + }, + fromAmino(object: QueryVoteRequestAmino): QueryVoteRequest { + return { + proposalId: Long.fromString(object.proposal_id), + voter: object.voter, + }; + }, + toAmino(message: QueryVoteRequest): QueryVoteRequestAmino { + const obj: any = {}; + obj.proposal_id = message.proposalId + ? message.proposalId.toString() + : undefined; + obj.voter = message.voter; + return obj; + }, + fromAminoMsg(object: QueryVoteRequestAminoMsg): QueryVoteRequest { + return QueryVoteRequest.fromAmino(object.value); + }, + toAminoMsg(message: QueryVoteRequest): QueryVoteRequestAminoMsg { + return { + type: "cosmos-sdk/v1/QueryVoteRequest", + value: QueryVoteRequest.toAmino(message), + }; + }, + fromProtoMsg(message: QueryVoteRequestProtoMsg): QueryVoteRequest { + return QueryVoteRequest.decode(message.value); + }, + toProto(message: QueryVoteRequest): Uint8Array { + return QueryVoteRequest.encode(message).finish(); + }, + toProtoMsg(message: QueryVoteRequest): QueryVoteRequestProtoMsg { + return { + typeUrl: "/cosmos.gov.v1.QueryVoteRequest", + value: QueryVoteRequest.encode(message).finish(), + }; + }, +}; +function createBaseQueryVoteResponse(): QueryVoteResponse { + return { + vote: undefined, + }; +} +export const QueryVoteResponse = { + encode( + message: QueryVoteResponse, + writer: _m0.Writer = _m0.Writer.create() + ): _m0.Writer { + if (message.vote !== undefined) { + Vote.encode(message.vote, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + decode(input: _m0.Reader | Uint8Array, length?: number): QueryVoteResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryVoteResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.vote = Vote.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object: any): QueryVoteResponse { + return { + vote: isSet(object.vote) ? Vote.fromJSON(object.vote) : undefined, + }; + }, + toJSON(message: QueryVoteResponse): unknown { + const obj: any = {}; + message.vote !== undefined && + (obj.vote = message.vote ? Vote.toJSON(message.vote) : undefined); + return obj; + }, + fromPartial, I>>( + object: I + ): QueryVoteResponse { + const message = createBaseQueryVoteResponse(); + message.vote = + object.vote !== undefined && object.vote !== null + ? Vote.fromPartial(object.vote) + : undefined; + return message; + }, + fromAmino(object: QueryVoteResponseAmino): QueryVoteResponse { + return { + vote: object?.vote ? Vote.fromAmino(object.vote) : undefined, + }; + }, + toAmino(message: QueryVoteResponse): QueryVoteResponseAmino { + const obj: any = {}; + obj.vote = message.vote ? Vote.toAmino(message.vote) : undefined; + return obj; + }, + fromAminoMsg(object: QueryVoteResponseAminoMsg): QueryVoteResponse { + return QueryVoteResponse.fromAmino(object.value); + }, + toAminoMsg(message: QueryVoteResponse): QueryVoteResponseAminoMsg { + return { + type: "cosmos-sdk/v1/QueryVoteResponse", + value: QueryVoteResponse.toAmino(message), + }; + }, + fromProtoMsg(message: QueryVoteResponseProtoMsg): QueryVoteResponse { + return QueryVoteResponse.decode(message.value); + }, + toProto(message: QueryVoteResponse): Uint8Array { + return QueryVoteResponse.encode(message).finish(); + }, + toProtoMsg(message: QueryVoteResponse): QueryVoteResponseProtoMsg { + return { + typeUrl: "/cosmos.gov.v1.QueryVoteResponse", + value: QueryVoteResponse.encode(message).finish(), + }; + }, +}; +function createBaseQueryVotesRequest(): QueryVotesRequest { + return { + proposalId: Long.UZERO, + pagination: undefined, + }; +} +export const QueryVotesRequest = { + encode( + message: QueryVotesRequest, + writer: _m0.Writer = _m0.Writer.create() + ): _m0.Writer { + if (!message.proposalId.isZero()) { + writer.uint32(8).uint64(message.proposalId); + } + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input: _m0.Reader | Uint8Array, length?: number): QueryVotesRequest { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryVotesRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.proposalId = reader.uint64() as Long; + break; + case 2: + message.pagination = PageRequest.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object: any): QueryVotesRequest { + return { + proposalId: isSet(object.proposalId) + ? Long.fromValue(object.proposalId) + : Long.UZERO, + pagination: isSet(object.pagination) + ? PageRequest.fromJSON(object.pagination) + : undefined, + }; + }, + toJSON(message: QueryVotesRequest): unknown { + const obj: any = {}; + message.proposalId !== undefined && + (obj.proposalId = (message.proposalId || Long.UZERO).toString()); + message.pagination !== undefined && + (obj.pagination = message.pagination + ? PageRequest.toJSON(message.pagination) + : undefined); + return obj; + }, + fromPartial, I>>( + object: I + ): QueryVotesRequest { + const message = createBaseQueryVotesRequest(); + message.proposalId = + object.proposalId !== undefined && object.proposalId !== null + ? Long.fromValue(object.proposalId) + : Long.UZERO; + message.pagination = + object.pagination !== undefined && object.pagination !== null + ? PageRequest.fromPartial(object.pagination) + : undefined; + return message; + }, + fromAmino(object: QueryVotesRequestAmino): QueryVotesRequest { + return { + proposalId: Long.fromString(object.proposal_id), + pagination: object?.pagination + ? PageRequest.fromAmino(object.pagination) + : undefined, + }; + }, + toAmino(message: QueryVotesRequest): QueryVotesRequestAmino { + const obj: any = {}; + obj.proposal_id = message.proposalId + ? message.proposalId.toString() + : undefined; + obj.pagination = message.pagination + ? PageRequest.toAmino(message.pagination) + : undefined; + return obj; + }, + fromAminoMsg(object: QueryVotesRequestAminoMsg): QueryVotesRequest { + return QueryVotesRequest.fromAmino(object.value); + }, + toAminoMsg(message: QueryVotesRequest): QueryVotesRequestAminoMsg { + return { + type: "cosmos-sdk/v1/QueryVotesRequest", + value: QueryVotesRequest.toAmino(message), + }; + }, + fromProtoMsg(message: QueryVotesRequestProtoMsg): QueryVotesRequest { + return QueryVotesRequest.decode(message.value); + }, + toProto(message: QueryVotesRequest): Uint8Array { + return QueryVotesRequest.encode(message).finish(); + }, + toProtoMsg(message: QueryVotesRequest): QueryVotesRequestProtoMsg { + return { + typeUrl: "/cosmos.gov.v1.QueryVotesRequest", + value: QueryVotesRequest.encode(message).finish(), + }; + }, +}; +function createBaseQueryVotesResponse(): QueryVotesResponse { + return { + votes: [], + pagination: undefined, + }; +} +export const QueryVotesResponse = { + encode( + message: QueryVotesResponse, + writer: _m0.Writer = _m0.Writer.create() + ): _m0.Writer { + for (const v of message.votes) { + Vote.encode(v!, writer.uint32(10).fork()).ldelim(); + } + if (message.pagination !== undefined) { + PageResponse.encode( + message.pagination, + writer.uint32(18).fork() + ).ldelim(); + } + return writer; + }, + decode(input: _m0.Reader | Uint8Array, length?: number): QueryVotesResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryVotesResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.votes.push(Vote.decode(reader, reader.uint32())); + break; + case 2: + message.pagination = PageResponse.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object: any): QueryVotesResponse { + return { + votes: Array.isArray(object?.votes) + ? object.votes.map((e: any) => Vote.fromJSON(e)) + : [], + pagination: isSet(object.pagination) + ? PageResponse.fromJSON(object.pagination) + : undefined, + }; + }, + toJSON(message: QueryVotesResponse): unknown { + const obj: any = {}; + if (message.votes) { + obj.votes = message.votes.map((e) => (e ? Vote.toJSON(e) : undefined)); + } else { + obj.votes = []; + } + message.pagination !== undefined && + (obj.pagination = message.pagination + ? PageResponse.toJSON(message.pagination) + : undefined); + return obj; + }, + fromPartial, I>>( + object: I + ): QueryVotesResponse { + const message = createBaseQueryVotesResponse(); + message.votes = object.votes?.map((e) => Vote.fromPartial(e)) || []; + message.pagination = + object.pagination !== undefined && object.pagination !== null + ? PageResponse.fromPartial(object.pagination) + : undefined; + return message; + }, + fromAmino(object: QueryVotesResponseAmino): QueryVotesResponse { + return { + votes: Array.isArray(object?.votes) + ? object.votes.map((e: any) => Vote.fromAmino(e)) + : [], + pagination: object?.pagination + ? PageResponse.fromAmino(object.pagination) + : undefined, + }; + }, + toAmino(message: QueryVotesResponse): QueryVotesResponseAmino { + const obj: any = {}; + if (message.votes) { + obj.votes = message.votes.map((e) => (e ? Vote.toAmino(e) : undefined)); + } else { + obj.votes = []; + } + obj.pagination = message.pagination + ? PageResponse.toAmino(message.pagination) + : undefined; + return obj; + }, + fromAminoMsg(object: QueryVotesResponseAminoMsg): QueryVotesResponse { + return QueryVotesResponse.fromAmino(object.value); + }, + toAminoMsg(message: QueryVotesResponse): QueryVotesResponseAminoMsg { + return { + type: "cosmos-sdk/v1/QueryVotesResponse", + value: QueryVotesResponse.toAmino(message), + }; + }, + fromProtoMsg(message: QueryVotesResponseProtoMsg): QueryVotesResponse { + return QueryVotesResponse.decode(message.value); + }, + toProto(message: QueryVotesResponse): Uint8Array { + return QueryVotesResponse.encode(message).finish(); + }, + toProtoMsg(message: QueryVotesResponse): QueryVotesResponseProtoMsg { + return { + typeUrl: "/cosmos.gov.v1.QueryVotesResponse", + value: QueryVotesResponse.encode(message).finish(), + }; + }, +}; +function createBaseQueryParamsRequest(): QueryParamsRequest { + return { + paramsType: "", + }; +} +export const QueryParamsRequest = { + encode( + message: QueryParamsRequest, + writer: _m0.Writer = _m0.Writer.create() + ): _m0.Writer { + if (message.paramsType !== "") { + writer.uint32(10).string(message.paramsType); + } + 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) { + case 1: + message.paramsType = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object: any): QueryParamsRequest { + return { + paramsType: isSet(object.paramsType) ? String(object.paramsType) : "", + }; + }, + toJSON(message: QueryParamsRequest): unknown { + const obj: any = {}; + message.paramsType !== undefined && (obj.paramsType = message.paramsType); + return obj; + }, + fromPartial, I>>( + object: I + ): QueryParamsRequest { + const message = createBaseQueryParamsRequest(); + message.paramsType = object.paramsType ?? ""; + return message; + }, + fromAmino(object: QueryParamsRequestAmino): QueryParamsRequest { + return { + paramsType: object.params_type, + }; + }, + toAmino(message: QueryParamsRequest): QueryParamsRequestAmino { + const obj: any = {}; + obj.params_type = message.paramsType; + return obj; + }, + fromAminoMsg(object: QueryParamsRequestAminoMsg): QueryParamsRequest { + return QueryParamsRequest.fromAmino(object.value); + }, + toAminoMsg(message: QueryParamsRequest): QueryParamsRequestAminoMsg { + return { + type: "cosmos-sdk/v1/QueryParamsRequest", + value: QueryParamsRequest.toAmino(message), + }; + }, + fromProtoMsg(message: QueryParamsRequestProtoMsg): QueryParamsRequest { + return QueryParamsRequest.decode(message.value); + }, + toProto(message: QueryParamsRequest): Uint8Array { + return QueryParamsRequest.encode(message).finish(); + }, + toProtoMsg(message: QueryParamsRequest): QueryParamsRequestProtoMsg { + return { + typeUrl: "/cosmos.gov.v1.QueryParamsRequest", + value: QueryParamsRequest.encode(message).finish(), + }; + }, +}; +function createBaseQueryParamsResponse(): QueryParamsResponse { + return { + votingParams: undefined, + depositParams: undefined, + tallyParams: undefined, + params: undefined, + }; +} +export const QueryParamsResponse = { + encode( + message: QueryParamsResponse, + writer: _m0.Writer = _m0.Writer.create() + ): _m0.Writer { + if (message.votingParams !== undefined) { + VotingParams.encode( + message.votingParams, + writer.uint32(10).fork() + ).ldelim(); + } + if (message.depositParams !== undefined) { + DepositParams.encode( + message.depositParams, + writer.uint32(18).fork() + ).ldelim(); + } + if (message.tallyParams !== undefined) { + TallyParams.encode( + message.tallyParams, + writer.uint32(26).fork() + ).ldelim(); + } + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(34).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.votingParams = VotingParams.decode(reader, reader.uint32()); + break; + case 2: + message.depositParams = DepositParams.decode(reader, reader.uint32()); + break; + case 3: + message.tallyParams = TallyParams.decode(reader, reader.uint32()); + break; + case 4: + message.params = Params.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object: any): QueryParamsResponse { + return { + votingParams: isSet(object.votingParams) + ? VotingParams.fromJSON(object.votingParams) + : undefined, + depositParams: isSet(object.depositParams) + ? DepositParams.fromJSON(object.depositParams) + : undefined, + tallyParams: isSet(object.tallyParams) + ? TallyParams.fromJSON(object.tallyParams) + : undefined, + params: isSet(object.params) ? Params.fromJSON(object.params) : undefined, + }; + }, + toJSON(message: QueryParamsResponse): unknown { + const obj: any = {}; + message.votingParams !== undefined && + (obj.votingParams = message.votingParams + ? VotingParams.toJSON(message.votingParams) + : undefined); + message.depositParams !== undefined && + (obj.depositParams = message.depositParams + ? DepositParams.toJSON(message.depositParams) + : undefined); + message.tallyParams !== undefined && + (obj.tallyParams = message.tallyParams + ? TallyParams.toJSON(message.tallyParams) + : undefined); + message.params !== undefined && + (obj.params = message.params ? Params.toJSON(message.params) : undefined); + return obj; + }, + fromPartial, I>>( + object: I + ): QueryParamsResponse { + const message = createBaseQueryParamsResponse(); + message.votingParams = + object.votingParams !== undefined && object.votingParams !== null + ? VotingParams.fromPartial(object.votingParams) + : undefined; + message.depositParams = + object.depositParams !== undefined && object.depositParams !== null + ? DepositParams.fromPartial(object.depositParams) + : undefined; + message.tallyParams = + object.tallyParams !== undefined && object.tallyParams !== null + ? TallyParams.fromPartial(object.tallyParams) + : undefined; + message.params = + object.params !== undefined && object.params !== null + ? Params.fromPartial(object.params) + : undefined; + return message; + }, + fromAmino(object: QueryParamsResponseAmino): QueryParamsResponse { + return { + votingParams: object?.voting_params + ? VotingParams.fromAmino(object.voting_params) + : undefined, + depositParams: object?.deposit_params + ? DepositParams.fromAmino(object.deposit_params) + : undefined, + tallyParams: object?.tally_params + ? TallyParams.fromAmino(object.tally_params) + : undefined, + params: object?.params ? Params.fromAmino(object.params) : undefined, + }; + }, + toAmino(message: QueryParamsResponse): QueryParamsResponseAmino { + const obj: any = {}; + obj.voting_params = message.votingParams + ? VotingParams.toAmino(message.votingParams) + : undefined; + obj.deposit_params = message.depositParams + ? DepositParams.toAmino(message.depositParams) + : undefined; + obj.tally_params = message.tallyParams + ? TallyParams.toAmino(message.tallyParams) + : undefined; + obj.params = message.params ? Params.toAmino(message.params) : undefined; + return obj; + }, + fromAminoMsg(object: QueryParamsResponseAminoMsg): QueryParamsResponse { + return QueryParamsResponse.fromAmino(object.value); + }, + toAminoMsg(message: QueryParamsResponse): QueryParamsResponseAminoMsg { + return { + type: "cosmos-sdk/v1/QueryParamsResponse", + value: QueryParamsResponse.toAmino(message), + }; + }, + fromProtoMsg(message: QueryParamsResponseProtoMsg): QueryParamsResponse { + return QueryParamsResponse.decode(message.value); + }, + toProto(message: QueryParamsResponse): Uint8Array { + return QueryParamsResponse.encode(message).finish(); + }, + toProtoMsg(message: QueryParamsResponse): QueryParamsResponseProtoMsg { + return { + typeUrl: "/cosmos.gov.v1.QueryParamsResponse", + value: QueryParamsResponse.encode(message).finish(), + }; + }, +}; +function createBaseQueryDepositRequest(): QueryDepositRequest { + return { + proposalId: Long.UZERO, + depositor: "", + }; +} +export const QueryDepositRequest = { + encode( + message: QueryDepositRequest, + writer: _m0.Writer = _m0.Writer.create() + ): _m0.Writer { + if (!message.proposalId.isZero()) { + writer.uint32(8).uint64(message.proposalId); + } + if (message.depositor !== "") { + writer.uint32(18).string(message.depositor); + } + return writer; + }, + decode(input: _m0.Reader | Uint8Array, length?: number): QueryDepositRequest { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDepositRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.proposalId = reader.uint64() as Long; + break; + case 2: + message.depositor = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object: any): QueryDepositRequest { + return { + proposalId: isSet(object.proposalId) + ? Long.fromValue(object.proposalId) + : Long.UZERO, + depositor: isSet(object.depositor) ? String(object.depositor) : "", + }; + }, + toJSON(message: QueryDepositRequest): unknown { + const obj: any = {}; + message.proposalId !== undefined && + (obj.proposalId = (message.proposalId || Long.UZERO).toString()); + message.depositor !== undefined && (obj.depositor = message.depositor); + return obj; + }, + fromPartial, I>>( + object: I + ): QueryDepositRequest { + const message = createBaseQueryDepositRequest(); + message.proposalId = + object.proposalId !== undefined && object.proposalId !== null + ? Long.fromValue(object.proposalId) + : Long.UZERO; + message.depositor = object.depositor ?? ""; + return message; + }, + fromAmino(object: QueryDepositRequestAmino): QueryDepositRequest { + return { + proposalId: Long.fromString(object.proposal_id), + depositor: object.depositor, + }; + }, + toAmino(message: QueryDepositRequest): QueryDepositRequestAmino { + const obj: any = {}; + obj.proposal_id = message.proposalId + ? message.proposalId.toString() + : undefined; + obj.depositor = message.depositor; + return obj; + }, + fromAminoMsg(object: QueryDepositRequestAminoMsg): QueryDepositRequest { + return QueryDepositRequest.fromAmino(object.value); + }, + toAminoMsg(message: QueryDepositRequest): QueryDepositRequestAminoMsg { + return { + type: "cosmos-sdk/v1/QueryDepositRequest", + value: QueryDepositRequest.toAmino(message), + }; + }, + fromProtoMsg(message: QueryDepositRequestProtoMsg): QueryDepositRequest { + return QueryDepositRequest.decode(message.value); + }, + toProto(message: QueryDepositRequest): Uint8Array { + return QueryDepositRequest.encode(message).finish(); + }, + toProtoMsg(message: QueryDepositRequest): QueryDepositRequestProtoMsg { + return { + typeUrl: "/cosmos.gov.v1.QueryDepositRequest", + value: QueryDepositRequest.encode(message).finish(), + }; + }, +}; +function createBaseQueryDepositResponse(): QueryDepositResponse { + return { + deposit: undefined, + }; +} +export const QueryDepositResponse = { + encode( + message: QueryDepositResponse, + writer: _m0.Writer = _m0.Writer.create() + ): _m0.Writer { + if (message.deposit !== undefined) { + Deposit.encode(message.deposit, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + decode( + input: _m0.Reader | Uint8Array, + length?: number + ): QueryDepositResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDepositResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.deposit = Deposit.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object: any): QueryDepositResponse { + return { + deposit: isSet(object.deposit) + ? Deposit.fromJSON(object.deposit) + : undefined, + }; + }, + toJSON(message: QueryDepositResponse): unknown { + const obj: any = {}; + message.deposit !== undefined && + (obj.deposit = message.deposit + ? Deposit.toJSON(message.deposit) + : undefined); + return obj; + }, + fromPartial, I>>( + object: I + ): QueryDepositResponse { + const message = createBaseQueryDepositResponse(); + message.deposit = + object.deposit !== undefined && object.deposit !== null + ? Deposit.fromPartial(object.deposit) + : undefined; + return message; + }, + fromAmino(object: QueryDepositResponseAmino): QueryDepositResponse { + return { + deposit: object?.deposit ? Deposit.fromAmino(object.deposit) : undefined, + }; + }, + toAmino(message: QueryDepositResponse): QueryDepositResponseAmino { + const obj: any = {}; + obj.deposit = message.deposit + ? Deposit.toAmino(message.deposit) + : undefined; + return obj; + }, + fromAminoMsg(object: QueryDepositResponseAminoMsg): QueryDepositResponse { + return QueryDepositResponse.fromAmino(object.value); + }, + toAminoMsg(message: QueryDepositResponse): QueryDepositResponseAminoMsg { + return { + type: "cosmos-sdk/v1/QueryDepositResponse", + value: QueryDepositResponse.toAmino(message), + }; + }, + fromProtoMsg(message: QueryDepositResponseProtoMsg): QueryDepositResponse { + return QueryDepositResponse.decode(message.value); + }, + toProto(message: QueryDepositResponse): Uint8Array { + return QueryDepositResponse.encode(message).finish(); + }, + toProtoMsg(message: QueryDepositResponse): QueryDepositResponseProtoMsg { + return { + typeUrl: "/cosmos.gov.v1.QueryDepositResponse", + value: QueryDepositResponse.encode(message).finish(), + }; + }, +}; +function createBaseQueryDepositsRequest(): QueryDepositsRequest { + return { + proposalId: Long.UZERO, + pagination: undefined, + }; +} +export const QueryDepositsRequest = { + encode( + message: QueryDepositsRequest, + writer: _m0.Writer = _m0.Writer.create() + ): _m0.Writer { + if (!message.proposalId.isZero()) { + writer.uint32(8).uint64(message.proposalId); + } + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode( + input: _m0.Reader | Uint8Array, + length?: number + ): QueryDepositsRequest { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDepositsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.proposalId = reader.uint64() as Long; + break; + case 2: + message.pagination = PageRequest.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object: any): QueryDepositsRequest { + return { + proposalId: isSet(object.proposalId) + ? Long.fromValue(object.proposalId) + : Long.UZERO, + pagination: isSet(object.pagination) + ? PageRequest.fromJSON(object.pagination) + : undefined, + }; + }, + toJSON(message: QueryDepositsRequest): unknown { + const obj: any = {}; + message.proposalId !== undefined && + (obj.proposalId = (message.proposalId || Long.UZERO).toString()); + message.pagination !== undefined && + (obj.pagination = message.pagination + ? PageRequest.toJSON(message.pagination) + : undefined); + return obj; + }, + fromPartial, I>>( + object: I + ): QueryDepositsRequest { + const message = createBaseQueryDepositsRequest(); + message.proposalId = + object.proposalId !== undefined && object.proposalId !== null + ? Long.fromValue(object.proposalId) + : Long.UZERO; + message.pagination = + object.pagination !== undefined && object.pagination !== null + ? PageRequest.fromPartial(object.pagination) + : undefined; + return message; + }, + fromAmino(object: QueryDepositsRequestAmino): QueryDepositsRequest { + return { + proposalId: Long.fromString(object.proposal_id), + pagination: object?.pagination + ? PageRequest.fromAmino(object.pagination) + : undefined, + }; + }, + toAmino(message: QueryDepositsRequest): QueryDepositsRequestAmino { + const obj: any = {}; + obj.proposal_id = message.proposalId + ? message.proposalId.toString() + : undefined; + obj.pagination = message.pagination + ? PageRequest.toAmino(message.pagination) + : undefined; + return obj; + }, + fromAminoMsg(object: QueryDepositsRequestAminoMsg): QueryDepositsRequest { + return QueryDepositsRequest.fromAmino(object.value); + }, + toAminoMsg(message: QueryDepositsRequest): QueryDepositsRequestAminoMsg { + return { + type: "cosmos-sdk/v1/QueryDepositsRequest", + value: QueryDepositsRequest.toAmino(message), + }; + }, + fromProtoMsg(message: QueryDepositsRequestProtoMsg): QueryDepositsRequest { + return QueryDepositsRequest.decode(message.value); + }, + toProto(message: QueryDepositsRequest): Uint8Array { + return QueryDepositsRequest.encode(message).finish(); + }, + toProtoMsg(message: QueryDepositsRequest): QueryDepositsRequestProtoMsg { + return { + typeUrl: "/cosmos.gov.v1.QueryDepositsRequest", + value: QueryDepositsRequest.encode(message).finish(), + }; + }, +}; +function createBaseQueryDepositsResponse(): QueryDepositsResponse { + return { + deposits: [], + pagination: undefined, + }; +} +export const QueryDepositsResponse = { + encode( + message: QueryDepositsResponse, + writer: _m0.Writer = _m0.Writer.create() + ): _m0.Writer { + for (const v of message.deposits) { + Deposit.encode(v!, writer.uint32(10).fork()).ldelim(); + } + if (message.pagination !== undefined) { + PageResponse.encode( + message.pagination, + writer.uint32(18).fork() + ).ldelim(); + } + return writer; + }, + decode( + input: _m0.Reader | Uint8Array, + length?: number + ): QueryDepositsResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDepositsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.deposits.push(Deposit.decode(reader, reader.uint32())); + break; + case 2: + message.pagination = PageResponse.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object: any): QueryDepositsResponse { + return { + deposits: Array.isArray(object?.deposits) + ? object.deposits.map((e: any) => Deposit.fromJSON(e)) + : [], + pagination: isSet(object.pagination) + ? PageResponse.fromJSON(object.pagination) + : undefined, + }; + }, + toJSON(message: QueryDepositsResponse): unknown { + const obj: any = {}; + if (message.deposits) { + obj.deposits = message.deposits.map((e) => + e ? Deposit.toJSON(e) : undefined + ); + } else { + obj.deposits = []; + } + message.pagination !== undefined && + (obj.pagination = message.pagination + ? PageResponse.toJSON(message.pagination) + : undefined); + return obj; + }, + fromPartial, I>>( + object: I + ): QueryDepositsResponse { + const message = createBaseQueryDepositsResponse(); + message.deposits = + object.deposits?.map((e) => Deposit.fromPartial(e)) || []; + message.pagination = + object.pagination !== undefined && object.pagination !== null + ? PageResponse.fromPartial(object.pagination) + : undefined; + return message; + }, + fromAmino(object: QueryDepositsResponseAmino): QueryDepositsResponse { + return { + deposits: Array.isArray(object?.deposits) + ? object.deposits.map((e: any) => Deposit.fromAmino(e)) + : [], + pagination: object?.pagination + ? PageResponse.fromAmino(object.pagination) + : undefined, + }; + }, + toAmino(message: QueryDepositsResponse): QueryDepositsResponseAmino { + const obj: any = {}; + if (message.deposits) { + obj.deposits = message.deposits.map((e) => + e ? Deposit.toAmino(e) : undefined + ); + } else { + obj.deposits = []; + } + obj.pagination = message.pagination + ? PageResponse.toAmino(message.pagination) + : undefined; + return obj; + }, + fromAminoMsg(object: QueryDepositsResponseAminoMsg): QueryDepositsResponse { + return QueryDepositsResponse.fromAmino(object.value); + }, + toAminoMsg(message: QueryDepositsResponse): QueryDepositsResponseAminoMsg { + return { + type: "cosmos-sdk/v1/QueryDepositsResponse", + value: QueryDepositsResponse.toAmino(message), + }; + }, + fromProtoMsg(message: QueryDepositsResponseProtoMsg): QueryDepositsResponse { + return QueryDepositsResponse.decode(message.value); + }, + toProto(message: QueryDepositsResponse): Uint8Array { + return QueryDepositsResponse.encode(message).finish(); + }, + toProtoMsg(message: QueryDepositsResponse): QueryDepositsResponseProtoMsg { + return { + typeUrl: "/cosmos.gov.v1.QueryDepositsResponse", + value: QueryDepositsResponse.encode(message).finish(), + }; + }, +}; +function createBaseQueryTallyResultRequest(): QueryTallyResultRequest { + return { + proposalId: Long.UZERO, + }; +} +export const QueryTallyResultRequest = { + encode( + message: QueryTallyResultRequest, + writer: _m0.Writer = _m0.Writer.create() + ): _m0.Writer { + if (!message.proposalId.isZero()) { + writer.uint32(8).uint64(message.proposalId); + } + return writer; + }, + decode( + input: _m0.Reader | Uint8Array, + length?: number + ): QueryTallyResultRequest { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryTallyResultRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.proposalId = reader.uint64() as Long; + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object: any): QueryTallyResultRequest { + return { + proposalId: isSet(object.proposalId) + ? Long.fromValue(object.proposalId) + : Long.UZERO, + }; + }, + toJSON(message: QueryTallyResultRequest): unknown { + const obj: any = {}; + message.proposalId !== undefined && + (obj.proposalId = (message.proposalId || Long.UZERO).toString()); + return obj; + }, + fromPartial, I>>( + object: I + ): QueryTallyResultRequest { + const message = createBaseQueryTallyResultRequest(); + message.proposalId = + object.proposalId !== undefined && object.proposalId !== null + ? Long.fromValue(object.proposalId) + : Long.UZERO; + return message; + }, + fromAmino(object: QueryTallyResultRequestAmino): QueryTallyResultRequest { + return { + proposalId: Long.fromString(object.proposal_id), + }; + }, + toAmino(message: QueryTallyResultRequest): QueryTallyResultRequestAmino { + const obj: any = {}; + obj.proposal_id = message.proposalId + ? message.proposalId.toString() + : undefined; + return obj; + }, + fromAminoMsg( + object: QueryTallyResultRequestAminoMsg + ): QueryTallyResultRequest { + return QueryTallyResultRequest.fromAmino(object.value); + }, + toAminoMsg( + message: QueryTallyResultRequest + ): QueryTallyResultRequestAminoMsg { + return { + type: "cosmos-sdk/v1/QueryTallyResultRequest", + value: QueryTallyResultRequest.toAmino(message), + }; + }, + fromProtoMsg( + message: QueryTallyResultRequestProtoMsg + ): QueryTallyResultRequest { + return QueryTallyResultRequest.decode(message.value); + }, + toProto(message: QueryTallyResultRequest): Uint8Array { + return QueryTallyResultRequest.encode(message).finish(); + }, + toProtoMsg( + message: QueryTallyResultRequest + ): QueryTallyResultRequestProtoMsg { + return { + typeUrl: "/cosmos.gov.v1.QueryTallyResultRequest", + value: QueryTallyResultRequest.encode(message).finish(), + }; + }, +}; +function createBaseQueryTallyResultResponse(): QueryTallyResultResponse { + return { + tally: undefined, + }; +} +export const QueryTallyResultResponse = { + encode( + message: QueryTallyResultResponse, + writer: _m0.Writer = _m0.Writer.create() + ): _m0.Writer { + if (message.tally !== undefined) { + TallyResult.encode(message.tally, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + decode( + input: _m0.Reader | Uint8Array, + length?: number + ): QueryTallyResultResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryTallyResultResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.tally = TallyResult.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object: any): QueryTallyResultResponse { + return { + tally: isSet(object.tally) + ? TallyResult.fromJSON(object.tally) + : undefined, + }; + }, + toJSON(message: QueryTallyResultResponse): unknown { + const obj: any = {}; + message.tally !== undefined && + (obj.tally = message.tally + ? TallyResult.toJSON(message.tally) + : undefined); + return obj; + }, + fromPartial, I>>( + object: I + ): QueryTallyResultResponse { + const message = createBaseQueryTallyResultResponse(); + message.tally = + object.tally !== undefined && object.tally !== null + ? TallyResult.fromPartial(object.tally) + : undefined; + return message; + }, + fromAmino(object: QueryTallyResultResponseAmino): QueryTallyResultResponse { + return { + tally: object?.tally ? TallyResult.fromAmino(object.tally) : undefined, + }; + }, + toAmino(message: QueryTallyResultResponse): QueryTallyResultResponseAmino { + const obj: any = {}; + obj.tally = message.tally ? TallyResult.toAmino(message.tally) : undefined; + return obj; + }, + fromAminoMsg( + object: QueryTallyResultResponseAminoMsg + ): QueryTallyResultResponse { + return QueryTallyResultResponse.fromAmino(object.value); + }, + toAminoMsg( + message: QueryTallyResultResponse + ): QueryTallyResultResponseAminoMsg { + return { + type: "cosmos-sdk/v1/QueryTallyResultResponse", + value: QueryTallyResultResponse.toAmino(message), + }; + }, + fromProtoMsg( + message: QueryTallyResultResponseProtoMsg + ): QueryTallyResultResponse { + return QueryTallyResultResponse.decode(message.value); + }, + toProto(message: QueryTallyResultResponse): Uint8Array { + return QueryTallyResultResponse.encode(message).finish(); + }, + toProtoMsg( + message: QueryTallyResultResponse + ): QueryTallyResultResponseProtoMsg { + return { + typeUrl: "/cosmos.gov.v1.QueryTallyResultResponse", + value: QueryTallyResultResponse.encode(message).finish(), + }; + }, +}; +/** Query defines the gRPC querier service for gov module */ +export interface Query { + /** Proposal queries proposal details based on ProposalID. */ + Proposal(request: QueryProposalRequest): Promise; + /** Proposals queries all proposals based on given status. */ + Proposals(request: QueryProposalsRequest): Promise; + /** Vote queries voted information based on proposalID, voterAddr. */ + Vote(request: QueryVoteRequest): Promise; + /** Votes queries votes of a given proposal. */ + Votes(request: QueryVotesRequest): Promise; + /** Params queries all parameters of the gov module. */ + Params(request: QueryParamsRequest): Promise; + /** Deposit queries single deposit information based proposalID, depositAddr. */ + Deposit(request: QueryDepositRequest): Promise; + /** Deposits queries all deposits of a single proposal. */ + Deposits(request: QueryDepositsRequest): Promise; + /** TallyResult queries the tally of a proposal vote. */ + TallyResult( + request: QueryTallyResultRequest + ): Promise; +} +export class QueryClientImpl implements Query { + private readonly rpc: Rpc; + constructor(rpc: Rpc) { + this.rpc = rpc; + this.Proposal = this.Proposal.bind(this); + this.Proposals = this.Proposals.bind(this); + this.Vote = this.Vote.bind(this); + this.Votes = this.Votes.bind(this); + this.Params = this.Params.bind(this); + this.Deposit = this.Deposit.bind(this); + this.Deposits = this.Deposits.bind(this); + this.TallyResult = this.TallyResult.bind(this); + } + Proposal(request: QueryProposalRequest): Promise { + const data = QueryProposalRequest.encode(request).finish(); + const promise = this.rpc.request("cosmos.gov.v1.Query", "Proposal", data); + return promise.then((data) => + QueryProposalResponse.decode(new _m0.Reader(data)) + ); + } + Proposals(request: QueryProposalsRequest): Promise { + const data = QueryProposalsRequest.encode(request).finish(); + const promise = this.rpc.request("cosmos.gov.v1.Query", "Proposals", data); + return promise.then((data) => + QueryProposalsResponse.decode(new _m0.Reader(data)) + ); + } + Vote(request: QueryVoteRequest): Promise { + const data = QueryVoteRequest.encode(request).finish(); + const promise = this.rpc.request("cosmos.gov.v1.Query", "Vote", data); + return promise.then((data) => + QueryVoteResponse.decode(new _m0.Reader(data)) + ); + } + Votes(request: QueryVotesRequest): Promise { + const data = QueryVotesRequest.encode(request).finish(); + const promise = this.rpc.request("cosmos.gov.v1.Query", "Votes", data); + return promise.then((data) => + QueryVotesResponse.decode(new _m0.Reader(data)) + ); + } + Params(request: QueryParamsRequest): Promise { + const data = QueryParamsRequest.encode(request).finish(); + const promise = this.rpc.request("cosmos.gov.v1.Query", "Params", data); + return promise.then((data) => + QueryParamsResponse.decode(new _m0.Reader(data)) + ); + } + Deposit(request: QueryDepositRequest): Promise { + const data = QueryDepositRequest.encode(request).finish(); + const promise = this.rpc.request("cosmos.gov.v1.Query", "Deposit", data); + return promise.then((data) => + QueryDepositResponse.decode(new _m0.Reader(data)) + ); + } + Deposits(request: QueryDepositsRequest): Promise { + const data = QueryDepositsRequest.encode(request).finish(); + const promise = this.rpc.request("cosmos.gov.v1.Query", "Deposits", data); + return promise.then((data) => + QueryDepositsResponse.decode(new _m0.Reader(data)) + ); + } + TallyResult( + request: QueryTallyResultRequest + ): Promise { + const data = QueryTallyResultRequest.encode(request).finish(); + const promise = this.rpc.request( + "cosmos.gov.v1.Query", + "TallyResult", + data + ); + return promise.then((data) => + QueryTallyResultResponse.decode(new _m0.Reader(data)) + ); + } +} diff --git a/packages/types/src/cosmos/gov/v1/tx.amino.ts b/packages/types/src/cosmos/gov/v1/tx.amino.ts new file mode 100644 index 000000000..cd483bab5 --- /dev/null +++ b/packages/types/src/cosmos/gov/v1/tx.amino.ts @@ -0,0 +1,41 @@ +/* eslint-disable */ +import { + MsgSubmitProposal, + MsgExecLegacyContent, + MsgVote, + MsgVoteWeighted, + MsgDeposit, + MsgUpdateParams, +} from "./tx"; +export const AminoConverter = { + "/cosmos.gov.v1.MsgSubmitProposal": { + aminoType: "cosmos-sdk/v1/MsgSubmitProposal", + toAmino: MsgSubmitProposal.toAmino, + fromAmino: MsgSubmitProposal.fromAmino, + }, + "/cosmos.gov.v1.MsgExecLegacyContent": { + aminoType: "cosmos-sdk/v1/MsgExecLegacyContent", + toAmino: MsgExecLegacyContent.toAmino, + fromAmino: MsgExecLegacyContent.fromAmino, + }, + "/cosmos.gov.v1.MsgVote": { + aminoType: "cosmos-sdk/v1/MsgVote", + toAmino: MsgVote.toAmino, + fromAmino: MsgVote.fromAmino, + }, + "/cosmos.gov.v1.MsgVoteWeighted": { + aminoType: "cosmos-sdk/v1/MsgVoteWeighted", + toAmino: MsgVoteWeighted.toAmino, + fromAmino: MsgVoteWeighted.fromAmino, + }, + "/cosmos.gov.v1.MsgDeposit": { + aminoType: "cosmos-sdk/v1/MsgDeposit", + toAmino: MsgDeposit.toAmino, + fromAmino: MsgDeposit.fromAmino, + }, + "/cosmos.gov.v1.MsgUpdateParams": { + aminoType: "cosmos-sdk/x/gov/v1/MsgUpdateParams", + toAmino: MsgUpdateParams.toAmino, + fromAmino: MsgUpdateParams.fromAmino, + }, +}; diff --git a/packages/types/src/cosmos/gov/v1/tx.registry.ts b/packages/types/src/cosmos/gov/v1/tx.registry.ts new file mode 100644 index 000000000..a2c441eef --- /dev/null +++ b/packages/types/src/cosmos/gov/v1/tx.registry.ts @@ -0,0 +1,215 @@ +/* eslint-disable */ +import { GeneratedType, Registry } from "@cosmjs/proto-signing"; +import { + MsgSubmitProposal, + MsgExecLegacyContent, + MsgVote, + MsgVoteWeighted, + MsgDeposit, + MsgUpdateParams, +} 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], + ["/cosmos.gov.v1.MsgUpdateParams", MsgUpdateParams], +]; +export const load = (protoRegistry: Registry) => { + registry.forEach(([typeUrl, mod]) => { + protoRegistry.register(typeUrl, mod); + }); +}; +export const MessageComposer = { + encoded: { + submitProposal(value: MsgSubmitProposal) { + return { + typeUrl: "/cosmos.gov.v1.MsgSubmitProposal", + value: MsgSubmitProposal.encode(value).finish(), + }; + }, + execLegacyContent(value: MsgExecLegacyContent) { + return { + typeUrl: "/cosmos.gov.v1.MsgExecLegacyContent", + value: MsgExecLegacyContent.encode(value).finish(), + }; + }, + vote(value: MsgVote) { + return { + typeUrl: "/cosmos.gov.v1.MsgVote", + value: MsgVote.encode(value).finish(), + }; + }, + voteWeighted(value: MsgVoteWeighted) { + return { + typeUrl: "/cosmos.gov.v1.MsgVoteWeighted", + value: MsgVoteWeighted.encode(value).finish(), + }; + }, + deposit(value: MsgDeposit) { + return { + typeUrl: "/cosmos.gov.v1.MsgDeposit", + value: MsgDeposit.encode(value).finish(), + }; + }, + updateParams(value: MsgUpdateParams) { + return { + typeUrl: "/cosmos.gov.v1.MsgUpdateParams", + value: MsgUpdateParams.encode(value).finish(), + }; + }, + }, + withTypeUrl: { + submitProposal(value: MsgSubmitProposal) { + return { + typeUrl: "/cosmos.gov.v1.MsgSubmitProposal", + value, + }; + }, + execLegacyContent(value: MsgExecLegacyContent) { + return { + typeUrl: "/cosmos.gov.v1.MsgExecLegacyContent", + value, + }; + }, + vote(value: MsgVote) { + return { + typeUrl: "/cosmos.gov.v1.MsgVote", + value, + }; + }, + voteWeighted(value: MsgVoteWeighted) { + return { + typeUrl: "/cosmos.gov.v1.MsgVoteWeighted", + value, + }; + }, + deposit(value: MsgDeposit) { + return { + typeUrl: "/cosmos.gov.v1.MsgDeposit", + value, + }; + }, + updateParams(value: MsgUpdateParams) { + return { + typeUrl: "/cosmos.gov.v1.MsgUpdateParams", + value, + }; + }, + }, + toJSON: { + submitProposal(value: MsgSubmitProposal) { + return { + typeUrl: "/cosmos.gov.v1.MsgSubmitProposal", + value: MsgSubmitProposal.toJSON(value), + }; + }, + execLegacyContent(value: MsgExecLegacyContent) { + return { + typeUrl: "/cosmos.gov.v1.MsgExecLegacyContent", + value: MsgExecLegacyContent.toJSON(value), + }; + }, + vote(value: MsgVote) { + return { + typeUrl: "/cosmos.gov.v1.MsgVote", + value: MsgVote.toJSON(value), + }; + }, + voteWeighted(value: MsgVoteWeighted) { + return { + typeUrl: "/cosmos.gov.v1.MsgVoteWeighted", + value: MsgVoteWeighted.toJSON(value), + }; + }, + deposit(value: MsgDeposit) { + return { + typeUrl: "/cosmos.gov.v1.MsgDeposit", + value: MsgDeposit.toJSON(value), + }; + }, + updateParams(value: MsgUpdateParams) { + return { + typeUrl: "/cosmos.gov.v1.MsgUpdateParams", + value: MsgUpdateParams.toJSON(value), + }; + }, + }, + fromJSON: { + submitProposal(value: any) { + return { + typeUrl: "/cosmos.gov.v1.MsgSubmitProposal", + value: MsgSubmitProposal.fromJSON(value), + }; + }, + execLegacyContent(value: any) { + return { + typeUrl: "/cosmos.gov.v1.MsgExecLegacyContent", + value: MsgExecLegacyContent.fromJSON(value), + }; + }, + vote(value: any) { + return { + typeUrl: "/cosmos.gov.v1.MsgVote", + value: MsgVote.fromJSON(value), + }; + }, + voteWeighted(value: any) { + return { + typeUrl: "/cosmos.gov.v1.MsgVoteWeighted", + value: MsgVoteWeighted.fromJSON(value), + }; + }, + deposit(value: any) { + return { + typeUrl: "/cosmos.gov.v1.MsgDeposit", + value: MsgDeposit.fromJSON(value), + }; + }, + updateParams(value: any) { + return { + typeUrl: "/cosmos.gov.v1.MsgUpdateParams", + value: MsgUpdateParams.fromJSON(value), + }; + }, + }, + fromPartial: { + submitProposal(value: MsgSubmitProposal) { + return { + typeUrl: "/cosmos.gov.v1.MsgSubmitProposal", + value: MsgSubmitProposal.fromPartial(value), + }; + }, + execLegacyContent(value: MsgExecLegacyContent) { + return { + typeUrl: "/cosmos.gov.v1.MsgExecLegacyContent", + value: MsgExecLegacyContent.fromPartial(value), + }; + }, + vote(value: MsgVote) { + return { + typeUrl: "/cosmos.gov.v1.MsgVote", + value: MsgVote.fromPartial(value), + }; + }, + voteWeighted(value: MsgVoteWeighted) { + return { + typeUrl: "/cosmos.gov.v1.MsgVoteWeighted", + value: MsgVoteWeighted.fromPartial(value), + }; + }, + deposit(value: MsgDeposit) { + return { + typeUrl: "/cosmos.gov.v1.MsgDeposit", + value: MsgDeposit.fromPartial(value), + }; + }, + updateParams(value: MsgUpdateParams) { + return { + typeUrl: "/cosmos.gov.v1.MsgUpdateParams", + value: MsgUpdateParams.fromPartial(value), + }; + }, + }, +}; diff --git a/packages/types/src/cosmos/gov/v1/tx.ts b/packages/types/src/cosmos/gov/v1/tx.ts new file mode 100644 index 000000000..b9a06e4a0 --- /dev/null +++ b/packages/types/src/cosmos/gov/v1/tx.ts @@ -0,0 +1,1670 @@ +/* eslint-disable */ +import { Any, AnyAmino } from "../../../google/protobuf/any"; +import { Coin, CoinAmino } from "../../base/v1beta1/coin"; +import { + VoteOption, + WeightedVoteOption, + WeightedVoteOptionAmino, + Params, + ParamsAmino, + voteOptionFromJSON, + voteOptionToJSON, +} from "./gov"; +import { Long, isSet, DeepPartial, Exact, Rpc } from "../../../helpers"; +import * as _m0 from "protobufjs/minimal"; +import { AminoMsg } from "@cosmjs/amino"; +import { AminoConverter } from "../../../aminoconverter"; + +export const protobufPackage = "cosmos.gov.v1"; +/** + * MsgSubmitProposal defines an sdk.Msg type that supports submitting arbitrary + * proposal Content. + */ +export interface MsgSubmitProposal { + /** messages are the arbitrary messages to be executed if proposal passes. */ + messages: Any[]; + /** initial_deposit is the deposit value that must be paid at proposal submission. */ + initialDeposit: Coin[]; + /** proposer is the account address of the proposer. */ + proposer: string; + /** metadata is any arbitrary metadata attached to the proposal. */ + metadata: string; + /** + * title is the title of the proposal. + * + * Since: cosmos-sdk 0.47 + */ + title: string; + /** + * summary is the summary of the proposal + * + * Since: cosmos-sdk 0.47 + */ + summary: string; +} +export interface MsgSubmitProposalProtoMsg { + typeUrl: "/cosmos.gov.v1.MsgSubmitProposal"; + value: Uint8Array; +} +/** + * MsgSubmitProposal defines an sdk.Msg type that supports submitting arbitrary + * proposal Content. + */ +export interface MsgSubmitProposalAmino { + messages?: AminoMsg[]; + /** initial_deposit is the deposit value that must be paid at proposal submission. */ + initial_deposit: CoinAmino[]; + /** proposer is the account address of the proposer. */ + proposer: string; + metadata?: string; + /** + * title is the title of the proposal. + * + * Since: cosmos-sdk 0.47 + */ + title: string; + /** + * summary is the summary of the proposal + * + * Since: cosmos-sdk 0.47 + */ + summary: string; +} +export interface MsgSubmitProposalAminoMsg { + type: "cosmos-sdk/v1/MsgSubmitProposal"; + value: MsgSubmitProposalAmino; +} +/** MsgSubmitProposalResponse defines the Msg/SubmitProposal response type. */ +export interface MsgSubmitProposalResponse { + /** proposal_id defines the unique id of the proposal. */ + proposalId: Long; +} +export interface MsgSubmitProposalResponseProtoMsg { + typeUrl: "/cosmos.gov.v1.MsgSubmitProposalResponse"; + value: Uint8Array; +} +/** MsgSubmitProposalResponse defines the Msg/SubmitProposal response type. */ +export interface MsgSubmitProposalResponseAmino { + /** proposal_id defines the unique id of the proposal. */ + proposal_id: string; +} +export interface MsgSubmitProposalResponseAminoMsg { + type: "cosmos-sdk/v1/MsgSubmitProposalResponse"; + value: MsgSubmitProposalResponseAmino; +} +/** + * MsgExecLegacyContent is used to wrap the legacy content field into a message. + * This ensures backwards compatibility with v1beta1.MsgSubmitProposal. + */ +export interface MsgExecLegacyContent { + /** content is the proposal's content. */ + content?: Any; + /** authority must be the gov module address. */ + authority: string; +} +export interface MsgExecLegacyContentProtoMsg { + typeUrl: "/cosmos.gov.v1.MsgExecLegacyContent"; + value: Uint8Array; +} +/** + * MsgExecLegacyContent is used to wrap the legacy content field into a message. + * This ensures backwards compatibility with v1beta1.MsgSubmitProposal. + */ +export interface MsgExecLegacyContentAmino { + content?: AminoMsg; + /** authority must be the gov module address. */ + authority: string; +} +export interface MsgExecLegacyContentAminoMsg { + type: "cosmos-sdk/v1/MsgExecLegacyContent"; + value: MsgExecLegacyContentAmino; +} +/** MsgExecLegacyContentResponse defines the Msg/ExecLegacyContent response type. */ +export interface MsgExecLegacyContentResponse {} +export interface MsgExecLegacyContentResponseProtoMsg { + typeUrl: "/cosmos.gov.v1.MsgExecLegacyContentResponse"; + value: Uint8Array; +} +/** MsgExecLegacyContentResponse defines the Msg/ExecLegacyContent response type. */ +export interface MsgExecLegacyContentResponseAmino {} +export interface MsgExecLegacyContentResponseAminoMsg { + type: "cosmos-sdk/v1/MsgExecLegacyContentResponse"; + value: MsgExecLegacyContentResponseAmino; +} +/** MsgVote defines a message to cast a vote. */ +export interface MsgVote { + /** proposal_id defines the unique id of the proposal. */ + proposalId: Long; + /** voter is the voter address for the proposal. */ + voter: string; + /** option defines the vote option. */ + option: VoteOption; + /** metadata is any arbitrary metadata attached to the Vote. */ + metadata: string; +} +export interface MsgVoteProtoMsg { + typeUrl: "/cosmos.gov.v1.MsgVote"; + value: Uint8Array; +} +/** MsgVote defines a message to cast a vote. */ +export interface MsgVoteAmino { + /** proposal_id defines the unique id of the proposal. */ + proposal_id: string; + /** voter is the voter address for the proposal. */ + voter: string; + /** option defines the vote option. */ + option: VoteOption; + metadata?: string; +} +export interface MsgVoteAminoMsg { + type: "cosmos-sdk/v1/MsgVote"; + value: MsgVoteAmino; +} +/** MsgVoteResponse defines the Msg/Vote response type. */ +export interface MsgVoteResponse {} +export interface MsgVoteResponseProtoMsg { + typeUrl: "/cosmos.gov.v1.MsgVoteResponse"; + value: Uint8Array; +} +/** MsgVoteResponse defines the Msg/Vote response type. */ +export interface MsgVoteResponseAmino {} +export interface MsgVoteResponseAminoMsg { + type: "cosmos-sdk/v1/MsgVoteResponse"; + value: MsgVoteResponseAmino; +} +/** MsgVoteWeighted defines a message to cast a vote. */ +export interface MsgVoteWeighted { + /** proposal_id defines the unique id of the proposal. */ + proposalId: Long; + /** voter is the voter address for the proposal. */ + voter: string; + /** options defines the weighted vote options. */ + options: WeightedVoteOption[]; + /** metadata is any arbitrary metadata attached to the VoteWeighted. */ + metadata: string; +} +export interface MsgVoteWeightedProtoMsg { + typeUrl: "/cosmos.gov.v1.MsgVoteWeighted"; + value: Uint8Array; +} +/** MsgVoteWeighted defines a message to cast a vote. */ +export interface MsgVoteWeightedAmino { + /** proposal_id defines the unique id of the proposal. */ + proposal_id: string; + /** voter is the voter address for the proposal. */ + voter: string; + /** options defines the weighted vote options. */ + options: WeightedVoteOptionAmino[]; + metadata?: string; +} +export interface MsgVoteWeightedAminoMsg { + type: "cosmos-sdk/v1/MsgVoteWeighted"; + value: MsgVoteWeightedAmino; +} +/** MsgVoteWeightedResponse defines the Msg/VoteWeighted response type. */ +export interface MsgVoteWeightedResponse {} +export interface MsgVoteWeightedResponseProtoMsg { + typeUrl: "/cosmos.gov.v1.MsgVoteWeightedResponse"; + value: Uint8Array; +} +/** MsgVoteWeightedResponse defines the Msg/VoteWeighted response type. */ +export interface MsgVoteWeightedResponseAmino {} +export interface MsgVoteWeightedResponseAminoMsg { + type: "cosmos-sdk/v1/MsgVoteWeightedResponse"; + value: MsgVoteWeightedResponseAmino; +} +/** MsgDeposit defines a message to submit a deposit to an existing proposal. */ +export interface MsgDeposit { + /** proposal_id defines the unique id of the proposal. */ + proposalId: Long; + /** depositor defines the deposit addresses from the proposals. */ + depositor: string; + /** amount to be deposited by depositor. */ + amount: Coin[]; +} +export interface MsgDepositProtoMsg { + typeUrl: "/cosmos.gov.v1.MsgDeposit"; + value: Uint8Array; +} +/** MsgDeposit defines a message to submit a deposit to an existing proposal. */ +export interface MsgDepositAmino { + /** proposal_id defines the unique id of the proposal. */ + proposal_id: string; + /** depositor defines the deposit addresses from the proposals. */ + depositor: string; + /** amount to be deposited by depositor. */ + amount: CoinAmino[]; +} +export interface MsgDepositAminoMsg { + type: "cosmos-sdk/v1/MsgDeposit"; + value: MsgDepositAmino; +} +/** MsgDepositResponse defines the Msg/Deposit response type. */ +export interface MsgDepositResponse {} +export interface MsgDepositResponseProtoMsg { + typeUrl: "/cosmos.gov.v1.MsgDepositResponse"; + value: Uint8Array; +} +/** MsgDepositResponse defines the Msg/Deposit response type. */ +export interface MsgDepositResponseAmino {} +export interface MsgDepositResponseAminoMsg { + type: "cosmos-sdk/v1/MsgDepositResponse"; + value: MsgDepositResponseAmino; +} +/** + * MsgUpdateParams is the Msg/UpdateParams request type. + * + * Since: cosmos-sdk 0.47 + */ +export interface MsgUpdateParams { + /** authority is the address that controls the module (defaults to x/gov unless overwritten). */ + authority: string; + /** + * params defines the x/gov parameters to update. + * + * NOTE: All parameters must be supplied. + */ + params?: Params; +} +export interface MsgUpdateParamsProtoMsg { + typeUrl: "/cosmos.gov.v1.MsgUpdateParams"; + value: Uint8Array; +} +/** + * MsgUpdateParams is the Msg/UpdateParams request type. + * + * Since: cosmos-sdk 0.47 + */ +export interface MsgUpdateParamsAmino { + /** authority is the address that controls the module (defaults to x/gov unless overwritten). */ + authority: string; + /** + * params defines the x/gov parameters to update. + * + * NOTE: All parameters must be supplied. + */ + params?: ParamsAmino; +} +export interface MsgUpdateParamsAminoMsg { + type: "cosmos-sdk/x/gov/v1/MsgUpdateParams"; + value: MsgUpdateParamsAmino; +} +/** + * MsgUpdateParamsResponse defines the response structure for executing a + * MsgUpdateParams message. + * + * Since: cosmos-sdk 0.47 + */ +export interface MsgUpdateParamsResponse {} +export interface MsgUpdateParamsResponseProtoMsg { + typeUrl: "/cosmos.gov.v1.MsgUpdateParamsResponse"; + value: Uint8Array; +} +/** + * MsgUpdateParamsResponse defines the response structure for executing a + * MsgUpdateParams message. + * + * Since: cosmos-sdk 0.47 + */ +export interface MsgUpdateParamsResponseAmino {} +export interface MsgUpdateParamsResponseAminoMsg { + type: "cosmos-sdk/v1/MsgUpdateParamsResponse"; + value: MsgUpdateParamsResponseAmino; +} +function createBaseMsgSubmitProposal(): MsgSubmitProposal { + return { + messages: [], + initialDeposit: [], + proposer: "", + metadata: "", + title: "", + summary: "", + }; +} +export const MsgSubmitProposal = { + encode( + message: MsgSubmitProposal, + writer: _m0.Writer = _m0.Writer.create() + ): _m0.Writer { + for (const v of message.messages) { + Any.encode(v!, writer.uint32(10).fork()).ldelim(); + } + for (const v of message.initialDeposit) { + Coin.encode(v!, writer.uint32(18).fork()).ldelim(); + } + if (message.proposer !== "") { + writer.uint32(26).string(message.proposer); + } + if (message.metadata !== "") { + writer.uint32(34).string(message.metadata); + } + if (message.title !== "") { + writer.uint32(42).string(message.title); + } + if (message.summary !== "") { + writer.uint32(50).string(message.summary); + } + return writer; + }, + decode(input: _m0.Reader | Uint8Array, length?: number): MsgSubmitProposal { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSubmitProposal(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.messages.push(Any.decode(reader, reader.uint32())); + break; + case 2: + message.initialDeposit.push(Coin.decode(reader, reader.uint32())); + break; + case 3: + message.proposer = reader.string(); + break; + case 4: + message.metadata = reader.string(); + break; + case 5: + message.title = reader.string(); + break; + case 6: + message.summary = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object: any): MsgSubmitProposal { + return { + messages: Array.isArray(object?.messages) + ? object.messages.map((e: any) => Any.fromJSON(e)) + : [], + initialDeposit: Array.isArray(object?.initialDeposit) + ? object.initialDeposit.map((e: any) => Coin.fromJSON(e)) + : [], + proposer: isSet(object.proposer) ? String(object.proposer) : "", + metadata: isSet(object.metadata) ? String(object.metadata) : "", + title: isSet(object.title) ? String(object.title) : "", + summary: isSet(object.summary) ? String(object.summary) : "", + }; + }, + toJSON(message: MsgSubmitProposal): unknown { + const obj: any = {}; + if (message.messages) { + obj.messages = message.messages.map((e) => + e ? Any.toJSON(e) : undefined + ); + } else { + obj.messages = []; + } + if (message.initialDeposit) { + obj.initialDeposit = message.initialDeposit.map((e) => + e ? Coin.toJSON(e) : undefined + ); + } else { + obj.initialDeposit = []; + } + message.proposer !== undefined && (obj.proposer = message.proposer); + message.metadata !== undefined && (obj.metadata = message.metadata); + message.title !== undefined && (obj.title = message.title); + message.summary !== undefined && (obj.summary = message.summary); + return obj; + }, + fromPartial, I>>( + object: I + ): MsgSubmitProposal { + const message = createBaseMsgSubmitProposal(); + message.messages = object.messages?.map((e) => Any.fromPartial(e)) || []; + message.initialDeposit = + object.initialDeposit?.map((e) => Coin.fromPartial(e)) || []; + message.proposer = object.proposer ?? ""; + message.metadata = object.metadata ?? ""; + message.title = object.title ?? ""; + message.summary = object.summary ?? ""; + return message; + }, + fromAmino( + object: MsgSubmitProposalAmino, + converter?: AminoConverter + ): MsgSubmitProposal { + if (converter === undefined) { + throw new Error( + "Can't convert to MsgSubmitProposal from amino without an AminoConverter instance" + ); + } + return { + messages: object.messages?.map((m) => converter.toAny(m)) ?? [], + initialDeposit: Array.isArray(object?.initial_deposit) + ? object.initial_deposit.map((e: any) => Coin.fromAmino(e)) + : [], + proposer: object.proposer, + metadata: object.metadata ?? "", + title: object.title, + summary: object.summary, + }; + }, + toAmino( + message: MsgSubmitProposal, + converter?: AminoConverter + ): MsgSubmitProposalAmino { + if (converter === undefined) { + throw new Error( + "Can't convert to MsgSubmitProposal to amino without an AminoConverter instance" + ); + } + + const obj: any = {}; + if (message.messages && message.messages.length > 0) { + obj.messages = message.messages.map((m) => converter.fromAny(m)); + } + if (message.initialDeposit) { + obj.initial_deposit = message.initialDeposit.map((e) => + e ? Coin.toAmino(e) : undefined + ); + } else { + obj.initial_deposit = []; + } + obj.proposer = message.proposer; + if (message.metadata !== "") { + obj.metadata = message.metadata; + } + obj.title = message.title; + obj.summary = message.summary; + return obj; + }, + fromAminoMsg(object: MsgSubmitProposalAminoMsg): MsgSubmitProposal { + return MsgSubmitProposal.fromAmino(object.value); + }, + toAminoMsg(message: MsgSubmitProposal): MsgSubmitProposalAminoMsg { + return { + type: "cosmos-sdk/v1/MsgSubmitProposal", + value: MsgSubmitProposal.toAmino(message), + }; + }, + fromProtoMsg(message: MsgSubmitProposalProtoMsg): MsgSubmitProposal { + return MsgSubmitProposal.decode(message.value); + }, + toProto(message: MsgSubmitProposal): Uint8Array { + return MsgSubmitProposal.encode(message).finish(); + }, + toProtoMsg(message: MsgSubmitProposal): MsgSubmitProposalProtoMsg { + return { + typeUrl: "/cosmos.gov.v1.MsgSubmitProposal", + value: MsgSubmitProposal.encode(message).finish(), + }; + }, +}; +function createBaseMsgSubmitProposalResponse(): MsgSubmitProposalResponse { + return { + proposalId: Long.UZERO, + }; +} +export const MsgSubmitProposalResponse = { + encode( + message: MsgSubmitProposalResponse, + writer: _m0.Writer = _m0.Writer.create() + ): _m0.Writer { + if (!message.proposalId.isZero()) { + writer.uint32(8).uint64(message.proposalId); + } + return writer; + }, + decode( + input: _m0.Reader | Uint8Array, + length?: number + ): MsgSubmitProposalResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSubmitProposalResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.proposalId = reader.uint64() as Long; + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object: any): MsgSubmitProposalResponse { + return { + proposalId: isSet(object.proposalId) + ? Long.fromValue(object.proposalId) + : Long.UZERO, + }; + }, + toJSON(message: MsgSubmitProposalResponse): unknown { + const obj: any = {}; + message.proposalId !== undefined && + (obj.proposalId = (message.proposalId || Long.UZERO).toString()); + return obj; + }, + fromPartial, I>>( + object: I + ): MsgSubmitProposalResponse { + const message = createBaseMsgSubmitProposalResponse(); + message.proposalId = + object.proposalId !== undefined && object.proposalId !== null + ? Long.fromValue(object.proposalId) + : Long.UZERO; + return message; + }, + fromAmino(object: MsgSubmitProposalResponseAmino): MsgSubmitProposalResponse { + return { + proposalId: Long.fromString(object.proposal_id), + }; + }, + toAmino(message: MsgSubmitProposalResponse): MsgSubmitProposalResponseAmino { + const obj: any = {}; + obj.proposal_id = message.proposalId + ? message.proposalId.toString() + : undefined; + return obj; + }, + fromAminoMsg( + object: MsgSubmitProposalResponseAminoMsg + ): MsgSubmitProposalResponse { + return MsgSubmitProposalResponse.fromAmino(object.value); + }, + toAminoMsg( + message: MsgSubmitProposalResponse + ): MsgSubmitProposalResponseAminoMsg { + return { + type: "cosmos-sdk/v1/MsgSubmitProposalResponse", + value: MsgSubmitProposalResponse.toAmino(message), + }; + }, + fromProtoMsg( + message: MsgSubmitProposalResponseProtoMsg + ): MsgSubmitProposalResponse { + return MsgSubmitProposalResponse.decode(message.value); + }, + toProto(message: MsgSubmitProposalResponse): Uint8Array { + return MsgSubmitProposalResponse.encode(message).finish(); + }, + toProtoMsg( + message: MsgSubmitProposalResponse + ): MsgSubmitProposalResponseProtoMsg { + return { + typeUrl: "/cosmos.gov.v1.MsgSubmitProposalResponse", + value: MsgSubmitProposalResponse.encode(message).finish(), + }; + }, +}; +function createBaseMsgExecLegacyContent(): MsgExecLegacyContent { + return { + content: undefined, + authority: "", + }; +} +export const MsgExecLegacyContent = { + encode( + message: MsgExecLegacyContent, + writer: _m0.Writer = _m0.Writer.create() + ): _m0.Writer { + if (message.content !== undefined) { + Any.encode(message.content, writer.uint32(10).fork()).ldelim(); + } + if (message.authority !== "") { + writer.uint32(18).string(message.authority); + } + return writer; + }, + decode( + input: _m0.Reader | Uint8Array, + length?: number + ): MsgExecLegacyContent { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgExecLegacyContent(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.content = Any.decode(reader, reader.uint32()); + break; + case 2: + message.authority = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object: any): MsgExecLegacyContent { + return { + content: isSet(object.content) ? Any.fromJSON(object.content) : undefined, + authority: isSet(object.authority) ? String(object.authority) : "", + }; + }, + toJSON(message: MsgExecLegacyContent): unknown { + const obj: any = {}; + message.content !== undefined && + (obj.content = message.content ? Any.toJSON(message.content) : undefined); + message.authority !== undefined && (obj.authority = message.authority); + return obj; + }, + fromPartial, I>>( + object: I + ): MsgExecLegacyContent { + const message = createBaseMsgExecLegacyContent(); + message.content = + object.content !== undefined && object.content !== null + ? Any.fromPartial(object.content) + : undefined; + message.authority = object.authority ?? ""; + return message; + }, + fromAmino( + object: MsgExecLegacyContentAmino, + aminoConverter?: AminoConverter + ): MsgExecLegacyContent { + if (aminoConverter === undefined) { + throw new Error( + "Can't convert to MsgExecLegacyContent from amino without an AminoConverter instance" + ); + } + + return { + content: object?.content + ? aminoConverter.toAny(object.content) + : undefined, + authority: object.authority, + }; + }, + toAmino( + message: MsgExecLegacyContent, + converter?: AminoConverter + ): MsgExecLegacyContentAmino { + if (converter === undefined) { + throw new Error( + "Can't convert to MsgExecLegacyContent from amino without an AminoConverter instance" + ); + } + + const obj: any = {}; + obj.content = message.content + ? converter.fromAny(message.content) + : undefined; + obj.authority = message.authority; + return obj; + }, + fromAminoMsg(object: MsgExecLegacyContentAminoMsg): MsgExecLegacyContent { + return MsgExecLegacyContent.fromAmino(object.value); + }, + toAminoMsg(message: MsgExecLegacyContent): MsgExecLegacyContentAminoMsg { + return { + type: "cosmos-sdk/v1/MsgExecLegacyContent", + value: MsgExecLegacyContent.toAmino(message), + }; + }, + fromProtoMsg(message: MsgExecLegacyContentProtoMsg): MsgExecLegacyContent { + return MsgExecLegacyContent.decode(message.value); + }, + toProto(message: MsgExecLegacyContent): Uint8Array { + return MsgExecLegacyContent.encode(message).finish(); + }, + toProtoMsg(message: MsgExecLegacyContent): MsgExecLegacyContentProtoMsg { + return { + typeUrl: "/cosmos.gov.v1.MsgExecLegacyContent", + value: MsgExecLegacyContent.encode(message).finish(), + }; + }, +}; +function createBaseMsgExecLegacyContentResponse(): MsgExecLegacyContentResponse { + return {}; +} +export const MsgExecLegacyContentResponse = { + encode( + _: MsgExecLegacyContentResponse, + writer: _m0.Writer = _m0.Writer.create() + ): _m0.Writer { + return writer; + }, + decode( + input: _m0.Reader | Uint8Array, + length?: number + ): MsgExecLegacyContentResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgExecLegacyContentResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(_: any): MsgExecLegacyContentResponse { + return {}; + }, + toJSON(_: MsgExecLegacyContentResponse): unknown { + const obj: any = {}; + return obj; + }, + fromPartial, I>>( + _: I + ): MsgExecLegacyContentResponse { + const message = createBaseMsgExecLegacyContentResponse(); + return message; + }, + fromAmino( + _: MsgExecLegacyContentResponseAmino + ): MsgExecLegacyContentResponse { + return {}; + }, + toAmino(_: MsgExecLegacyContentResponse): MsgExecLegacyContentResponseAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg( + object: MsgExecLegacyContentResponseAminoMsg + ): MsgExecLegacyContentResponse { + return MsgExecLegacyContentResponse.fromAmino(object.value); + }, + toAminoMsg( + message: MsgExecLegacyContentResponse + ): MsgExecLegacyContentResponseAminoMsg { + return { + type: "cosmos-sdk/v1/MsgExecLegacyContentResponse", + value: MsgExecLegacyContentResponse.toAmino(message), + }; + }, + fromProtoMsg( + message: MsgExecLegacyContentResponseProtoMsg + ): MsgExecLegacyContentResponse { + return MsgExecLegacyContentResponse.decode(message.value); + }, + toProto(message: MsgExecLegacyContentResponse): Uint8Array { + return MsgExecLegacyContentResponse.encode(message).finish(); + }, + toProtoMsg( + message: MsgExecLegacyContentResponse + ): MsgExecLegacyContentResponseProtoMsg { + return { + typeUrl: "/cosmos.gov.v1.MsgExecLegacyContentResponse", + value: MsgExecLegacyContentResponse.encode(message).finish(), + }; + }, +}; +function createBaseMsgVote(): MsgVote { + return { + proposalId: Long.UZERO, + voter: "", + option: 0, + metadata: "", + }; +} +export const MsgVote = { + encode( + message: MsgVote, + writer: _m0.Writer = _m0.Writer.create() + ): _m0.Writer { + if (!message.proposalId.isZero()) { + writer.uint32(8).uint64(message.proposalId); + } + if (message.voter !== "") { + writer.uint32(18).string(message.voter); + } + if (message.option !== 0) { + writer.uint32(24).int32(message.option); + } + if (message.metadata !== "") { + writer.uint32(34).string(message.metadata); + } + return writer; + }, + decode(input: _m0.Reader | Uint8Array, length?: number): MsgVote { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgVote(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.proposalId = reader.uint64() as Long; + break; + case 2: + message.voter = reader.string(); + break; + case 3: + message.option = reader.int32() as any; + break; + case 4: + message.metadata = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object: any): MsgVote { + return { + proposalId: isSet(object.proposalId) + ? Long.fromValue(object.proposalId) + : Long.UZERO, + voter: isSet(object.voter) ? String(object.voter) : "", + option: isSet(object.option) ? voteOptionFromJSON(object.option) : 0, + metadata: isSet(object.metadata) ? String(object.metadata) : "", + }; + }, + toJSON(message: MsgVote): unknown { + const obj: any = {}; + message.proposalId !== undefined && + (obj.proposalId = (message.proposalId || Long.UZERO).toString()); + message.voter !== undefined && (obj.voter = message.voter); + message.option !== undefined && + (obj.option = voteOptionToJSON(message.option)); + message.metadata !== undefined && (obj.metadata = message.metadata); + return obj; + }, + fromPartial, I>>(object: I): MsgVote { + const message = createBaseMsgVote(); + message.proposalId = + object.proposalId !== undefined && object.proposalId !== null + ? Long.fromValue(object.proposalId) + : Long.UZERO; + message.voter = object.voter ?? ""; + message.option = object.option ?? 0; + message.metadata = object.metadata ?? ""; + return message; + }, + fromAmino(object: MsgVoteAmino): MsgVote { + return { + proposalId: Long.fromString(object.proposal_id), + voter: object.voter, + option: isSet(object.option) ? object.option : 0, + metadata: object.metadata ?? "", + }; + }, + toAmino(message: MsgVote): MsgVoteAmino { + const obj: any = {}; + obj.proposal_id = message.proposalId + ? message.proposalId.toString() + : undefined; + obj.voter = message.voter; + obj.option = message.option; + obj.metadata = message.metadata === "" ? undefined : message.metadata; + return obj; + }, + fromAminoMsg(object: MsgVoteAminoMsg): MsgVote { + return MsgVote.fromAmino(object.value); + }, + toAminoMsg(message: MsgVote): MsgVoteAminoMsg { + return { + type: "cosmos-sdk/v1/MsgVote", + value: MsgVote.toAmino(message), + }; + }, + fromProtoMsg(message: MsgVoteProtoMsg): MsgVote { + return MsgVote.decode(message.value); + }, + toProto(message: MsgVote): Uint8Array { + return MsgVote.encode(message).finish(); + }, + toProtoMsg(message: MsgVote): MsgVoteProtoMsg { + return { + typeUrl: "/cosmos.gov.v1.MsgVote", + value: MsgVote.encode(message).finish(), + }; + }, +}; +function createBaseMsgVoteResponse(): MsgVoteResponse { + return {}; +} +export const MsgVoteResponse = { + encode( + _: MsgVoteResponse, + writer: _m0.Writer = _m0.Writer.create() + ): _m0.Writer { + return writer; + }, + decode(input: _m0.Reader | Uint8Array, length?: number): MsgVoteResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgVoteResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(_: any): MsgVoteResponse { + return {}; + }, + toJSON(_: MsgVoteResponse): unknown { + const obj: any = {}; + return obj; + }, + fromPartial, I>>( + _: I + ): MsgVoteResponse { + const message = createBaseMsgVoteResponse(); + return message; + }, + fromAmino(_: MsgVoteResponseAmino): MsgVoteResponse { + return {}; + }, + toAmino(_: MsgVoteResponse): MsgVoteResponseAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg(object: MsgVoteResponseAminoMsg): MsgVoteResponse { + return MsgVoteResponse.fromAmino(object.value); + }, + toAminoMsg(message: MsgVoteResponse): MsgVoteResponseAminoMsg { + return { + type: "cosmos-sdk/v1/MsgVoteResponse", + value: MsgVoteResponse.toAmino(message), + }; + }, + fromProtoMsg(message: MsgVoteResponseProtoMsg): MsgVoteResponse { + return MsgVoteResponse.decode(message.value); + }, + toProto(message: MsgVoteResponse): Uint8Array { + return MsgVoteResponse.encode(message).finish(); + }, + toProtoMsg(message: MsgVoteResponse): MsgVoteResponseProtoMsg { + return { + typeUrl: "/cosmos.gov.v1.MsgVoteResponse", + value: MsgVoteResponse.encode(message).finish(), + }; + }, +}; +function createBaseMsgVoteWeighted(): MsgVoteWeighted { + return { + proposalId: Long.UZERO, + voter: "", + options: [], + metadata: "", + }; +} +export const MsgVoteWeighted = { + encode( + message: MsgVoteWeighted, + writer: _m0.Writer = _m0.Writer.create() + ): _m0.Writer { + if (!message.proposalId.isZero()) { + writer.uint32(8).uint64(message.proposalId); + } + if (message.voter !== "") { + writer.uint32(18).string(message.voter); + } + for (const v of message.options) { + WeightedVoteOption.encode(v!, writer.uint32(26).fork()).ldelim(); + } + if (message.metadata !== "") { + writer.uint32(34).string(message.metadata); + } + return writer; + }, + decode(input: _m0.Reader | Uint8Array, length?: number): MsgVoteWeighted { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgVoteWeighted(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.proposalId = reader.uint64() as Long; + break; + case 2: + message.voter = reader.string(); + break; + case 3: + message.options.push( + WeightedVoteOption.decode(reader, reader.uint32()) + ); + break; + case 4: + message.metadata = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object: any): MsgVoteWeighted { + return { + proposalId: isSet(object.proposalId) + ? Long.fromValue(object.proposalId) + : Long.UZERO, + voter: isSet(object.voter) ? String(object.voter) : "", + options: Array.isArray(object?.options) + ? object.options.map((e: any) => WeightedVoteOption.fromJSON(e)) + : [], + metadata: isSet(object.metadata) ? String(object.metadata) : "", + }; + }, + toJSON(message: MsgVoteWeighted): unknown { + const obj: any = {}; + message.proposalId !== undefined && + (obj.proposalId = (message.proposalId || Long.UZERO).toString()); + message.voter !== undefined && (obj.voter = message.voter); + if (message.options) { + obj.options = message.options.map((e) => + e ? WeightedVoteOption.toJSON(e) : undefined + ); + } else { + obj.options = []; + } + message.metadata !== undefined && (obj.metadata = message.metadata); + return obj; + }, + fromPartial, I>>( + object: I + ): MsgVoteWeighted { + const message = createBaseMsgVoteWeighted(); + message.proposalId = + object.proposalId !== undefined && object.proposalId !== null + ? Long.fromValue(object.proposalId) + : Long.UZERO; + message.voter = object.voter ?? ""; + message.options = + object.options?.map((e) => WeightedVoteOption.fromPartial(e)) || []; + message.metadata = object.metadata ?? ""; + return message; + }, + fromAmino(object: MsgVoteWeightedAmino): MsgVoteWeighted { + return { + proposalId: Long.fromString(object.proposal_id), + voter: object.voter, + options: Array.isArray(object?.options) + ? object.options.map((e: any) => WeightedVoteOption.fromAmino(e)) + : [], + metadata: object.metadata ?? "", + }; + }, + toAmino(message: MsgVoteWeighted): MsgVoteWeightedAmino { + const obj: any = {}; + obj.proposal_id = message.proposalId + ? message.proposalId.toString() + : undefined; + obj.voter = message.voter; + if (message.options) { + obj.options = message.options.map((e) => + e ? WeightedVoteOption.toAmino(e) : undefined + ); + } else { + obj.options = []; + } + if (message.metadata !== "") { + obj.metadata = message.metadata; + } + return obj; + }, + fromAminoMsg(object: MsgVoteWeightedAminoMsg): MsgVoteWeighted { + return MsgVoteWeighted.fromAmino(object.value); + }, + toAminoMsg(message: MsgVoteWeighted): MsgVoteWeightedAminoMsg { + return { + type: "cosmos-sdk/v1/MsgVoteWeighted", + value: MsgVoteWeighted.toAmino(message), + }; + }, + fromProtoMsg(message: MsgVoteWeightedProtoMsg): MsgVoteWeighted { + return MsgVoteWeighted.decode(message.value); + }, + toProto(message: MsgVoteWeighted): Uint8Array { + return MsgVoteWeighted.encode(message).finish(); + }, + toProtoMsg(message: MsgVoteWeighted): MsgVoteWeightedProtoMsg { + return { + typeUrl: "/cosmos.gov.v1.MsgVoteWeighted", + value: MsgVoteWeighted.encode(message).finish(), + }; + }, +}; +function createBaseMsgVoteWeightedResponse(): MsgVoteWeightedResponse { + return {}; +} +export const MsgVoteWeightedResponse = { + encode( + _: MsgVoteWeightedResponse, + writer: _m0.Writer = _m0.Writer.create() + ): _m0.Writer { + return writer; + }, + decode( + input: _m0.Reader | Uint8Array, + length?: number + ): MsgVoteWeightedResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgVoteWeightedResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(_: any): MsgVoteWeightedResponse { + return {}; + }, + toJSON(_: MsgVoteWeightedResponse): unknown { + const obj: any = {}; + return obj; + }, + fromPartial, I>>( + _: I + ): MsgVoteWeightedResponse { + const message = createBaseMsgVoteWeightedResponse(); + return message; + }, + fromAmino(_: MsgVoteWeightedResponseAmino): MsgVoteWeightedResponse { + return {}; + }, + toAmino(_: MsgVoteWeightedResponse): MsgVoteWeightedResponseAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg( + object: MsgVoteWeightedResponseAminoMsg + ): MsgVoteWeightedResponse { + return MsgVoteWeightedResponse.fromAmino(object.value); + }, + toAminoMsg( + message: MsgVoteWeightedResponse + ): MsgVoteWeightedResponseAminoMsg { + return { + type: "cosmos-sdk/v1/MsgVoteWeightedResponse", + value: MsgVoteWeightedResponse.toAmino(message), + }; + }, + fromProtoMsg( + message: MsgVoteWeightedResponseProtoMsg + ): MsgVoteWeightedResponse { + return MsgVoteWeightedResponse.decode(message.value); + }, + toProto(message: MsgVoteWeightedResponse): Uint8Array { + return MsgVoteWeightedResponse.encode(message).finish(); + }, + toProtoMsg( + message: MsgVoteWeightedResponse + ): MsgVoteWeightedResponseProtoMsg { + return { + typeUrl: "/cosmos.gov.v1.MsgVoteWeightedResponse", + value: MsgVoteWeightedResponse.encode(message).finish(), + }; + }, +}; +function createBaseMsgDeposit(): MsgDeposit { + return { + proposalId: Long.UZERO, + depositor: "", + amount: [], + }; +} +export const MsgDeposit = { + encode( + message: MsgDeposit, + writer: _m0.Writer = _m0.Writer.create() + ): _m0.Writer { + if (!message.proposalId.isZero()) { + writer.uint32(8).uint64(message.proposalId); + } + if (message.depositor !== "") { + writer.uint32(18).string(message.depositor); + } + for (const v of message.amount) { + Coin.encode(v!, writer.uint32(26).fork()).ldelim(); + } + return writer; + }, + decode(input: _m0.Reader | Uint8Array, length?: number): MsgDeposit { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgDeposit(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.proposalId = reader.uint64() as Long; + break; + case 2: + message.depositor = reader.string(); + break; + case 3: + message.amount.push(Coin.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object: any): MsgDeposit { + return { + proposalId: isSet(object.proposalId) + ? Long.fromValue(object.proposalId) + : Long.UZERO, + depositor: isSet(object.depositor) ? String(object.depositor) : "", + amount: Array.isArray(object?.amount) + ? object.amount.map((e: any) => Coin.fromJSON(e)) + : [], + }; + }, + toJSON(message: MsgDeposit): unknown { + const obj: any = {}; + message.proposalId !== undefined && + (obj.proposalId = (message.proposalId || Long.UZERO).toString()); + message.depositor !== undefined && (obj.depositor = message.depositor); + if (message.amount) { + obj.amount = message.amount.map((e) => (e ? Coin.toJSON(e) : undefined)); + } else { + obj.amount = []; + } + return obj; + }, + fromPartial, I>>( + object: I + ): MsgDeposit { + const message = createBaseMsgDeposit(); + message.proposalId = + object.proposalId !== undefined && object.proposalId !== null + ? Long.fromValue(object.proposalId) + : Long.UZERO; + message.depositor = object.depositor ?? ""; + message.amount = object.amount?.map((e) => Coin.fromPartial(e)) || []; + return message; + }, + fromAmino(object: MsgDepositAmino): MsgDeposit { + return { + proposalId: Long.fromString(object.proposal_id), + depositor: object.depositor, + amount: Array.isArray(object?.amount) + ? object.amount.map((e: any) => Coin.fromAmino(e)) + : [], + }; + }, + toAmino(message: MsgDeposit): MsgDepositAmino { + const obj: any = {}; + obj.proposal_id = message.proposalId + ? message.proposalId.toString() + : undefined; + obj.depositor = message.depositor; + if (message.amount) { + obj.amount = message.amount.map((e) => (e ? Coin.toAmino(e) : undefined)); + } else { + obj.amount = []; + } + return obj; + }, + fromAminoMsg(object: MsgDepositAminoMsg): MsgDeposit { + return MsgDeposit.fromAmino(object.value); + }, + toAminoMsg(message: MsgDeposit): MsgDepositAminoMsg { + return { + type: "cosmos-sdk/v1/MsgDeposit", + value: MsgDeposit.toAmino(message), + }; + }, + fromProtoMsg(message: MsgDepositProtoMsg): MsgDeposit { + return MsgDeposit.decode(message.value); + }, + toProto(message: MsgDeposit): Uint8Array { + return MsgDeposit.encode(message).finish(); + }, + toProtoMsg(message: MsgDeposit): MsgDepositProtoMsg { + return { + typeUrl: "/cosmos.gov.v1.MsgDeposit", + value: MsgDeposit.encode(message).finish(), + }; + }, +}; +function createBaseMsgDepositResponse(): MsgDepositResponse { + return {}; +} +export const MsgDepositResponse = { + encode( + _: MsgDepositResponse, + writer: _m0.Writer = _m0.Writer.create() + ): _m0.Writer { + return writer; + }, + decode(input: _m0.Reader | Uint8Array, length?: number): MsgDepositResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgDepositResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(_: any): MsgDepositResponse { + return {}; + }, + toJSON(_: MsgDepositResponse): unknown { + const obj: any = {}; + return obj; + }, + fromPartial, I>>( + _: I + ): MsgDepositResponse { + const message = createBaseMsgDepositResponse(); + return message; + }, + fromAmino(_: MsgDepositResponseAmino): MsgDepositResponse { + return {}; + }, + toAmino(_: MsgDepositResponse): MsgDepositResponseAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg(object: MsgDepositResponseAminoMsg): MsgDepositResponse { + return MsgDepositResponse.fromAmino(object.value); + }, + toAminoMsg(message: MsgDepositResponse): MsgDepositResponseAminoMsg { + return { + type: "cosmos-sdk/v1/MsgDepositResponse", + value: MsgDepositResponse.toAmino(message), + }; + }, + fromProtoMsg(message: MsgDepositResponseProtoMsg): MsgDepositResponse { + return MsgDepositResponse.decode(message.value); + }, + toProto(message: MsgDepositResponse): Uint8Array { + return MsgDepositResponse.encode(message).finish(); + }, + toProtoMsg(message: MsgDepositResponse): MsgDepositResponseProtoMsg { + return { + typeUrl: "/cosmos.gov.v1.MsgDepositResponse", + value: MsgDepositResponse.encode(message).finish(), + }; + }, +}; +function createBaseMsgUpdateParams(): MsgUpdateParams { + return { + authority: "", + params: undefined, + }; +} +export const MsgUpdateParams = { + encode( + message: MsgUpdateParams, + writer: _m0.Writer = _m0.Writer.create() + ): _m0.Writer { + if (message.authority !== "") { + writer.uint32(10).string(message.authority); + } + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input: _m0.Reader | Uint8Array, length?: number): MsgUpdateParams { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.authority = reader.string(); + break; + case 2: + message.params = Params.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object: any): MsgUpdateParams { + return { + authority: isSet(object.authority) ? String(object.authority) : "", + params: isSet(object.params) ? Params.fromJSON(object.params) : undefined, + }; + }, + toJSON(message: MsgUpdateParams): unknown { + const obj: any = {}; + message.authority !== undefined && (obj.authority = message.authority); + message.params !== undefined && + (obj.params = message.params ? Params.toJSON(message.params) : undefined); + return obj; + }, + fromPartial, I>>( + object: I + ): MsgUpdateParams { + const message = createBaseMsgUpdateParams(); + message.authority = object.authority ?? ""; + message.params = + object.params !== undefined && object.params !== null + ? Params.fromPartial(object.params) + : undefined; + return message; + }, + fromAmino(object: MsgUpdateParamsAmino): MsgUpdateParams { + return { + authority: object.authority, + params: object?.params ? Params.fromAmino(object.params) : undefined, + }; + }, + toAmino(message: MsgUpdateParams): MsgUpdateParamsAmino { + const obj: any = {}; + obj.authority = message.authority; + obj.params = message.params ? Params.toAmino(message.params) : undefined; + return obj; + }, + fromAminoMsg(object: MsgUpdateParamsAminoMsg): MsgUpdateParams { + return MsgUpdateParams.fromAmino(object.value); + }, + toAminoMsg(message: MsgUpdateParams): MsgUpdateParamsAminoMsg { + return { + type: "cosmos-sdk/x/gov/v1/MsgUpdateParams", + value: MsgUpdateParams.toAmino(message), + }; + }, + fromProtoMsg(message: MsgUpdateParamsProtoMsg): MsgUpdateParams { + return MsgUpdateParams.decode(message.value); + }, + toProto(message: MsgUpdateParams): Uint8Array { + return MsgUpdateParams.encode(message).finish(); + }, + toProtoMsg(message: MsgUpdateParams): MsgUpdateParamsProtoMsg { + return { + typeUrl: "/cosmos.gov.v1.MsgUpdateParams", + value: MsgUpdateParams.encode(message).finish(), + }; + }, +}; +function createBaseMsgUpdateParamsResponse(): MsgUpdateParamsResponse { + return {}; +} +export const MsgUpdateParamsResponse = { + encode( + _: MsgUpdateParamsResponse, + writer: _m0.Writer = _m0.Writer.create() + ): _m0.Writer { + return writer; + }, + decode( + input: _m0.Reader | Uint8Array, + length?: number + ): MsgUpdateParamsResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateParamsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(_: any): MsgUpdateParamsResponse { + return {}; + }, + toJSON(_: MsgUpdateParamsResponse): unknown { + const obj: any = {}; + return obj; + }, + fromPartial, I>>( + _: I + ): MsgUpdateParamsResponse { + const message = createBaseMsgUpdateParamsResponse(); + return message; + }, + fromAmino(_: MsgUpdateParamsResponseAmino): MsgUpdateParamsResponse { + return {}; + }, + toAmino(_: MsgUpdateParamsResponse): MsgUpdateParamsResponseAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg( + object: MsgUpdateParamsResponseAminoMsg + ): MsgUpdateParamsResponse { + return MsgUpdateParamsResponse.fromAmino(object.value); + }, + toAminoMsg( + message: MsgUpdateParamsResponse + ): MsgUpdateParamsResponseAminoMsg { + return { + type: "cosmos-sdk/v1/MsgUpdateParamsResponse", + value: MsgUpdateParamsResponse.toAmino(message), + }; + }, + fromProtoMsg( + message: MsgUpdateParamsResponseProtoMsg + ): MsgUpdateParamsResponse { + return MsgUpdateParamsResponse.decode(message.value); + }, + toProto(message: MsgUpdateParamsResponse): Uint8Array { + return MsgUpdateParamsResponse.encode(message).finish(); + }, + toProtoMsg( + message: MsgUpdateParamsResponse + ): MsgUpdateParamsResponseProtoMsg { + return { + typeUrl: "/cosmos.gov.v1.MsgUpdateParamsResponse", + value: MsgUpdateParamsResponse.encode(message).finish(), + }; + }, +}; +/** Msg defines the gov Msg service. */ +export interface Msg { + /** SubmitProposal defines a method to create new proposal given the messages. */ + SubmitProposal( + request: MsgSubmitProposal + ): Promise; + /** + * ExecLegacyContent defines a Msg to be in included in a MsgSubmitProposal + * to execute a legacy content-based proposal. + */ + ExecLegacyContent( + request: MsgExecLegacyContent + ): Promise; + /** Vote defines a method to add a vote on a specific proposal. */ + Vote(request: MsgVote): Promise; + /** VoteWeighted defines a method to add a weighted vote on a specific proposal. */ + VoteWeighted(request: MsgVoteWeighted): Promise; + /** Deposit defines a method to add deposit on a specific proposal. */ + Deposit(request: MsgDeposit): Promise; + /** + * UpdateParams defines a governance operation for updating the x/gov module + * parameters. The authority is defined in the keeper. + * + * Since: cosmos-sdk 0.47 + */ + UpdateParams(request: MsgUpdateParams): Promise; +} +export class MsgClientImpl implements Msg { + private readonly rpc: Rpc; + constructor(rpc: Rpc) { + this.rpc = rpc; + this.SubmitProposal = this.SubmitProposal.bind(this); + this.ExecLegacyContent = this.ExecLegacyContent.bind(this); + this.Vote = this.Vote.bind(this); + this.VoteWeighted = this.VoteWeighted.bind(this); + this.Deposit = this.Deposit.bind(this); + this.UpdateParams = this.UpdateParams.bind(this); + } + SubmitProposal( + request: MsgSubmitProposal + ): Promise { + const data = MsgSubmitProposal.encode(request).finish(); + const promise = this.rpc.request( + "cosmos.gov.v1.Msg", + "SubmitProposal", + data + ); + return promise.then((data) => + MsgSubmitProposalResponse.decode(new _m0.Reader(data)) + ); + } + ExecLegacyContent( + request: MsgExecLegacyContent + ): Promise { + const data = MsgExecLegacyContent.encode(request).finish(); + const promise = this.rpc.request( + "cosmos.gov.v1.Msg", + "ExecLegacyContent", + data + ); + return promise.then((data) => + MsgExecLegacyContentResponse.decode(new _m0.Reader(data)) + ); + } + Vote(request: MsgVote): Promise { + const data = MsgVote.encode(request).finish(); + const promise = this.rpc.request("cosmos.gov.v1.Msg", "Vote", data); + return promise.then((data) => MsgVoteResponse.decode(new _m0.Reader(data))); + } + VoteWeighted(request: MsgVoteWeighted): Promise { + const data = MsgVoteWeighted.encode(request).finish(); + const promise = this.rpc.request("cosmos.gov.v1.Msg", "VoteWeighted", data); + return promise.then((data) => + MsgVoteWeightedResponse.decode(new _m0.Reader(data)) + ); + } + Deposit(request: MsgDeposit): Promise { + const data = MsgDeposit.encode(request).finish(); + const promise = this.rpc.request("cosmos.gov.v1.Msg", "Deposit", data); + return promise.then((data) => + MsgDepositResponse.decode(new _m0.Reader(data)) + ); + } + UpdateParams(request: MsgUpdateParams): Promise { + const data = MsgUpdateParams.encode(request).finish(); + const promise = this.rpc.request("cosmos.gov.v1.Msg", "UpdateParams", data); + return promise.then((data) => + MsgUpdateParamsResponse.decode(new _m0.Reader(data)) + ); + } +} diff --git a/packages/types/src/cosmos/gov/v1beta1/genesis.ts b/packages/types/src/cosmos/gov/v1beta1/genesis.ts new file mode 100644 index 000000000..d388f6ebf --- /dev/null +++ b/packages/types/src/cosmos/gov/v1beta1/genesis.ts @@ -0,0 +1,315 @@ +/* eslint-disable */ +import { + Deposit, + DepositAmino, + Vote, + VoteAmino, + Proposal, + ProposalAmino, + DepositParams, + DepositParamsAmino, + VotingParams, + VotingParamsAmino, + TallyParams, + TallyParamsAmino, +} from "./gov"; +import { Long, isSet, DeepPartial, Exact } from "../../../helpers"; +import * as _m0 from "protobufjs/minimal"; +export const protobufPackage = "cosmos.gov.v1beta1"; +/** GenesisState defines the gov module's genesis state. */ +export interface GenesisState { + /** starting_proposal_id is the ID of the starting proposal. */ + startingProposalId: Long; + /** deposits defines all the deposits present at genesis. */ + deposits: Deposit[]; + /** votes defines all the votes present at genesis. */ + votes: Vote[]; + /** proposals defines all the proposals present at genesis. */ + proposals: Proposal[]; + /** params defines all the parameters of related to deposit. */ + depositParams?: DepositParams; + /** params defines all the parameters of related to voting. */ + votingParams?: VotingParams; + /** params defines all the parameters of related to tally. */ + tallyParams?: TallyParams; +} +export interface GenesisStateProtoMsg { + typeUrl: "/cosmos.gov.v1beta1.GenesisState"; + value: Uint8Array; +} +/** GenesisState defines the gov module's genesis state. */ +export interface GenesisStateAmino { + /** starting_proposal_id is the ID of the starting proposal. */ + starting_proposal_id: string; + /** deposits defines all the deposits present at genesis. */ + deposits: DepositAmino[]; + /** votes defines all the votes present at genesis. */ + votes: VoteAmino[]; + /** proposals defines all the proposals present at genesis. */ + proposals: ProposalAmino[]; + /** params defines all the parameters of related to deposit. */ + deposit_params?: DepositParamsAmino; + /** params defines all the parameters of related to voting. */ + voting_params?: VotingParamsAmino; + /** params defines all the parameters of related to tally. */ + tally_params?: TallyParamsAmino; +} +export interface GenesisStateAminoMsg { + type: "cosmos-sdk/GenesisState"; + value: GenesisStateAmino; +} +function createBaseGenesisState(): GenesisState { + return { + startingProposalId: Long.UZERO, + deposits: [], + votes: [], + proposals: [], + depositParams: undefined, + votingParams: undefined, + tallyParams: undefined, + }; +} +export const GenesisState = { + encode( + message: GenesisState, + writer: _m0.Writer = _m0.Writer.create() + ): _m0.Writer { + if (!message.startingProposalId.isZero()) { + writer.uint32(8).uint64(message.startingProposalId); + } + for (const v of message.deposits) { + Deposit.encode(v!, writer.uint32(18).fork()).ldelim(); + } + for (const v of message.votes) { + Vote.encode(v!, writer.uint32(26).fork()).ldelim(); + } + for (const v of message.proposals) { + Proposal.encode(v!, writer.uint32(34).fork()).ldelim(); + } + if (message.depositParams !== undefined) { + DepositParams.encode( + message.depositParams, + writer.uint32(42).fork() + ).ldelim(); + } + if (message.votingParams !== undefined) { + VotingParams.encode( + message.votingParams, + writer.uint32(50).fork() + ).ldelim(); + } + if (message.tallyParams !== undefined) { + TallyParams.encode( + message.tallyParams, + writer.uint32(58).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.startingProposalId = reader.uint64() as Long; + break; + case 2: + message.deposits.push(Deposit.decode(reader, reader.uint32())); + break; + case 3: + message.votes.push(Vote.decode(reader, reader.uint32())); + break; + case 4: + message.proposals.push(Proposal.decode(reader, reader.uint32())); + break; + case 5: + message.depositParams = DepositParams.decode(reader, reader.uint32()); + break; + case 6: + message.votingParams = VotingParams.decode(reader, reader.uint32()); + break; + case 7: + message.tallyParams = TallyParams.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object: any): GenesisState { + return { + startingProposalId: isSet(object.startingProposalId) + ? Long.fromValue(object.startingProposalId) + : Long.UZERO, + deposits: Array.isArray(object?.deposits) + ? object.deposits.map((e: any) => Deposit.fromJSON(e)) + : [], + votes: Array.isArray(object?.votes) + ? object.votes.map((e: any) => Vote.fromJSON(e)) + : [], + proposals: Array.isArray(object?.proposals) + ? object.proposals.map((e: any) => Proposal.fromJSON(e)) + : [], + depositParams: isSet(object.depositParams) + ? DepositParams.fromJSON(object.depositParams) + : undefined, + votingParams: isSet(object.votingParams) + ? VotingParams.fromJSON(object.votingParams) + : undefined, + tallyParams: isSet(object.tallyParams) + ? TallyParams.fromJSON(object.tallyParams) + : undefined, + }; + }, + toJSON(message: GenesisState): unknown { + const obj: any = {}; + message.startingProposalId !== undefined && + (obj.startingProposalId = ( + message.startingProposalId || Long.UZERO + ).toString()); + if (message.deposits) { + obj.deposits = message.deposits.map((e) => + e ? Deposit.toJSON(e) : undefined + ); + } else { + obj.deposits = []; + } + if (message.votes) { + obj.votes = message.votes.map((e) => (e ? Vote.toJSON(e) : undefined)); + } else { + obj.votes = []; + } + if (message.proposals) { + obj.proposals = message.proposals.map((e) => + e ? Proposal.toJSON(e) : undefined + ); + } else { + obj.proposals = []; + } + message.depositParams !== undefined && + (obj.depositParams = message.depositParams + ? DepositParams.toJSON(message.depositParams) + : undefined); + message.votingParams !== undefined && + (obj.votingParams = message.votingParams + ? VotingParams.toJSON(message.votingParams) + : undefined); + message.tallyParams !== undefined && + (obj.tallyParams = message.tallyParams + ? TallyParams.toJSON(message.tallyParams) + : undefined); + return obj; + }, + fromPartial, I>>( + object: I + ): GenesisState { + const message = createBaseGenesisState(); + message.startingProposalId = + object.startingProposalId !== undefined && + object.startingProposalId !== null + ? Long.fromValue(object.startingProposalId) + : Long.UZERO; + message.deposits = + object.deposits?.map((e) => Deposit.fromPartial(e)) || []; + message.votes = object.votes?.map((e) => Vote.fromPartial(e)) || []; + message.proposals = + object.proposals?.map((e) => Proposal.fromPartial(e)) || []; + message.depositParams = + object.depositParams !== undefined && object.depositParams !== null + ? DepositParams.fromPartial(object.depositParams) + : undefined; + message.votingParams = + object.votingParams !== undefined && object.votingParams !== null + ? VotingParams.fromPartial(object.votingParams) + : undefined; + message.tallyParams = + object.tallyParams !== undefined && object.tallyParams !== null + ? TallyParams.fromPartial(object.tallyParams) + : undefined; + return message; + }, + fromAmino(object: GenesisStateAmino): GenesisState { + return { + startingProposalId: Long.fromString(object.starting_proposal_id), + deposits: Array.isArray(object?.deposits) + ? object.deposits.map((e: any) => Deposit.fromAmino(e)) + : [], + votes: Array.isArray(object?.votes) + ? object.votes.map((e: any) => Vote.fromAmino(e)) + : [], + proposals: Array.isArray(object?.proposals) + ? object.proposals.map((e: any) => Proposal.fromAmino(e)) + : [], + depositParams: object?.deposit_params + ? DepositParams.fromAmino(object.deposit_params) + : undefined, + votingParams: object?.voting_params + ? VotingParams.fromAmino(object.voting_params) + : undefined, + tallyParams: object?.tally_params + ? TallyParams.fromAmino(object.tally_params) + : undefined, + }; + }, + toAmino(message: GenesisState): GenesisStateAmino { + const obj: any = {}; + obj.starting_proposal_id = message.startingProposalId + ? message.startingProposalId.toString() + : undefined; + if (message.deposits) { + obj.deposits = message.deposits.map((e) => + e ? Deposit.toAmino(e) : undefined + ); + } else { + obj.deposits = []; + } + if (message.votes) { + obj.votes = message.votes.map((e) => (e ? Vote.toAmino(e) : undefined)); + } else { + obj.votes = []; + } + if (message.proposals) { + obj.proposals = message.proposals.map((e) => + e ? Proposal.toAmino(e) : undefined + ); + } else { + obj.proposals = []; + } + obj.deposit_params = message.depositParams + ? DepositParams.toAmino(message.depositParams) + : undefined; + obj.voting_params = message.votingParams + ? VotingParams.toAmino(message.votingParams) + : undefined; + obj.tally_params = message.tallyParams + ? TallyParams.toAmino(message.tallyParams) + : undefined; + return obj; + }, + fromAminoMsg(object: GenesisStateAminoMsg): GenesisState { + return GenesisState.fromAmino(object.value); + }, + toAminoMsg(message: GenesisState): GenesisStateAminoMsg { + return { + type: "cosmos-sdk/GenesisState", + value: GenesisState.toAmino(message), + }; + }, + fromProtoMsg(message: GenesisStateProtoMsg): GenesisState { + return GenesisState.decode(message.value); + }, + toProto(message: GenesisState): Uint8Array { + return GenesisState.encode(message).finish(); + }, + toProtoMsg(message: GenesisState): GenesisStateProtoMsg { + return { + typeUrl: "/cosmos.gov.v1beta1.GenesisState", + value: GenesisState.encode(message).finish(), + }; + }, +}; diff --git a/packages/types/src/cosmos/gov/v1beta1/gov.ts b/packages/types/src/cosmos/gov/v1beta1/gov.ts new file mode 100644 index 000000000..baf395fa7 --- /dev/null +++ b/packages/types/src/cosmos/gov/v1beta1/gov.ts @@ -0,0 +1,1649 @@ +/* eslint-disable */ +import { Coin, CoinAmino } from "../../base/v1beta1/coin"; +import { Any, AnyAmino } from "../../../google/protobuf/any"; +import { Timestamp, TimestampAmino } from "../../../google/protobuf/timestamp"; +import { Duration, DurationAmino } from "../../../google/protobuf/duration"; +import { + Long, + isSet, + DeepPartial, + Exact, + fromJsonTimestamp, + fromTimestamp, + bytesFromBase64, + base64FromBytes, +} from "../../../helpers"; +import * as _m0 from "protobufjs/minimal"; +export const protobufPackage = "cosmos.gov.v1beta1"; +/** VoteOption enumerates the valid vote options for a given governance proposal. */ +export enum VoteOption { + /** VOTE_OPTION_UNSPECIFIED - VOTE_OPTION_UNSPECIFIED defines a no-op vote option. */ + VOTE_OPTION_UNSPECIFIED = 0, + /** VOTE_OPTION_YES - VOTE_OPTION_YES defines a yes vote option. */ + VOTE_OPTION_YES = 1, + /** VOTE_OPTION_ABSTAIN - VOTE_OPTION_ABSTAIN defines an abstain vote option. */ + VOTE_OPTION_ABSTAIN = 2, + /** VOTE_OPTION_NO - VOTE_OPTION_NO defines a no vote option. */ + VOTE_OPTION_NO = 3, + /** VOTE_OPTION_NO_WITH_VETO - VOTE_OPTION_NO_WITH_VETO defines a no with veto vote option. */ + VOTE_OPTION_NO_WITH_VETO = 4, + UNRECOGNIZED = -1, +} +export const VoteOptionAmino = VoteOption; +export function voteOptionFromJSON(object: any): VoteOption { + switch (object) { + case 0: + case "VOTE_OPTION_UNSPECIFIED": + return VoteOption.VOTE_OPTION_UNSPECIFIED; + case 1: + case "VOTE_OPTION_YES": + return VoteOption.VOTE_OPTION_YES; + case 2: + case "VOTE_OPTION_ABSTAIN": + return VoteOption.VOTE_OPTION_ABSTAIN; + case 3: + case "VOTE_OPTION_NO": + return VoteOption.VOTE_OPTION_NO; + case 4: + case "VOTE_OPTION_NO_WITH_VETO": + return VoteOption.VOTE_OPTION_NO_WITH_VETO; + case -1: + case "UNRECOGNIZED": + default: + return VoteOption.UNRECOGNIZED; + } +} +export function voteOptionToJSON(object: VoteOption): string { + switch (object) { + case VoteOption.VOTE_OPTION_UNSPECIFIED: + return "VOTE_OPTION_UNSPECIFIED"; + case VoteOption.VOTE_OPTION_YES: + return "VOTE_OPTION_YES"; + case VoteOption.VOTE_OPTION_ABSTAIN: + return "VOTE_OPTION_ABSTAIN"; + case VoteOption.VOTE_OPTION_NO: + return "VOTE_OPTION_NO"; + case VoteOption.VOTE_OPTION_NO_WITH_VETO: + return "VOTE_OPTION_NO_WITH_VETO"; + case VoteOption.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} +/** ProposalStatus enumerates the valid statuses of a proposal. */ +export enum ProposalStatus { + /** PROPOSAL_STATUS_UNSPECIFIED - PROPOSAL_STATUS_UNSPECIFIED defines the default proposal status. */ + PROPOSAL_STATUS_UNSPECIFIED = 0, + /** + * PROPOSAL_STATUS_DEPOSIT_PERIOD - PROPOSAL_STATUS_DEPOSIT_PERIOD defines a proposal status during the deposit + * period. + */ + PROPOSAL_STATUS_DEPOSIT_PERIOD = 1, + /** + * PROPOSAL_STATUS_VOTING_PERIOD - PROPOSAL_STATUS_VOTING_PERIOD defines a proposal status during the voting + * period. + */ + PROPOSAL_STATUS_VOTING_PERIOD = 2, + /** + * PROPOSAL_STATUS_PASSED - PROPOSAL_STATUS_PASSED defines a proposal status of a proposal that has + * passed. + */ + PROPOSAL_STATUS_PASSED = 3, + /** + * PROPOSAL_STATUS_REJECTED - PROPOSAL_STATUS_REJECTED defines a proposal status of a proposal that has + * been rejected. + */ + PROPOSAL_STATUS_REJECTED = 4, + /** + * PROPOSAL_STATUS_FAILED - PROPOSAL_STATUS_FAILED defines a proposal status of a proposal that has + * failed. + */ + PROPOSAL_STATUS_FAILED = 5, + UNRECOGNIZED = -1, +} +export const ProposalStatusAmino = ProposalStatus; +export function proposalStatusFromJSON(object: any): ProposalStatus { + switch (object) { + case 0: + case "PROPOSAL_STATUS_UNSPECIFIED": + return ProposalStatus.PROPOSAL_STATUS_UNSPECIFIED; + case 1: + case "PROPOSAL_STATUS_DEPOSIT_PERIOD": + return ProposalStatus.PROPOSAL_STATUS_DEPOSIT_PERIOD; + case 2: + case "PROPOSAL_STATUS_VOTING_PERIOD": + return ProposalStatus.PROPOSAL_STATUS_VOTING_PERIOD; + case 3: + case "PROPOSAL_STATUS_PASSED": + return ProposalStatus.PROPOSAL_STATUS_PASSED; + case 4: + case "PROPOSAL_STATUS_REJECTED": + return ProposalStatus.PROPOSAL_STATUS_REJECTED; + case 5: + case "PROPOSAL_STATUS_FAILED": + return ProposalStatus.PROPOSAL_STATUS_FAILED; + case -1: + case "UNRECOGNIZED": + default: + return ProposalStatus.UNRECOGNIZED; + } +} +export function proposalStatusToJSON(object: ProposalStatus): string { + switch (object) { + case ProposalStatus.PROPOSAL_STATUS_UNSPECIFIED: + return "PROPOSAL_STATUS_UNSPECIFIED"; + case ProposalStatus.PROPOSAL_STATUS_DEPOSIT_PERIOD: + return "PROPOSAL_STATUS_DEPOSIT_PERIOD"; + case ProposalStatus.PROPOSAL_STATUS_VOTING_PERIOD: + return "PROPOSAL_STATUS_VOTING_PERIOD"; + case ProposalStatus.PROPOSAL_STATUS_PASSED: + return "PROPOSAL_STATUS_PASSED"; + case ProposalStatus.PROPOSAL_STATUS_REJECTED: + return "PROPOSAL_STATUS_REJECTED"; + case ProposalStatus.PROPOSAL_STATUS_FAILED: + return "PROPOSAL_STATUS_FAILED"; + case ProposalStatus.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} +/** + * WeightedVoteOption defines a unit of vote for vote split. + * + * Since: cosmos-sdk 0.43 + */ +export interface WeightedVoteOption { + /** option defines the valid vote options, it must not contain duplicate vote options. */ + option: VoteOption; + /** weight is the vote weight associated with the vote option. */ + weight: string; +} +export interface WeightedVoteOptionProtoMsg { + typeUrl: "/cosmos.gov.v1beta1.WeightedVoteOption"; + value: Uint8Array; +} +/** + * WeightedVoteOption defines a unit of vote for vote split. + * + * Since: cosmos-sdk 0.43 + */ +export interface WeightedVoteOptionAmino { + /** option defines the valid vote options, it must not contain duplicate vote options. */ + option: VoteOption; + /** weight is the vote weight associated with the vote option. */ + weight: string; +} +export interface WeightedVoteOptionAminoMsg { + type: "cosmos-sdk/WeightedVoteOption"; + value: WeightedVoteOptionAmino; +} +/** + * TextProposal defines a standard text proposal whose changes need to be + * manually updated in case of approval. + */ +export interface TextProposal { + /** title of the proposal. */ + title: string; + /** description associated with the proposal. */ + description: string; +} +export interface TextProposalProtoMsg { + typeUrl: "/cosmos.gov.v1beta1.TextProposal"; + value: Uint8Array; +} +/** + * TextProposal defines a standard text proposal whose changes need to be + * manually updated in case of approval. + */ +export interface TextProposalAmino { + /** title of the proposal. */ + title: string; + /** description associated with the proposal. */ + description: string; +} +export interface TextProposalAminoMsg { + type: "cosmos-sdk/TextProposal"; + value: TextProposalAmino; +} +/** + * Deposit defines an amount deposited by an account address to an active + * proposal. + */ +export interface Deposit { + /** proposal_id defines the unique id of the proposal. */ + proposalId: Long; + /** depositor defines the deposit addresses from the proposals. */ + depositor: string; + /** amount to be deposited by depositor. */ + amount: Coin[]; +} +export interface DepositProtoMsg { + typeUrl: "/cosmos.gov.v1beta1.Deposit"; + value: Uint8Array; +} +/** + * Deposit defines an amount deposited by an account address to an active + * proposal. + */ +export interface DepositAmino { + /** proposal_id defines the unique id of the proposal. */ + proposal_id: string; + /** depositor defines the deposit addresses from the proposals. */ + depositor: string; + /** amount to be deposited by depositor. */ + amount: CoinAmino[]; +} +export interface DepositAminoMsg { + type: "cosmos-sdk/Deposit"; + value: DepositAmino; +} +/** Proposal defines the core field members of a governance proposal. */ +export interface Proposal { + /** proposal_id defines the unique id of the proposal. */ + proposalId: Long; + /** content is the proposal's content. */ + content?: Any; + /** status defines the proposal status. */ + status: ProposalStatus; + /** + * final_tally_result is the final tally result of the proposal. When + * querying a proposal via gRPC, this field is not populated until the + * proposal's voting period has ended. + */ + finalTallyResult?: TallyResult; + /** submit_time is the time of proposal submission. */ + submitTime?: Timestamp; + /** deposit_end_time is the end time for deposition. */ + depositEndTime?: Timestamp; + /** total_deposit is the total deposit on the proposal. */ + totalDeposit: Coin[]; + /** voting_start_time is the starting time to vote on a proposal. */ + votingStartTime?: Timestamp; + /** voting_end_time is the end time of voting on a proposal. */ + votingEndTime?: Timestamp; +} +export interface ProposalProtoMsg { + typeUrl: "/cosmos.gov.v1beta1.Proposal"; + value: Uint8Array; +} +/** Proposal defines the core field members of a governance proposal. */ +export interface ProposalAmino { + /** proposal_id defines the unique id of the proposal. */ + proposal_id: string; + /** content is the proposal's content. */ + content?: AnyAmino; + /** status defines the proposal status. */ + status: ProposalStatus; + /** + * final_tally_result is the final tally result of the proposal. When + * querying a proposal via gRPC, this field is not populated until the + * proposal's voting period has ended. + */ + final_tally_result?: TallyResultAmino; + /** submit_time is the time of proposal submission. */ + submit_time?: TimestampAmino; + /** deposit_end_time is the end time for deposition. */ + deposit_end_time?: TimestampAmino; + /** total_deposit is the total deposit on the proposal. */ + total_deposit: CoinAmino[]; + /** voting_start_time is the starting time to vote on a proposal. */ + voting_start_time?: TimestampAmino; + /** voting_end_time is the end time of voting on a proposal. */ + voting_end_time?: TimestampAmino; +} +export interface ProposalAminoMsg { + type: "cosmos-sdk/Proposal"; + value: ProposalAmino; +} +/** TallyResult defines a standard tally for a governance proposal. */ +export interface TallyResult { + /** yes is the number of yes votes on a proposal. */ + yes: string; + /** abstain is the number of abstain votes on a proposal. */ + abstain: string; + /** no is the number of no votes on a proposal. */ + no: string; + /** no_with_veto is the number of no with veto votes on a proposal. */ + noWithVeto: string; +} +export interface TallyResultProtoMsg { + typeUrl: "/cosmos.gov.v1beta1.TallyResult"; + value: Uint8Array; +} +/** TallyResult defines a standard tally for a governance proposal. */ +export interface TallyResultAmino { + /** yes is the number of yes votes on a proposal. */ + yes: string; + /** abstain is the number of abstain votes on a proposal. */ + abstain: string; + /** no is the number of no votes on a proposal. */ + no: string; + /** no_with_veto is the number of no with veto votes on a proposal. */ + no_with_veto: string; +} +export interface TallyResultAminoMsg { + type: "cosmos-sdk/TallyResult"; + value: TallyResultAmino; +} +/** + * Vote defines a vote on a governance proposal. + * A Vote consists of a proposal ID, the voter, and the vote option. + */ +export interface Vote { + /** proposal_id defines the unique id of the proposal. */ + proposalId: Long; + /** voter is the voter address of the proposal. */ + voter: string; + /** + * Deprecated: Prefer to use `options` instead. This field is set in queries + * if and only if `len(options) == 1` and that option has weight 1. In all + * other cases, this field will default to VOTE_OPTION_UNSPECIFIED. + */ + /** @deprecated */ + option: VoteOption; + /** + * options is the weighted vote options. + * + * Since: cosmos-sdk 0.43 + */ + options: WeightedVoteOption[]; +} +export interface VoteProtoMsg { + typeUrl: "/cosmos.gov.v1beta1.Vote"; + value: Uint8Array; +} +/** + * Vote defines a vote on a governance proposal. + * A Vote consists of a proposal ID, the voter, and the vote option. + */ +export interface VoteAmino { + /** proposal_id defines the unique id of the proposal. */ + proposal_id: string; + /** voter is the voter address of the proposal. */ + voter: string; + /** + * Deprecated: Prefer to use `options` instead. This field is set in queries + * if and only if `len(options) == 1` and that option has weight 1. In all + * other cases, this field will default to VOTE_OPTION_UNSPECIFIED. + */ + /** @deprecated */ + option: VoteOption; + /** + * options is the weighted vote options. + * + * Since: cosmos-sdk 0.43 + */ + options: WeightedVoteOptionAmino[]; +} +export interface VoteAminoMsg { + type: "cosmos-sdk/Vote"; + value: VoteAmino; +} +/** DepositParams defines the params for deposits on governance proposals. */ +export interface DepositParams { + /** Minimum deposit for a proposal to enter voting period. */ + minDeposit: Coin[]; + /** + * Maximum period for Atom holders to deposit on a proposal. Initial value: 2 + * months. + */ + maxDepositPeriod?: Duration; +} +export interface DepositParamsProtoMsg { + typeUrl: "/cosmos.gov.v1beta1.DepositParams"; + value: Uint8Array; +} +/** DepositParams defines the params for deposits on governance proposals. */ +export interface DepositParamsAmino { + /** Minimum deposit for a proposal to enter voting period. */ + min_deposit: CoinAmino[]; + /** + * Maximum period for Atom holders to deposit on a proposal. Initial value: 2 + * months. + */ + max_deposit_period?: DurationAmino; +} +export interface DepositParamsAminoMsg { + type: "cosmos-sdk/DepositParams"; + value: DepositParamsAmino; +} +/** VotingParams defines the params for voting on governance proposals. */ +export interface VotingParams { + /** Duration of the voting period. */ + votingPeriod?: Duration; +} +export interface VotingParamsProtoMsg { + typeUrl: "/cosmos.gov.v1beta1.VotingParams"; + value: Uint8Array; +} +/** VotingParams defines the params for voting on governance proposals. */ +export interface VotingParamsAmino { + /** Duration of the voting period. */ + voting_period?: DurationAmino; +} +export interface VotingParamsAminoMsg { + type: "cosmos-sdk/VotingParams"; + value: VotingParamsAmino; +} +/** TallyParams defines the params for tallying votes on governance proposals. */ +export interface TallyParams { + /** + * Minimum percentage of total stake needed to vote for a result to be + * considered valid. + */ + quorum: Uint8Array; + /** Minimum proportion of Yes votes for proposal to pass. Default value: 0.5. */ + threshold: Uint8Array; + /** + * Minimum value of Veto votes to Total votes ratio for proposal to be + * vetoed. Default value: 1/3. + */ + vetoThreshold: Uint8Array; +} +export interface TallyParamsProtoMsg { + typeUrl: "/cosmos.gov.v1beta1.TallyParams"; + value: Uint8Array; +} +/** TallyParams defines the params for tallying votes on governance proposals. */ +export interface TallyParamsAmino { + /** + * Minimum percentage of total stake needed to vote for a result to be + * considered valid. + */ + quorum: Uint8Array; + /** Minimum proportion of Yes votes for proposal to pass. Default value: 0.5. */ + threshold: Uint8Array; + /** + * Minimum value of Veto votes to Total votes ratio for proposal to be + * vetoed. Default value: 1/3. + */ + veto_threshold: Uint8Array; +} +export interface TallyParamsAminoMsg { + type: "cosmos-sdk/TallyParams"; + value: TallyParamsAmino; +} +function createBaseWeightedVoteOption(): WeightedVoteOption { + return { + option: 0, + weight: "", + }; +} +export const WeightedVoteOption = { + encode( + message: WeightedVoteOption, + writer: _m0.Writer = _m0.Writer.create() + ): _m0.Writer { + if (message.option !== 0) { + writer.uint32(8).int32(message.option); + } + if (message.weight !== "") { + writer.uint32(18).string(message.weight); + } + return writer; + }, + decode(input: _m0.Reader | Uint8Array, length?: number): WeightedVoteOption { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseWeightedVoteOption(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.option = reader.int32() as any; + break; + case 2: + message.weight = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object: any): WeightedVoteOption { + return { + option: isSet(object.option) ? voteOptionFromJSON(object.option) : 0, + weight: isSet(object.weight) ? String(object.weight) : "", + }; + }, + toJSON(message: WeightedVoteOption): unknown { + const obj: any = {}; + message.option !== undefined && + (obj.option = voteOptionToJSON(message.option)); + message.weight !== undefined && (obj.weight = message.weight); + return obj; + }, + fromPartial, I>>( + object: I + ): WeightedVoteOption { + const message = createBaseWeightedVoteOption(); + message.option = object.option ?? 0; + message.weight = object.weight ?? ""; + return message; + }, + fromAmino(object: WeightedVoteOptionAmino): WeightedVoteOption { + return { + option: isSet(object.option) ? voteOptionFromJSON(object.option) : 0, + weight: object.weight, + }; + }, + toAmino(message: WeightedVoteOption): WeightedVoteOptionAmino { + const obj: any = {}; + obj.option = message.option; + obj.weight = message.weight; + return obj; + }, + fromAminoMsg(object: WeightedVoteOptionAminoMsg): WeightedVoteOption { + return WeightedVoteOption.fromAmino(object.value); + }, + toAminoMsg(message: WeightedVoteOption): WeightedVoteOptionAminoMsg { + return { + type: "cosmos-sdk/WeightedVoteOption", + value: WeightedVoteOption.toAmino(message), + }; + }, + fromProtoMsg(message: WeightedVoteOptionProtoMsg): WeightedVoteOption { + return WeightedVoteOption.decode(message.value); + }, + toProto(message: WeightedVoteOption): Uint8Array { + return WeightedVoteOption.encode(message).finish(); + }, + toProtoMsg(message: WeightedVoteOption): WeightedVoteOptionProtoMsg { + return { + typeUrl: "/cosmos.gov.v1beta1.WeightedVoteOption", + value: WeightedVoteOption.encode(message).finish(), + }; + }, +}; +function createBaseTextProposal(): TextProposal { + return { + title: "", + description: "", + }; +} +export const TextProposal = { + encode( + message: TextProposal, + writer: _m0.Writer = _m0.Writer.create() + ): _m0.Writer { + if (message.title !== "") { + writer.uint32(10).string(message.title); + } + if (message.description !== "") { + writer.uint32(18).string(message.description); + } + return writer; + }, + decode(input: _m0.Reader | Uint8Array, length?: number): TextProposal { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseTextProposal(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.title = reader.string(); + break; + case 2: + message.description = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object: any): TextProposal { + return { + title: isSet(object.title) ? String(object.title) : "", + description: isSet(object.description) ? String(object.description) : "", + }; + }, + toJSON(message: TextProposal): unknown { + const obj: any = {}; + message.title !== undefined && (obj.title = message.title); + message.description !== undefined && + (obj.description = message.description); + return obj; + }, + fromPartial, I>>( + object: I + ): TextProposal { + const message = createBaseTextProposal(); + message.title = object.title ?? ""; + message.description = object.description ?? ""; + return message; + }, + fromAmino(object: TextProposalAmino): TextProposal { + return { + title: object.title, + description: object.description, + }; + }, + toAmino(message: TextProposal): TextProposalAmino { + const obj: any = {}; + obj.title = message.title; + obj.description = message.description; + return obj; + }, + fromAminoMsg(object: TextProposalAminoMsg): TextProposal { + return TextProposal.fromAmino(object.value); + }, + toAminoMsg(message: TextProposal): TextProposalAminoMsg { + return { + type: "cosmos-sdk/TextProposal", + value: TextProposal.toAmino(message), + }; + }, + fromProtoMsg(message: TextProposalProtoMsg): TextProposal { + return TextProposal.decode(message.value); + }, + toProto(message: TextProposal): Uint8Array { + return TextProposal.encode(message).finish(); + }, + toProtoMsg(message: TextProposal): TextProposalProtoMsg { + return { + typeUrl: "/cosmos.gov.v1beta1.TextProposal", + value: TextProposal.encode(message).finish(), + }; + }, +}; +function createBaseDeposit(): Deposit { + return { + proposalId: Long.UZERO, + depositor: "", + amount: [], + }; +} +export const Deposit = { + encode( + message: Deposit, + writer: _m0.Writer = _m0.Writer.create() + ): _m0.Writer { + if (!message.proposalId.isZero()) { + writer.uint32(8).uint64(message.proposalId); + } + if (message.depositor !== "") { + writer.uint32(18).string(message.depositor); + } + for (const v of message.amount) { + Coin.encode(v!, writer.uint32(26).fork()).ldelim(); + } + return writer; + }, + decode(input: _m0.Reader | Uint8Array, length?: number): Deposit { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDeposit(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.proposalId = reader.uint64() as Long; + break; + case 2: + message.depositor = reader.string(); + break; + case 3: + message.amount.push(Coin.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object: any): Deposit { + return { + proposalId: isSet(object.proposalId) + ? Long.fromValue(object.proposalId) + : Long.UZERO, + depositor: isSet(object.depositor) ? String(object.depositor) : "", + amount: Array.isArray(object?.amount) + ? object.amount.map((e: any) => Coin.fromJSON(e)) + : [], + }; + }, + toJSON(message: Deposit): unknown { + const obj: any = {}; + message.proposalId !== undefined && + (obj.proposalId = (message.proposalId || Long.UZERO).toString()); + message.depositor !== undefined && (obj.depositor = message.depositor); + if (message.amount) { + obj.amount = message.amount.map((e) => (e ? Coin.toJSON(e) : undefined)); + } else { + obj.amount = []; + } + return obj; + }, + fromPartial, I>>(object: I): Deposit { + const message = createBaseDeposit(); + message.proposalId = + object.proposalId !== undefined && object.proposalId !== null + ? Long.fromValue(object.proposalId) + : Long.UZERO; + message.depositor = object.depositor ?? ""; + message.amount = object.amount?.map((e) => Coin.fromPartial(e)) || []; + return message; + }, + fromAmino(object: DepositAmino): Deposit { + return { + proposalId: Long.fromString(object.proposal_id), + depositor: object.depositor, + amount: Array.isArray(object?.amount) + ? object.amount.map((e: any) => Coin.fromAmino(e)) + : [], + }; + }, + toAmino(message: Deposit): DepositAmino { + const obj: any = {}; + obj.proposal_id = message.proposalId + ? message.proposalId.toString() + : undefined; + obj.depositor = message.depositor; + if (message.amount) { + obj.amount = message.amount.map((e) => (e ? Coin.toAmino(e) : undefined)); + } else { + obj.amount = []; + } + return obj; + }, + fromAminoMsg(object: DepositAminoMsg): Deposit { + return Deposit.fromAmino(object.value); + }, + toAminoMsg(message: Deposit): DepositAminoMsg { + return { + type: "cosmos-sdk/Deposit", + value: Deposit.toAmino(message), + }; + }, + fromProtoMsg(message: DepositProtoMsg): Deposit { + return Deposit.decode(message.value); + }, + toProto(message: Deposit): Uint8Array { + return Deposit.encode(message).finish(); + }, + toProtoMsg(message: Deposit): DepositProtoMsg { + return { + typeUrl: "/cosmos.gov.v1beta1.Deposit", + value: Deposit.encode(message).finish(), + }; + }, +}; +function createBaseProposal(): Proposal { + return { + proposalId: Long.UZERO, + content: undefined, + status: 0, + finalTallyResult: undefined, + submitTime: undefined, + depositEndTime: undefined, + totalDeposit: [], + votingStartTime: undefined, + votingEndTime: undefined, + }; +} +export const Proposal = { + encode( + message: Proposal, + writer: _m0.Writer = _m0.Writer.create() + ): _m0.Writer { + if (!message.proposalId.isZero()) { + writer.uint32(8).uint64(message.proposalId); + } + if (message.content !== undefined) { + Any.encode(message.content, writer.uint32(18).fork()).ldelim(); + } + if (message.status !== 0) { + writer.uint32(24).int32(message.status); + } + if (message.finalTallyResult !== undefined) { + TallyResult.encode( + message.finalTallyResult, + writer.uint32(34).fork() + ).ldelim(); + } + if (message.submitTime !== undefined) { + Timestamp.encode(message.submitTime, writer.uint32(42).fork()).ldelim(); + } + if (message.depositEndTime !== undefined) { + Timestamp.encode( + message.depositEndTime, + writer.uint32(50).fork() + ).ldelim(); + } + for (const v of message.totalDeposit) { + Coin.encode(v!, writer.uint32(58).fork()).ldelim(); + } + if (message.votingStartTime !== undefined) { + Timestamp.encode( + message.votingStartTime, + writer.uint32(66).fork() + ).ldelim(); + } + if (message.votingEndTime !== undefined) { + Timestamp.encode( + message.votingEndTime, + writer.uint32(74).fork() + ).ldelim(); + } + return writer; + }, + decode(input: _m0.Reader | Uint8Array, length?: number): Proposal { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseProposal(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.proposalId = reader.uint64() as Long; + break; + case 2: + message.content = Any.decode(reader, reader.uint32()); + break; + case 3: + message.status = reader.int32() as any; + break; + case 4: + message.finalTallyResult = TallyResult.decode( + reader, + reader.uint32() + ); + break; + case 5: + message.submitTime = Timestamp.decode(reader, reader.uint32()); + break; + case 6: + message.depositEndTime = Timestamp.decode(reader, reader.uint32()); + break; + case 7: + message.totalDeposit.push(Coin.decode(reader, reader.uint32())); + break; + case 8: + message.votingStartTime = Timestamp.decode(reader, reader.uint32()); + break; + case 9: + message.votingEndTime = Timestamp.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object: any): Proposal { + return { + proposalId: isSet(object.proposalId) + ? Long.fromValue(object.proposalId) + : Long.UZERO, + content: isSet(object.content) ? Any.fromJSON(object.content) : undefined, + status: isSet(object.status) ? proposalStatusFromJSON(object.status) : 0, + finalTallyResult: isSet(object.finalTallyResult) + ? TallyResult.fromJSON(object.finalTallyResult) + : undefined, + submitTime: isSet(object.submitTime) + ? fromJsonTimestamp(object.submitTime) + : undefined, + depositEndTime: isSet(object.depositEndTime) + ? fromJsonTimestamp(object.depositEndTime) + : undefined, + totalDeposit: Array.isArray(object?.totalDeposit) + ? object.totalDeposit.map((e: any) => Coin.fromJSON(e)) + : [], + votingStartTime: isSet(object.votingStartTime) + ? fromJsonTimestamp(object.votingStartTime) + : undefined, + votingEndTime: isSet(object.votingEndTime) + ? fromJsonTimestamp(object.votingEndTime) + : undefined, + }; + }, + toJSON(message: Proposal): unknown { + const obj: any = {}; + message.proposalId !== undefined && + (obj.proposalId = (message.proposalId || Long.UZERO).toString()); + message.content !== undefined && + (obj.content = message.content ? Any.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 = fromTimestamp(message.submitTime).toISOString()); + message.depositEndTime !== undefined && + (obj.depositEndTime = fromTimestamp( + message.depositEndTime + ).toISOString()); + if (message.totalDeposit) { + obj.totalDeposit = message.totalDeposit.map((e) => + e ? Coin.toJSON(e) : undefined + ); + } else { + obj.totalDeposit = []; + } + message.votingStartTime !== undefined && + (obj.votingStartTime = fromTimestamp( + message.votingStartTime + ).toISOString()); + message.votingEndTime !== undefined && + (obj.votingEndTime = fromTimestamp(message.votingEndTime).toISOString()); + return obj; + }, + fromPartial, I>>(object: I): Proposal { + const message = createBaseProposal(); + message.proposalId = + object.proposalId !== undefined && object.proposalId !== null + ? Long.fromValue(object.proposalId) + : Long.UZERO; + message.content = + object.content !== undefined && object.content !== null + ? Any.fromPartial(object.content) + : undefined; + message.status = object.status ?? 0; + message.finalTallyResult = + object.finalTallyResult !== undefined && object.finalTallyResult !== null + ? TallyResult.fromPartial(object.finalTallyResult) + : undefined; + message.submitTime = + object.submitTime !== undefined && object.submitTime !== null + ? Timestamp.fromPartial(object.submitTime) + : undefined; + message.depositEndTime = + object.depositEndTime !== undefined && object.depositEndTime !== null + ? Timestamp.fromPartial(object.depositEndTime) + : undefined; + message.totalDeposit = + object.totalDeposit?.map((e) => Coin.fromPartial(e)) || []; + message.votingStartTime = + object.votingStartTime !== undefined && object.votingStartTime !== null + ? Timestamp.fromPartial(object.votingStartTime) + : undefined; + message.votingEndTime = + object.votingEndTime !== undefined && object.votingEndTime !== null + ? Timestamp.fromPartial(object.votingEndTime) + : undefined; + return message; + }, + fromAmino(object: ProposalAmino): Proposal { + return { + proposalId: Long.fromString(object.proposal_id), + content: object?.content ? Any.fromAmino(object.content) : undefined, + status: isSet(object.status) ? proposalStatusFromJSON(object.status) : 0, + finalTallyResult: object?.final_tally_result + ? TallyResult.fromAmino(object.final_tally_result) + : undefined, + submitTime: object?.submit_time + ? Timestamp.fromAmino(object.submit_time) + : undefined, + depositEndTime: object?.deposit_end_time + ? Timestamp.fromAmino(object.deposit_end_time) + : undefined, + totalDeposit: Array.isArray(object?.total_deposit) + ? object.total_deposit.map((e: any) => Coin.fromAmino(e)) + : [], + votingStartTime: object?.voting_start_time + ? Timestamp.fromAmino(object.voting_start_time) + : undefined, + votingEndTime: object?.voting_end_time + ? Timestamp.fromAmino(object.voting_end_time) + : undefined, + }; + }, + toAmino(message: Proposal): ProposalAmino { + const obj: any = {}; + obj.proposal_id = message.proposalId + ? message.proposalId.toString() + : undefined; + obj.content = message.content ? Any.toAmino(message.content) : undefined; + obj.status = message.status; + obj.final_tally_result = message.finalTallyResult + ? TallyResult.toAmino(message.finalTallyResult) + : undefined; + obj.submit_time = message.submitTime + ? Timestamp.toAmino(message.submitTime) + : undefined; + obj.deposit_end_time = message.depositEndTime + ? Timestamp.toAmino(message.depositEndTime) + : undefined; + if (message.totalDeposit) { + obj.total_deposit = message.totalDeposit.map((e) => + e ? Coin.toAmino(e) : undefined + ); + } else { + obj.total_deposit = []; + } + obj.voting_start_time = message.votingStartTime + ? Timestamp.toAmino(message.votingStartTime) + : undefined; + obj.voting_end_time = message.votingEndTime + ? Timestamp.toAmino(message.votingEndTime) + : undefined; + return obj; + }, + fromAminoMsg(object: ProposalAminoMsg): Proposal { + return Proposal.fromAmino(object.value); + }, + toAminoMsg(message: Proposal): ProposalAminoMsg { + return { + type: "cosmos-sdk/Proposal", + value: Proposal.toAmino(message), + }; + }, + fromProtoMsg(message: ProposalProtoMsg): Proposal { + return Proposal.decode(message.value); + }, + toProto(message: Proposal): Uint8Array { + return Proposal.encode(message).finish(); + }, + toProtoMsg(message: Proposal): ProposalProtoMsg { + return { + typeUrl: "/cosmos.gov.v1beta1.Proposal", + value: Proposal.encode(message).finish(), + }; + }, +}; +function createBaseTallyResult(): TallyResult { + return { + yes: "", + abstain: "", + no: "", + noWithVeto: "", + }; +} +export const TallyResult = { + encode( + message: TallyResult, + writer: _m0.Writer = _m0.Writer.create() + ): _m0.Writer { + if (message.yes !== "") { + writer.uint32(10).string(message.yes); + } + if (message.abstain !== "") { + writer.uint32(18).string(message.abstain); + } + if (message.no !== "") { + writer.uint32(26).string(message.no); + } + if (message.noWithVeto !== "") { + writer.uint32(34).string(message.noWithVeto); + } + return writer; + }, + decode(input: _m0.Reader | Uint8Array, length?: number): TallyResult { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseTallyResult(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.yes = reader.string(); + break; + case 2: + message.abstain = reader.string(); + break; + case 3: + message.no = reader.string(); + break; + case 4: + message.noWithVeto = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object: any): TallyResult { + return { + yes: isSet(object.yes) ? String(object.yes) : "", + abstain: isSet(object.abstain) ? String(object.abstain) : "", + no: isSet(object.no) ? String(object.no) : "", + noWithVeto: isSet(object.noWithVeto) ? String(object.noWithVeto) : "", + }; + }, + toJSON(message: TallyResult): unknown { + const obj: any = {}; + message.yes !== undefined && (obj.yes = message.yes); + message.abstain !== undefined && (obj.abstain = message.abstain); + message.no !== undefined && (obj.no = message.no); + message.noWithVeto !== undefined && (obj.noWithVeto = message.noWithVeto); + return obj; + }, + fromPartial, I>>( + object: I + ): TallyResult { + const message = createBaseTallyResult(); + message.yes = object.yes ?? ""; + message.abstain = object.abstain ?? ""; + message.no = object.no ?? ""; + message.noWithVeto = object.noWithVeto ?? ""; + return message; + }, + fromAmino(object: TallyResultAmino): TallyResult { + return { + yes: object.yes, + abstain: object.abstain, + no: object.no, + noWithVeto: object.no_with_veto, + }; + }, + toAmino(message: TallyResult): TallyResultAmino { + const obj: any = {}; + obj.yes = message.yes; + obj.abstain = message.abstain; + obj.no = message.no; + obj.no_with_veto = message.noWithVeto; + return obj; + }, + fromAminoMsg(object: TallyResultAminoMsg): TallyResult { + return TallyResult.fromAmino(object.value); + }, + toAminoMsg(message: TallyResult): TallyResultAminoMsg { + return { + type: "cosmos-sdk/TallyResult", + value: TallyResult.toAmino(message), + }; + }, + fromProtoMsg(message: TallyResultProtoMsg): TallyResult { + return TallyResult.decode(message.value); + }, + toProto(message: TallyResult): Uint8Array { + return TallyResult.encode(message).finish(); + }, + toProtoMsg(message: TallyResult): TallyResultProtoMsg { + return { + typeUrl: "/cosmos.gov.v1beta1.TallyResult", + value: TallyResult.encode(message).finish(), + }; + }, +}; +function createBaseVote(): Vote { + return { + proposalId: Long.UZERO, + voter: "", + option: 0, + options: [], + }; +} +export const Vote = { + encode(message: Vote, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (!message.proposalId.isZero()) { + writer.uint32(8).uint64(message.proposalId); + } + if (message.voter !== "") { + writer.uint32(18).string(message.voter); + } + if (message.option !== 0) { + writer.uint32(24).int32(message.option); + } + for (const v of message.options) { + WeightedVoteOption.encode(v!, writer.uint32(34).fork()).ldelim(); + } + return writer; + }, + decode(input: _m0.Reader | Uint8Array, length?: number): Vote { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseVote(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.proposalId = reader.uint64() as Long; + break; + case 2: + message.voter = reader.string(); + break; + case 3: + message.option = reader.int32() as any; + break; + case 4: + message.options.push( + WeightedVoteOption.decode(reader, reader.uint32()) + ); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object: any): Vote { + return { + proposalId: isSet(object.proposalId) + ? Long.fromValue(object.proposalId) + : Long.UZERO, + voter: isSet(object.voter) ? String(object.voter) : "", + option: isSet(object.option) ? voteOptionFromJSON(object.option) : 0, + options: Array.isArray(object?.options) + ? object.options.map((e: any) => WeightedVoteOption.fromJSON(e)) + : [], + }; + }, + toJSON(message: Vote): unknown { + const obj: any = {}; + message.proposalId !== undefined && + (obj.proposalId = (message.proposalId || Long.UZERO).toString()); + message.voter !== undefined && (obj.voter = message.voter); + message.option !== undefined && + (obj.option = voteOptionToJSON(message.option)); + if (message.options) { + obj.options = message.options.map((e) => + e ? WeightedVoteOption.toJSON(e) : undefined + ); + } else { + obj.options = []; + } + return obj; + }, + fromPartial, I>>(object: I): Vote { + const message = createBaseVote(); + message.proposalId = + object.proposalId !== undefined && object.proposalId !== null + ? Long.fromValue(object.proposalId) + : Long.UZERO; + message.voter = object.voter ?? ""; + message.option = object.option ?? 0; + message.options = + object.options?.map((e) => WeightedVoteOption.fromPartial(e)) || []; + return message; + }, + fromAmino(object: VoteAmino): Vote { + return { + proposalId: Long.fromString(object.proposal_id), + voter: object.voter, + option: isSet(object.option) ? voteOptionFromJSON(object.option) : 0, + options: Array.isArray(object?.options) + ? object.options.map((e: any) => WeightedVoteOption.fromAmino(e)) + : [], + }; + }, + toAmino(message: Vote): VoteAmino { + const obj: any = {}; + obj.proposal_id = message.proposalId + ? message.proposalId.toString() + : undefined; + obj.voter = message.voter; + obj.option = message.option; + if (message.options) { + obj.options = message.options.map((e) => + e ? WeightedVoteOption.toAmino(e) : undefined + ); + } else { + obj.options = []; + } + return obj; + }, + fromAminoMsg(object: VoteAminoMsg): Vote { + return Vote.fromAmino(object.value); + }, + toAminoMsg(message: Vote): VoteAminoMsg { + return { + type: "cosmos-sdk/Vote", + value: Vote.toAmino(message), + }; + }, + fromProtoMsg(message: VoteProtoMsg): Vote { + return Vote.decode(message.value); + }, + toProto(message: Vote): Uint8Array { + return Vote.encode(message).finish(); + }, + toProtoMsg(message: Vote): VoteProtoMsg { + return { + typeUrl: "/cosmos.gov.v1beta1.Vote", + value: Vote.encode(message).finish(), + }; + }, +}; +function createBaseDepositParams(): DepositParams { + return { + minDeposit: [], + maxDepositPeriod: undefined, + }; +} +export const DepositParams = { + encode( + message: DepositParams, + writer: _m0.Writer = _m0.Writer.create() + ): _m0.Writer { + for (const v of message.minDeposit) { + Coin.encode(v!, writer.uint32(10).fork()).ldelim(); + } + if (message.maxDepositPeriod !== undefined) { + Duration.encode( + message.maxDepositPeriod, + writer.uint32(18).fork() + ).ldelim(); + } + return writer; + }, + decode(input: _m0.Reader | Uint8Array, length?: number): DepositParams { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDepositParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.minDeposit.push(Coin.decode(reader, reader.uint32())); + break; + case 2: + message.maxDepositPeriod = Duration.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object: any): DepositParams { + return { + minDeposit: Array.isArray(object?.minDeposit) + ? object.minDeposit.map((e: any) => Coin.fromJSON(e)) + : [], + maxDepositPeriod: isSet(object.maxDepositPeriod) + ? Duration.fromJSON(object.maxDepositPeriod) + : undefined, + }; + }, + toJSON(message: DepositParams): unknown { + const obj: any = {}; + if (message.minDeposit) { + obj.minDeposit = message.minDeposit.map((e) => + e ? Coin.toJSON(e) : undefined + ); + } else { + obj.minDeposit = []; + } + message.maxDepositPeriod !== undefined && + (obj.maxDepositPeriod = message.maxDepositPeriod + ? Duration.toJSON(message.maxDepositPeriod) + : undefined); + return obj; + }, + fromPartial, I>>( + object: I + ): DepositParams { + const message = createBaseDepositParams(); + message.minDeposit = + object.minDeposit?.map((e) => Coin.fromPartial(e)) || []; + message.maxDepositPeriod = + object.maxDepositPeriod !== undefined && object.maxDepositPeriod !== null + ? Duration.fromPartial(object.maxDepositPeriod) + : undefined; + return message; + }, + fromAmino(object: DepositParamsAmino): DepositParams { + return { + minDeposit: Array.isArray(object?.min_deposit) + ? object.min_deposit.map((e: any) => Coin.fromAmino(e)) + : [], + maxDepositPeriod: object?.max_deposit_period + ? Duration.fromAmino(object.max_deposit_period) + : undefined, + }; + }, + toAmino(message: DepositParams): DepositParamsAmino { + const obj: any = {}; + if (message.minDeposit) { + obj.min_deposit = message.minDeposit.map((e) => + e ? Coin.toAmino(e) : undefined + ); + } else { + obj.min_deposit = []; + } + obj.max_deposit_period = message.maxDepositPeriod + ? Duration.toAmino(message.maxDepositPeriod) + : undefined; + return obj; + }, + fromAminoMsg(object: DepositParamsAminoMsg): DepositParams { + return DepositParams.fromAmino(object.value); + }, + toAminoMsg(message: DepositParams): DepositParamsAminoMsg { + return { + type: "cosmos-sdk/DepositParams", + value: DepositParams.toAmino(message), + }; + }, + fromProtoMsg(message: DepositParamsProtoMsg): DepositParams { + return DepositParams.decode(message.value); + }, + toProto(message: DepositParams): Uint8Array { + return DepositParams.encode(message).finish(); + }, + toProtoMsg(message: DepositParams): DepositParamsProtoMsg { + return { + typeUrl: "/cosmos.gov.v1beta1.DepositParams", + value: DepositParams.encode(message).finish(), + }; + }, +}; +function createBaseVotingParams(): VotingParams { + return { + votingPeriod: undefined, + }; +} +export const VotingParams = { + encode( + message: VotingParams, + writer: _m0.Writer = _m0.Writer.create() + ): _m0.Writer { + if (message.votingPeriod !== undefined) { + Duration.encode(message.votingPeriod, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + decode(input: _m0.Reader | Uint8Array, length?: number): VotingParams { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseVotingParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.votingPeriod = Duration.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object: any): VotingParams { + return { + votingPeriod: isSet(object.votingPeriod) + ? Duration.fromJSON(object.votingPeriod) + : undefined, + }; + }, + toJSON(message: VotingParams): unknown { + const obj: any = {}; + message.votingPeriod !== undefined && + (obj.votingPeriod = message.votingPeriod + ? Duration.toJSON(message.votingPeriod) + : undefined); + return obj; + }, + fromPartial, I>>( + object: I + ): VotingParams { + const message = createBaseVotingParams(); + message.votingPeriod = + object.votingPeriod !== undefined && object.votingPeriod !== null + ? Duration.fromPartial(object.votingPeriod) + : undefined; + return message; + }, + fromAmino(object: VotingParamsAmino): VotingParams { + return { + votingPeriod: object?.voting_period + ? Duration.fromAmino(object.voting_period) + : undefined, + }; + }, + toAmino(message: VotingParams): VotingParamsAmino { + const obj: any = {}; + obj.voting_period = message.votingPeriod + ? Duration.toAmino(message.votingPeriod) + : undefined; + return obj; + }, + fromAminoMsg(object: VotingParamsAminoMsg): VotingParams { + return VotingParams.fromAmino(object.value); + }, + toAminoMsg(message: VotingParams): VotingParamsAminoMsg { + return { + type: "cosmos-sdk/VotingParams", + value: VotingParams.toAmino(message), + }; + }, + fromProtoMsg(message: VotingParamsProtoMsg): VotingParams { + return VotingParams.decode(message.value); + }, + toProto(message: VotingParams): Uint8Array { + return VotingParams.encode(message).finish(); + }, + toProtoMsg(message: VotingParams): VotingParamsProtoMsg { + return { + typeUrl: "/cosmos.gov.v1beta1.VotingParams", + value: VotingParams.encode(message).finish(), + }; + }, +}; +function createBaseTallyParams(): TallyParams { + return { + quorum: new Uint8Array(), + threshold: new Uint8Array(), + vetoThreshold: new Uint8Array(), + }; +} +export const TallyParams = { + encode( + message: TallyParams, + writer: _m0.Writer = _m0.Writer.create() + ): _m0.Writer { + if (message.quorum.length !== 0) { + writer.uint32(10).bytes(message.quorum); + } + if (message.threshold.length !== 0) { + writer.uint32(18).bytes(message.threshold); + } + if (message.vetoThreshold.length !== 0) { + writer.uint32(26).bytes(message.vetoThreshold); + } + return writer; + }, + decode(input: _m0.Reader | Uint8Array, length?: number): TallyParams { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseTallyParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.quorum = reader.bytes(); + break; + case 2: + message.threshold = reader.bytes(); + break; + case 3: + message.vetoThreshold = reader.bytes(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object: any): TallyParams { + return { + quorum: isSet(object.quorum) + ? bytesFromBase64(object.quorum) + : new Uint8Array(), + threshold: isSet(object.threshold) + ? bytesFromBase64(object.threshold) + : new Uint8Array(), + vetoThreshold: isSet(object.vetoThreshold) + ? bytesFromBase64(object.vetoThreshold) + : new Uint8Array(), + }; + }, + toJSON(message: TallyParams): unknown { + const obj: any = {}; + message.quorum !== undefined && + (obj.quorum = base64FromBytes( + message.quorum !== undefined ? message.quorum : new Uint8Array() + )); + message.threshold !== undefined && + (obj.threshold = base64FromBytes( + message.threshold !== undefined ? message.threshold : new Uint8Array() + )); + message.vetoThreshold !== undefined && + (obj.vetoThreshold = base64FromBytes( + message.vetoThreshold !== undefined + ? message.vetoThreshold + : new Uint8Array() + )); + return obj; + }, + fromPartial, I>>( + object: I + ): TallyParams { + const message = createBaseTallyParams(); + message.quorum = object.quorum ?? new Uint8Array(); + message.threshold = object.threshold ?? new Uint8Array(); + message.vetoThreshold = object.vetoThreshold ?? new Uint8Array(); + return message; + }, + fromAmino(object: TallyParamsAmino): TallyParams { + return { + quorum: object.quorum, + threshold: object.threshold, + vetoThreshold: object.veto_threshold, + }; + }, + toAmino(message: TallyParams): TallyParamsAmino { + const obj: any = {}; + obj.quorum = message.quorum; + obj.threshold = message.threshold; + obj.veto_threshold = message.vetoThreshold; + return obj; + }, + fromAminoMsg(object: TallyParamsAminoMsg): TallyParams { + return TallyParams.fromAmino(object.value); + }, + toAminoMsg(message: TallyParams): TallyParamsAminoMsg { + return { + type: "cosmos-sdk/TallyParams", + value: TallyParams.toAmino(message), + }; + }, + fromProtoMsg(message: TallyParamsProtoMsg): TallyParams { + return TallyParams.decode(message.value); + }, + toProto(message: TallyParams): Uint8Array { + return TallyParams.encode(message).finish(); + }, + toProtoMsg(message: TallyParams): TallyParamsProtoMsg { + return { + typeUrl: "/cosmos.gov.v1beta1.TallyParams", + value: TallyParams.encode(message).finish(), + }; + }, +}; diff --git a/packages/types/src/cosmos/gov/v1beta1/query.ts b/packages/types/src/cosmos/gov/v1beta1/query.ts new file mode 100644 index 000000000..d7aa6d712 --- /dev/null +++ b/packages/types/src/cosmos/gov/v1beta1/query.ts @@ -0,0 +1,2236 @@ +/* eslint-disable */ +import { + ProposalStatus, + Proposal, + ProposalAmino, + Vote, + VoteAmino, + VotingParams, + VotingParamsAmino, + DepositParams, + DepositParamsAmino, + TallyParams, + TallyParamsAmino, + Deposit, + DepositAmino, + TallyResult, + TallyResultAmino, + proposalStatusFromJSON, + proposalStatusToJSON, +} from "./gov"; +import { + PageRequest, + PageRequestAmino, + PageResponse, + PageResponseAmino, +} from "../../base/query/v1beta1/pagination"; +import { Long, isSet, DeepPartial, Exact, Rpc } from "../../../helpers"; +import * as _m0 from "protobufjs/minimal"; +export const protobufPackage = "cosmos.gov.v1beta1"; +/** QueryProposalRequest is the request type for the Query/Proposal RPC method. */ +export interface QueryProposalRequest { + /** proposal_id defines the unique id of the proposal. */ + proposalId: Long; +} +export interface QueryProposalRequestProtoMsg { + typeUrl: "/cosmos.gov.v1beta1.QueryProposalRequest"; + value: Uint8Array; +} +/** QueryProposalRequest is the request type for the Query/Proposal RPC method. */ +export interface QueryProposalRequestAmino { + /** proposal_id defines the unique id of the proposal. */ + proposal_id: string; +} +export interface QueryProposalRequestAminoMsg { + type: "cosmos-sdk/QueryProposalRequest"; + value: QueryProposalRequestAmino; +} +/** QueryProposalResponse is the response type for the Query/Proposal RPC method. */ +export interface QueryProposalResponse { + proposal?: Proposal; +} +export interface QueryProposalResponseProtoMsg { + typeUrl: "/cosmos.gov.v1beta1.QueryProposalResponse"; + value: Uint8Array; +} +/** QueryProposalResponse is the response type for the Query/Proposal RPC method. */ +export interface QueryProposalResponseAmino { + proposal?: ProposalAmino; +} +export interface QueryProposalResponseAminoMsg { + type: "cosmos-sdk/QueryProposalResponse"; + value: QueryProposalResponseAmino; +} +/** QueryProposalsRequest is the request type for the Query/Proposals RPC method. */ +export interface QueryProposalsRequest { + /** proposal_status defines the status of the proposals. */ + proposalStatus: ProposalStatus; + /** voter defines the voter address for the proposals. */ + voter: string; + /** depositor defines the deposit addresses from the proposals. */ + depositor: string; + /** pagination defines an optional pagination for the request. */ + pagination?: PageRequest; +} +export interface QueryProposalsRequestProtoMsg { + typeUrl: "/cosmos.gov.v1beta1.QueryProposalsRequest"; + value: Uint8Array; +} +/** QueryProposalsRequest is the request type for the Query/Proposals RPC method. */ +export interface QueryProposalsRequestAmino { + /** proposal_status defines the status of the proposals. */ + proposal_status: ProposalStatus; + /** voter defines the voter address for the proposals. */ + voter: string; + /** depositor defines the deposit addresses from the proposals. */ + depositor: string; + /** pagination defines an optional pagination for the request. */ + pagination?: PageRequestAmino; +} +export interface QueryProposalsRequestAminoMsg { + type: "cosmos-sdk/QueryProposalsRequest"; + value: QueryProposalsRequestAmino; +} +/** + * QueryProposalsResponse is the response type for the Query/Proposals RPC + * method. + */ +export interface QueryProposalsResponse { + /** proposals defines all the requested governance proposals. */ + proposals: Proposal[]; + /** pagination defines the pagination in the response. */ + pagination?: PageResponse; +} +export interface QueryProposalsResponseProtoMsg { + typeUrl: "/cosmos.gov.v1beta1.QueryProposalsResponse"; + value: Uint8Array; +} +/** + * QueryProposalsResponse is the response type for the Query/Proposals RPC + * method. + */ +export interface QueryProposalsResponseAmino { + /** proposals defines all the requested governance proposals. */ + proposals: ProposalAmino[]; + /** pagination defines the pagination in the response. */ + pagination?: PageResponseAmino; +} +export interface QueryProposalsResponseAminoMsg { + type: "cosmos-sdk/QueryProposalsResponse"; + value: QueryProposalsResponseAmino; +} +/** QueryVoteRequest is the request type for the Query/Vote RPC method. */ +export interface QueryVoteRequest { + /** proposal_id defines the unique id of the proposal. */ + proposalId: Long; + /** voter defines the voter address for the proposals. */ + voter: string; +} +export interface QueryVoteRequestProtoMsg { + typeUrl: "/cosmos.gov.v1beta1.QueryVoteRequest"; + value: Uint8Array; +} +/** QueryVoteRequest is the request type for the Query/Vote RPC method. */ +export interface QueryVoteRequestAmino { + /** proposal_id defines the unique id of the proposal. */ + proposal_id: string; + /** voter defines the voter address for the proposals. */ + voter: string; +} +export interface QueryVoteRequestAminoMsg { + type: "cosmos-sdk/QueryVoteRequest"; + value: QueryVoteRequestAmino; +} +/** QueryVoteResponse is the response type for the Query/Vote RPC method. */ +export interface QueryVoteResponse { + /** vote defines the queried vote. */ + vote?: Vote; +} +export interface QueryVoteResponseProtoMsg { + typeUrl: "/cosmos.gov.v1beta1.QueryVoteResponse"; + value: Uint8Array; +} +/** QueryVoteResponse is the response type for the Query/Vote RPC method. */ +export interface QueryVoteResponseAmino { + /** vote defines the queried vote. */ + vote?: VoteAmino; +} +export interface QueryVoteResponseAminoMsg { + type: "cosmos-sdk/QueryVoteResponse"; + value: QueryVoteResponseAmino; +} +/** QueryVotesRequest is the request type for the Query/Votes RPC method. */ +export interface QueryVotesRequest { + /** proposal_id defines the unique id of the proposal. */ + proposalId: Long; + /** pagination defines an optional pagination for the request. */ + pagination?: PageRequest; +} +export interface QueryVotesRequestProtoMsg { + typeUrl: "/cosmos.gov.v1beta1.QueryVotesRequest"; + value: Uint8Array; +} +/** QueryVotesRequest is the request type for the Query/Votes RPC method. */ +export interface QueryVotesRequestAmino { + /** proposal_id defines the unique id of the proposal. */ + proposal_id: string; + /** pagination defines an optional pagination for the request. */ + pagination?: PageRequestAmino; +} +export interface QueryVotesRequestAminoMsg { + type: "cosmos-sdk/QueryVotesRequest"; + value: QueryVotesRequestAmino; +} +/** QueryVotesResponse is the response type for the Query/Votes RPC method. */ +export interface QueryVotesResponse { + /** votes defines the queried votes. */ + votes: Vote[]; + /** pagination defines the pagination in the response. */ + pagination?: PageResponse; +} +export interface QueryVotesResponseProtoMsg { + typeUrl: "/cosmos.gov.v1beta1.QueryVotesResponse"; + value: Uint8Array; +} +/** QueryVotesResponse is the response type for the Query/Votes RPC method. */ +export interface QueryVotesResponseAmino { + /** votes defines the queried votes. */ + votes: VoteAmino[]; + /** pagination defines the pagination in the response. */ + pagination?: PageResponseAmino; +} +export interface QueryVotesResponseAminoMsg { + type: "cosmos-sdk/QueryVotesResponse"; + value: QueryVotesResponseAmino; +} +/** QueryParamsRequest is the request type for the Query/Params RPC method. */ +export interface QueryParamsRequest { + /** + * params_type defines which parameters to query for, can be one of "voting", + * "tallying" or "deposit". + */ + paramsType: string; +} +export interface QueryParamsRequestProtoMsg { + typeUrl: "/cosmos.gov.v1beta1.QueryParamsRequest"; + value: Uint8Array; +} +/** QueryParamsRequest is the request type for the Query/Params RPC method. */ +export interface QueryParamsRequestAmino { + /** + * params_type defines which parameters to query for, can be one of "voting", + * "tallying" or "deposit". + */ + params_type: string; +} +export interface QueryParamsRequestAminoMsg { + type: "cosmos-sdk/QueryParamsRequest"; + value: QueryParamsRequestAmino; +} +/** QueryParamsResponse is the response type for the Query/Params RPC method. */ +export interface QueryParamsResponse { + /** voting_params defines the parameters related to voting. */ + votingParams?: VotingParams; + /** deposit_params defines the parameters related to deposit. */ + depositParams?: DepositParams; + /** tally_params defines the parameters related to tally. */ + tallyParams?: TallyParams; +} +export interface QueryParamsResponseProtoMsg { + typeUrl: "/cosmos.gov.v1beta1.QueryParamsResponse"; + value: Uint8Array; +} +/** QueryParamsResponse is the response type for the Query/Params RPC method. */ +export interface QueryParamsResponseAmino { + /** voting_params defines the parameters related to voting. */ + voting_params?: VotingParamsAmino; + /** deposit_params defines the parameters related to deposit. */ + deposit_params?: DepositParamsAmino; + /** tally_params defines the parameters related to tally. */ + tally_params?: TallyParamsAmino; +} +export interface QueryParamsResponseAminoMsg { + type: "cosmos-sdk/QueryParamsResponse"; + value: QueryParamsResponseAmino; +} +/** QueryDepositRequest is the request type for the Query/Deposit RPC method. */ +export interface QueryDepositRequest { + /** proposal_id defines the unique id of the proposal. */ + proposalId: Long; + /** depositor defines the deposit addresses from the proposals. */ + depositor: string; +} +export interface QueryDepositRequestProtoMsg { + typeUrl: "/cosmos.gov.v1beta1.QueryDepositRequest"; + value: Uint8Array; +} +/** QueryDepositRequest is the request type for the Query/Deposit RPC method. */ +export interface QueryDepositRequestAmino { + /** proposal_id defines the unique id of the proposal. */ + proposal_id: string; + /** depositor defines the deposit addresses from the proposals. */ + depositor: string; +} +export interface QueryDepositRequestAminoMsg { + type: "cosmos-sdk/QueryDepositRequest"; + value: QueryDepositRequestAmino; +} +/** QueryDepositResponse is the response type for the Query/Deposit RPC method. */ +export interface QueryDepositResponse { + /** deposit defines the requested deposit. */ + deposit?: Deposit; +} +export interface QueryDepositResponseProtoMsg { + typeUrl: "/cosmos.gov.v1beta1.QueryDepositResponse"; + value: Uint8Array; +} +/** QueryDepositResponse is the response type for the Query/Deposit RPC method. */ +export interface QueryDepositResponseAmino { + /** deposit defines the requested deposit. */ + deposit?: DepositAmino; +} +export interface QueryDepositResponseAminoMsg { + type: "cosmos-sdk/QueryDepositResponse"; + value: QueryDepositResponseAmino; +} +/** QueryDepositsRequest is the request type for the Query/Deposits RPC method. */ +export interface QueryDepositsRequest { + /** proposal_id defines the unique id of the proposal. */ + proposalId: Long; + /** pagination defines an optional pagination for the request. */ + pagination?: PageRequest; +} +export interface QueryDepositsRequestProtoMsg { + typeUrl: "/cosmos.gov.v1beta1.QueryDepositsRequest"; + value: Uint8Array; +} +/** QueryDepositsRequest is the request type for the Query/Deposits RPC method. */ +export interface QueryDepositsRequestAmino { + /** proposal_id defines the unique id of the proposal. */ + proposal_id: string; + /** pagination defines an optional pagination for the request. */ + pagination?: PageRequestAmino; +} +export interface QueryDepositsRequestAminoMsg { + type: "cosmos-sdk/QueryDepositsRequest"; + value: QueryDepositsRequestAmino; +} +/** QueryDepositsResponse is the response type for the Query/Deposits RPC method. */ +export interface QueryDepositsResponse { + /** deposits defines the requested deposits. */ + deposits: Deposit[]; + /** pagination defines the pagination in the response. */ + pagination?: PageResponse; +} +export interface QueryDepositsResponseProtoMsg { + typeUrl: "/cosmos.gov.v1beta1.QueryDepositsResponse"; + value: Uint8Array; +} +/** QueryDepositsResponse is the response type for the Query/Deposits RPC method. */ +export interface QueryDepositsResponseAmino { + /** deposits defines the requested deposits. */ + deposits: DepositAmino[]; + /** pagination defines the pagination in the response. */ + pagination?: PageResponseAmino; +} +export interface QueryDepositsResponseAminoMsg { + type: "cosmos-sdk/QueryDepositsResponse"; + value: QueryDepositsResponseAmino; +} +/** QueryTallyResultRequest is the request type for the Query/Tally RPC method. */ +export interface QueryTallyResultRequest { + /** proposal_id defines the unique id of the proposal. */ + proposalId: Long; +} +export interface QueryTallyResultRequestProtoMsg { + typeUrl: "/cosmos.gov.v1beta1.QueryTallyResultRequest"; + value: Uint8Array; +} +/** QueryTallyResultRequest is the request type for the Query/Tally RPC method. */ +export interface QueryTallyResultRequestAmino { + /** proposal_id defines the unique id of the proposal. */ + proposal_id: string; +} +export interface QueryTallyResultRequestAminoMsg { + type: "cosmos-sdk/QueryTallyResultRequest"; + value: QueryTallyResultRequestAmino; +} +/** QueryTallyResultResponse is the response type for the Query/Tally RPC method. */ +export interface QueryTallyResultResponse { + /** tally defines the requested tally. */ + tally?: TallyResult; +} +export interface QueryTallyResultResponseProtoMsg { + typeUrl: "/cosmos.gov.v1beta1.QueryTallyResultResponse"; + value: Uint8Array; +} +/** QueryTallyResultResponse is the response type for the Query/Tally RPC method. */ +export interface QueryTallyResultResponseAmino { + /** tally defines the requested tally. */ + tally?: TallyResultAmino; +} +export interface QueryTallyResultResponseAminoMsg { + type: "cosmos-sdk/QueryTallyResultResponse"; + value: QueryTallyResultResponseAmino; +} +function createBaseQueryProposalRequest(): QueryProposalRequest { + return { + proposalId: Long.UZERO, + }; +} +export const QueryProposalRequest = { + encode( + message: QueryProposalRequest, + writer: _m0.Writer = _m0.Writer.create() + ): _m0.Writer { + if (!message.proposalId.isZero()) { + writer.uint32(8).uint64(message.proposalId); + } + return writer; + }, + decode( + input: _m0.Reader | Uint8Array, + length?: number + ): QueryProposalRequest { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryProposalRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.proposalId = reader.uint64() as Long; + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object: any): QueryProposalRequest { + return { + proposalId: isSet(object.proposalId) + ? Long.fromValue(object.proposalId) + : Long.UZERO, + }; + }, + toJSON(message: QueryProposalRequest): unknown { + const obj: any = {}; + message.proposalId !== undefined && + (obj.proposalId = (message.proposalId || Long.UZERO).toString()); + return obj; + }, + fromPartial, I>>( + object: I + ): QueryProposalRequest { + const message = createBaseQueryProposalRequest(); + message.proposalId = + object.proposalId !== undefined && object.proposalId !== null + ? Long.fromValue(object.proposalId) + : Long.UZERO; + return message; + }, + fromAmino(object: QueryProposalRequestAmino): QueryProposalRequest { + return { + proposalId: Long.fromString(object.proposal_id), + }; + }, + toAmino(message: QueryProposalRequest): QueryProposalRequestAmino { + const obj: any = {}; + obj.proposal_id = message.proposalId + ? message.proposalId.toString() + : undefined; + return obj; + }, + fromAminoMsg(object: QueryProposalRequestAminoMsg): QueryProposalRequest { + return QueryProposalRequest.fromAmino(object.value); + }, + toAminoMsg(message: QueryProposalRequest): QueryProposalRequestAminoMsg { + return { + type: "cosmos-sdk/QueryProposalRequest", + value: QueryProposalRequest.toAmino(message), + }; + }, + fromProtoMsg(message: QueryProposalRequestProtoMsg): QueryProposalRequest { + return QueryProposalRequest.decode(message.value); + }, + toProto(message: QueryProposalRequest): Uint8Array { + return QueryProposalRequest.encode(message).finish(); + }, + toProtoMsg(message: QueryProposalRequest): QueryProposalRequestProtoMsg { + return { + typeUrl: "/cosmos.gov.v1beta1.QueryProposalRequest", + value: QueryProposalRequest.encode(message).finish(), + }; + }, +}; +function createBaseQueryProposalResponse(): QueryProposalResponse { + return { + proposal: undefined, + }; +} +export const QueryProposalResponse = { + encode( + message: QueryProposalResponse, + writer: _m0.Writer = _m0.Writer.create() + ): _m0.Writer { + if (message.proposal !== undefined) { + Proposal.encode(message.proposal, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + decode( + input: _m0.Reader | Uint8Array, + length?: number + ): QueryProposalResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryProposalResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.proposal = Proposal.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object: any): QueryProposalResponse { + return { + proposal: isSet(object.proposal) + ? Proposal.fromJSON(object.proposal) + : undefined, + }; + }, + toJSON(message: QueryProposalResponse): unknown { + const obj: any = {}; + message.proposal !== undefined && + (obj.proposal = message.proposal + ? Proposal.toJSON(message.proposal) + : undefined); + return obj; + }, + fromPartial, I>>( + object: I + ): QueryProposalResponse { + const message = createBaseQueryProposalResponse(); + message.proposal = + object.proposal !== undefined && object.proposal !== null + ? Proposal.fromPartial(object.proposal) + : undefined; + return message; + }, + fromAmino(object: QueryProposalResponseAmino): QueryProposalResponse { + return { + proposal: object?.proposal + ? Proposal.fromAmino(object.proposal) + : undefined, + }; + }, + toAmino(message: QueryProposalResponse): QueryProposalResponseAmino { + const obj: any = {}; + obj.proposal = message.proposal + ? Proposal.toAmino(message.proposal) + : undefined; + return obj; + }, + fromAminoMsg(object: QueryProposalResponseAminoMsg): QueryProposalResponse { + return QueryProposalResponse.fromAmino(object.value); + }, + toAminoMsg(message: QueryProposalResponse): QueryProposalResponseAminoMsg { + return { + type: "cosmos-sdk/QueryProposalResponse", + value: QueryProposalResponse.toAmino(message), + }; + }, + fromProtoMsg(message: QueryProposalResponseProtoMsg): QueryProposalResponse { + return QueryProposalResponse.decode(message.value); + }, + toProto(message: QueryProposalResponse): Uint8Array { + return QueryProposalResponse.encode(message).finish(); + }, + toProtoMsg(message: QueryProposalResponse): QueryProposalResponseProtoMsg { + return { + typeUrl: "/cosmos.gov.v1beta1.QueryProposalResponse", + value: QueryProposalResponse.encode(message).finish(), + }; + }, +}; +function createBaseQueryProposalsRequest(): QueryProposalsRequest { + return { + proposalStatus: 0, + voter: "", + depositor: "", + pagination: undefined, + }; +} +export const QueryProposalsRequest = { + encode( + message: QueryProposalsRequest, + writer: _m0.Writer = _m0.Writer.create() + ): _m0.Writer { + if (message.proposalStatus !== 0) { + writer.uint32(8).int32(message.proposalStatus); + } + if (message.voter !== "") { + writer.uint32(18).string(message.voter); + } + if (message.depositor !== "") { + writer.uint32(26).string(message.depositor); + } + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(34).fork()).ldelim(); + } + return writer; + }, + decode( + input: _m0.Reader | Uint8Array, + length?: number + ): QueryProposalsRequest { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryProposalsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.proposalStatus = reader.int32() as any; + break; + case 2: + message.voter = reader.string(); + break; + case 3: + message.depositor = reader.string(); + break; + case 4: + message.pagination = PageRequest.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object: any): QueryProposalsRequest { + return { + proposalStatus: isSet(object.proposalStatus) + ? proposalStatusFromJSON(object.proposalStatus) + : 0, + voter: isSet(object.voter) ? String(object.voter) : "", + depositor: isSet(object.depositor) ? String(object.depositor) : "", + pagination: isSet(object.pagination) + ? PageRequest.fromJSON(object.pagination) + : undefined, + }; + }, + toJSON(message: QueryProposalsRequest): unknown { + const obj: any = {}; + message.proposalStatus !== undefined && + (obj.proposalStatus = proposalStatusToJSON(message.proposalStatus)); + message.voter !== undefined && (obj.voter = message.voter); + message.depositor !== undefined && (obj.depositor = message.depositor); + message.pagination !== undefined && + (obj.pagination = message.pagination + ? PageRequest.toJSON(message.pagination) + : undefined); + return obj; + }, + fromPartial, I>>( + object: I + ): QueryProposalsRequest { + const message = createBaseQueryProposalsRequest(); + message.proposalStatus = object.proposalStatus ?? 0; + message.voter = object.voter ?? ""; + message.depositor = object.depositor ?? ""; + message.pagination = + object.pagination !== undefined && object.pagination !== null + ? PageRequest.fromPartial(object.pagination) + : undefined; + return message; + }, + fromAmino(object: QueryProposalsRequestAmino): QueryProposalsRequest { + return { + proposalStatus: isSet(object.proposal_status) + ? proposalStatusFromJSON(object.proposal_status) + : 0, + voter: object.voter, + depositor: object.depositor, + pagination: object?.pagination + ? PageRequest.fromAmino(object.pagination) + : undefined, + }; + }, + toAmino(message: QueryProposalsRequest): QueryProposalsRequestAmino { + const obj: any = {}; + obj.proposal_status = message.proposalStatus; + obj.voter = message.voter; + obj.depositor = message.depositor; + obj.pagination = message.pagination + ? PageRequest.toAmino(message.pagination) + : undefined; + return obj; + }, + fromAminoMsg(object: QueryProposalsRequestAminoMsg): QueryProposalsRequest { + return QueryProposalsRequest.fromAmino(object.value); + }, + toAminoMsg(message: QueryProposalsRequest): QueryProposalsRequestAminoMsg { + return { + type: "cosmos-sdk/QueryProposalsRequest", + value: QueryProposalsRequest.toAmino(message), + }; + }, + fromProtoMsg(message: QueryProposalsRequestProtoMsg): QueryProposalsRequest { + return QueryProposalsRequest.decode(message.value); + }, + toProto(message: QueryProposalsRequest): Uint8Array { + return QueryProposalsRequest.encode(message).finish(); + }, + toProtoMsg(message: QueryProposalsRequest): QueryProposalsRequestProtoMsg { + return { + typeUrl: "/cosmos.gov.v1beta1.QueryProposalsRequest", + value: QueryProposalsRequest.encode(message).finish(), + }; + }, +}; +function createBaseQueryProposalsResponse(): QueryProposalsResponse { + return { + proposals: [], + pagination: undefined, + }; +} +export const QueryProposalsResponse = { + encode( + message: QueryProposalsResponse, + writer: _m0.Writer = _m0.Writer.create() + ): _m0.Writer { + for (const v of message.proposals) { + Proposal.encode(v!, writer.uint32(10).fork()).ldelim(); + } + if (message.pagination !== undefined) { + PageResponse.encode( + message.pagination, + writer.uint32(18).fork() + ).ldelim(); + } + return writer; + }, + decode( + input: _m0.Reader | Uint8Array, + length?: number + ): QueryProposalsResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryProposalsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.proposals.push(Proposal.decode(reader, reader.uint32())); + break; + case 2: + message.pagination = PageResponse.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object: any): QueryProposalsResponse { + return { + proposals: Array.isArray(object?.proposals) + ? object.proposals.map((e: any) => Proposal.fromJSON(e)) + : [], + pagination: isSet(object.pagination) + ? PageResponse.fromJSON(object.pagination) + : undefined, + }; + }, + toJSON(message: QueryProposalsResponse): unknown { + const obj: any = {}; + if (message.proposals) { + obj.proposals = message.proposals.map((e) => + e ? Proposal.toJSON(e) : undefined + ); + } else { + obj.proposals = []; + } + message.pagination !== undefined && + (obj.pagination = message.pagination + ? PageResponse.toJSON(message.pagination) + : undefined); + return obj; + }, + fromPartial, I>>( + object: I + ): QueryProposalsResponse { + const message = createBaseQueryProposalsResponse(); + message.proposals = + object.proposals?.map((e) => Proposal.fromPartial(e)) || []; + message.pagination = + object.pagination !== undefined && object.pagination !== null + ? PageResponse.fromPartial(object.pagination) + : undefined; + return message; + }, + fromAmino(object: QueryProposalsResponseAmino): QueryProposalsResponse { + return { + proposals: Array.isArray(object?.proposals) + ? object.proposals.map((e: any) => Proposal.fromAmino(e)) + : [], + pagination: object?.pagination + ? PageResponse.fromAmino(object.pagination) + : undefined, + }; + }, + toAmino(message: QueryProposalsResponse): QueryProposalsResponseAmino { + const obj: any = {}; + if (message.proposals) { + obj.proposals = message.proposals.map((e) => + e ? Proposal.toAmino(e) : undefined + ); + } else { + obj.proposals = []; + } + obj.pagination = message.pagination + ? PageResponse.toAmino(message.pagination) + : undefined; + return obj; + }, + fromAminoMsg(object: QueryProposalsResponseAminoMsg): QueryProposalsResponse { + return QueryProposalsResponse.fromAmino(object.value); + }, + toAminoMsg(message: QueryProposalsResponse): QueryProposalsResponseAminoMsg { + return { + type: "cosmos-sdk/QueryProposalsResponse", + value: QueryProposalsResponse.toAmino(message), + }; + }, + fromProtoMsg( + message: QueryProposalsResponseProtoMsg + ): QueryProposalsResponse { + return QueryProposalsResponse.decode(message.value); + }, + toProto(message: QueryProposalsResponse): Uint8Array { + return QueryProposalsResponse.encode(message).finish(); + }, + toProtoMsg(message: QueryProposalsResponse): QueryProposalsResponseProtoMsg { + return { + typeUrl: "/cosmos.gov.v1beta1.QueryProposalsResponse", + value: QueryProposalsResponse.encode(message).finish(), + }; + }, +}; +function createBaseQueryVoteRequest(): QueryVoteRequest { + return { + proposalId: Long.UZERO, + voter: "", + }; +} +export const QueryVoteRequest = { + encode( + message: QueryVoteRequest, + writer: _m0.Writer = _m0.Writer.create() + ): _m0.Writer { + if (!message.proposalId.isZero()) { + writer.uint32(8).uint64(message.proposalId); + } + if (message.voter !== "") { + writer.uint32(18).string(message.voter); + } + return writer; + }, + decode(input: _m0.Reader | Uint8Array, length?: number): QueryVoteRequest { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryVoteRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.proposalId = reader.uint64() as Long; + break; + case 2: + message.voter = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object: any): QueryVoteRequest { + return { + proposalId: isSet(object.proposalId) + ? Long.fromValue(object.proposalId) + : Long.UZERO, + voter: isSet(object.voter) ? String(object.voter) : "", + }; + }, + toJSON(message: QueryVoteRequest): unknown { + const obj: any = {}; + message.proposalId !== undefined && + (obj.proposalId = (message.proposalId || Long.UZERO).toString()); + message.voter !== undefined && (obj.voter = message.voter); + return obj; + }, + fromPartial, I>>( + object: I + ): QueryVoteRequest { + const message = createBaseQueryVoteRequest(); + message.proposalId = + object.proposalId !== undefined && object.proposalId !== null + ? Long.fromValue(object.proposalId) + : Long.UZERO; + message.voter = object.voter ?? ""; + return message; + }, + fromAmino(object: QueryVoteRequestAmino): QueryVoteRequest { + return { + proposalId: Long.fromString(object.proposal_id), + voter: object.voter, + }; + }, + toAmino(message: QueryVoteRequest): QueryVoteRequestAmino { + const obj: any = {}; + obj.proposal_id = message.proposalId + ? message.proposalId.toString() + : undefined; + obj.voter = message.voter; + return obj; + }, + fromAminoMsg(object: QueryVoteRequestAminoMsg): QueryVoteRequest { + return QueryVoteRequest.fromAmino(object.value); + }, + toAminoMsg(message: QueryVoteRequest): QueryVoteRequestAminoMsg { + return { + type: "cosmos-sdk/QueryVoteRequest", + value: QueryVoteRequest.toAmino(message), + }; + }, + fromProtoMsg(message: QueryVoteRequestProtoMsg): QueryVoteRequest { + return QueryVoteRequest.decode(message.value); + }, + toProto(message: QueryVoteRequest): Uint8Array { + return QueryVoteRequest.encode(message).finish(); + }, + toProtoMsg(message: QueryVoteRequest): QueryVoteRequestProtoMsg { + return { + typeUrl: "/cosmos.gov.v1beta1.QueryVoteRequest", + value: QueryVoteRequest.encode(message).finish(), + }; + }, +}; +function createBaseQueryVoteResponse(): QueryVoteResponse { + return { + vote: undefined, + }; +} +export const QueryVoteResponse = { + encode( + message: QueryVoteResponse, + writer: _m0.Writer = _m0.Writer.create() + ): _m0.Writer { + if (message.vote !== undefined) { + Vote.encode(message.vote, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + decode(input: _m0.Reader | Uint8Array, length?: number): QueryVoteResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryVoteResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.vote = Vote.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object: any): QueryVoteResponse { + return { + vote: isSet(object.vote) ? Vote.fromJSON(object.vote) : undefined, + }; + }, + toJSON(message: QueryVoteResponse): unknown { + const obj: any = {}; + message.vote !== undefined && + (obj.vote = message.vote ? Vote.toJSON(message.vote) : undefined); + return obj; + }, + fromPartial, I>>( + object: I + ): QueryVoteResponse { + const message = createBaseQueryVoteResponse(); + message.vote = + object.vote !== undefined && object.vote !== null + ? Vote.fromPartial(object.vote) + : undefined; + return message; + }, + fromAmino(object: QueryVoteResponseAmino): QueryVoteResponse { + return { + vote: object?.vote ? Vote.fromAmino(object.vote) : undefined, + }; + }, + toAmino(message: QueryVoteResponse): QueryVoteResponseAmino { + const obj: any = {}; + obj.vote = message.vote ? Vote.toAmino(message.vote) : undefined; + return obj; + }, + fromAminoMsg(object: QueryVoteResponseAminoMsg): QueryVoteResponse { + return QueryVoteResponse.fromAmino(object.value); + }, + toAminoMsg(message: QueryVoteResponse): QueryVoteResponseAminoMsg { + return { + type: "cosmos-sdk/QueryVoteResponse", + value: QueryVoteResponse.toAmino(message), + }; + }, + fromProtoMsg(message: QueryVoteResponseProtoMsg): QueryVoteResponse { + return QueryVoteResponse.decode(message.value); + }, + toProto(message: QueryVoteResponse): Uint8Array { + return QueryVoteResponse.encode(message).finish(); + }, + toProtoMsg(message: QueryVoteResponse): QueryVoteResponseProtoMsg { + return { + typeUrl: "/cosmos.gov.v1beta1.QueryVoteResponse", + value: QueryVoteResponse.encode(message).finish(), + }; + }, +}; +function createBaseQueryVotesRequest(): QueryVotesRequest { + return { + proposalId: Long.UZERO, + pagination: undefined, + }; +} +export const QueryVotesRequest = { + encode( + message: QueryVotesRequest, + writer: _m0.Writer = _m0.Writer.create() + ): _m0.Writer { + if (!message.proposalId.isZero()) { + writer.uint32(8).uint64(message.proposalId); + } + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input: _m0.Reader | Uint8Array, length?: number): QueryVotesRequest { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryVotesRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.proposalId = reader.uint64() as Long; + break; + case 2: + message.pagination = PageRequest.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object: any): QueryVotesRequest { + return { + proposalId: isSet(object.proposalId) + ? Long.fromValue(object.proposalId) + : Long.UZERO, + pagination: isSet(object.pagination) + ? PageRequest.fromJSON(object.pagination) + : undefined, + }; + }, + toJSON(message: QueryVotesRequest): unknown { + const obj: any = {}; + message.proposalId !== undefined && + (obj.proposalId = (message.proposalId || Long.UZERO).toString()); + message.pagination !== undefined && + (obj.pagination = message.pagination + ? PageRequest.toJSON(message.pagination) + : undefined); + return obj; + }, + fromPartial, I>>( + object: I + ): QueryVotesRequest { + const message = createBaseQueryVotesRequest(); + message.proposalId = + object.proposalId !== undefined && object.proposalId !== null + ? Long.fromValue(object.proposalId) + : Long.UZERO; + message.pagination = + object.pagination !== undefined && object.pagination !== null + ? PageRequest.fromPartial(object.pagination) + : undefined; + return message; + }, + fromAmino(object: QueryVotesRequestAmino): QueryVotesRequest { + return { + proposalId: Long.fromString(object.proposal_id), + pagination: object?.pagination + ? PageRequest.fromAmino(object.pagination) + : undefined, + }; + }, + toAmino(message: QueryVotesRequest): QueryVotesRequestAmino { + const obj: any = {}; + obj.proposal_id = message.proposalId + ? message.proposalId.toString() + : undefined; + obj.pagination = message.pagination + ? PageRequest.toAmino(message.pagination) + : undefined; + return obj; + }, + fromAminoMsg(object: QueryVotesRequestAminoMsg): QueryVotesRequest { + return QueryVotesRequest.fromAmino(object.value); + }, + toAminoMsg(message: QueryVotesRequest): QueryVotesRequestAminoMsg { + return { + type: "cosmos-sdk/QueryVotesRequest", + value: QueryVotesRequest.toAmino(message), + }; + }, + fromProtoMsg(message: QueryVotesRequestProtoMsg): QueryVotesRequest { + return QueryVotesRequest.decode(message.value); + }, + toProto(message: QueryVotesRequest): Uint8Array { + return QueryVotesRequest.encode(message).finish(); + }, + toProtoMsg(message: QueryVotesRequest): QueryVotesRequestProtoMsg { + return { + typeUrl: "/cosmos.gov.v1beta1.QueryVotesRequest", + value: QueryVotesRequest.encode(message).finish(), + }; + }, +}; +function createBaseQueryVotesResponse(): QueryVotesResponse { + return { + votes: [], + pagination: undefined, + }; +} +export const QueryVotesResponse = { + encode( + message: QueryVotesResponse, + writer: _m0.Writer = _m0.Writer.create() + ): _m0.Writer { + for (const v of message.votes) { + Vote.encode(v!, writer.uint32(10).fork()).ldelim(); + } + if (message.pagination !== undefined) { + PageResponse.encode( + message.pagination, + writer.uint32(18).fork() + ).ldelim(); + } + return writer; + }, + decode(input: _m0.Reader | Uint8Array, length?: number): QueryVotesResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryVotesResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.votes.push(Vote.decode(reader, reader.uint32())); + break; + case 2: + message.pagination = PageResponse.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object: any): QueryVotesResponse { + return { + votes: Array.isArray(object?.votes) + ? object.votes.map((e: any) => Vote.fromJSON(e)) + : [], + pagination: isSet(object.pagination) + ? PageResponse.fromJSON(object.pagination) + : undefined, + }; + }, + toJSON(message: QueryVotesResponse): unknown { + const obj: any = {}; + if (message.votes) { + obj.votes = message.votes.map((e) => (e ? Vote.toJSON(e) : undefined)); + } else { + obj.votes = []; + } + message.pagination !== undefined && + (obj.pagination = message.pagination + ? PageResponse.toJSON(message.pagination) + : undefined); + return obj; + }, + fromPartial, I>>( + object: I + ): QueryVotesResponse { + const message = createBaseQueryVotesResponse(); + message.votes = object.votes?.map((e) => Vote.fromPartial(e)) || []; + message.pagination = + object.pagination !== undefined && object.pagination !== null + ? PageResponse.fromPartial(object.pagination) + : undefined; + return message; + }, + fromAmino(object: QueryVotesResponseAmino): QueryVotesResponse { + return { + votes: Array.isArray(object?.votes) + ? object.votes.map((e: any) => Vote.fromAmino(e)) + : [], + pagination: object?.pagination + ? PageResponse.fromAmino(object.pagination) + : undefined, + }; + }, + toAmino(message: QueryVotesResponse): QueryVotesResponseAmino { + const obj: any = {}; + if (message.votes) { + obj.votes = message.votes.map((e) => (e ? Vote.toAmino(e) : undefined)); + } else { + obj.votes = []; + } + obj.pagination = message.pagination + ? PageResponse.toAmino(message.pagination) + : undefined; + return obj; + }, + fromAminoMsg(object: QueryVotesResponseAminoMsg): QueryVotesResponse { + return QueryVotesResponse.fromAmino(object.value); + }, + toAminoMsg(message: QueryVotesResponse): QueryVotesResponseAminoMsg { + return { + type: "cosmos-sdk/QueryVotesResponse", + value: QueryVotesResponse.toAmino(message), + }; + }, + fromProtoMsg(message: QueryVotesResponseProtoMsg): QueryVotesResponse { + return QueryVotesResponse.decode(message.value); + }, + toProto(message: QueryVotesResponse): Uint8Array { + return QueryVotesResponse.encode(message).finish(); + }, + toProtoMsg(message: QueryVotesResponse): QueryVotesResponseProtoMsg { + return { + typeUrl: "/cosmos.gov.v1beta1.QueryVotesResponse", + value: QueryVotesResponse.encode(message).finish(), + }; + }, +}; +function createBaseQueryParamsRequest(): QueryParamsRequest { + return { + paramsType: "", + }; +} +export const QueryParamsRequest = { + encode( + message: QueryParamsRequest, + writer: _m0.Writer = _m0.Writer.create() + ): _m0.Writer { + if (message.paramsType !== "") { + writer.uint32(10).string(message.paramsType); + } + 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) { + case 1: + message.paramsType = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object: any): QueryParamsRequest { + return { + paramsType: isSet(object.paramsType) ? String(object.paramsType) : "", + }; + }, + toJSON(message: QueryParamsRequest): unknown { + const obj: any = {}; + message.paramsType !== undefined && (obj.paramsType = message.paramsType); + return obj; + }, + fromPartial, I>>( + object: I + ): QueryParamsRequest { + const message = createBaseQueryParamsRequest(); + message.paramsType = object.paramsType ?? ""; + return message; + }, + fromAmino(object: QueryParamsRequestAmino): QueryParamsRequest { + return { + paramsType: object.params_type, + }; + }, + toAmino(message: QueryParamsRequest): QueryParamsRequestAmino { + const obj: any = {}; + obj.params_type = message.paramsType; + return obj; + }, + fromAminoMsg(object: QueryParamsRequestAminoMsg): QueryParamsRequest { + return QueryParamsRequest.fromAmino(object.value); + }, + toAminoMsg(message: QueryParamsRequest): QueryParamsRequestAminoMsg { + return { + type: "cosmos-sdk/QueryParamsRequest", + value: QueryParamsRequest.toAmino(message), + }; + }, + fromProtoMsg(message: QueryParamsRequestProtoMsg): QueryParamsRequest { + return QueryParamsRequest.decode(message.value); + }, + toProto(message: QueryParamsRequest): Uint8Array { + return QueryParamsRequest.encode(message).finish(); + }, + toProtoMsg(message: QueryParamsRequest): QueryParamsRequestProtoMsg { + return { + typeUrl: "/cosmos.gov.v1beta1.QueryParamsRequest", + value: QueryParamsRequest.encode(message).finish(), + }; + }, +}; +function createBaseQueryParamsResponse(): QueryParamsResponse { + return { + votingParams: undefined, + depositParams: undefined, + tallyParams: undefined, + }; +} +export const QueryParamsResponse = { + encode( + message: QueryParamsResponse, + writer: _m0.Writer = _m0.Writer.create() + ): _m0.Writer { + if (message.votingParams !== undefined) { + VotingParams.encode( + message.votingParams, + writer.uint32(10).fork() + ).ldelim(); + } + if (message.depositParams !== undefined) { + DepositParams.encode( + message.depositParams, + writer.uint32(18).fork() + ).ldelim(); + } + if (message.tallyParams !== undefined) { + TallyParams.encode( + message.tallyParams, + writer.uint32(26).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.votingParams = VotingParams.decode(reader, reader.uint32()); + break; + case 2: + message.depositParams = DepositParams.decode(reader, reader.uint32()); + break; + case 3: + message.tallyParams = TallyParams.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object: any): QueryParamsResponse { + return { + votingParams: isSet(object.votingParams) + ? VotingParams.fromJSON(object.votingParams) + : undefined, + depositParams: isSet(object.depositParams) + ? DepositParams.fromJSON(object.depositParams) + : undefined, + tallyParams: isSet(object.tallyParams) + ? TallyParams.fromJSON(object.tallyParams) + : undefined, + }; + }, + toJSON(message: QueryParamsResponse): unknown { + const obj: any = {}; + message.votingParams !== undefined && + (obj.votingParams = message.votingParams + ? VotingParams.toJSON(message.votingParams) + : undefined); + message.depositParams !== undefined && + (obj.depositParams = message.depositParams + ? DepositParams.toJSON(message.depositParams) + : undefined); + message.tallyParams !== undefined && + (obj.tallyParams = message.tallyParams + ? TallyParams.toJSON(message.tallyParams) + : undefined); + return obj; + }, + fromPartial, I>>( + object: I + ): QueryParamsResponse { + const message = createBaseQueryParamsResponse(); + message.votingParams = + object.votingParams !== undefined && object.votingParams !== null + ? VotingParams.fromPartial(object.votingParams) + : undefined; + message.depositParams = + object.depositParams !== undefined && object.depositParams !== null + ? DepositParams.fromPartial(object.depositParams) + : undefined; + message.tallyParams = + object.tallyParams !== undefined && object.tallyParams !== null + ? TallyParams.fromPartial(object.tallyParams) + : undefined; + return message; + }, + fromAmino(object: QueryParamsResponseAmino): QueryParamsResponse { + return { + votingParams: object?.voting_params + ? VotingParams.fromAmino(object.voting_params) + : undefined, + depositParams: object?.deposit_params + ? DepositParams.fromAmino(object.deposit_params) + : undefined, + tallyParams: object?.tally_params + ? TallyParams.fromAmino(object.tally_params) + : undefined, + }; + }, + toAmino(message: QueryParamsResponse): QueryParamsResponseAmino { + const obj: any = {}; + obj.voting_params = message.votingParams + ? VotingParams.toAmino(message.votingParams) + : undefined; + obj.deposit_params = message.depositParams + ? DepositParams.toAmino(message.depositParams) + : undefined; + obj.tally_params = message.tallyParams + ? TallyParams.toAmino(message.tallyParams) + : undefined; + return obj; + }, + fromAminoMsg(object: QueryParamsResponseAminoMsg): QueryParamsResponse { + return QueryParamsResponse.fromAmino(object.value); + }, + toAminoMsg(message: QueryParamsResponse): QueryParamsResponseAminoMsg { + return { + type: "cosmos-sdk/QueryParamsResponse", + value: QueryParamsResponse.toAmino(message), + }; + }, + fromProtoMsg(message: QueryParamsResponseProtoMsg): QueryParamsResponse { + return QueryParamsResponse.decode(message.value); + }, + toProto(message: QueryParamsResponse): Uint8Array { + return QueryParamsResponse.encode(message).finish(); + }, + toProtoMsg(message: QueryParamsResponse): QueryParamsResponseProtoMsg { + return { + typeUrl: "/cosmos.gov.v1beta1.QueryParamsResponse", + value: QueryParamsResponse.encode(message).finish(), + }; + }, +}; +function createBaseQueryDepositRequest(): QueryDepositRequest { + return { + proposalId: Long.UZERO, + depositor: "", + }; +} +export const QueryDepositRequest = { + encode( + message: QueryDepositRequest, + writer: _m0.Writer = _m0.Writer.create() + ): _m0.Writer { + if (!message.proposalId.isZero()) { + writer.uint32(8).uint64(message.proposalId); + } + if (message.depositor !== "") { + writer.uint32(18).string(message.depositor); + } + return writer; + }, + decode(input: _m0.Reader | Uint8Array, length?: number): QueryDepositRequest { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDepositRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.proposalId = reader.uint64() as Long; + break; + case 2: + message.depositor = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object: any): QueryDepositRequest { + return { + proposalId: isSet(object.proposalId) + ? Long.fromValue(object.proposalId) + : Long.UZERO, + depositor: isSet(object.depositor) ? String(object.depositor) : "", + }; + }, + toJSON(message: QueryDepositRequest): unknown { + const obj: any = {}; + message.proposalId !== undefined && + (obj.proposalId = (message.proposalId || Long.UZERO).toString()); + message.depositor !== undefined && (obj.depositor = message.depositor); + return obj; + }, + fromPartial, I>>( + object: I + ): QueryDepositRequest { + const message = createBaseQueryDepositRequest(); + message.proposalId = + object.proposalId !== undefined && object.proposalId !== null + ? Long.fromValue(object.proposalId) + : Long.UZERO; + message.depositor = object.depositor ?? ""; + return message; + }, + fromAmino(object: QueryDepositRequestAmino): QueryDepositRequest { + return { + proposalId: Long.fromString(object.proposal_id), + depositor: object.depositor, + }; + }, + toAmino(message: QueryDepositRequest): QueryDepositRequestAmino { + const obj: any = {}; + obj.proposal_id = message.proposalId + ? message.proposalId.toString() + : undefined; + obj.depositor = message.depositor; + return obj; + }, + fromAminoMsg(object: QueryDepositRequestAminoMsg): QueryDepositRequest { + return QueryDepositRequest.fromAmino(object.value); + }, + toAminoMsg(message: QueryDepositRequest): QueryDepositRequestAminoMsg { + return { + type: "cosmos-sdk/QueryDepositRequest", + value: QueryDepositRequest.toAmino(message), + }; + }, + fromProtoMsg(message: QueryDepositRequestProtoMsg): QueryDepositRequest { + return QueryDepositRequest.decode(message.value); + }, + toProto(message: QueryDepositRequest): Uint8Array { + return QueryDepositRequest.encode(message).finish(); + }, + toProtoMsg(message: QueryDepositRequest): QueryDepositRequestProtoMsg { + return { + typeUrl: "/cosmos.gov.v1beta1.QueryDepositRequest", + value: QueryDepositRequest.encode(message).finish(), + }; + }, +}; +function createBaseQueryDepositResponse(): QueryDepositResponse { + return { + deposit: undefined, + }; +} +export const QueryDepositResponse = { + encode( + message: QueryDepositResponse, + writer: _m0.Writer = _m0.Writer.create() + ): _m0.Writer { + if (message.deposit !== undefined) { + Deposit.encode(message.deposit, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + decode( + input: _m0.Reader | Uint8Array, + length?: number + ): QueryDepositResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDepositResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.deposit = Deposit.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object: any): QueryDepositResponse { + return { + deposit: isSet(object.deposit) + ? Deposit.fromJSON(object.deposit) + : undefined, + }; + }, + toJSON(message: QueryDepositResponse): unknown { + const obj: any = {}; + message.deposit !== undefined && + (obj.deposit = message.deposit + ? Deposit.toJSON(message.deposit) + : undefined); + return obj; + }, + fromPartial, I>>( + object: I + ): QueryDepositResponse { + const message = createBaseQueryDepositResponse(); + message.deposit = + object.deposit !== undefined && object.deposit !== null + ? Deposit.fromPartial(object.deposit) + : undefined; + return message; + }, + fromAmino(object: QueryDepositResponseAmino): QueryDepositResponse { + return { + deposit: object?.deposit ? Deposit.fromAmino(object.deposit) : undefined, + }; + }, + toAmino(message: QueryDepositResponse): QueryDepositResponseAmino { + const obj: any = {}; + obj.deposit = message.deposit + ? Deposit.toAmino(message.deposit) + : undefined; + return obj; + }, + fromAminoMsg(object: QueryDepositResponseAminoMsg): QueryDepositResponse { + return QueryDepositResponse.fromAmino(object.value); + }, + toAminoMsg(message: QueryDepositResponse): QueryDepositResponseAminoMsg { + return { + type: "cosmos-sdk/QueryDepositResponse", + value: QueryDepositResponse.toAmino(message), + }; + }, + fromProtoMsg(message: QueryDepositResponseProtoMsg): QueryDepositResponse { + return QueryDepositResponse.decode(message.value); + }, + toProto(message: QueryDepositResponse): Uint8Array { + return QueryDepositResponse.encode(message).finish(); + }, + toProtoMsg(message: QueryDepositResponse): QueryDepositResponseProtoMsg { + return { + typeUrl: "/cosmos.gov.v1beta1.QueryDepositResponse", + value: QueryDepositResponse.encode(message).finish(), + }; + }, +}; +function createBaseQueryDepositsRequest(): QueryDepositsRequest { + return { + proposalId: Long.UZERO, + pagination: undefined, + }; +} +export const QueryDepositsRequest = { + encode( + message: QueryDepositsRequest, + writer: _m0.Writer = _m0.Writer.create() + ): _m0.Writer { + if (!message.proposalId.isZero()) { + writer.uint32(8).uint64(message.proposalId); + } + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode( + input: _m0.Reader | Uint8Array, + length?: number + ): QueryDepositsRequest { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDepositsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.proposalId = reader.uint64() as Long; + break; + case 2: + message.pagination = PageRequest.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object: any): QueryDepositsRequest { + return { + proposalId: isSet(object.proposalId) + ? Long.fromValue(object.proposalId) + : Long.UZERO, + pagination: isSet(object.pagination) + ? PageRequest.fromJSON(object.pagination) + : undefined, + }; + }, + toJSON(message: QueryDepositsRequest): unknown { + const obj: any = {}; + message.proposalId !== undefined && + (obj.proposalId = (message.proposalId || Long.UZERO).toString()); + message.pagination !== undefined && + (obj.pagination = message.pagination + ? PageRequest.toJSON(message.pagination) + : undefined); + return obj; + }, + fromPartial, I>>( + object: I + ): QueryDepositsRequest { + const message = createBaseQueryDepositsRequest(); + message.proposalId = + object.proposalId !== undefined && object.proposalId !== null + ? Long.fromValue(object.proposalId) + : Long.UZERO; + message.pagination = + object.pagination !== undefined && object.pagination !== null + ? PageRequest.fromPartial(object.pagination) + : undefined; + return message; + }, + fromAmino(object: QueryDepositsRequestAmino): QueryDepositsRequest { + return { + proposalId: Long.fromString(object.proposal_id), + pagination: object?.pagination + ? PageRequest.fromAmino(object.pagination) + : undefined, + }; + }, + toAmino(message: QueryDepositsRequest): QueryDepositsRequestAmino { + const obj: any = {}; + obj.proposal_id = message.proposalId + ? message.proposalId.toString() + : undefined; + obj.pagination = message.pagination + ? PageRequest.toAmino(message.pagination) + : undefined; + return obj; + }, + fromAminoMsg(object: QueryDepositsRequestAminoMsg): QueryDepositsRequest { + return QueryDepositsRequest.fromAmino(object.value); + }, + toAminoMsg(message: QueryDepositsRequest): QueryDepositsRequestAminoMsg { + return { + type: "cosmos-sdk/QueryDepositsRequest", + value: QueryDepositsRequest.toAmino(message), + }; + }, + fromProtoMsg(message: QueryDepositsRequestProtoMsg): QueryDepositsRequest { + return QueryDepositsRequest.decode(message.value); + }, + toProto(message: QueryDepositsRequest): Uint8Array { + return QueryDepositsRequest.encode(message).finish(); + }, + toProtoMsg(message: QueryDepositsRequest): QueryDepositsRequestProtoMsg { + return { + typeUrl: "/cosmos.gov.v1beta1.QueryDepositsRequest", + value: QueryDepositsRequest.encode(message).finish(), + }; + }, +}; +function createBaseQueryDepositsResponse(): QueryDepositsResponse { + return { + deposits: [], + pagination: undefined, + }; +} +export const QueryDepositsResponse = { + encode( + message: QueryDepositsResponse, + writer: _m0.Writer = _m0.Writer.create() + ): _m0.Writer { + for (const v of message.deposits) { + Deposit.encode(v!, writer.uint32(10).fork()).ldelim(); + } + if (message.pagination !== undefined) { + PageResponse.encode( + message.pagination, + writer.uint32(18).fork() + ).ldelim(); + } + return writer; + }, + decode( + input: _m0.Reader | Uint8Array, + length?: number + ): QueryDepositsResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDepositsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.deposits.push(Deposit.decode(reader, reader.uint32())); + break; + case 2: + message.pagination = PageResponse.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object: any): QueryDepositsResponse { + return { + deposits: Array.isArray(object?.deposits) + ? object.deposits.map((e: any) => Deposit.fromJSON(e)) + : [], + pagination: isSet(object.pagination) + ? PageResponse.fromJSON(object.pagination) + : undefined, + }; + }, + toJSON(message: QueryDepositsResponse): unknown { + const obj: any = {}; + if (message.deposits) { + obj.deposits = message.deposits.map((e) => + e ? Deposit.toJSON(e) : undefined + ); + } else { + obj.deposits = []; + } + message.pagination !== undefined && + (obj.pagination = message.pagination + ? PageResponse.toJSON(message.pagination) + : undefined); + return obj; + }, + fromPartial, I>>( + object: I + ): QueryDepositsResponse { + const message = createBaseQueryDepositsResponse(); + message.deposits = + object.deposits?.map((e) => Deposit.fromPartial(e)) || []; + message.pagination = + object.pagination !== undefined && object.pagination !== null + ? PageResponse.fromPartial(object.pagination) + : undefined; + return message; + }, + fromAmino(object: QueryDepositsResponseAmino): QueryDepositsResponse { + return { + deposits: Array.isArray(object?.deposits) + ? object.deposits.map((e: any) => Deposit.fromAmino(e)) + : [], + pagination: object?.pagination + ? PageResponse.fromAmino(object.pagination) + : undefined, + }; + }, + toAmino(message: QueryDepositsResponse): QueryDepositsResponseAmino { + const obj: any = {}; + if (message.deposits) { + obj.deposits = message.deposits.map((e) => + e ? Deposit.toAmino(e) : undefined + ); + } else { + obj.deposits = []; + } + obj.pagination = message.pagination + ? PageResponse.toAmino(message.pagination) + : undefined; + return obj; + }, + fromAminoMsg(object: QueryDepositsResponseAminoMsg): QueryDepositsResponse { + return QueryDepositsResponse.fromAmino(object.value); + }, + toAminoMsg(message: QueryDepositsResponse): QueryDepositsResponseAminoMsg { + return { + type: "cosmos-sdk/QueryDepositsResponse", + value: QueryDepositsResponse.toAmino(message), + }; + }, + fromProtoMsg(message: QueryDepositsResponseProtoMsg): QueryDepositsResponse { + return QueryDepositsResponse.decode(message.value); + }, + toProto(message: QueryDepositsResponse): Uint8Array { + return QueryDepositsResponse.encode(message).finish(); + }, + toProtoMsg(message: QueryDepositsResponse): QueryDepositsResponseProtoMsg { + return { + typeUrl: "/cosmos.gov.v1beta1.QueryDepositsResponse", + value: QueryDepositsResponse.encode(message).finish(), + }; + }, +}; +function createBaseQueryTallyResultRequest(): QueryTallyResultRequest { + return { + proposalId: Long.UZERO, + }; +} +export const QueryTallyResultRequest = { + encode( + message: QueryTallyResultRequest, + writer: _m0.Writer = _m0.Writer.create() + ): _m0.Writer { + if (!message.proposalId.isZero()) { + writer.uint32(8).uint64(message.proposalId); + } + return writer; + }, + decode( + input: _m0.Reader | Uint8Array, + length?: number + ): QueryTallyResultRequest { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryTallyResultRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.proposalId = reader.uint64() as Long; + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object: any): QueryTallyResultRequest { + return { + proposalId: isSet(object.proposalId) + ? Long.fromValue(object.proposalId) + : Long.UZERO, + }; + }, + toJSON(message: QueryTallyResultRequest): unknown { + const obj: any = {}; + message.proposalId !== undefined && + (obj.proposalId = (message.proposalId || Long.UZERO).toString()); + return obj; + }, + fromPartial, I>>( + object: I + ): QueryTallyResultRequest { + const message = createBaseQueryTallyResultRequest(); + message.proposalId = + object.proposalId !== undefined && object.proposalId !== null + ? Long.fromValue(object.proposalId) + : Long.UZERO; + return message; + }, + fromAmino(object: QueryTallyResultRequestAmino): QueryTallyResultRequest { + return { + proposalId: Long.fromString(object.proposal_id), + }; + }, + toAmino(message: QueryTallyResultRequest): QueryTallyResultRequestAmino { + const obj: any = {}; + obj.proposal_id = message.proposalId + ? message.proposalId.toString() + : undefined; + return obj; + }, + fromAminoMsg( + object: QueryTallyResultRequestAminoMsg + ): QueryTallyResultRequest { + return QueryTallyResultRequest.fromAmino(object.value); + }, + toAminoMsg( + message: QueryTallyResultRequest + ): QueryTallyResultRequestAminoMsg { + return { + type: "cosmos-sdk/QueryTallyResultRequest", + value: QueryTallyResultRequest.toAmino(message), + }; + }, + fromProtoMsg( + message: QueryTallyResultRequestProtoMsg + ): QueryTallyResultRequest { + return QueryTallyResultRequest.decode(message.value); + }, + toProto(message: QueryTallyResultRequest): Uint8Array { + return QueryTallyResultRequest.encode(message).finish(); + }, + toProtoMsg( + message: QueryTallyResultRequest + ): QueryTallyResultRequestProtoMsg { + return { + typeUrl: "/cosmos.gov.v1beta1.QueryTallyResultRequest", + value: QueryTallyResultRequest.encode(message).finish(), + }; + }, +}; +function createBaseQueryTallyResultResponse(): QueryTallyResultResponse { + return { + tally: undefined, + }; +} +export const QueryTallyResultResponse = { + encode( + message: QueryTallyResultResponse, + writer: _m0.Writer = _m0.Writer.create() + ): _m0.Writer { + if (message.tally !== undefined) { + TallyResult.encode(message.tally, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + decode( + input: _m0.Reader | Uint8Array, + length?: number + ): QueryTallyResultResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryTallyResultResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.tally = TallyResult.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object: any): QueryTallyResultResponse { + return { + tally: isSet(object.tally) + ? TallyResult.fromJSON(object.tally) + : undefined, + }; + }, + toJSON(message: QueryTallyResultResponse): unknown { + const obj: any = {}; + message.tally !== undefined && + (obj.tally = message.tally + ? TallyResult.toJSON(message.tally) + : undefined); + return obj; + }, + fromPartial, I>>( + object: I + ): QueryTallyResultResponse { + const message = createBaseQueryTallyResultResponse(); + message.tally = + object.tally !== undefined && object.tally !== null + ? TallyResult.fromPartial(object.tally) + : undefined; + return message; + }, + fromAmino(object: QueryTallyResultResponseAmino): QueryTallyResultResponse { + return { + tally: object?.tally ? TallyResult.fromAmino(object.tally) : undefined, + }; + }, + toAmino(message: QueryTallyResultResponse): QueryTallyResultResponseAmino { + const obj: any = {}; + obj.tally = message.tally ? TallyResult.toAmino(message.tally) : undefined; + return obj; + }, + fromAminoMsg( + object: QueryTallyResultResponseAminoMsg + ): QueryTallyResultResponse { + return QueryTallyResultResponse.fromAmino(object.value); + }, + toAminoMsg( + message: QueryTallyResultResponse + ): QueryTallyResultResponseAminoMsg { + return { + type: "cosmos-sdk/QueryTallyResultResponse", + value: QueryTallyResultResponse.toAmino(message), + }; + }, + fromProtoMsg( + message: QueryTallyResultResponseProtoMsg + ): QueryTallyResultResponse { + return QueryTallyResultResponse.decode(message.value); + }, + toProto(message: QueryTallyResultResponse): Uint8Array { + return QueryTallyResultResponse.encode(message).finish(); + }, + toProtoMsg( + message: QueryTallyResultResponse + ): QueryTallyResultResponseProtoMsg { + return { + typeUrl: "/cosmos.gov.v1beta1.QueryTallyResultResponse", + value: QueryTallyResultResponse.encode(message).finish(), + }; + }, +}; +/** Query defines the gRPC querier service for gov module */ +export interface Query { + /** Proposal queries proposal details based on ProposalID. */ + Proposal(request: QueryProposalRequest): Promise; + /** Proposals queries all proposals based on given status. */ + Proposals(request: QueryProposalsRequest): Promise; + /** Vote queries voted information based on proposalID, voterAddr. */ + Vote(request: QueryVoteRequest): Promise; + /** Votes queries votes of a given proposal. */ + Votes(request: QueryVotesRequest): Promise; + /** Params queries all parameters of the gov module. */ + Params(request: QueryParamsRequest): Promise; + /** Deposit queries single deposit information based proposalID, depositAddr. */ + Deposit(request: QueryDepositRequest): Promise; + /** Deposits queries all deposits of a single proposal. */ + Deposits(request: QueryDepositsRequest): Promise; + /** TallyResult queries the tally of a proposal vote. */ + TallyResult( + request: QueryTallyResultRequest + ): Promise; +} +export class QueryClientImpl implements Query { + private readonly rpc: Rpc; + constructor(rpc: Rpc) { + this.rpc = rpc; + this.Proposal = this.Proposal.bind(this); + this.Proposals = this.Proposals.bind(this); + this.Vote = this.Vote.bind(this); + this.Votes = this.Votes.bind(this); + this.Params = this.Params.bind(this); + this.Deposit = this.Deposit.bind(this); + this.Deposits = this.Deposits.bind(this); + this.TallyResult = this.TallyResult.bind(this); + } + Proposal(request: QueryProposalRequest): Promise { + const data = QueryProposalRequest.encode(request).finish(); + const promise = this.rpc.request( + "cosmos.gov.v1beta1.Query", + "Proposal", + data + ); + return promise.then((data) => + QueryProposalResponse.decode(new _m0.Reader(data)) + ); + } + Proposals(request: QueryProposalsRequest): Promise { + const data = QueryProposalsRequest.encode(request).finish(); + const promise = this.rpc.request( + "cosmos.gov.v1beta1.Query", + "Proposals", + data + ); + return promise.then((data) => + QueryProposalsResponse.decode(new _m0.Reader(data)) + ); + } + Vote(request: QueryVoteRequest): Promise { + const data = QueryVoteRequest.encode(request).finish(); + const promise = this.rpc.request("cosmos.gov.v1beta1.Query", "Vote", data); + return promise.then((data) => + QueryVoteResponse.decode(new _m0.Reader(data)) + ); + } + Votes(request: QueryVotesRequest): Promise { + const data = QueryVotesRequest.encode(request).finish(); + const promise = this.rpc.request("cosmos.gov.v1beta1.Query", "Votes", data); + return promise.then((data) => + QueryVotesResponse.decode(new _m0.Reader(data)) + ); + } + Params(request: QueryParamsRequest): Promise { + const data = QueryParamsRequest.encode(request).finish(); + const promise = this.rpc.request( + "cosmos.gov.v1beta1.Query", + "Params", + data + ); + return promise.then((data) => + QueryParamsResponse.decode(new _m0.Reader(data)) + ); + } + Deposit(request: QueryDepositRequest): Promise { + const data = QueryDepositRequest.encode(request).finish(); + const promise = this.rpc.request( + "cosmos.gov.v1beta1.Query", + "Deposit", + data + ); + return promise.then((data) => + QueryDepositResponse.decode(new _m0.Reader(data)) + ); + } + Deposits(request: QueryDepositsRequest): Promise { + const data = QueryDepositsRequest.encode(request).finish(); + const promise = this.rpc.request( + "cosmos.gov.v1beta1.Query", + "Deposits", + data + ); + return promise.then((data) => + QueryDepositsResponse.decode(new _m0.Reader(data)) + ); + } + TallyResult( + request: QueryTallyResultRequest + ): Promise { + const data = QueryTallyResultRequest.encode(request).finish(); + const promise = this.rpc.request( + "cosmos.gov.v1beta1.Query", + "TallyResult", + data + ); + return promise.then((data) => + QueryTallyResultResponse.decode(new _m0.Reader(data)) + ); + } +} diff --git a/packages/types/src/cosmos/gov/v1beta1/tx.amino.ts b/packages/types/src/cosmos/gov/v1beta1/tx.amino.ts new file mode 100644 index 000000000..357f8bbed --- /dev/null +++ b/packages/types/src/cosmos/gov/v1beta1/tx.amino.ts @@ -0,0 +1,24 @@ +/* eslint-disable */ +import { MsgSubmitProposal, MsgVote, MsgVoteWeighted, MsgDeposit } from "./tx"; +export const AminoConverter = { + "/cosmos.gov.v1beta1.MsgSubmitProposal": { + aminoType: "cosmos-sdk/MsgSubmitProposal", + toAmino: MsgSubmitProposal.toAmino, + fromAmino: MsgSubmitProposal.fromAmino, + }, + "/cosmos.gov.v1beta1.MsgVote": { + aminoType: "cosmos-sdk/MsgVote", + toAmino: MsgVote.toAmino, + fromAmino: MsgVote.fromAmino, + }, + "/cosmos.gov.v1beta1.MsgVoteWeighted": { + aminoType: "cosmos-sdk/MsgVoteWeighted", + toAmino: MsgVoteWeighted.toAmino, + fromAmino: MsgVoteWeighted.fromAmino, + }, + "/cosmos.gov.v1beta1.MsgDeposit": { + aminoType: "cosmos-sdk/MsgDeposit", + toAmino: MsgDeposit.toAmino, + fromAmino: MsgDeposit.fromAmino, + }, +}; diff --git a/packages/types/src/cosmos/gov/v1beta1/tx.registry.ts b/packages/types/src/cosmos/gov/v1beta1/tx.registry.ts new file mode 100644 index 000000000..553e5c2a5 --- /dev/null +++ b/packages/types/src/cosmos/gov/v1beta1/tx.registry.ts @@ -0,0 +1,146 @@ +/* eslint-disable */ +import { GeneratedType, Registry } from "@cosmjs/proto-signing"; +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 MessageComposer = { + encoded: { + submitProposal(value: MsgSubmitProposal) { + return { + typeUrl: "/cosmos.gov.v1beta1.MsgSubmitProposal", + value: MsgSubmitProposal.encode(value).finish(), + }; + }, + vote(value: MsgVote) { + return { + typeUrl: "/cosmos.gov.v1beta1.MsgVote", + value: MsgVote.encode(value).finish(), + }; + }, + voteWeighted(value: MsgVoteWeighted) { + return { + typeUrl: "/cosmos.gov.v1beta1.MsgVoteWeighted", + value: MsgVoteWeighted.encode(value).finish(), + }; + }, + deposit(value: MsgDeposit) { + return { + typeUrl: "/cosmos.gov.v1beta1.MsgDeposit", + value: MsgDeposit.encode(value).finish(), + }; + }, + }, + withTypeUrl: { + submitProposal(value: MsgSubmitProposal) { + return { + typeUrl: "/cosmos.gov.v1beta1.MsgSubmitProposal", + value, + }; + }, + vote(value: MsgVote) { + return { + typeUrl: "/cosmos.gov.v1beta1.MsgVote", + value, + }; + }, + voteWeighted(value: MsgVoteWeighted) { + return { + typeUrl: "/cosmos.gov.v1beta1.MsgVoteWeighted", + value, + }; + }, + deposit(value: MsgDeposit) { + return { + typeUrl: "/cosmos.gov.v1beta1.MsgDeposit", + value, + }; + }, + }, + toJSON: { + submitProposal(value: MsgSubmitProposal) { + return { + typeUrl: "/cosmos.gov.v1beta1.MsgSubmitProposal", + value: MsgSubmitProposal.toJSON(value), + }; + }, + vote(value: MsgVote) { + return { + typeUrl: "/cosmos.gov.v1beta1.MsgVote", + value: MsgVote.toJSON(value), + }; + }, + voteWeighted(value: MsgVoteWeighted) { + return { + typeUrl: "/cosmos.gov.v1beta1.MsgVoteWeighted", + value: MsgVoteWeighted.toJSON(value), + }; + }, + deposit(value: MsgDeposit) { + return { + typeUrl: "/cosmos.gov.v1beta1.MsgDeposit", + value: MsgDeposit.toJSON(value), + }; + }, + }, + fromJSON: { + submitProposal(value: any) { + return { + typeUrl: "/cosmos.gov.v1beta1.MsgSubmitProposal", + value: MsgSubmitProposal.fromJSON(value), + }; + }, + vote(value: any) { + return { + typeUrl: "/cosmos.gov.v1beta1.MsgVote", + value: MsgVote.fromJSON(value), + }; + }, + voteWeighted(value: any) { + return { + typeUrl: "/cosmos.gov.v1beta1.MsgVoteWeighted", + value: MsgVoteWeighted.fromJSON(value), + }; + }, + deposit(value: any) { + return { + typeUrl: "/cosmos.gov.v1beta1.MsgDeposit", + value: MsgDeposit.fromJSON(value), + }; + }, + }, + fromPartial: { + submitProposal(value: MsgSubmitProposal) { + return { + typeUrl: "/cosmos.gov.v1beta1.MsgSubmitProposal", + value: MsgSubmitProposal.fromPartial(value), + }; + }, + vote(value: MsgVote) { + return { + typeUrl: "/cosmos.gov.v1beta1.MsgVote", + value: MsgVote.fromPartial(value), + }; + }, + voteWeighted(value: MsgVoteWeighted) { + return { + typeUrl: "/cosmos.gov.v1beta1.MsgVoteWeighted", + value: MsgVoteWeighted.fromPartial(value), + }; + }, + deposit(value: MsgDeposit) { + return { + typeUrl: "/cosmos.gov.v1beta1.MsgDeposit", + value: MsgDeposit.fromPartial(value), + }; + }, + }, +}; diff --git a/packages/types/src/cosmos/gov/v1beta1/tx.ts b/packages/types/src/cosmos/gov/v1beta1/tx.ts new file mode 100644 index 000000000..4b96bad75 --- /dev/null +++ b/packages/types/src/cosmos/gov/v1beta1/tx.ts @@ -0,0 +1,1060 @@ +/* eslint-disable */ +import { Any, AnyAmino } from "../../../google/protobuf/any"; +import { Coin, CoinAmino } from "../../base/v1beta1/coin"; +import { + VoteOption, + WeightedVoteOption, + WeightedVoteOptionAmino, + voteOptionFromJSON, + voteOptionToJSON, +} from "./gov"; +import { Long, isSet, DeepPartial, Exact, Rpc } from "../../../helpers"; +import * as _m0 from "protobufjs/minimal"; +export const protobufPackage = "cosmos.gov.v1beta1"; +/** + * MsgSubmitProposal defines an sdk.Msg type that supports submitting arbitrary + * proposal Content. + */ +export interface MsgSubmitProposal { + /** content is the proposal's content. */ + content?: Any; + /** initial_deposit is the deposit value that must be paid at proposal submission. */ + initialDeposit: Coin[]; + /** proposer is the account address of the proposer. */ + proposer: string; +} +export interface MsgSubmitProposalProtoMsg { + typeUrl: "/cosmos.gov.v1beta1.MsgSubmitProposal"; + value: Uint8Array; +} +/** + * MsgSubmitProposal defines an sdk.Msg type that supports submitting arbitrary + * proposal Content. + */ +export interface MsgSubmitProposalAmino { + /** content is the proposal's content. */ + content?: AnyAmino; + /** initial_deposit is the deposit value that must be paid at proposal submission. */ + initial_deposit: CoinAmino[]; + /** proposer is the account address of the proposer. */ + proposer: string; +} +export interface MsgSubmitProposalAminoMsg { + type: "cosmos-sdk/MsgSubmitProposal"; + value: MsgSubmitProposalAmino; +} +/** MsgSubmitProposalResponse defines the Msg/SubmitProposal response type. */ +export interface MsgSubmitProposalResponse { + /** proposal_id defines the unique id of the proposal. */ + proposalId: Long; +} +export interface MsgSubmitProposalResponseProtoMsg { + typeUrl: "/cosmos.gov.v1beta1.MsgSubmitProposalResponse"; + value: Uint8Array; +} +/** MsgSubmitProposalResponse defines the Msg/SubmitProposal response type. */ +export interface MsgSubmitProposalResponseAmino { + /** proposal_id defines the unique id of the proposal. */ + proposal_id: string; +} +export interface MsgSubmitProposalResponseAminoMsg { + type: "cosmos-sdk/MsgSubmitProposalResponse"; + value: MsgSubmitProposalResponseAmino; +} +/** MsgVote defines a message to cast a vote. */ +export interface MsgVote { + /** proposal_id defines the unique id of the proposal. */ + proposalId: Long; + /** voter is the voter address for the proposal. */ + voter: string; + /** option defines the vote option. */ + option: VoteOption; +} +export interface MsgVoteProtoMsg { + typeUrl: "/cosmos.gov.v1beta1.MsgVote"; + value: Uint8Array; +} +/** MsgVote defines a message to cast a vote. */ +export interface MsgVoteAmino { + /** proposal_id defines the unique id of the proposal. */ + proposal_id: string; + /** voter is the voter address for the proposal. */ + voter: string; + /** option defines the vote option. */ + option: VoteOption; +} +export interface MsgVoteAminoMsg { + type: "cosmos-sdk/MsgVote"; + value: MsgVoteAmino; +} +/** MsgVoteResponse defines the Msg/Vote response type. */ +export interface MsgVoteResponse {} +export interface MsgVoteResponseProtoMsg { + typeUrl: "/cosmos.gov.v1beta1.MsgVoteResponse"; + value: Uint8Array; +} +/** MsgVoteResponse defines the Msg/Vote response type. */ +export interface MsgVoteResponseAmino {} +export interface MsgVoteResponseAminoMsg { + type: "cosmos-sdk/MsgVoteResponse"; + value: MsgVoteResponseAmino; +} +/** + * MsgVoteWeighted defines a message to cast a vote. + * + * Since: cosmos-sdk 0.43 + */ +export interface MsgVoteWeighted { + /** proposal_id defines the unique id of the proposal. */ + proposalId: Long; + /** voter is the voter address for the proposal. */ + voter: string; + /** options defines the weighted vote options. */ + options: WeightedVoteOption[]; +} +export interface MsgVoteWeightedProtoMsg { + typeUrl: "/cosmos.gov.v1beta1.MsgVoteWeighted"; + value: Uint8Array; +} +/** + * MsgVoteWeighted defines a message to cast a vote. + * + * Since: cosmos-sdk 0.43 + */ +export interface MsgVoteWeightedAmino { + /** proposal_id defines the unique id of the proposal. */ + proposal_id: string; + /** voter is the voter address for the proposal. */ + voter: string; + /** options defines the weighted vote options. */ + options: WeightedVoteOptionAmino[]; +} +export interface MsgVoteWeightedAminoMsg { + type: "cosmos-sdk/MsgVoteWeighted"; + value: MsgVoteWeightedAmino; +} +/** + * MsgVoteWeightedResponse defines the Msg/VoteWeighted response type. + * + * Since: cosmos-sdk 0.43 + */ +export interface MsgVoteWeightedResponse {} +export interface MsgVoteWeightedResponseProtoMsg { + typeUrl: "/cosmos.gov.v1beta1.MsgVoteWeightedResponse"; + value: Uint8Array; +} +/** + * MsgVoteWeightedResponse defines the Msg/VoteWeighted response type. + * + * Since: cosmos-sdk 0.43 + */ +export interface MsgVoteWeightedResponseAmino {} +export interface MsgVoteWeightedResponseAminoMsg { + type: "cosmos-sdk/MsgVoteWeightedResponse"; + value: MsgVoteWeightedResponseAmino; +} +/** MsgDeposit defines a message to submit a deposit to an existing proposal. */ +export interface MsgDeposit { + /** proposal_id defines the unique id of the proposal. */ + proposalId: Long; + /** depositor defines the deposit addresses from the proposals. */ + depositor: string; + /** amount to be deposited by depositor. */ + amount: Coin[]; +} +export interface MsgDepositProtoMsg { + typeUrl: "/cosmos.gov.v1beta1.MsgDeposit"; + value: Uint8Array; +} +/** MsgDeposit defines a message to submit a deposit to an existing proposal. */ +export interface MsgDepositAmino { + /** proposal_id defines the unique id of the proposal. */ + proposal_id: string; + /** depositor defines the deposit addresses from the proposals. */ + depositor: string; + /** amount to be deposited by depositor. */ + amount: CoinAmino[]; +} +export interface MsgDepositAminoMsg { + type: "cosmos-sdk/MsgDeposit"; + value: MsgDepositAmino; +} +/** MsgDepositResponse defines the Msg/Deposit response type. */ +export interface MsgDepositResponse {} +export interface MsgDepositResponseProtoMsg { + typeUrl: "/cosmos.gov.v1beta1.MsgDepositResponse"; + value: Uint8Array; +} +/** MsgDepositResponse defines the Msg/Deposit response type. */ +export interface MsgDepositResponseAmino {} +export interface MsgDepositResponseAminoMsg { + type: "cosmos-sdk/MsgDepositResponse"; + value: MsgDepositResponseAmino; +} +function createBaseMsgSubmitProposal(): MsgSubmitProposal { + return { + content: undefined, + initialDeposit: [], + proposer: "", + }; +} +export const MsgSubmitProposal = { + encode( + message: MsgSubmitProposal, + writer: _m0.Writer = _m0.Writer.create() + ): _m0.Writer { + if (message.content !== undefined) { + Any.encode(message.content, writer.uint32(10).fork()).ldelim(); + } + for (const v of message.initialDeposit) { + Coin.encode(v!, writer.uint32(18).fork()).ldelim(); + } + if (message.proposer !== "") { + writer.uint32(26).string(message.proposer); + } + return writer; + }, + decode(input: _m0.Reader | Uint8Array, length?: number): MsgSubmitProposal { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSubmitProposal(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.content = Any.decode(reader, reader.uint32()); + break; + case 2: + message.initialDeposit.push(Coin.decode(reader, reader.uint32())); + break; + case 3: + message.proposer = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object: any): MsgSubmitProposal { + return { + content: isSet(object.content) ? Any.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): unknown { + const obj: any = {}; + message.content !== undefined && + (obj.content = message.content ? Any.toJSON(message.content) : undefined); + if (message.initialDeposit) { + obj.initialDeposit = message.initialDeposit.map((e) => + e ? Coin.toJSON(e) : undefined + ); + } else { + obj.initialDeposit = []; + } + message.proposer !== undefined && (obj.proposer = message.proposer); + return obj; + }, + fromPartial, I>>( + object: I + ): MsgSubmitProposal { + const message = createBaseMsgSubmitProposal(); + message.content = + object.content !== undefined && object.content !== null + ? Any.fromPartial(object.content) + : undefined; + message.initialDeposit = + object.initialDeposit?.map((e) => Coin.fromPartial(e)) || []; + message.proposer = object.proposer ?? ""; + return message; + }, + fromAmino(object: MsgSubmitProposalAmino): MsgSubmitProposal { + return { + content: object?.content ? Any.fromAmino(object.content) : undefined, + initialDeposit: Array.isArray(object?.initial_deposit) + ? object.initial_deposit.map((e: any) => Coin.fromAmino(e)) + : [], + proposer: object.proposer, + }; + }, + toAmino(message: MsgSubmitProposal): MsgSubmitProposalAmino { + const obj: any = {}; + obj.content = message.content ? Any.toAmino(message.content) : undefined; + if (message.initialDeposit) { + obj.initial_deposit = message.initialDeposit.map((e) => + e ? Coin.toAmino(e) : undefined + ); + } else { + obj.initial_deposit = []; + } + obj.proposer = message.proposer; + return obj; + }, + fromAminoMsg(object: MsgSubmitProposalAminoMsg): MsgSubmitProposal { + return MsgSubmitProposal.fromAmino(object.value); + }, + toAminoMsg(message: MsgSubmitProposal): MsgSubmitProposalAminoMsg { + return { + type: "cosmos-sdk/MsgSubmitProposal", + value: MsgSubmitProposal.toAmino(message), + }; + }, + fromProtoMsg(message: MsgSubmitProposalProtoMsg): MsgSubmitProposal { + return MsgSubmitProposal.decode(message.value); + }, + toProto(message: MsgSubmitProposal): Uint8Array { + return MsgSubmitProposal.encode(message).finish(); + }, + toProtoMsg(message: MsgSubmitProposal): MsgSubmitProposalProtoMsg { + return { + typeUrl: "/cosmos.gov.v1beta1.MsgSubmitProposal", + value: MsgSubmitProposal.encode(message).finish(), + }; + }, +}; +function createBaseMsgSubmitProposalResponse(): MsgSubmitProposalResponse { + return { + proposalId: Long.UZERO, + }; +} +export const MsgSubmitProposalResponse = { + encode( + message: MsgSubmitProposalResponse, + writer: _m0.Writer = _m0.Writer.create() + ): _m0.Writer { + if (!message.proposalId.isZero()) { + writer.uint32(8).uint64(message.proposalId); + } + return writer; + }, + decode( + input: _m0.Reader | Uint8Array, + length?: number + ): MsgSubmitProposalResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSubmitProposalResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.proposalId = reader.uint64() as Long; + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object: any): MsgSubmitProposalResponse { + return { + proposalId: isSet(object.proposalId) + ? Long.fromValue(object.proposalId) + : Long.UZERO, + }; + }, + toJSON(message: MsgSubmitProposalResponse): unknown { + const obj: any = {}; + message.proposalId !== undefined && + (obj.proposalId = (message.proposalId || Long.UZERO).toString()); + return obj; + }, + fromPartial, I>>( + object: I + ): MsgSubmitProposalResponse { + const message = createBaseMsgSubmitProposalResponse(); + message.proposalId = + object.proposalId !== undefined && object.proposalId !== null + ? Long.fromValue(object.proposalId) + : Long.UZERO; + return message; + }, + fromAmino(object: MsgSubmitProposalResponseAmino): MsgSubmitProposalResponse { + return { + proposalId: Long.fromString(object.proposal_id), + }; + }, + toAmino(message: MsgSubmitProposalResponse): MsgSubmitProposalResponseAmino { + const obj: any = {}; + obj.proposal_id = message.proposalId + ? message.proposalId.toString() + : undefined; + return obj; + }, + fromAminoMsg( + object: MsgSubmitProposalResponseAminoMsg + ): MsgSubmitProposalResponse { + return MsgSubmitProposalResponse.fromAmino(object.value); + }, + toAminoMsg( + message: MsgSubmitProposalResponse + ): MsgSubmitProposalResponseAminoMsg { + return { + type: "cosmos-sdk/MsgSubmitProposalResponse", + value: MsgSubmitProposalResponse.toAmino(message), + }; + }, + fromProtoMsg( + message: MsgSubmitProposalResponseProtoMsg + ): MsgSubmitProposalResponse { + return MsgSubmitProposalResponse.decode(message.value); + }, + toProto(message: MsgSubmitProposalResponse): Uint8Array { + return MsgSubmitProposalResponse.encode(message).finish(); + }, + toProtoMsg( + message: MsgSubmitProposalResponse + ): MsgSubmitProposalResponseProtoMsg { + return { + typeUrl: "/cosmos.gov.v1beta1.MsgSubmitProposalResponse", + value: MsgSubmitProposalResponse.encode(message).finish(), + }; + }, +}; +function createBaseMsgVote(): MsgVote { + return { + proposalId: Long.UZERO, + voter: "", + option: 0, + }; +} +export const MsgVote = { + encode( + message: MsgVote, + writer: _m0.Writer = _m0.Writer.create() + ): _m0.Writer { + if (!message.proposalId.isZero()) { + writer.uint32(8).uint64(message.proposalId); + } + if (message.voter !== "") { + writer.uint32(18).string(message.voter); + } + if (message.option !== 0) { + writer.uint32(24).int32(message.option); + } + return writer; + }, + decode(input: _m0.Reader | Uint8Array, length?: number): MsgVote { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgVote(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.proposalId = reader.uint64() as Long; + break; + case 2: + message.voter = reader.string(); + break; + case 3: + message.option = reader.int32() as any; + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object: any): MsgVote { + return { + proposalId: isSet(object.proposalId) + ? Long.fromValue(object.proposalId) + : Long.UZERO, + voter: isSet(object.voter) ? String(object.voter) : "", + option: isSet(object.option) ? voteOptionFromJSON(object.option) : 0, + }; + }, + toJSON(message: MsgVote): unknown { + const obj: any = {}; + message.proposalId !== undefined && + (obj.proposalId = (message.proposalId || Long.UZERO).toString()); + message.voter !== undefined && (obj.voter = message.voter); + message.option !== undefined && + (obj.option = voteOptionToJSON(message.option)); + return obj; + }, + fromPartial, I>>(object: I): MsgVote { + const message = createBaseMsgVote(); + message.proposalId = + object.proposalId !== undefined && object.proposalId !== null + ? Long.fromValue(object.proposalId) + : Long.UZERO; + message.voter = object.voter ?? ""; + message.option = object.option ?? 0; + return message; + }, + fromAmino(object: MsgVoteAmino): MsgVote { + return { + proposalId: Long.fromString(object.proposal_id), + voter: object.voter, + option: isSet(object.option) ? voteOptionFromJSON(object.option) : 0, + }; + }, + toAmino(message: MsgVote): MsgVoteAmino { + const obj: any = {}; + obj.proposal_id = message.proposalId + ? message.proposalId.toString() + : undefined; + obj.voter = message.voter; + obj.option = message.option; + return obj; + }, + fromAminoMsg(object: MsgVoteAminoMsg): MsgVote { + return MsgVote.fromAmino(object.value); + }, + toAminoMsg(message: MsgVote): MsgVoteAminoMsg { + return { + type: "cosmos-sdk/MsgVote", + value: MsgVote.toAmino(message), + }; + }, + fromProtoMsg(message: MsgVoteProtoMsg): MsgVote { + return MsgVote.decode(message.value); + }, + toProto(message: MsgVote): Uint8Array { + return MsgVote.encode(message).finish(); + }, + toProtoMsg(message: MsgVote): MsgVoteProtoMsg { + return { + typeUrl: "/cosmos.gov.v1beta1.MsgVote", + value: MsgVote.encode(message).finish(), + }; + }, +}; +function createBaseMsgVoteResponse(): MsgVoteResponse { + return {}; +} +export const MsgVoteResponse = { + encode( + _: MsgVoteResponse, + writer: _m0.Writer = _m0.Writer.create() + ): _m0.Writer { + return writer; + }, + decode(input: _m0.Reader | Uint8Array, length?: number): MsgVoteResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgVoteResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(_: any): MsgVoteResponse { + return {}; + }, + toJSON(_: MsgVoteResponse): unknown { + const obj: any = {}; + return obj; + }, + fromPartial, I>>( + _: I + ): MsgVoteResponse { + const message = createBaseMsgVoteResponse(); + return message; + }, + fromAmino(_: MsgVoteResponseAmino): MsgVoteResponse { + return {}; + }, + toAmino(_: MsgVoteResponse): MsgVoteResponseAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg(object: MsgVoteResponseAminoMsg): MsgVoteResponse { + return MsgVoteResponse.fromAmino(object.value); + }, + toAminoMsg(message: MsgVoteResponse): MsgVoteResponseAminoMsg { + return { + type: "cosmos-sdk/MsgVoteResponse", + value: MsgVoteResponse.toAmino(message), + }; + }, + fromProtoMsg(message: MsgVoteResponseProtoMsg): MsgVoteResponse { + return MsgVoteResponse.decode(message.value); + }, + toProto(message: MsgVoteResponse): Uint8Array { + return MsgVoteResponse.encode(message).finish(); + }, + toProtoMsg(message: MsgVoteResponse): MsgVoteResponseProtoMsg { + return { + typeUrl: "/cosmos.gov.v1beta1.MsgVoteResponse", + value: MsgVoteResponse.encode(message).finish(), + }; + }, +}; +function createBaseMsgVoteWeighted(): MsgVoteWeighted { + return { + proposalId: Long.UZERO, + voter: "", + options: [], + }; +} +export const MsgVoteWeighted = { + encode( + message: MsgVoteWeighted, + writer: _m0.Writer = _m0.Writer.create() + ): _m0.Writer { + if (!message.proposalId.isZero()) { + writer.uint32(8).uint64(message.proposalId); + } + if (message.voter !== "") { + writer.uint32(18).string(message.voter); + } + for (const v of message.options) { + WeightedVoteOption.encode(v!, writer.uint32(26).fork()).ldelim(); + } + return writer; + }, + decode(input: _m0.Reader | Uint8Array, length?: number): MsgVoteWeighted { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgVoteWeighted(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.proposalId = reader.uint64() as Long; + break; + case 2: + message.voter = reader.string(); + break; + case 3: + message.options.push( + WeightedVoteOption.decode(reader, reader.uint32()) + ); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object: any): MsgVoteWeighted { + return { + proposalId: isSet(object.proposalId) + ? Long.fromValue(object.proposalId) + : Long.UZERO, + voter: isSet(object.voter) ? String(object.voter) : "", + options: Array.isArray(object?.options) + ? object.options.map((e: any) => WeightedVoteOption.fromJSON(e)) + : [], + }; + }, + toJSON(message: MsgVoteWeighted): unknown { + const obj: any = {}; + message.proposalId !== undefined && + (obj.proposalId = (message.proposalId || Long.UZERO).toString()); + message.voter !== undefined && (obj.voter = message.voter); + if (message.options) { + obj.options = message.options.map((e) => + e ? WeightedVoteOption.toJSON(e) : undefined + ); + } else { + obj.options = []; + } + return obj; + }, + fromPartial, I>>( + object: I + ): MsgVoteWeighted { + const message = createBaseMsgVoteWeighted(); + message.proposalId = + object.proposalId !== undefined && object.proposalId !== null + ? Long.fromValue(object.proposalId) + : Long.UZERO; + message.voter = object.voter ?? ""; + message.options = + object.options?.map((e) => WeightedVoteOption.fromPartial(e)) || []; + return message; + }, + fromAmino(object: MsgVoteWeightedAmino): MsgVoteWeighted { + return { + proposalId: Long.fromString(object.proposal_id), + voter: object.voter, + options: Array.isArray(object?.options) + ? object.options.map((e: any) => WeightedVoteOption.fromAmino(e)) + : [], + }; + }, + toAmino(message: MsgVoteWeighted): MsgVoteWeightedAmino { + const obj: any = {}; + obj.proposal_id = message.proposalId + ? message.proposalId.toString() + : undefined; + obj.voter = message.voter; + if (message.options) { + obj.options = message.options.map((e) => + e ? WeightedVoteOption.toAmino(e) : undefined + ); + } else { + obj.options = []; + } + return obj; + }, + fromAminoMsg(object: MsgVoteWeightedAminoMsg): MsgVoteWeighted { + return MsgVoteWeighted.fromAmino(object.value); + }, + toAminoMsg(message: MsgVoteWeighted): MsgVoteWeightedAminoMsg { + return { + type: "cosmos-sdk/MsgVoteWeighted", + value: MsgVoteWeighted.toAmino(message), + }; + }, + fromProtoMsg(message: MsgVoteWeightedProtoMsg): MsgVoteWeighted { + return MsgVoteWeighted.decode(message.value); + }, + toProto(message: MsgVoteWeighted): Uint8Array { + return MsgVoteWeighted.encode(message).finish(); + }, + toProtoMsg(message: MsgVoteWeighted): MsgVoteWeightedProtoMsg { + return { + typeUrl: "/cosmos.gov.v1beta1.MsgVoteWeighted", + value: MsgVoteWeighted.encode(message).finish(), + }; + }, +}; +function createBaseMsgVoteWeightedResponse(): MsgVoteWeightedResponse { + return {}; +} +export const MsgVoteWeightedResponse = { + encode( + _: MsgVoteWeightedResponse, + writer: _m0.Writer = _m0.Writer.create() + ): _m0.Writer { + return writer; + }, + decode( + input: _m0.Reader | Uint8Array, + length?: number + ): MsgVoteWeightedResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgVoteWeightedResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(_: any): MsgVoteWeightedResponse { + return {}; + }, + toJSON(_: MsgVoteWeightedResponse): unknown { + const obj: any = {}; + return obj; + }, + fromPartial, I>>( + _: I + ): MsgVoteWeightedResponse { + const message = createBaseMsgVoteWeightedResponse(); + return message; + }, + fromAmino(_: MsgVoteWeightedResponseAmino): MsgVoteWeightedResponse { + return {}; + }, + toAmino(_: MsgVoteWeightedResponse): MsgVoteWeightedResponseAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg( + object: MsgVoteWeightedResponseAminoMsg + ): MsgVoteWeightedResponse { + return MsgVoteWeightedResponse.fromAmino(object.value); + }, + toAminoMsg( + message: MsgVoteWeightedResponse + ): MsgVoteWeightedResponseAminoMsg { + return { + type: "cosmos-sdk/MsgVoteWeightedResponse", + value: MsgVoteWeightedResponse.toAmino(message), + }; + }, + fromProtoMsg( + message: MsgVoteWeightedResponseProtoMsg + ): MsgVoteWeightedResponse { + return MsgVoteWeightedResponse.decode(message.value); + }, + toProto(message: MsgVoteWeightedResponse): Uint8Array { + return MsgVoteWeightedResponse.encode(message).finish(); + }, + toProtoMsg( + message: MsgVoteWeightedResponse + ): MsgVoteWeightedResponseProtoMsg { + return { + typeUrl: "/cosmos.gov.v1beta1.MsgVoteWeightedResponse", + value: MsgVoteWeightedResponse.encode(message).finish(), + }; + }, +}; +function createBaseMsgDeposit(): MsgDeposit { + return { + proposalId: Long.UZERO, + depositor: "", + amount: [], + }; +} +export const MsgDeposit = { + encode( + message: MsgDeposit, + writer: _m0.Writer = _m0.Writer.create() + ): _m0.Writer { + if (!message.proposalId.isZero()) { + writer.uint32(8).uint64(message.proposalId); + } + if (message.depositor !== "") { + writer.uint32(18).string(message.depositor); + } + for (const v of message.amount) { + Coin.encode(v!, writer.uint32(26).fork()).ldelim(); + } + return writer; + }, + decode(input: _m0.Reader | Uint8Array, length?: number): MsgDeposit { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgDeposit(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.proposalId = reader.uint64() as Long; + break; + case 2: + message.depositor = reader.string(); + break; + case 3: + message.amount.push(Coin.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object: any): MsgDeposit { + return { + proposalId: isSet(object.proposalId) + ? Long.fromValue(object.proposalId) + : Long.UZERO, + depositor: isSet(object.depositor) ? String(object.depositor) : "", + amount: Array.isArray(object?.amount) + ? object.amount.map((e: any) => Coin.fromJSON(e)) + : [], + }; + }, + toJSON(message: MsgDeposit): unknown { + const obj: any = {}; + message.proposalId !== undefined && + (obj.proposalId = (message.proposalId || Long.UZERO).toString()); + message.depositor !== undefined && (obj.depositor = message.depositor); + if (message.amount) { + obj.amount = message.amount.map((e) => (e ? Coin.toJSON(e) : undefined)); + } else { + obj.amount = []; + } + return obj; + }, + fromPartial, I>>( + object: I + ): MsgDeposit { + const message = createBaseMsgDeposit(); + message.proposalId = + object.proposalId !== undefined && object.proposalId !== null + ? Long.fromValue(object.proposalId) + : Long.UZERO; + message.depositor = object.depositor ?? ""; + message.amount = object.amount?.map((e) => Coin.fromPartial(e)) || []; + return message; + }, + fromAmino(object: MsgDepositAmino): MsgDeposit { + return { + proposalId: Long.fromString(object.proposal_id), + depositor: object.depositor, + amount: Array.isArray(object?.amount) + ? object.amount.map((e: any) => Coin.fromAmino(e)) + : [], + }; + }, + toAmino(message: MsgDeposit): MsgDepositAmino { + const obj: any = {}; + obj.proposal_id = message.proposalId + ? message.proposalId.toString() + : undefined; + obj.depositor = message.depositor; + if (message.amount) { + obj.amount = message.amount.map((e) => (e ? Coin.toAmino(e) : undefined)); + } else { + obj.amount = []; + } + return obj; + }, + fromAminoMsg(object: MsgDepositAminoMsg): MsgDeposit { + return MsgDeposit.fromAmino(object.value); + }, + toAminoMsg(message: MsgDeposit): MsgDepositAminoMsg { + return { + type: "cosmos-sdk/MsgDeposit", + value: MsgDeposit.toAmino(message), + }; + }, + fromProtoMsg(message: MsgDepositProtoMsg): MsgDeposit { + return MsgDeposit.decode(message.value); + }, + toProto(message: MsgDeposit): Uint8Array { + return MsgDeposit.encode(message).finish(); + }, + toProtoMsg(message: MsgDeposit): MsgDepositProtoMsg { + return { + typeUrl: "/cosmos.gov.v1beta1.MsgDeposit", + value: MsgDeposit.encode(message).finish(), + }; + }, +}; +function createBaseMsgDepositResponse(): MsgDepositResponse { + return {}; +} +export const MsgDepositResponse = { + encode( + _: MsgDepositResponse, + writer: _m0.Writer = _m0.Writer.create() + ): _m0.Writer { + return writer; + }, + decode(input: _m0.Reader | Uint8Array, length?: number): MsgDepositResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgDepositResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(_: any): MsgDepositResponse { + return {}; + }, + toJSON(_: MsgDepositResponse): unknown { + const obj: any = {}; + return obj; + }, + fromPartial, I>>( + _: I + ): MsgDepositResponse { + const message = createBaseMsgDepositResponse(); + return message; + }, + fromAmino(_: MsgDepositResponseAmino): MsgDepositResponse { + return {}; + }, + toAmino(_: MsgDepositResponse): MsgDepositResponseAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg(object: MsgDepositResponseAminoMsg): MsgDepositResponse { + return MsgDepositResponse.fromAmino(object.value); + }, + toAminoMsg(message: MsgDepositResponse): MsgDepositResponseAminoMsg { + return { + type: "cosmos-sdk/MsgDepositResponse", + value: MsgDepositResponse.toAmino(message), + }; + }, + fromProtoMsg(message: MsgDepositResponseProtoMsg): MsgDepositResponse { + return MsgDepositResponse.decode(message.value); + }, + toProto(message: MsgDepositResponse): Uint8Array { + return MsgDepositResponse.encode(message).finish(); + }, + toProtoMsg(message: MsgDepositResponse): MsgDepositResponseProtoMsg { + return { + typeUrl: "/cosmos.gov.v1beta1.MsgDepositResponse", + value: MsgDepositResponse.encode(message).finish(), + }; + }, +}; +/** Msg defines the bank Msg service. */ +export interface Msg { + /** SubmitProposal defines a method to create new proposal given a content. */ + SubmitProposal( + request: MsgSubmitProposal + ): Promise; + /** Vote defines a method to add a vote on a specific proposal. */ + Vote(request: MsgVote): Promise; + /** + * VoteWeighted defines a method to add a weighted vote on a specific proposal. + * + * Since: cosmos-sdk 0.43 + */ + VoteWeighted(request: MsgVoteWeighted): Promise; + /** Deposit defines a method to add deposit on a specific proposal. */ + Deposit(request: MsgDeposit): Promise; +} +export class MsgClientImpl implements Msg { + private readonly rpc: Rpc; + constructor(rpc: Rpc) { + this.rpc = rpc; + this.SubmitProposal = this.SubmitProposal.bind(this); + this.Vote = this.Vote.bind(this); + this.VoteWeighted = this.VoteWeighted.bind(this); + this.Deposit = this.Deposit.bind(this); + } + SubmitProposal( + request: MsgSubmitProposal + ): Promise { + const data = MsgSubmitProposal.encode(request).finish(); + const promise = this.rpc.request( + "cosmos.gov.v1beta1.Msg", + "SubmitProposal", + data + ); + return promise.then((data) => + MsgSubmitProposalResponse.decode(new _m0.Reader(data)) + ); + } + Vote(request: MsgVote): Promise { + const data = MsgVote.encode(request).finish(); + const promise = this.rpc.request("cosmos.gov.v1beta1.Msg", "Vote", data); + return promise.then((data) => MsgVoteResponse.decode(new _m0.Reader(data))); + } + VoteWeighted(request: MsgVoteWeighted): Promise { + const data = MsgVoteWeighted.encode(request).finish(); + const promise = this.rpc.request( + "cosmos.gov.v1beta1.Msg", + "VoteWeighted", + data + ); + return promise.then((data) => + MsgVoteWeightedResponse.decode(new _m0.Reader(data)) + ); + } + Deposit(request: MsgDeposit): Promise { + const data = MsgDeposit.encode(request).finish(); + const promise = this.rpc.request("cosmos.gov.v1beta1.Msg", "Deposit", data); + return promise.then((data) => + MsgDepositResponse.decode(new _m0.Reader(data)) + ); + } +} diff --git a/packages/types/src/cosmos/tx/signing/v1beta1/signing.ts b/packages/types/src/cosmos/tx/signing/v1beta1/signing.ts index f10f6d746..f5f1abb64 100644 --- a/packages/types/src/cosmos/tx/signing/v1beta1/signing.ts +++ b/packages/types/src/cosmos/tx/signing/v1beta1/signing.ts @@ -1,6 +1,9 @@ /* eslint-disable */ -import { CompactBitArray } from "../../../crypto/multisig/v1beta1/multisig"; -import { Any } from "../../../../google/protobuf/any"; +import { + CompactBitArray, + CompactBitArrayAmino, +} from "../../../crypto/multisig/v1beta1/multisig"; +import { Any, AnyAmino } from "../../../../google/protobuf/any"; import { Long, DeepPartial, @@ -52,8 +55,22 @@ export enum SignMode { * Amino JSON and will be removed in the future. */ SIGN_MODE_LEGACY_AMINO_JSON = 127, + /** + * SIGN_MODE_EIP_191 - SIGN_MODE_EIP_191 specifies the sign mode for EIP 191 signing on the Cosmos + * SDK. Ref: https://eips.ethereum.org/EIPS/eip-191 + * + * Currently, SIGN_MODE_EIP_191 is registered as a SignMode enum variant, + * but is not implemented on the SDK by default. To enable EIP-191, you need + * to pass a custom `TxConfig` that has an implementation of + * `SignModeHandler` for EIP-191. The SDK may decide to fully support + * EIP-191 in the future. + * + * Since: cosmos-sdk 0.45.2 + */ + SIGN_MODE_EIP_191 = 191, UNRECOGNIZED = -1, } +export const SignModeAmino = SignMode; export function signModeFromJSON(object: any): SignMode { switch (object) { case 0: @@ -71,6 +88,9 @@ export function signModeFromJSON(object: any): SignMode { case 127: case "SIGN_MODE_LEGACY_AMINO_JSON": return SignMode.SIGN_MODE_LEGACY_AMINO_JSON; + case 191: + case "SIGN_MODE_EIP_191": + return SignMode.SIGN_MODE_EIP_191; case -1: case "UNRECOGNIZED": default: @@ -89,6 +109,8 @@ export function signModeToJSON(object: SignMode): string { return "SIGN_MODE_DIRECT_AUX"; case SignMode.SIGN_MODE_LEGACY_AMINO_JSON: return "SIGN_MODE_LEGACY_AMINO_JSON"; + case SignMode.SIGN_MODE_EIP_191: + return "SIGN_MODE_EIP_191"; case SignMode.UNRECOGNIZED: default: return "UNRECOGNIZED"; @@ -99,6 +121,19 @@ export interface SignatureDescriptors { /** signatures are the signature descriptors */ signatures: SignatureDescriptor[]; } +export interface SignatureDescriptorsProtoMsg { + typeUrl: "/cosmos.tx.signing.v1beta1.SignatureDescriptors"; + value: Uint8Array; +} +/** SignatureDescriptors wraps multiple SignatureDescriptor's. */ +export interface SignatureDescriptorsAmino { + /** signatures are the signature descriptors */ + signatures: SignatureDescriptorAmino[]; +} +export interface SignatureDescriptorsAminoMsg { + type: "cosmos-sdk/SignatureDescriptors"; + value: SignatureDescriptorsAmino; +} /** * SignatureDescriptor is a convenience type which represents the full data for * a signature including the public key of the signer, signing modes and the @@ -116,6 +151,31 @@ export interface SignatureDescriptor { */ sequence: Long; } +export interface SignatureDescriptorProtoMsg { + typeUrl: "/cosmos.tx.signing.v1beta1.SignatureDescriptor"; + value: Uint8Array; +} +/** + * 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. + */ +export interface SignatureDescriptorAmino { + /** public_key is the public key of the signer */ + public_key?: AnyAmino; + data?: SignatureDescriptor_DataAmino; + /** + * sequence is the sequence of the account, which describes the + * number of committed transactions signed by a given address. It is used to prevent + * replay attacks. + */ + sequence: string; +} +export interface SignatureDescriptorAminoMsg { + type: "cosmos-sdk/SignatureDescriptor"; + value: SignatureDescriptorAmino; +} /** Data represents signature data */ export interface SignatureDescriptor_Data { /** single represents a single signer */ @@ -123,6 +183,21 @@ export interface SignatureDescriptor_Data { /** multi represents a multisig signer */ multi?: SignatureDescriptor_Data_Multi; } +export interface SignatureDescriptor_DataProtoMsg { + typeUrl: "/cosmos.tx.signing.v1beta1.Data"; + value: Uint8Array; +} +/** Data represents signature data */ +export interface SignatureDescriptor_DataAmino { + /** single represents a single signer */ + single?: SignatureDescriptor_Data_SingleAmino; + /** multi represents a multisig signer */ + multi?: SignatureDescriptor_Data_MultiAmino; +} +export interface SignatureDescriptor_DataAminoMsg { + type: "cosmos-sdk/Data"; + value: SignatureDescriptor_DataAmino; +} /** Single is the signature data for a single signer */ export interface SignatureDescriptor_Data_Single { /** mode is the signing mode of the single signer */ @@ -130,6 +205,21 @@ export interface SignatureDescriptor_Data_Single { /** signature is the raw signature bytes */ signature: Uint8Array; } +export interface SignatureDescriptor_Data_SingleProtoMsg { + typeUrl: "/cosmos.tx.signing.v1beta1.Single"; + value: Uint8Array; +} +/** Single is the signature data for a single signer */ +export interface SignatureDescriptor_Data_SingleAmino { + /** mode is the signing mode of the single signer */ + mode: SignMode; + /** signature is the raw signature bytes */ + signature: Uint8Array; +} +export interface SignatureDescriptor_Data_SingleAminoMsg { + type: "cosmos-sdk/Single"; + value: SignatureDescriptor_Data_SingleAmino; +} /** Multi is the signature data for a multisig public key */ export interface SignatureDescriptor_Data_Multi { /** bitarray specifies which keys within the multisig are signing */ @@ -137,6 +227,21 @@ export interface SignatureDescriptor_Data_Multi { /** signatures is the signatures of the multi-signature */ signatures: SignatureDescriptor_Data[]; } +export interface SignatureDescriptor_Data_MultiProtoMsg { + typeUrl: "/cosmos.tx.signing.v1beta1.Multi"; + value: Uint8Array; +} +/** Multi is the signature data for a multisig public key */ +export interface SignatureDescriptor_Data_MultiAmino { + /** bitarray specifies which keys within the multisig are signing */ + bitarray?: CompactBitArrayAmino; + /** signatures is the signatures of the multi-signature */ + signatures: SignatureDescriptor_DataAmino[]; +} +export interface SignatureDescriptor_Data_MultiAminoMsg { + type: "cosmos-sdk/Multi"; + value: SignatureDescriptor_Data_MultiAmino; +} function createBaseSignatureDescriptors(): SignatureDescriptors { return { signatures: [], @@ -200,6 +305,45 @@ export const SignatureDescriptors = { object.signatures?.map((e) => SignatureDescriptor.fromPartial(e)) || []; return message; }, + fromAmino(object: SignatureDescriptorsAmino): SignatureDescriptors { + return { + signatures: Array.isArray(object?.signatures) + ? object.signatures.map((e: any) => SignatureDescriptor.fromAmino(e)) + : [], + }; + }, + toAmino(message: SignatureDescriptors): SignatureDescriptorsAmino { + const obj: any = {}; + if (message.signatures) { + obj.signatures = message.signatures.map((e) => + e ? SignatureDescriptor.toAmino(e) : undefined + ); + } else { + obj.signatures = []; + } + return obj; + }, + fromAminoMsg(object: SignatureDescriptorsAminoMsg): SignatureDescriptors { + return SignatureDescriptors.fromAmino(object.value); + }, + toAminoMsg(message: SignatureDescriptors): SignatureDescriptorsAminoMsg { + return { + type: "cosmos-sdk/SignatureDescriptors", + value: SignatureDescriptors.toAmino(message), + }; + }, + fromProtoMsg(message: SignatureDescriptorsProtoMsg): SignatureDescriptors { + return SignatureDescriptors.decode(message.value); + }, + toProto(message: SignatureDescriptors): Uint8Array { + return SignatureDescriptors.encode(message).finish(); + }, + toProtoMsg(message: SignatureDescriptors): SignatureDescriptorsProtoMsg { + return { + typeUrl: "/cosmos.tx.signing.v1beta1.SignatureDescriptors", + value: SignatureDescriptors.encode(message).finish(), + }; + }, }; function createBaseSignatureDescriptor(): SignatureDescriptor { return { @@ -298,6 +442,49 @@ export const SignatureDescriptor = { : Long.UZERO; return message; }, + fromAmino(object: SignatureDescriptorAmino): SignatureDescriptor { + return { + publicKey: object?.public_key + ? Any.fromAmino(object.public_key) + : undefined, + data: object?.data + ? SignatureDescriptor_Data.fromAmino(object.data) + : undefined, + sequence: Long.fromString(object.sequence), + }; + }, + toAmino(message: SignatureDescriptor): SignatureDescriptorAmino { + const obj: any = {}; + obj.public_key = message.publicKey + ? Any.toAmino(message.publicKey) + : undefined; + obj.data = message.data + ? SignatureDescriptor_Data.toAmino(message.data) + : undefined; + obj.sequence = message.sequence ? message.sequence.toString() : undefined; + return obj; + }, + fromAminoMsg(object: SignatureDescriptorAminoMsg): SignatureDescriptor { + return SignatureDescriptor.fromAmino(object.value); + }, + toAminoMsg(message: SignatureDescriptor): SignatureDescriptorAminoMsg { + return { + type: "cosmos-sdk/SignatureDescriptor", + value: SignatureDescriptor.toAmino(message), + }; + }, + fromProtoMsg(message: SignatureDescriptorProtoMsg): SignatureDescriptor { + return SignatureDescriptor.decode(message.value); + }, + toProto(message: SignatureDescriptor): Uint8Array { + return SignatureDescriptor.encode(message).finish(); + }, + toProtoMsg(message: SignatureDescriptor): SignatureDescriptorProtoMsg { + return { + typeUrl: "/cosmos.tx.signing.v1beta1.SignatureDescriptor", + value: SignatureDescriptor.encode(message).finish(), + }; + }, }; function createBaseSignatureDescriptor_Data(): SignatureDescriptor_Data { return { @@ -389,6 +576,55 @@ export const SignatureDescriptor_Data = { : undefined; return message; }, + fromAmino(object: SignatureDescriptor_DataAmino): SignatureDescriptor_Data { + return { + single: object?.single + ? SignatureDescriptor_Data_Single.fromAmino(object.single) + : undefined, + multi: object?.multi + ? SignatureDescriptor_Data_Multi.fromAmino(object.multi) + : undefined, + }; + }, + toAmino(message: SignatureDescriptor_Data): SignatureDescriptor_DataAmino { + const obj: any = {}; + obj.single = message.single + ? SignatureDescriptor_Data_Single.toAmino(message.single) + : undefined; + obj.multi = message.multi + ? SignatureDescriptor_Data_Multi.toAmino(message.multi) + : undefined; + return obj; + }, + fromAminoMsg( + object: SignatureDescriptor_DataAminoMsg + ): SignatureDescriptor_Data { + return SignatureDescriptor_Data.fromAmino(object.value); + }, + toAminoMsg( + message: SignatureDescriptor_Data + ): SignatureDescriptor_DataAminoMsg { + return { + type: "cosmos-sdk/Data", + value: SignatureDescriptor_Data.toAmino(message), + }; + }, + fromProtoMsg( + message: SignatureDescriptor_DataProtoMsg + ): SignatureDescriptor_Data { + return SignatureDescriptor_Data.decode(message.value); + }, + toProto(message: SignatureDescriptor_Data): Uint8Array { + return SignatureDescriptor_Data.encode(message).finish(); + }, + toProtoMsg( + message: SignatureDescriptor_Data + ): SignatureDescriptor_DataProtoMsg { + return { + typeUrl: "/cosmos.tx.signing.v1beta1.Data", + value: SignatureDescriptor_Data.encode(message).finish(), + }; + }, }; function createBaseSignatureDescriptor_Data_Single(): SignatureDescriptor_Data_Single { return { @@ -457,6 +693,51 @@ export const SignatureDescriptor_Data_Single = { message.signature = object.signature ?? new Uint8Array(); return message; }, + fromAmino( + object: SignatureDescriptor_Data_SingleAmino + ): SignatureDescriptor_Data_Single { + return { + mode: isSet(object.mode) ? signModeFromJSON(object.mode) : 0, + signature: object.signature, + }; + }, + toAmino( + message: SignatureDescriptor_Data_Single + ): SignatureDescriptor_Data_SingleAmino { + const obj: any = {}; + obj.mode = message.mode; + obj.signature = message.signature; + return obj; + }, + fromAminoMsg( + object: SignatureDescriptor_Data_SingleAminoMsg + ): SignatureDescriptor_Data_Single { + return SignatureDescriptor_Data_Single.fromAmino(object.value); + }, + toAminoMsg( + message: SignatureDescriptor_Data_Single + ): SignatureDescriptor_Data_SingleAminoMsg { + return { + type: "cosmos-sdk/Single", + value: SignatureDescriptor_Data_Single.toAmino(message), + }; + }, + fromProtoMsg( + message: SignatureDescriptor_Data_SingleProtoMsg + ): SignatureDescriptor_Data_Single { + return SignatureDescriptor_Data_Single.decode(message.value); + }, + toProto(message: SignatureDescriptor_Data_Single): Uint8Array { + return SignatureDescriptor_Data_Single.encode(message).finish(); + }, + toProtoMsg( + message: SignatureDescriptor_Data_Single + ): SignatureDescriptor_Data_SingleProtoMsg { + return { + typeUrl: "/cosmos.tx.signing.v1beta1.Single", + value: SignatureDescriptor_Data_Single.encode(message).finish(), + }; + }, }; function createBaseSignatureDescriptor_Data_Multi(): SignatureDescriptor_Data_Multi { return { @@ -545,4 +826,63 @@ export const SignatureDescriptor_Data_Multi = { []; return message; }, + fromAmino( + object: SignatureDescriptor_Data_MultiAmino + ): SignatureDescriptor_Data_Multi { + return { + bitarray: object?.bitarray + ? CompactBitArray.fromAmino(object.bitarray) + : undefined, + signatures: Array.isArray(object?.signatures) + ? object.signatures.map((e: any) => + SignatureDescriptor_Data.fromAmino(e) + ) + : [], + }; + }, + toAmino( + message: SignatureDescriptor_Data_Multi + ): SignatureDescriptor_Data_MultiAmino { + const obj: any = {}; + obj.bitarray = message.bitarray + ? CompactBitArray.toAmino(message.bitarray) + : undefined; + if (message.signatures) { + obj.signatures = message.signatures.map((e) => + e ? SignatureDescriptor_Data.toAmino(e) : undefined + ); + } else { + obj.signatures = []; + } + return obj; + }, + fromAminoMsg( + object: SignatureDescriptor_Data_MultiAminoMsg + ): SignatureDescriptor_Data_Multi { + return SignatureDescriptor_Data_Multi.fromAmino(object.value); + }, + toAminoMsg( + message: SignatureDescriptor_Data_Multi + ): SignatureDescriptor_Data_MultiAminoMsg { + return { + type: "cosmos-sdk/Multi", + value: SignatureDescriptor_Data_Multi.toAmino(message), + }; + }, + fromProtoMsg( + message: SignatureDescriptor_Data_MultiProtoMsg + ): SignatureDescriptor_Data_Multi { + return SignatureDescriptor_Data_Multi.decode(message.value); + }, + toProto(message: SignatureDescriptor_Data_Multi): Uint8Array { + return SignatureDescriptor_Data_Multi.encode(message).finish(); + }, + toProtoMsg( + message: SignatureDescriptor_Data_Multi + ): SignatureDescriptor_Data_MultiProtoMsg { + return { + typeUrl: "/cosmos.tx.signing.v1beta1.Multi", + value: SignatureDescriptor_Data_Multi.encode(message).finish(), + }; + }, }; diff --git a/packages/types/src/cosmos/upgrade/v1beta1/query.ts b/packages/types/src/cosmos/upgrade/v1beta1/query.ts index 2fcc3e33c..0e3bcaa07 100644 --- a/packages/types/src/cosmos/upgrade/v1beta1/query.ts +++ b/packages/types/src/cosmos/upgrade/v1beta1/query.ts @@ -1,5 +1,5 @@ /* eslint-disable */ -import { Plan, ModuleVersion } from "./upgrade"; +import { Plan, PlanAmino, ModuleVersion, ModuleVersionAmino } from "./upgrade"; import { Long, DeepPartial, @@ -16,6 +16,19 @@ export const protobufPackage = "cosmos.upgrade.v1beta1"; * method. */ export interface QueryCurrentPlanRequest {} +export interface QueryCurrentPlanRequestProtoMsg { + typeUrl: "/cosmos.upgrade.v1beta1.QueryCurrentPlanRequest"; + value: Uint8Array; +} +/** + * QueryCurrentPlanRequest is the request type for the Query/CurrentPlan RPC + * method. + */ +export interface QueryCurrentPlanRequestAmino {} +export interface QueryCurrentPlanRequestAminoMsg { + type: "cosmos-sdk/QueryCurrentPlanRequest"; + value: QueryCurrentPlanRequestAmino; +} /** * QueryCurrentPlanResponse is the response type for the Query/CurrentPlan RPC * method. @@ -24,6 +37,22 @@ export interface QueryCurrentPlanResponse { /** plan is the current upgrade plan. */ plan?: Plan; } +export interface QueryCurrentPlanResponseProtoMsg { + typeUrl: "/cosmos.upgrade.v1beta1.QueryCurrentPlanResponse"; + value: Uint8Array; +} +/** + * QueryCurrentPlanResponse is the response type for the Query/CurrentPlan RPC + * method. + */ +export interface QueryCurrentPlanResponseAmino { + /** plan is the current upgrade plan. */ + plan?: PlanAmino; +} +export interface QueryCurrentPlanResponseAminoMsg { + type: "cosmos-sdk/QueryCurrentPlanResponse"; + value: QueryCurrentPlanResponseAmino; +} /** * QueryCurrentPlanRequest is the request type for the Query/AppliedPlan RPC * method. @@ -32,6 +61,22 @@ export interface QueryAppliedPlanRequest { /** name is the name of the applied plan to query for. */ name: string; } +export interface QueryAppliedPlanRequestProtoMsg { + typeUrl: "/cosmos.upgrade.v1beta1.QueryAppliedPlanRequest"; + value: Uint8Array; +} +/** + * QueryCurrentPlanRequest is the request type for the Query/AppliedPlan RPC + * method. + */ +export interface QueryAppliedPlanRequestAmino { + /** name is the name of the applied plan to query for. */ + name: string; +} +export interface QueryAppliedPlanRequestAminoMsg { + type: "cosmos-sdk/QueryAppliedPlanRequest"; + value: QueryAppliedPlanRequestAmino; +} /** * QueryAppliedPlanResponse is the response type for the Query/AppliedPlan RPC * method. @@ -40,6 +85,22 @@ export interface QueryAppliedPlanResponse { /** height is the block height at which the plan was applied. */ height: Long; } +export interface QueryAppliedPlanResponseProtoMsg { + typeUrl: "/cosmos.upgrade.v1beta1.QueryAppliedPlanResponse"; + value: Uint8Array; +} +/** + * QueryAppliedPlanResponse is the response type for the Query/AppliedPlan RPC + * method. + */ +export interface QueryAppliedPlanResponseAmino { + /** height is the block height at which the plan was applied. */ + height: string; +} +export interface QueryAppliedPlanResponseAminoMsg { + type: "cosmos-sdk/QueryAppliedPlanResponse"; + value: QueryAppliedPlanResponseAmino; +} /** * QueryUpgradedConsensusStateRequest is the request type for the Query/UpgradedConsensusState * RPC method. @@ -52,6 +113,26 @@ export interface QueryUpgradedConsensusStateRequest { */ lastHeight: Long; } +export interface QueryUpgradedConsensusStateRequestProtoMsg { + typeUrl: "/cosmos.upgrade.v1beta1.QueryUpgradedConsensusStateRequest"; + value: Uint8Array; +} +/** + * QueryUpgradedConsensusStateRequest is the request type for the Query/UpgradedConsensusState + * RPC method. + */ +/** @deprecated */ +export interface QueryUpgradedConsensusStateRequestAmino { + /** + * last height of the current chain must be sent in request + * as this is the height under which next consensus state is stored + */ + last_height: string; +} +export interface QueryUpgradedConsensusStateRequestAminoMsg { + type: "cosmos-sdk/QueryUpgradedConsensusStateRequest"; + value: QueryUpgradedConsensusStateRequestAmino; +} /** * QueryUpgradedConsensusStateResponse is the response type for the Query/UpgradedConsensusState * RPC method. @@ -61,6 +142,23 @@ export interface QueryUpgradedConsensusStateResponse { /** Since: cosmos-sdk 0.43 */ upgradedConsensusState: Uint8Array; } +export interface QueryUpgradedConsensusStateResponseProtoMsg { + typeUrl: "/cosmos.upgrade.v1beta1.QueryUpgradedConsensusStateResponse"; + value: Uint8Array; +} +/** + * QueryUpgradedConsensusStateResponse is the response type for the Query/UpgradedConsensusState + * RPC method. + */ +/** @deprecated */ +export interface QueryUpgradedConsensusStateResponseAmino { + /** Since: cosmos-sdk 0.43 */ + upgraded_consensus_state: Uint8Array; +} +export interface QueryUpgradedConsensusStateResponseAminoMsg { + type: "cosmos-sdk/QueryUpgradedConsensusStateResponse"; + value: QueryUpgradedConsensusStateResponseAmino; +} /** * QueryModuleVersionsRequest is the request type for the Query/ModuleVersions * RPC method. @@ -75,6 +173,28 @@ export interface QueryModuleVersionsRequest { */ moduleName: string; } +export interface QueryModuleVersionsRequestProtoMsg { + typeUrl: "/cosmos.upgrade.v1beta1.QueryModuleVersionsRequest"; + value: Uint8Array; +} +/** + * QueryModuleVersionsRequest is the request type for the Query/ModuleVersions + * RPC method. + * + * Since: cosmos-sdk 0.43 + */ +export interface QueryModuleVersionsRequestAmino { + /** + * module_name is a field to query a specific module + * consensus version from state. Leaving this empty will + * fetch the full list of module versions from state + */ + module_name: string; +} +export interface QueryModuleVersionsRequestAminoMsg { + type: "cosmos-sdk/QueryModuleVersionsRequest"; + value: QueryModuleVersionsRequestAmino; +} /** * QueryModuleVersionsResponse is the response type for the Query/ModuleVersions * RPC method. @@ -85,12 +205,44 @@ export interface QueryModuleVersionsResponse { /** module_versions is a list of module names with their consensus versions. */ moduleVersions: ModuleVersion[]; } +export interface QueryModuleVersionsResponseProtoMsg { + typeUrl: "/cosmos.upgrade.v1beta1.QueryModuleVersionsResponse"; + value: Uint8Array; +} +/** + * QueryModuleVersionsResponse is the response type for the Query/ModuleVersions + * RPC method. + * + * Since: cosmos-sdk 0.43 + */ +export interface QueryModuleVersionsResponseAmino { + /** module_versions is a list of module names with their consensus versions. */ + module_versions: ModuleVersionAmino[]; +} +export interface QueryModuleVersionsResponseAminoMsg { + type: "cosmos-sdk/QueryModuleVersionsResponse"; + value: QueryModuleVersionsResponseAmino; +} /** * QueryAuthorityRequest is the request type for Query/Authority * * Since: cosmos-sdk 0.46 */ export interface QueryAuthorityRequest {} +export interface QueryAuthorityRequestProtoMsg { + typeUrl: "/cosmos.upgrade.v1beta1.QueryAuthorityRequest"; + value: Uint8Array; +} +/** + * QueryAuthorityRequest is the request type for Query/Authority + * + * Since: cosmos-sdk 0.46 + */ +export interface QueryAuthorityRequestAmino {} +export interface QueryAuthorityRequestAminoMsg { + type: "cosmos-sdk/QueryAuthorityRequest"; + value: QueryAuthorityRequestAmino; +} /** * QueryAuthorityResponse is the response type for Query/Authority * @@ -99,6 +251,22 @@ export interface QueryAuthorityRequest {} export interface QueryAuthorityResponse { address: string; } +export interface QueryAuthorityResponseProtoMsg { + typeUrl: "/cosmos.upgrade.v1beta1.QueryAuthorityResponse"; + value: Uint8Array; +} +/** + * QueryAuthorityResponse is the response type for Query/Authority + * + * Since: cosmos-sdk 0.46 + */ +export interface QueryAuthorityResponseAmino { + address: string; +} +export interface QueryAuthorityResponseAminoMsg { + type: "cosmos-sdk/QueryAuthorityResponse"; + value: QueryAuthorityResponseAmino; +} function createBaseQueryCurrentPlanRequest(): QueryCurrentPlanRequest { return {}; } @@ -139,6 +307,42 @@ export const QueryCurrentPlanRequest = { const message = createBaseQueryCurrentPlanRequest(); return message; }, + fromAmino(_: QueryCurrentPlanRequestAmino): QueryCurrentPlanRequest { + return {}; + }, + toAmino(_: QueryCurrentPlanRequest): QueryCurrentPlanRequestAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg( + object: QueryCurrentPlanRequestAminoMsg + ): QueryCurrentPlanRequest { + return QueryCurrentPlanRequest.fromAmino(object.value); + }, + toAminoMsg( + message: QueryCurrentPlanRequest + ): QueryCurrentPlanRequestAminoMsg { + return { + type: "cosmos-sdk/QueryCurrentPlanRequest", + value: QueryCurrentPlanRequest.toAmino(message), + }; + }, + fromProtoMsg( + message: QueryCurrentPlanRequestProtoMsg + ): QueryCurrentPlanRequest { + return QueryCurrentPlanRequest.decode(message.value); + }, + toProto(message: QueryCurrentPlanRequest): Uint8Array { + return QueryCurrentPlanRequest.encode(message).finish(); + }, + toProtoMsg( + message: QueryCurrentPlanRequest + ): QueryCurrentPlanRequestProtoMsg { + return { + typeUrl: "/cosmos.upgrade.v1beta1.QueryCurrentPlanRequest", + value: QueryCurrentPlanRequest.encode(message).finish(), + }; + }, }; function createBaseQueryCurrentPlanResponse(): QueryCurrentPlanResponse { return { @@ -196,6 +400,45 @@ export const QueryCurrentPlanResponse = { : undefined; return message; }, + fromAmino(object: QueryCurrentPlanResponseAmino): QueryCurrentPlanResponse { + return { + plan: object?.plan ? Plan.fromAmino(object.plan) : undefined, + }; + }, + toAmino(message: QueryCurrentPlanResponse): QueryCurrentPlanResponseAmino { + const obj: any = {}; + obj.plan = message.plan ? Plan.toAmino(message.plan) : undefined; + return obj; + }, + fromAminoMsg( + object: QueryCurrentPlanResponseAminoMsg + ): QueryCurrentPlanResponse { + return QueryCurrentPlanResponse.fromAmino(object.value); + }, + toAminoMsg( + message: QueryCurrentPlanResponse + ): QueryCurrentPlanResponseAminoMsg { + return { + type: "cosmos-sdk/QueryCurrentPlanResponse", + value: QueryCurrentPlanResponse.toAmino(message), + }; + }, + fromProtoMsg( + message: QueryCurrentPlanResponseProtoMsg + ): QueryCurrentPlanResponse { + return QueryCurrentPlanResponse.decode(message.value); + }, + toProto(message: QueryCurrentPlanResponse): Uint8Array { + return QueryCurrentPlanResponse.encode(message).finish(); + }, + toProtoMsg( + message: QueryCurrentPlanResponse + ): QueryCurrentPlanResponseProtoMsg { + return { + typeUrl: "/cosmos.upgrade.v1beta1.QueryCurrentPlanResponse", + value: QueryCurrentPlanResponse.encode(message).finish(), + }; + }, }; function createBaseQueryAppliedPlanRequest(): QueryAppliedPlanRequest { return { @@ -249,6 +492,45 @@ export const QueryAppliedPlanRequest = { message.name = object.name ?? ""; return message; }, + fromAmino(object: QueryAppliedPlanRequestAmino): QueryAppliedPlanRequest { + return { + name: object.name, + }; + }, + toAmino(message: QueryAppliedPlanRequest): QueryAppliedPlanRequestAmino { + const obj: any = {}; + obj.name = message.name; + return obj; + }, + fromAminoMsg( + object: QueryAppliedPlanRequestAminoMsg + ): QueryAppliedPlanRequest { + return QueryAppliedPlanRequest.fromAmino(object.value); + }, + toAminoMsg( + message: QueryAppliedPlanRequest + ): QueryAppliedPlanRequestAminoMsg { + return { + type: "cosmos-sdk/QueryAppliedPlanRequest", + value: QueryAppliedPlanRequest.toAmino(message), + }; + }, + fromProtoMsg( + message: QueryAppliedPlanRequestProtoMsg + ): QueryAppliedPlanRequest { + return QueryAppliedPlanRequest.decode(message.value); + }, + toProto(message: QueryAppliedPlanRequest): Uint8Array { + return QueryAppliedPlanRequest.encode(message).finish(); + }, + toProtoMsg( + message: QueryAppliedPlanRequest + ): QueryAppliedPlanRequestProtoMsg { + return { + typeUrl: "/cosmos.upgrade.v1beta1.QueryAppliedPlanRequest", + value: QueryAppliedPlanRequest.encode(message).finish(), + }; + }, }; function createBaseQueryAppliedPlanResponse(): QueryAppliedPlanResponse { return { @@ -306,6 +588,45 @@ export const QueryAppliedPlanResponse = { : Long.ZERO; return message; }, + fromAmino(object: QueryAppliedPlanResponseAmino): QueryAppliedPlanResponse { + return { + height: Long.fromString(object.height), + }; + }, + toAmino(message: QueryAppliedPlanResponse): QueryAppliedPlanResponseAmino { + const obj: any = {}; + obj.height = message.height ? message.height.toString() : undefined; + return obj; + }, + fromAminoMsg( + object: QueryAppliedPlanResponseAminoMsg + ): QueryAppliedPlanResponse { + return QueryAppliedPlanResponse.fromAmino(object.value); + }, + toAminoMsg( + message: QueryAppliedPlanResponse + ): QueryAppliedPlanResponseAminoMsg { + return { + type: "cosmos-sdk/QueryAppliedPlanResponse", + value: QueryAppliedPlanResponse.toAmino(message), + }; + }, + fromProtoMsg( + message: QueryAppliedPlanResponseProtoMsg + ): QueryAppliedPlanResponse { + return QueryAppliedPlanResponse.decode(message.value); + }, + toProto(message: QueryAppliedPlanResponse): Uint8Array { + return QueryAppliedPlanResponse.encode(message).finish(); + }, + toProtoMsg( + message: QueryAppliedPlanResponse + ): QueryAppliedPlanResponseProtoMsg { + return { + typeUrl: "/cosmos.upgrade.v1beta1.QueryAppliedPlanResponse", + value: QueryAppliedPlanResponse.encode(message).finish(), + }; + }, }; function createBaseQueryUpgradedConsensusStateRequest(): QueryUpgradedConsensusStateRequest { return { @@ -365,6 +686,51 @@ export const QueryUpgradedConsensusStateRequest = { : Long.ZERO; return message; }, + fromAmino( + object: QueryUpgradedConsensusStateRequestAmino + ): QueryUpgradedConsensusStateRequest { + return { + lastHeight: Long.fromString(object.last_height), + }; + }, + toAmino( + message: QueryUpgradedConsensusStateRequest + ): QueryUpgradedConsensusStateRequestAmino { + const obj: any = {}; + obj.last_height = message.lastHeight + ? message.lastHeight.toString() + : undefined; + return obj; + }, + fromAminoMsg( + object: QueryUpgradedConsensusStateRequestAminoMsg + ): QueryUpgradedConsensusStateRequest { + return QueryUpgradedConsensusStateRequest.fromAmino(object.value); + }, + toAminoMsg( + message: QueryUpgradedConsensusStateRequest + ): QueryUpgradedConsensusStateRequestAminoMsg { + return { + type: "cosmos-sdk/QueryUpgradedConsensusStateRequest", + value: QueryUpgradedConsensusStateRequest.toAmino(message), + }; + }, + fromProtoMsg( + message: QueryUpgradedConsensusStateRequestProtoMsg + ): QueryUpgradedConsensusStateRequest { + return QueryUpgradedConsensusStateRequest.decode(message.value); + }, + toProto(message: QueryUpgradedConsensusStateRequest): Uint8Array { + return QueryUpgradedConsensusStateRequest.encode(message).finish(); + }, + toProtoMsg( + message: QueryUpgradedConsensusStateRequest + ): QueryUpgradedConsensusStateRequestProtoMsg { + return { + typeUrl: "/cosmos.upgrade.v1beta1.QueryUpgradedConsensusStateRequest", + value: QueryUpgradedConsensusStateRequest.encode(message).finish(), + }; + }, }; function createBaseQueryUpgradedConsensusStateResponse(): QueryUpgradedConsensusStateResponse { return { @@ -426,6 +792,49 @@ export const QueryUpgradedConsensusStateResponse = { object.upgradedConsensusState ?? new Uint8Array(); return message; }, + fromAmino( + object: QueryUpgradedConsensusStateResponseAmino + ): QueryUpgradedConsensusStateResponse { + return { + upgradedConsensusState: object.upgraded_consensus_state, + }; + }, + toAmino( + message: QueryUpgradedConsensusStateResponse + ): QueryUpgradedConsensusStateResponseAmino { + const obj: any = {}; + obj.upgraded_consensus_state = message.upgradedConsensusState; + return obj; + }, + fromAminoMsg( + object: QueryUpgradedConsensusStateResponseAminoMsg + ): QueryUpgradedConsensusStateResponse { + return QueryUpgradedConsensusStateResponse.fromAmino(object.value); + }, + toAminoMsg( + message: QueryUpgradedConsensusStateResponse + ): QueryUpgradedConsensusStateResponseAminoMsg { + return { + type: "cosmos-sdk/QueryUpgradedConsensusStateResponse", + value: QueryUpgradedConsensusStateResponse.toAmino(message), + }; + }, + fromProtoMsg( + message: QueryUpgradedConsensusStateResponseProtoMsg + ): QueryUpgradedConsensusStateResponse { + return QueryUpgradedConsensusStateResponse.decode(message.value); + }, + toProto(message: QueryUpgradedConsensusStateResponse): Uint8Array { + return QueryUpgradedConsensusStateResponse.encode(message).finish(); + }, + toProtoMsg( + message: QueryUpgradedConsensusStateResponse + ): QueryUpgradedConsensusStateResponseProtoMsg { + return { + typeUrl: "/cosmos.upgrade.v1beta1.QueryUpgradedConsensusStateResponse", + value: QueryUpgradedConsensusStateResponse.encode(message).finish(), + }; + }, }; function createBaseQueryModuleVersionsRequest(): QueryModuleVersionsRequest { return { @@ -479,6 +888,49 @@ export const QueryModuleVersionsRequest = { message.moduleName = object.moduleName ?? ""; return message; }, + fromAmino( + object: QueryModuleVersionsRequestAmino + ): QueryModuleVersionsRequest { + return { + moduleName: object.module_name, + }; + }, + toAmino( + message: QueryModuleVersionsRequest + ): QueryModuleVersionsRequestAmino { + const obj: any = {}; + obj.module_name = message.moduleName; + return obj; + }, + fromAminoMsg( + object: QueryModuleVersionsRequestAminoMsg + ): QueryModuleVersionsRequest { + return QueryModuleVersionsRequest.fromAmino(object.value); + }, + toAminoMsg( + message: QueryModuleVersionsRequest + ): QueryModuleVersionsRequestAminoMsg { + return { + type: "cosmos-sdk/QueryModuleVersionsRequest", + value: QueryModuleVersionsRequest.toAmino(message), + }; + }, + fromProtoMsg( + message: QueryModuleVersionsRequestProtoMsg + ): QueryModuleVersionsRequest { + return QueryModuleVersionsRequest.decode(message.value); + }, + toProto(message: QueryModuleVersionsRequest): Uint8Array { + return QueryModuleVersionsRequest.encode(message).finish(); + }, + toProtoMsg( + message: QueryModuleVersionsRequest + ): QueryModuleVersionsRequestProtoMsg { + return { + typeUrl: "/cosmos.upgrade.v1beta1.QueryModuleVersionsRequest", + value: QueryModuleVersionsRequest.encode(message).finish(), + }; + }, }; function createBaseQueryModuleVersionsResponse(): QueryModuleVersionsResponse { return { @@ -543,6 +995,57 @@ export const QueryModuleVersionsResponse = { object.moduleVersions?.map((e) => ModuleVersion.fromPartial(e)) || []; return message; }, + fromAmino( + object: QueryModuleVersionsResponseAmino + ): QueryModuleVersionsResponse { + return { + moduleVersions: Array.isArray(object?.module_versions) + ? object.module_versions.map((e: any) => ModuleVersion.fromAmino(e)) + : [], + }; + }, + toAmino( + message: QueryModuleVersionsResponse + ): QueryModuleVersionsResponseAmino { + const obj: any = {}; + if (message.moduleVersions) { + obj.module_versions = message.moduleVersions.map((e) => + e ? ModuleVersion.toAmino(e) : undefined + ); + } else { + obj.module_versions = []; + } + return obj; + }, + fromAminoMsg( + object: QueryModuleVersionsResponseAminoMsg + ): QueryModuleVersionsResponse { + return QueryModuleVersionsResponse.fromAmino(object.value); + }, + toAminoMsg( + message: QueryModuleVersionsResponse + ): QueryModuleVersionsResponseAminoMsg { + return { + type: "cosmos-sdk/QueryModuleVersionsResponse", + value: QueryModuleVersionsResponse.toAmino(message), + }; + }, + fromProtoMsg( + message: QueryModuleVersionsResponseProtoMsg + ): QueryModuleVersionsResponse { + return QueryModuleVersionsResponse.decode(message.value); + }, + toProto(message: QueryModuleVersionsResponse): Uint8Array { + return QueryModuleVersionsResponse.encode(message).finish(); + }, + toProtoMsg( + message: QueryModuleVersionsResponse + ): QueryModuleVersionsResponseProtoMsg { + return { + typeUrl: "/cosmos.upgrade.v1beta1.QueryModuleVersionsResponse", + value: QueryModuleVersionsResponse.encode(message).finish(), + }; + }, }; function createBaseQueryAuthorityRequest(): QueryAuthorityRequest { return {}; @@ -584,6 +1087,34 @@ export const QueryAuthorityRequest = { const message = createBaseQueryAuthorityRequest(); return message; }, + fromAmino(_: QueryAuthorityRequestAmino): QueryAuthorityRequest { + return {}; + }, + toAmino(_: QueryAuthorityRequest): QueryAuthorityRequestAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg(object: QueryAuthorityRequestAminoMsg): QueryAuthorityRequest { + return QueryAuthorityRequest.fromAmino(object.value); + }, + toAminoMsg(message: QueryAuthorityRequest): QueryAuthorityRequestAminoMsg { + return { + type: "cosmos-sdk/QueryAuthorityRequest", + value: QueryAuthorityRequest.toAmino(message), + }; + }, + fromProtoMsg(message: QueryAuthorityRequestProtoMsg): QueryAuthorityRequest { + return QueryAuthorityRequest.decode(message.value); + }, + toProto(message: QueryAuthorityRequest): Uint8Array { + return QueryAuthorityRequest.encode(message).finish(); + }, + toProtoMsg(message: QueryAuthorityRequest): QueryAuthorityRequestProtoMsg { + return { + typeUrl: "/cosmos.upgrade.v1beta1.QueryAuthorityRequest", + value: QueryAuthorityRequest.encode(message).finish(), + }; + }, }; function createBaseQueryAuthorityResponse(): QueryAuthorityResponse { return { @@ -637,6 +1168,39 @@ export const QueryAuthorityResponse = { message.address = object.address ?? ""; return message; }, + fromAmino(object: QueryAuthorityResponseAmino): QueryAuthorityResponse { + return { + address: object.address, + }; + }, + toAmino(message: QueryAuthorityResponse): QueryAuthorityResponseAmino { + const obj: any = {}; + obj.address = message.address; + return obj; + }, + fromAminoMsg(object: QueryAuthorityResponseAminoMsg): QueryAuthorityResponse { + return QueryAuthorityResponse.fromAmino(object.value); + }, + toAminoMsg(message: QueryAuthorityResponse): QueryAuthorityResponseAminoMsg { + return { + type: "cosmos-sdk/QueryAuthorityResponse", + value: QueryAuthorityResponse.toAmino(message), + }; + }, + fromProtoMsg( + message: QueryAuthorityResponseProtoMsg + ): QueryAuthorityResponse { + return QueryAuthorityResponse.decode(message.value); + }, + toProto(message: QueryAuthorityResponse): Uint8Array { + return QueryAuthorityResponse.encode(message).finish(); + }, + toProtoMsg(message: QueryAuthorityResponse): QueryAuthorityResponseProtoMsg { + return { + typeUrl: "/cosmos.upgrade.v1beta1.QueryAuthorityResponse", + value: QueryAuthorityResponse.encode(message).finish(), + }; + }, }; /** Query defines the gRPC upgrade querier service. */ export interface Query { @@ -667,7 +1231,11 @@ export interface Query { ModuleVersions( request: QueryModuleVersionsRequest ): Promise; - /** Returns the account with authority to conduct upgrades */ + /** + * Returns the account with authority to conduct upgrades + * + * Since: cosmos-sdk 0.46 + */ Authority(request?: QueryAuthorityRequest): Promise; } export class QueryClientImpl implements Query { diff --git a/packages/types/src/cosmos/upgrade/v1beta1/tx.amino.ts b/packages/types/src/cosmos/upgrade/v1beta1/tx.amino.ts new file mode 100644 index 000000000..cf714f0f1 --- /dev/null +++ b/packages/types/src/cosmos/upgrade/v1beta1/tx.amino.ts @@ -0,0 +1,14 @@ +/* eslint-disable */ +import { MsgSoftwareUpgrade, MsgCancelUpgrade } from "./tx"; +export const AminoConverter = { + "/cosmos.upgrade.v1beta1.MsgSoftwareUpgrade": { + aminoType: "cosmos-sdk/MsgSoftwareUpgrade", + toAmino: MsgSoftwareUpgrade.toAmino, + fromAmino: MsgSoftwareUpgrade.fromAmino, + }, + "/cosmos.upgrade.v1beta1.MsgCancelUpgrade": { + aminoType: "cosmos-sdk/MsgCancelUpgrade", + toAmino: MsgCancelUpgrade.toAmino, + fromAmino: MsgCancelUpgrade.fromAmino, + }, +}; diff --git a/packages/types/src/cosmos/upgrade/v1beta1/tx.registry.ts b/packages/types/src/cosmos/upgrade/v1beta1/tx.registry.ts new file mode 100644 index 000000000..e56c2c7f0 --- /dev/null +++ b/packages/types/src/cosmos/upgrade/v1beta1/tx.registry.ts @@ -0,0 +1,84 @@ +/* eslint-disable */ +import { GeneratedType, Registry } from "@cosmjs/proto-signing"; +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 MessageComposer = { + encoded: { + softwareUpgrade(value: MsgSoftwareUpgrade) { + return { + typeUrl: "/cosmos.upgrade.v1beta1.MsgSoftwareUpgrade", + value: MsgSoftwareUpgrade.encode(value).finish(), + }; + }, + cancelUpgrade(value: MsgCancelUpgrade) { + return { + typeUrl: "/cosmos.upgrade.v1beta1.MsgCancelUpgrade", + value: MsgCancelUpgrade.encode(value).finish(), + }; + }, + }, + withTypeUrl: { + softwareUpgrade(value: MsgSoftwareUpgrade) { + return { + typeUrl: "/cosmos.upgrade.v1beta1.MsgSoftwareUpgrade", + value, + }; + }, + cancelUpgrade(value: MsgCancelUpgrade) { + return { + typeUrl: "/cosmos.upgrade.v1beta1.MsgCancelUpgrade", + value, + }; + }, + }, + toJSON: { + softwareUpgrade(value: MsgSoftwareUpgrade) { + return { + typeUrl: "/cosmos.upgrade.v1beta1.MsgSoftwareUpgrade", + value: MsgSoftwareUpgrade.toJSON(value), + }; + }, + cancelUpgrade(value: MsgCancelUpgrade) { + return { + typeUrl: "/cosmos.upgrade.v1beta1.MsgCancelUpgrade", + value: MsgCancelUpgrade.toJSON(value), + }; + }, + }, + fromJSON: { + softwareUpgrade(value: any) { + return { + typeUrl: "/cosmos.upgrade.v1beta1.MsgSoftwareUpgrade", + value: MsgSoftwareUpgrade.fromJSON(value), + }; + }, + cancelUpgrade(value: any) { + return { + typeUrl: "/cosmos.upgrade.v1beta1.MsgCancelUpgrade", + value: MsgCancelUpgrade.fromJSON(value), + }; + }, + }, + fromPartial: { + softwareUpgrade(value: MsgSoftwareUpgrade) { + return { + typeUrl: "/cosmos.upgrade.v1beta1.MsgSoftwareUpgrade", + value: MsgSoftwareUpgrade.fromPartial(value), + }; + }, + cancelUpgrade(value: MsgCancelUpgrade) { + return { + typeUrl: "/cosmos.upgrade.v1beta1.MsgCancelUpgrade", + value: MsgCancelUpgrade.fromPartial(value), + }; + }, + }, +}; diff --git a/packages/types/src/cosmos/upgrade/v1beta1/tx.ts b/packages/types/src/cosmos/upgrade/v1beta1/tx.ts index 99f21f4a0..02003b11b 100644 --- a/packages/types/src/cosmos/upgrade/v1beta1/tx.ts +++ b/packages/types/src/cosmos/upgrade/v1beta1/tx.ts @@ -1,5 +1,5 @@ /* eslint-disable */ -import { Plan } from "./upgrade"; +import { Plan, PlanAmino } from "./upgrade"; import * as _m0 from "protobufjs/minimal"; import { isSet, DeepPartial, Exact, Rpc } from "../../../helpers"; export const protobufPackage = "cosmos.upgrade.v1beta1"; @@ -9,32 +9,96 @@ export const protobufPackage = "cosmos.upgrade.v1beta1"; * Since: cosmos-sdk 0.46 */ export interface MsgSoftwareUpgrade { - /** authority is the address of the governance account. */ + /** authority is the address that controls the module (defaults to x/gov unless overwritten). */ authority: string; /** plan is the upgrade plan. */ plan?: Plan; } +export interface MsgSoftwareUpgradeProtoMsg { + typeUrl: "/cosmos.upgrade.v1beta1.MsgSoftwareUpgrade"; + value: Uint8Array; +} +/** + * MsgSoftwareUpgrade is the Msg/SoftwareUpgrade request type. + * + * Since: cosmos-sdk 0.46 + */ +export interface MsgSoftwareUpgradeAmino { + /** authority is the address that controls the module (defaults to x/gov unless overwritten). */ + authority: string; + /** plan is the upgrade plan. */ + plan?: PlanAmino; +} +export interface MsgSoftwareUpgradeAminoMsg { + type: "cosmos-sdk/MsgSoftwareUpgrade"; + value: MsgSoftwareUpgradeAmino; +} /** * MsgSoftwareUpgradeResponse is the Msg/SoftwareUpgrade response type. * * Since: cosmos-sdk 0.46 */ export interface MsgSoftwareUpgradeResponse {} +export interface MsgSoftwareUpgradeResponseProtoMsg { + typeUrl: "/cosmos.upgrade.v1beta1.MsgSoftwareUpgradeResponse"; + value: Uint8Array; +} +/** + * MsgSoftwareUpgradeResponse is the Msg/SoftwareUpgrade response type. + * + * Since: cosmos-sdk 0.46 + */ +export interface MsgSoftwareUpgradeResponseAmino {} +export interface MsgSoftwareUpgradeResponseAminoMsg { + type: "cosmos-sdk/MsgSoftwareUpgradeResponse"; + value: MsgSoftwareUpgradeResponseAmino; +} /** * MsgCancelUpgrade is the Msg/CancelUpgrade request type. * * Since: cosmos-sdk 0.46 */ export interface MsgCancelUpgrade { - /** authority is the address of the governance account. */ + /** authority is the address that controls the module (defaults to x/gov unless overwritten). */ + authority: string; +} +export interface MsgCancelUpgradeProtoMsg { + typeUrl: "/cosmos.upgrade.v1beta1.MsgCancelUpgrade"; + value: Uint8Array; +} +/** + * MsgCancelUpgrade is the Msg/CancelUpgrade request type. + * + * Since: cosmos-sdk 0.46 + */ +export interface MsgCancelUpgradeAmino { + /** authority is the address that controls the module (defaults to x/gov unless overwritten). */ authority: string; } +export interface MsgCancelUpgradeAminoMsg { + type: "cosmos-sdk/MsgCancelUpgrade"; + value: MsgCancelUpgradeAmino; +} /** * MsgCancelUpgradeResponse is the Msg/CancelUpgrade response type. * * Since: cosmos-sdk 0.46 */ export interface MsgCancelUpgradeResponse {} +export interface MsgCancelUpgradeResponseProtoMsg { + typeUrl: "/cosmos.upgrade.v1beta1.MsgCancelUpgradeResponse"; + value: Uint8Array; +} +/** + * MsgCancelUpgradeResponse is the Msg/CancelUpgrade response type. + * + * Since: cosmos-sdk 0.46 + */ +export interface MsgCancelUpgradeResponseAmino {} +export interface MsgCancelUpgradeResponseAminoMsg { + type: "cosmos-sdk/MsgCancelUpgradeResponse"; + value: MsgCancelUpgradeResponseAmino; +} function createBaseMsgSoftwareUpgrade(): MsgSoftwareUpgrade { return { authority: "", @@ -98,6 +162,39 @@ export const MsgSoftwareUpgrade = { : undefined; return message; }, + fromAmino(object: MsgSoftwareUpgradeAmino): MsgSoftwareUpgrade { + return { + authority: object.authority, + plan: object?.plan ? Plan.fromAmino(object.plan) : undefined, + }; + }, + toAmino(message: MsgSoftwareUpgrade): MsgSoftwareUpgradeAmino { + const obj: any = {}; + obj.authority = message.authority; + obj.plan = message.plan ? Plan.toAmino(message.plan) : undefined; + return obj; + }, + fromAminoMsg(object: MsgSoftwareUpgradeAminoMsg): MsgSoftwareUpgrade { + return MsgSoftwareUpgrade.fromAmino(object.value); + }, + toAminoMsg(message: MsgSoftwareUpgrade): MsgSoftwareUpgradeAminoMsg { + return { + type: "cosmos-sdk/MsgSoftwareUpgrade", + value: MsgSoftwareUpgrade.toAmino(message), + }; + }, + fromProtoMsg(message: MsgSoftwareUpgradeProtoMsg): MsgSoftwareUpgrade { + return MsgSoftwareUpgrade.decode(message.value); + }, + toProto(message: MsgSoftwareUpgrade): Uint8Array { + return MsgSoftwareUpgrade.encode(message).finish(); + }, + toProtoMsg(message: MsgSoftwareUpgrade): MsgSoftwareUpgradeProtoMsg { + return { + typeUrl: "/cosmos.upgrade.v1beta1.MsgSoftwareUpgrade", + value: MsgSoftwareUpgrade.encode(message).finish(), + }; + }, }; function createBaseMsgSoftwareUpgradeResponse(): MsgSoftwareUpgradeResponse { return {}; @@ -139,6 +236,42 @@ export const MsgSoftwareUpgradeResponse = { const message = createBaseMsgSoftwareUpgradeResponse(); return message; }, + fromAmino(_: MsgSoftwareUpgradeResponseAmino): MsgSoftwareUpgradeResponse { + return {}; + }, + toAmino(_: MsgSoftwareUpgradeResponse): MsgSoftwareUpgradeResponseAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg( + object: MsgSoftwareUpgradeResponseAminoMsg + ): MsgSoftwareUpgradeResponse { + return MsgSoftwareUpgradeResponse.fromAmino(object.value); + }, + toAminoMsg( + message: MsgSoftwareUpgradeResponse + ): MsgSoftwareUpgradeResponseAminoMsg { + return { + type: "cosmos-sdk/MsgSoftwareUpgradeResponse", + value: MsgSoftwareUpgradeResponse.toAmino(message), + }; + }, + fromProtoMsg( + message: MsgSoftwareUpgradeResponseProtoMsg + ): MsgSoftwareUpgradeResponse { + return MsgSoftwareUpgradeResponse.decode(message.value); + }, + toProto(message: MsgSoftwareUpgradeResponse): Uint8Array { + return MsgSoftwareUpgradeResponse.encode(message).finish(); + }, + toProtoMsg( + message: MsgSoftwareUpgradeResponse + ): MsgSoftwareUpgradeResponseProtoMsg { + return { + typeUrl: "/cosmos.upgrade.v1beta1.MsgSoftwareUpgradeResponse", + value: MsgSoftwareUpgradeResponse.encode(message).finish(), + }; + }, }; function createBaseMsgCancelUpgrade(): MsgCancelUpgrade { return { @@ -189,6 +322,37 @@ export const MsgCancelUpgrade = { message.authority = object.authority ?? ""; return message; }, + fromAmino(object: MsgCancelUpgradeAmino): MsgCancelUpgrade { + return { + authority: object.authority, + }; + }, + toAmino(message: MsgCancelUpgrade): MsgCancelUpgradeAmino { + const obj: any = {}; + obj.authority = message.authority; + return obj; + }, + fromAminoMsg(object: MsgCancelUpgradeAminoMsg): MsgCancelUpgrade { + return MsgCancelUpgrade.fromAmino(object.value); + }, + toAminoMsg(message: MsgCancelUpgrade): MsgCancelUpgradeAminoMsg { + return { + type: "cosmos-sdk/MsgCancelUpgrade", + value: MsgCancelUpgrade.toAmino(message), + }; + }, + fromProtoMsg(message: MsgCancelUpgradeProtoMsg): MsgCancelUpgrade { + return MsgCancelUpgrade.decode(message.value); + }, + toProto(message: MsgCancelUpgrade): Uint8Array { + return MsgCancelUpgrade.encode(message).finish(); + }, + toProtoMsg(message: MsgCancelUpgrade): MsgCancelUpgradeProtoMsg { + return { + typeUrl: "/cosmos.upgrade.v1beta1.MsgCancelUpgrade", + value: MsgCancelUpgrade.encode(message).finish(), + }; + }, }; function createBaseMsgCancelUpgradeResponse(): MsgCancelUpgradeResponse { return {}; @@ -230,6 +394,42 @@ export const MsgCancelUpgradeResponse = { const message = createBaseMsgCancelUpgradeResponse(); return message; }, + fromAmino(_: MsgCancelUpgradeResponseAmino): MsgCancelUpgradeResponse { + return {}; + }, + toAmino(_: MsgCancelUpgradeResponse): MsgCancelUpgradeResponseAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg( + object: MsgCancelUpgradeResponseAminoMsg + ): MsgCancelUpgradeResponse { + return MsgCancelUpgradeResponse.fromAmino(object.value); + }, + toAminoMsg( + message: MsgCancelUpgradeResponse + ): MsgCancelUpgradeResponseAminoMsg { + return { + type: "cosmos-sdk/MsgCancelUpgradeResponse", + value: MsgCancelUpgradeResponse.toAmino(message), + }; + }, + fromProtoMsg( + message: MsgCancelUpgradeResponseProtoMsg + ): MsgCancelUpgradeResponse { + return MsgCancelUpgradeResponse.decode(message.value); + }, + toProto(message: MsgCancelUpgradeResponse): Uint8Array { + return MsgCancelUpgradeResponse.encode(message).finish(); + }, + toProtoMsg( + message: MsgCancelUpgradeResponse + ): MsgCancelUpgradeResponseProtoMsg { + return { + typeUrl: "/cosmos.upgrade.v1beta1.MsgCancelUpgradeResponse", + value: MsgCancelUpgradeResponse.encode(message).finish(), + }; + }, }; /** Msg defines the upgrade Msg service. */ export interface Msg { @@ -243,7 +443,7 @@ export interface Msg { ): Promise; /** * CancelUpgrade is a governance operation for cancelling a previously - * approvid software upgrade. + * approved software upgrade. * * Since: cosmos-sdk 0.46 */ diff --git a/packages/types/src/cosmos/upgrade/v1beta1/upgrade.ts b/packages/types/src/cosmos/upgrade/v1beta1/upgrade.ts index 10b946f4b..d44d33577 100644 --- a/packages/types/src/cosmos/upgrade/v1beta1/upgrade.ts +++ b/packages/types/src/cosmos/upgrade/v1beta1/upgrade.ts @@ -1,6 +1,6 @@ /* eslint-disable */ -import { Timestamp } from "../../../google/protobuf/timestamp"; -import { Any } from "../../../google/protobuf/any"; +import { Timestamp, TimestampAmino } from "../../../google/protobuf/timestamp"; +import { Any, AnyAmino } from "../../../google/protobuf/any"; import { Long, isSet, @@ -30,10 +30,7 @@ export interface Plan { */ /** @deprecated */ time?: Timestamp; - /** - * The height at which the upgrade must be performed. - * Only used if Time is not set. - */ + /** The height at which the upgrade must be performed. */ height: Long; /** * Any application specific upgrade info to be included on-chain @@ -48,6 +45,48 @@ export interface Plan { /** @deprecated */ upgradedClientState?: Any; } +export interface PlanProtoMsg { + typeUrl: "/cosmos.upgrade.v1beta1.Plan"; + value: Uint8Array; +} +/** Plan specifies information about a planned upgrade and when it should occur. */ +export interface PlanAmino { + /** + * Sets the name for the upgrade. This name will be used by the upgraded + * version of the software to apply any special "on-upgrade" commands during + * the first BeginBlock method after the upgrade is applied. It is also used + * to detect whether a software version can handle a given upgrade. If no + * upgrade handler with this name has been set in the software, it will be + * assumed that the software is out-of-date when the upgrade Time or Height is + * reached and the software will exit. + */ + name: string; + /** + * Deprecated: Time based upgrades have been deprecated. Time based upgrade logic + * has been removed from the SDK. + * If this field is not empty, an error will be thrown. + */ + /** @deprecated */ + time?: TimestampAmino; + /** The height at which the upgrade must be performed. */ + height: string; + /** + * Any application specific upgrade info to be included on-chain + * such as a git commit that validators could automatically upgrade to + */ + info: string; + /** + * Deprecated: UpgradedClientState field has been deprecated. IBC upgrade logic has been + * moved to the IBC module in the sub module 02-client. + * If this field is not empty, an error will be thrown. + */ + /** @deprecated */ + upgraded_client_state?: AnyAmino; +} +export interface PlanAminoMsg { + type: "cosmos-sdk/Plan"; + value: PlanAmino; +} /** * SoftwareUpgradeProposal is a gov Content type for initiating a software * upgrade. @@ -56,10 +95,36 @@ export interface Plan { */ /** @deprecated */ export interface SoftwareUpgradeProposal { + /** title of the proposal */ title: string; + /** description of the proposal */ description: string; + /** plan of the proposal */ plan?: Plan; } +export interface SoftwareUpgradeProposalProtoMsg { + typeUrl: "/cosmos.upgrade.v1beta1.SoftwareUpgradeProposal"; + value: Uint8Array; +} +/** + * SoftwareUpgradeProposal is a gov Content type for initiating a software + * upgrade. + * Deprecated: This legacy proposal is deprecated in favor of Msg-based gov + * proposals, see MsgSoftwareUpgrade. + */ +/** @deprecated */ +export interface SoftwareUpgradeProposalAmino { + /** title of the proposal */ + title: string; + /** description of the proposal */ + description: string; + /** plan of the proposal */ + plan?: PlanAmino; +} +export interface SoftwareUpgradeProposalAminoMsg { + type: "cosmos-sdk/SoftwareUpgradeProposal"; + value: SoftwareUpgradeProposalAmino; +} /** * CancelSoftwareUpgradeProposal is a gov Content type for cancelling a software * upgrade. @@ -68,9 +133,32 @@ export interface SoftwareUpgradeProposal { */ /** @deprecated */ export interface CancelSoftwareUpgradeProposal { + /** title of the proposal */ title: string; + /** description of the proposal */ description: string; } +export interface CancelSoftwareUpgradeProposalProtoMsg { + typeUrl: "/cosmos.upgrade.v1beta1.CancelSoftwareUpgradeProposal"; + value: Uint8Array; +} +/** + * CancelSoftwareUpgradeProposal is a gov Content type for cancelling a software + * upgrade. + * Deprecated: This legacy proposal is deprecated in favor of Msg-based gov + * proposals, see MsgCancelUpgrade. + */ +/** @deprecated */ +export interface CancelSoftwareUpgradeProposalAmino { + /** title of the proposal */ + title: string; + /** description of the proposal */ + description: string; +} +export interface CancelSoftwareUpgradeProposalAminoMsg { + type: "cosmos-sdk/CancelSoftwareUpgradeProposal"; + value: CancelSoftwareUpgradeProposalAmino; +} /** * ModuleVersion specifies a module and its consensus version. * @@ -82,6 +170,25 @@ export interface ModuleVersion { /** consensus version of the app module */ version: Long; } +export interface ModuleVersionProtoMsg { + typeUrl: "/cosmos.upgrade.v1beta1.ModuleVersion"; + value: Uint8Array; +} +/** + * ModuleVersion specifies a module and its consensus version. + * + * Since: cosmos-sdk 0.43 + */ +export interface ModuleVersionAmino { + /** name of the app module */ + name: string; + /** consensus version of the app module */ + version: string; +} +export interface ModuleVersionAminoMsg { + type: "cosmos-sdk/ModuleVersion"; + value: ModuleVersionAmino; +} function createBasePlan(): Plan { return { name: "", @@ -186,6 +293,49 @@ export const Plan = { : undefined; return message; }, + fromAmino(object: PlanAmino): Plan { + return { + name: object.name, + time: object?.time ? Timestamp.fromAmino(object.time) : undefined, + height: Long.fromString(object.height), + info: object.info, + upgradedClientState: object?.upgraded_client_state + ? Any.fromAmino(object.upgraded_client_state) + : undefined, + }; + }, + toAmino(message: Plan): PlanAmino { + const obj: any = {}; + obj.name = message.name; + obj.time = message.time ? Timestamp.toAmino(message.time) : undefined; + obj.height = message.height ? message.height.toString() : undefined; + obj.info = message.info; + obj.upgraded_client_state = message.upgradedClientState + ? Any.toAmino(message.upgradedClientState) + : undefined; + return obj; + }, + fromAminoMsg(object: PlanAminoMsg): Plan { + return Plan.fromAmino(object.value); + }, + toAminoMsg(message: Plan): PlanAminoMsg { + return { + type: "cosmos-sdk/Plan", + value: Plan.toAmino(message), + }; + }, + fromProtoMsg(message: PlanProtoMsg): Plan { + return Plan.decode(message.value); + }, + toProto(message: Plan): Uint8Array { + return Plan.encode(message).finish(); + }, + toProtoMsg(message: Plan): PlanProtoMsg { + return { + typeUrl: "/cosmos.upgrade.v1beta1.Plan", + value: Plan.encode(message).finish(), + }; + }, }; function createBaseSoftwareUpgradeProposal(): SoftwareUpgradeProposal { return { @@ -264,6 +414,49 @@ export const SoftwareUpgradeProposal = { : undefined; return message; }, + fromAmino(object: SoftwareUpgradeProposalAmino): SoftwareUpgradeProposal { + return { + title: object.title, + description: object.description, + plan: object?.plan ? Plan.fromAmino(object.plan) : undefined, + }; + }, + toAmino(message: SoftwareUpgradeProposal): SoftwareUpgradeProposalAmino { + const obj: any = {}; + obj.title = message.title; + obj.description = message.description; + obj.plan = message.plan ? Plan.toAmino(message.plan) : undefined; + return obj; + }, + fromAminoMsg( + object: SoftwareUpgradeProposalAminoMsg + ): SoftwareUpgradeProposal { + return SoftwareUpgradeProposal.fromAmino(object.value); + }, + toAminoMsg( + message: SoftwareUpgradeProposal + ): SoftwareUpgradeProposalAminoMsg { + return { + type: "cosmos-sdk/SoftwareUpgradeProposal", + value: SoftwareUpgradeProposal.toAmino(message), + }; + }, + fromProtoMsg( + message: SoftwareUpgradeProposalProtoMsg + ): SoftwareUpgradeProposal { + return SoftwareUpgradeProposal.decode(message.value); + }, + toProto(message: SoftwareUpgradeProposal): Uint8Array { + return SoftwareUpgradeProposal.encode(message).finish(); + }, + toProtoMsg( + message: SoftwareUpgradeProposal + ): SoftwareUpgradeProposalProtoMsg { + return { + typeUrl: "/cosmos.upgrade.v1beta1.SoftwareUpgradeProposal", + value: SoftwareUpgradeProposal.encode(message).finish(), + }; + }, }; function createBaseCancelSoftwareUpgradeProposal(): CancelSoftwareUpgradeProposal { return { @@ -328,6 +521,51 @@ export const CancelSoftwareUpgradeProposal = { message.description = object.description ?? ""; return message; }, + fromAmino( + object: CancelSoftwareUpgradeProposalAmino + ): CancelSoftwareUpgradeProposal { + return { + title: object.title, + description: object.description, + }; + }, + toAmino( + message: CancelSoftwareUpgradeProposal + ): CancelSoftwareUpgradeProposalAmino { + const obj: any = {}; + obj.title = message.title; + obj.description = message.description; + return obj; + }, + fromAminoMsg( + object: CancelSoftwareUpgradeProposalAminoMsg + ): CancelSoftwareUpgradeProposal { + return CancelSoftwareUpgradeProposal.fromAmino(object.value); + }, + toAminoMsg( + message: CancelSoftwareUpgradeProposal + ): CancelSoftwareUpgradeProposalAminoMsg { + return { + type: "cosmos-sdk/CancelSoftwareUpgradeProposal", + value: CancelSoftwareUpgradeProposal.toAmino(message), + }; + }, + fromProtoMsg( + message: CancelSoftwareUpgradeProposalProtoMsg + ): CancelSoftwareUpgradeProposal { + return CancelSoftwareUpgradeProposal.decode(message.value); + }, + toProto(message: CancelSoftwareUpgradeProposal): Uint8Array { + return CancelSoftwareUpgradeProposal.encode(message).finish(); + }, + toProtoMsg( + message: CancelSoftwareUpgradeProposal + ): CancelSoftwareUpgradeProposalProtoMsg { + return { + typeUrl: "/cosmos.upgrade.v1beta1.CancelSoftwareUpgradeProposal", + value: CancelSoftwareUpgradeProposal.encode(message).finish(), + }; + }, }; function createBaseModuleVersion(): ModuleVersion { return { @@ -394,4 +632,37 @@ export const ModuleVersion = { : Long.UZERO; return message; }, + fromAmino(object: ModuleVersionAmino): ModuleVersion { + return { + name: object.name, + version: Long.fromString(object.version), + }; + }, + toAmino(message: ModuleVersion): ModuleVersionAmino { + const obj: any = {}; + obj.name = message.name; + obj.version = message.version ? message.version.toString() : undefined; + return obj; + }, + fromAminoMsg(object: ModuleVersionAminoMsg): ModuleVersion { + return ModuleVersion.fromAmino(object.value); + }, + toAminoMsg(message: ModuleVersion): ModuleVersionAminoMsg { + return { + type: "cosmos-sdk/ModuleVersion", + value: ModuleVersion.toAmino(message), + }; + }, + fromProtoMsg(message: ModuleVersionProtoMsg): ModuleVersion { + return ModuleVersion.decode(message.value); + }, + toProto(message: ModuleVersion): Uint8Array { + return ModuleVersion.encode(message).finish(); + }, + toProtoMsg(message: ModuleVersion): ModuleVersionProtoMsg { + return { + typeUrl: "/cosmos.upgrade.v1beta1.ModuleVersion", + value: ModuleVersion.encode(message).finish(), + }; + }, }; diff --git a/packages/types/src/cosmos_proto/cosmos.ts b/packages/types/src/cosmos_proto/cosmos.ts index 5f8909c45..28d78191f 100644 --- a/packages/types/src/cosmos_proto/cosmos.ts +++ b/packages/types/src/cosmos_proto/cosmos.ts @@ -8,6 +8,7 @@ export enum ScalarType { SCALAR_TYPE_BYTES = 2, UNRECOGNIZED = -1, } +export const ScalarTypeAmino = ScalarType; export function scalarTypeFromJSON(object: any): ScalarType { switch (object) { case 0: @@ -56,6 +57,32 @@ export interface InterfaceDescriptor { */ description: string; } +export interface InterfaceDescriptorProtoMsg { + typeUrl: "/cosmos_proto.InterfaceDescriptor"; + value: Uint8Array; +} +/** + * InterfaceDescriptor describes an interface type to be used with + * accepts_interface and implements_interface and declared by declare_interface. + */ +export interface InterfaceDescriptorAmino { + /** + * name is the name of the interface. It should be a short-name (without + * a period) such that the fully qualified name of the interface will be + * package.name, ex. for the package a.b and interface named C, the + * fully-qualified name will be a.b.C. + */ + name: string; + /** + * description is a human-readable description of the interface and its + * purpose. + */ + description: string; +} +export interface InterfaceDescriptorAminoMsg { + type: "/cosmos_proto.InterfaceDescriptor"; + value: InterfaceDescriptorAmino; +} /** * ScalarDescriptor describes an scalar type to be used with * the scalar field option and declared by declare_scalar. @@ -87,6 +114,45 @@ export interface ScalarDescriptor { */ fieldType: ScalarType[]; } +export interface ScalarDescriptorProtoMsg { + typeUrl: "/cosmos_proto.ScalarDescriptor"; + value: Uint8Array; +} +/** + * ScalarDescriptor describes an scalar type to be used with + * the scalar field option and declared by declare_scalar. + * Scalars extend simple protobuf built-in types with additional + * syntax and semantics, for instance to represent big integers. + * Scalars should ideally define an encoding such that there is only one + * valid syntactical representation for a given semantic meaning, + * i.e. the encoding should be deterministic. + */ +export interface ScalarDescriptorAmino { + /** + * name is the name of the scalar. It should be a short-name (without + * a period) such that the fully qualified name of the scalar will be + * package.name, ex. for the package a.b and scalar named C, the + * fully-qualified name will be a.b.C. + */ + name: string; + /** + * description is a human-readable description of the scalar and its + * encoding format. For instance a big integer or decimal scalar should + * specify precisely the expected encoding format. + */ + description: string; + /** + * field_type is the type of field with which this scalar can be used. + * Scalars can be used with one and only one type of field so that + * encoding standards and simple and clear. Currently only string and + * bytes fields are supported for scalars. + */ + field_type: ScalarType[]; +} +export interface ScalarDescriptorAminoMsg { + type: "/cosmos_proto.ScalarDescriptor"; + value: ScalarDescriptorAmino; +} function createBaseInterfaceDescriptor(): InterfaceDescriptor { return { name: "", @@ -147,6 +213,33 @@ export const InterfaceDescriptor = { message.description = object.description ?? ""; return message; }, + fromAmino(object: InterfaceDescriptorAmino): InterfaceDescriptor { + return { + name: object.name, + description: object.description, + }; + }, + toAmino(message: InterfaceDescriptor): InterfaceDescriptorAmino { + const obj: any = {}; + obj.name = message.name; + obj.description = message.description; + return obj; + }, + fromAminoMsg(object: InterfaceDescriptorAminoMsg): InterfaceDescriptor { + return InterfaceDescriptor.fromAmino(object.value); + }, + fromProtoMsg(message: InterfaceDescriptorProtoMsg): InterfaceDescriptor { + return InterfaceDescriptor.decode(message.value); + }, + toProto(message: InterfaceDescriptor): Uint8Array { + return InterfaceDescriptor.encode(message).finish(); + }, + toProtoMsg(message: InterfaceDescriptor): InterfaceDescriptorProtoMsg { + return { + typeUrl: "/cosmos_proto.InterfaceDescriptor", + value: InterfaceDescriptor.encode(message).finish(), + }; + }, }; function createBaseScalarDescriptor(): ScalarDescriptor { return { @@ -233,4 +326,39 @@ export const ScalarDescriptor = { message.fieldType = object.fieldType?.map((e) => e) || []; return message; }, + fromAmino(object: ScalarDescriptorAmino): ScalarDescriptor { + return { + name: object.name, + description: object.description, + fieldType: Array.isArray(object?.field_type) + ? object.field_type.map((e: any) => scalarTypeFromJSON(e)) + : [], + }; + }, + toAmino(message: ScalarDescriptor): ScalarDescriptorAmino { + const obj: any = {}; + obj.name = message.name; + obj.description = message.description; + if (message.fieldType) { + obj.field_type = message.fieldType.map((e) => scalarTypeToJSON(e)); + } else { + obj.field_type = []; + } + return obj; + }, + fromAminoMsg(object: ScalarDescriptorAminoMsg): ScalarDescriptor { + return ScalarDescriptor.fromAmino(object.value); + }, + fromProtoMsg(message: ScalarDescriptorProtoMsg): ScalarDescriptor { + return ScalarDescriptor.decode(message.value); + }, + toProto(message: ScalarDescriptor): Uint8Array { + return ScalarDescriptor.encode(message).finish(); + }, + toProtoMsg(message: ScalarDescriptor): ScalarDescriptorProtoMsg { + return { + typeUrl: "/cosmos_proto.ScalarDescriptor", + value: ScalarDescriptor.encode(message).finish(), + }; + }, }; diff --git a/packages/types/src/desmjs/msgs.ts b/packages/types/src/desmjs/msgs.ts index d602de542..8ddce5b6a 100644 --- a/packages/types/src/desmjs/msgs.ts +++ b/packages/types/src/desmjs/msgs.ts @@ -15,6 +15,21 @@ export interface MsgAuthenticate { /** Nonce to avoid double spending attacks */ nonce: Uint8Array; } +export interface MsgAuthenticateProtoMsg { + typeUrl: "/desmsjs.v2.MsgAuthenticate"; + value: Uint8Array; +} +/** MsgAuthenticate represents the message used to authenticate a user */ +export interface MsgAuthenticateAmino { + /** Address of the user to authenticate */ + user: string; + /** Nonce to avoid double spending attacks */ + nonce: Uint8Array; +} +export interface MsgAuthenticateAminoMsg { + type: "/desmsjs.v2.MsgAuthenticate"; + value: MsgAuthenticateAmino; +} function createBaseMsgAuthenticate(): MsgAuthenticate { return { user: "", @@ -79,4 +94,31 @@ export const MsgAuthenticate = { message.nonce = object.nonce ?? new Uint8Array(); return message; }, + fromAmino(object: MsgAuthenticateAmino): MsgAuthenticate { + return { + user: object.user, + nonce: object.nonce, + }; + }, + toAmino(message: MsgAuthenticate): MsgAuthenticateAmino { + const obj: any = {}; + obj.user = message.user; + obj.nonce = message.nonce; + return obj; + }, + fromAminoMsg(object: MsgAuthenticateAminoMsg): MsgAuthenticate { + return MsgAuthenticate.fromAmino(object.value); + }, + fromProtoMsg(message: MsgAuthenticateProtoMsg): MsgAuthenticate { + return MsgAuthenticate.decode(message.value); + }, + toProto(message: MsgAuthenticate): Uint8Array { + return MsgAuthenticate.encode(message).finish(); + }, + toProtoMsg(message: MsgAuthenticate): MsgAuthenticateProtoMsg { + return { + typeUrl: "/desmsjs.v2.MsgAuthenticate", + value: MsgAuthenticate.encode(message).finish(), + }; + }, }; diff --git a/packages/types/src/desmos/client.ts b/packages/types/src/desmos/client.ts new file mode 100644 index 000000000..5cbb76d8c --- /dev/null +++ b/packages/types/src/desmos/client.ts @@ -0,0 +1,63 @@ +/* eslint-disable */ +import { GeneratedType, Registry, OfflineSigner } from "@cosmjs/proto-signing"; +import { AminoTypes, SigningStargateClient } from "@cosmjs/stargate"; +import { HttpEndpoint } from "@cosmjs/tendermint-rpc"; +import * as desmosPostsV3MsgsRegistry from "./posts/v3/msgs.registry"; +import * as desmosProfilesV3MsgServerRegistry from "./profiles/v3/msg_server.registry"; +import * as desmosReactionsV1MsgsRegistry from "./reactions/v1/msgs.registry"; +import * as desmosRelationshipsV1MsgsRegistry from "./relationships/v1/msgs.registry"; +import * as desmosReportsV1MsgsRegistry from "./reports/v1/msgs.registry"; +import * as desmosSubspacesV3MsgsRegistry from "./subspaces/v3/msgs.registry"; +import * as desmosPostsV3MsgsAmino from "./posts/v3/msgs.amino"; +import * as desmosProfilesV3MsgServerAmino from "./profiles/v3/msg_server.amino"; +import * as desmosReactionsV1MsgsAmino from "./reactions/v1/msgs.amino"; +import * as desmosRelationshipsV1MsgsAmino from "./relationships/v1/msgs.amino"; +import * as desmosReportsV1MsgsAmino from "./reports/v1/msgs.amino"; +import * as desmosSubspacesV3MsgsAmino from "./subspaces/v3/msgs.amino"; +export const desmosAminoConverters = { + ...desmosPostsV3MsgsAmino.AminoConverter, + ...desmosProfilesV3MsgServerAmino.AminoConverter, + ...desmosReactionsV1MsgsAmino.AminoConverter, + ...desmosRelationshipsV1MsgsAmino.AminoConverter, + ...desmosReportsV1MsgsAmino.AminoConverter, + ...desmosSubspacesV3MsgsAmino.AminoConverter, +}; +export const desmosProtoRegistry: ReadonlyArray<[string, GeneratedType]> = [ + ...desmosPostsV3MsgsRegistry.registry, + ...desmosProfilesV3MsgServerRegistry.registry, + ...desmosReactionsV1MsgsRegistry.registry, + ...desmosRelationshipsV1MsgsRegistry.registry, + ...desmosReportsV1MsgsRegistry.registry, + ...desmosSubspacesV3MsgsRegistry.registry, +]; +export const getSigningDesmosClientOptions = (): { + registry: Registry; + aminoTypes: AminoTypes; +} => { + const registry = new Registry([...desmosProtoRegistry]); + const aminoTypes = new AminoTypes({ + ...desmosAminoConverters, + }); + return { + registry, + aminoTypes, + }; +}; +export const getSigningDesmosClient = async ({ + rpcEndpoint, + signer, +}: { + rpcEndpoint: string | HttpEndpoint; + signer: OfflineSigner; +}) => { + const { registry, aminoTypes } = getSigningDesmosClientOptions(); + const client = await SigningStargateClient.connectWithSigner( + rpcEndpoint, + signer, + { + registry, + aminoTypes, + } + ); + return client; +}; diff --git a/packages/types/src/desmos/posts/v3/genesis.ts b/packages/types/src/desmos/posts/v3/genesis.ts index ece84fe99..a05f9aaeb 100644 --- a/packages/types/src/desmos/posts/v3/genesis.ts +++ b/packages/types/src/desmos/posts/v3/genesis.ts @@ -1,6 +1,15 @@ /* eslint-disable */ -import { Post, Attachment, UserAnswer, Params } from "./models"; -import { Timestamp } from "../../../google/protobuf/timestamp"; +import { + Post, + PostAmino, + Attachment, + AttachmentAmino, + UserAnswer, + UserAnswerAmino, + Params, + ParamsAmino, +} from "./models"; +import { Timestamp, TimestampAmino } from "../../../google/protobuf/timestamp"; import { Long, isSet, @@ -21,17 +30,62 @@ export interface GenesisState { userAnswers: UserAnswer[]; params?: Params; } +export interface GenesisStateProtoMsg { + typeUrl: "/desmos.posts.v3.GenesisState"; + value: Uint8Array; +} +/** GenesisState contains the data of the genesis state for the posts module */ +export interface GenesisStateAmino { + subspaces_data: SubspaceDataEntryAmino[]; + posts_data: PostDataEntryAmino[]; + posts: PostAmino[]; + attachments: AttachmentAmino[]; + active_polls: ActivePollDataAmino[]; + user_answers: UserAnswerAmino[]; + params?: ParamsAmino; +} +export interface GenesisStateAminoMsg { + type: "/desmos.posts.v3.GenesisState"; + value: GenesisStateAmino; +} /** SubspaceDataEntry contains the data for a given subspace */ export interface SubspaceDataEntry { subspaceId: Long; initialPostId: Long; } +export interface SubspaceDataEntryProtoMsg { + typeUrl: "/desmos.posts.v3.SubspaceDataEntry"; + value: Uint8Array; +} +/** SubspaceDataEntry contains the data for a given subspace */ +export interface SubspaceDataEntryAmino { + subspace_id: string; + initial_post_id: string; +} +export interface SubspaceDataEntryAminoMsg { + type: "/desmos.posts.v3.SubspaceDataEntry"; + value: SubspaceDataEntryAmino; +} /** PostDataEntry contains the data of a given post */ export interface PostDataEntry { subspaceId: Long; postId: Long; initialAttachmentId: number; } +export interface PostDataEntryProtoMsg { + typeUrl: "/desmos.posts.v3.PostDataEntry"; + value: Uint8Array; +} +/** PostDataEntry contains the data of a given post */ +export interface PostDataEntryAmino { + subspace_id: string; + post_id: string; + initial_attachment_id: number; +} +export interface PostDataEntryAminoMsg { + type: "/desmos.posts.v3.PostDataEntry"; + value: PostDataEntryAmino; +} /** ActivePollData contains the data of an active poll */ export interface ActivePollData { subspaceId: Long; @@ -39,6 +93,21 @@ export interface ActivePollData { pollId: number; endDate?: Timestamp; } +export interface ActivePollDataProtoMsg { + typeUrl: "/desmos.posts.v3.ActivePollData"; + value: Uint8Array; +} +/** ActivePollData contains the data of an active poll */ +export interface ActivePollDataAmino { + subspace_id: string; + post_id: string; + poll_id: number; + end_date?: TimestampAmino; +} +export interface ActivePollDataAminoMsg { + type: "/desmos.posts.v3.ActivePollData"; + value: ActivePollDataAmino; +} function createBaseGenesisState(): GenesisState { return { subspacesData: [], @@ -207,6 +276,89 @@ export const GenesisState = { : undefined; return message; }, + fromAmino(object: GenesisStateAmino): GenesisState { + return { + subspacesData: Array.isArray(object?.subspaces_data) + ? object.subspaces_data.map((e: any) => SubspaceDataEntry.fromAmino(e)) + : [], + postsData: Array.isArray(object?.posts_data) + ? object.posts_data.map((e: any) => PostDataEntry.fromAmino(e)) + : [], + posts: Array.isArray(object?.posts) + ? object.posts.map((e: any) => Post.fromAmino(e)) + : [], + attachments: Array.isArray(object?.attachments) + ? object.attachments.map((e: any) => Attachment.fromAmino(e)) + : [], + activePolls: Array.isArray(object?.active_polls) + ? object.active_polls.map((e: any) => ActivePollData.fromAmino(e)) + : [], + userAnswers: Array.isArray(object?.user_answers) + ? object.user_answers.map((e: any) => UserAnswer.fromAmino(e)) + : [], + params: object?.params ? Params.fromAmino(object.params) : undefined, + }; + }, + toAmino(message: GenesisState): GenesisStateAmino { + const obj: any = {}; + if (message.subspacesData) { + obj.subspaces_data = message.subspacesData.map((e) => + e ? SubspaceDataEntry.toAmino(e) : undefined + ); + } else { + obj.subspaces_data = []; + } + if (message.postsData) { + obj.posts_data = message.postsData.map((e) => + e ? PostDataEntry.toAmino(e) : undefined + ); + } else { + obj.posts_data = []; + } + if (message.posts) { + obj.posts = message.posts.map((e) => (e ? Post.toAmino(e) : undefined)); + } else { + obj.posts = []; + } + if (message.attachments) { + obj.attachments = message.attachments.map((e) => + e ? Attachment.toAmino(e) : undefined + ); + } else { + obj.attachments = []; + } + if (message.activePolls) { + obj.active_polls = message.activePolls.map((e) => + e ? ActivePollData.toAmino(e) : undefined + ); + } else { + obj.active_polls = []; + } + if (message.userAnswers) { + obj.user_answers = message.userAnswers.map((e) => + e ? UserAnswer.toAmino(e) : undefined + ); + } else { + obj.user_answers = []; + } + obj.params = message.params ? Params.toAmino(message.params) : undefined; + return obj; + }, + fromAminoMsg(object: GenesisStateAminoMsg): GenesisState { + return GenesisState.fromAmino(object.value); + }, + fromProtoMsg(message: GenesisStateProtoMsg): GenesisState { + return GenesisState.decode(message.value); + }, + toProto(message: GenesisState): Uint8Array { + return GenesisState.encode(message).finish(); + }, + toProtoMsg(message: GenesisState): GenesisStateProtoMsg { + return { + typeUrl: "/desmos.posts.v3.GenesisState", + value: GenesisState.encode(message).finish(), + }; + }, }; function createBaseSubspaceDataEntry(): SubspaceDataEntry { return { @@ -279,6 +431,37 @@ export const SubspaceDataEntry = { : Long.UZERO; return message; }, + fromAmino(object: SubspaceDataEntryAmino): SubspaceDataEntry { + return { + subspaceId: Long.fromString(object.subspace_id), + initialPostId: Long.fromString(object.initial_post_id), + }; + }, + toAmino(message: SubspaceDataEntry): SubspaceDataEntryAmino { + const obj: any = {}; + obj.subspace_id = message.subspaceId + ? message.subspaceId.toString() + : undefined; + obj.initial_post_id = message.initialPostId + ? message.initialPostId.toString() + : undefined; + return obj; + }, + fromAminoMsg(object: SubspaceDataEntryAminoMsg): SubspaceDataEntry { + return SubspaceDataEntry.fromAmino(object.value); + }, + fromProtoMsg(message: SubspaceDataEntryProtoMsg): SubspaceDataEntry { + return SubspaceDataEntry.decode(message.value); + }, + toProto(message: SubspaceDataEntry): Uint8Array { + return SubspaceDataEntry.encode(message).finish(); + }, + toProtoMsg(message: SubspaceDataEntry): SubspaceDataEntryProtoMsg { + return { + typeUrl: "/desmos.posts.v3.SubspaceDataEntry", + value: SubspaceDataEntry.encode(message).finish(), + }; + }, }; function createBasePostDataEntry(): PostDataEntry { return { @@ -362,6 +545,37 @@ export const PostDataEntry = { message.initialAttachmentId = object.initialAttachmentId ?? 0; return message; }, + fromAmino(object: PostDataEntryAmino): PostDataEntry { + return { + subspaceId: Long.fromString(object.subspace_id), + postId: Long.fromString(object.post_id), + initialAttachmentId: object.initial_attachment_id, + }; + }, + toAmino(message: PostDataEntry): PostDataEntryAmino { + const obj: any = {}; + obj.subspace_id = message.subspaceId + ? message.subspaceId.toString() + : undefined; + obj.post_id = message.postId ? message.postId.toString() : undefined; + obj.initial_attachment_id = message.initialAttachmentId; + return obj; + }, + fromAminoMsg(object: PostDataEntryAminoMsg): PostDataEntry { + return PostDataEntry.fromAmino(object.value); + }, + fromProtoMsg(message: PostDataEntryProtoMsg): PostDataEntry { + return PostDataEntry.decode(message.value); + }, + toProto(message: PostDataEntry): Uint8Array { + return PostDataEntry.encode(message).finish(); + }, + toProtoMsg(message: PostDataEntry): PostDataEntryProtoMsg { + return { + typeUrl: "/desmos.posts.v3.PostDataEntry", + value: PostDataEntry.encode(message).finish(), + }; + }, }; function createBaseActivePollData(): ActivePollData { return { @@ -458,4 +672,41 @@ export const ActivePollData = { : undefined; return message; }, + fromAmino(object: ActivePollDataAmino): ActivePollData { + return { + subspaceId: Long.fromString(object.subspace_id), + postId: Long.fromString(object.post_id), + pollId: object.poll_id, + endDate: object?.end_date + ? Timestamp.fromAmino(object.end_date) + : undefined, + }; + }, + toAmino(message: ActivePollData): ActivePollDataAmino { + const obj: any = {}; + obj.subspace_id = message.subspaceId + ? message.subspaceId.toString() + : undefined; + obj.post_id = message.postId ? message.postId.toString() : undefined; + obj.poll_id = message.pollId; + obj.end_date = message.endDate + ? Timestamp.toAmino(message.endDate) + : undefined; + return obj; + }, + fromAminoMsg(object: ActivePollDataAminoMsg): ActivePollData { + return ActivePollData.fromAmino(object.value); + }, + fromProtoMsg(message: ActivePollDataProtoMsg): ActivePollData { + return ActivePollData.decode(message.value); + }, + toProto(message: ActivePollData): Uint8Array { + return ActivePollData.encode(message).finish(); + }, + toProtoMsg(message: ActivePollData): ActivePollDataProtoMsg { + return { + typeUrl: "/desmos.posts.v3.ActivePollData", + value: ActivePollData.encode(message).finish(), + }; + }, }; diff --git a/packages/types/src/desmos/posts/v3/models.ts b/packages/types/src/desmos/posts/v3/models.ts index e67df85f5..32466e63f 100644 --- a/packages/types/src/desmos/posts/v3/models.ts +++ b/packages/types/src/desmos/posts/v3/models.ts @@ -1,6 +1,6 @@ /* eslint-disable */ -import { Timestamp } from "../../../google/protobuf/timestamp"; -import { Any } from "../../../google/protobuf/any"; +import { Timestamp, TimestampAmino } from "../../../google/protobuf/timestamp"; +import { Any, AnyAmino } from "../../../google/protobuf/any"; import { Long, isSet, @@ -23,6 +23,7 @@ export enum PostReferenceType { POST_REFERENCE_TYPE_REPOST = 3, UNRECOGNIZED = -1, } +export const PostReferenceTypeAmino = PostReferenceType; export function postReferenceTypeFromJSON(object: any): PostReferenceType { switch (object) { case 0: @@ -72,6 +73,7 @@ export enum ReplySetting { REPLY_SETTING_MENTIONS = 4, UNRECOGNIZED = -1, } +export const ReplySettingAmino = ReplySetting; export function replySettingFromJSON(object: any): ReplySetting { switch (object) { case 0: @@ -141,6 +143,43 @@ export interface Post { /** (optional) Last edited time of the post */ lastEditedDate?: Timestamp; } +export interface PostProtoMsg { + typeUrl: "/desmos.posts.v3.Post"; + value: Uint8Array; +} +/** Post contains all the information about a single post */ +export interface PostAmino { + /** Id of the subspace inside which the post has been created */ + subspace_id: string; + /** Id of the section inside which the post has been created */ + section_id: number; + /** Unique id of the post */ + id: string; + /** (optional) External id for this post */ + external_id: string; + /** (optional) Text of the post */ + text: string; + /** (optional) Entities connected to this post */ + entities?: EntitiesAmino; + /** Tags related to this post, useful for categorization */ + tags: string[]; + /** Author of the post */ + author: string; + /** (optional) Id of the original post of the conversation */ + conversation_id: string; + /** A list this posts references (either as a reply, repost or quote) */ + referenced_posts: PostReferenceAmino[]; + /** Reply settings of this post */ + reply_settings: ReplySetting; + /** Creation date of the post */ + creation_date?: TimestampAmino; + /** (optional) Last edited time of the post */ + last_edited_date?: TimestampAmino; +} +export interface PostAminoMsg { + type: "/desmos.posts.v3.Post"; + value: PostAmino; +} /** PostReference contains the details of a post reference */ export interface PostReference { /** Type of reference */ @@ -153,6 +192,26 @@ export interface PostReference { */ position: Long; } +export interface PostReferenceProtoMsg { + typeUrl: "/desmos.posts.v3.PostReference"; + value: Uint8Array; +} +/** PostReference contains the details of a post reference */ +export interface PostReferenceAmino { + /** Type of reference */ + type: PostReferenceType; + /** Id of the referenced post */ + post_id: string; + /** + * Position of the reference inside the post's text. This should be used only + * with the type set to TYPE_QUOTE + */ + position: string; +} +export interface PostReferenceAminoMsg { + type: "/desmos.posts.v3.PostReference"; + value: PostReferenceAmino; +} /** Contains the details of entities parsed out of the post text */ export interface Entities { /** Hashtags represent inside the post text */ @@ -162,6 +221,23 @@ export interface Entities { /** Links present inside the post text */ urls: Url[]; } +export interface EntitiesProtoMsg { + typeUrl: "/desmos.posts.v3.Entities"; + value: Uint8Array; +} +/** Contains the details of entities parsed out of the post text */ +export interface EntitiesAmino { + /** Hashtags represent inside the post text */ + hashtags: TextTagAmino[]; + /** Mentions present inside the post text */ + mentions: TextTagAmino[]; + /** Links present inside the post text */ + urls: UrlAmino[]; +} +export interface EntitiesAminoMsg { + type: "/desmos.posts.v3.Entities"; + value: EntitiesAmino; +} /** TextTag represents a tag within the post text */ export interface TextTag { /** Index of the character inside the text at which the tag starts */ @@ -171,6 +247,23 @@ export interface TextTag { /** Tag reference (user address, hashtag value, etc) */ tag: string; } +export interface TextTagProtoMsg { + typeUrl: "/desmos.posts.v3.TextTag"; + value: Uint8Array; +} +/** TextTag represents a tag within the post text */ +export interface TextTagAmino { + /** Index of the character inside the text at which the tag starts */ + start: string; + /** Index of the character inside the text at which the tag ends */ + end: string; + /** Tag reference (user address, hashtag value, etc) */ + tag: string; +} +export interface TextTagAminoMsg { + type: "/desmos.posts.v3.TextTag"; + value: TextTagAmino; +} /** Url contains the details of a generic URL */ export interface Url { /** Index of the character inside the text at which the URL starts */ @@ -182,6 +275,25 @@ export interface Url { /** (optional) Display value of the URL */ displayUrl: string; } +export interface UrlProtoMsg { + typeUrl: "/desmos.posts.v3.Url"; + value: Uint8Array; +} +/** Url contains the details of a generic URL */ +export interface UrlAmino { + /** Index of the character inside the text at which the URL starts */ + start: string; + /** Index of the character inside the text at which the URL ends */ + end: string; + /** Value of the URL where the user should be redirected to */ + url: string; + /** (optional) Display value of the URL */ + display_url: string; +} +export interface UrlAminoMsg { + type: "/desmos.posts.v3.Url"; + value: UrlAmino; +} /** Attachment contains the data of a single post attachment */ export interface Attachment { /** @@ -196,11 +308,46 @@ export interface Attachment { /** Content of the attachment */ content?: Any; } +export interface AttachmentProtoMsg { + typeUrl: "/desmos.posts.v3.Attachment"; + value: Uint8Array; +} +/** Attachment contains the data of a single post attachment */ +export interface AttachmentAmino { + /** + * Id of the subspace inside which the post to which this attachment should be + * connected is + */ + subspace_id: string; + /** Id of the post to which this attachment should be connected */ + post_id: string; + /** If of this attachment */ + id: number; + /** Content of the attachment */ + content?: AnyAmino; +} +export interface AttachmentAminoMsg { + type: "/desmos.posts.v3.Attachment"; + value: AttachmentAmino; +} /** Media represents a media attachment */ export interface Media { uri: string; mimeType: string; } +export interface MediaProtoMsg { + typeUrl: "/desmos.posts.v3.Media"; + value: Uint8Array; +} +/** Media represents a media attachment */ +export interface MediaAmino { + uri: string; + mime_type: string; +} +export interface MediaAminoMsg { + type: "/desmos.posts.v3.Media"; + value: MediaAmino; +} /** Poll represents a poll attachment */ export interface Poll { /** Question of the poll */ @@ -216,6 +363,29 @@ export interface Poll { /** Final poll results */ finalTallyResults?: PollTallyResults; } +export interface PollProtoMsg { + typeUrl: "/desmos.posts.v3.Poll"; + value: Uint8Array; +} +/** Poll represents a poll attachment */ +export interface PollAmino { + /** Question of the poll */ + question: string; + /** Answers the users can choose from */ + provided_answers: Poll_ProvidedAnswerAmino[]; + /** Date at which the poll will close */ + end_date?: TimestampAmino; + /** Whether the poll allows multiple choices from the same user or not */ + allows_multiple_answers: boolean; + /** Whether the poll allows to edit an answer or not */ + allows_answer_edits: boolean; + /** Final poll results */ + final_tally_results?: PollTallyResultsAmino; +} +export interface PollAminoMsg { + type: "/desmos.posts.v3.Poll"; + value: PollAmino; +} /** Provided answer contains the details of a possible poll answer */ export interface Poll_ProvidedAnswer { /** (optional) Text of the answer */ @@ -223,6 +393,21 @@ export interface Poll_ProvidedAnswer { /** Content of the attachment */ attachments: Any[]; } +export interface Poll_ProvidedAnswerProtoMsg { + typeUrl: "/desmos.posts.v3.ProvidedAnswer"; + value: Uint8Array; +} +/** Provided answer contains the details of a possible poll answer */ +export interface Poll_ProvidedAnswerAmino { + /** (optional) Text of the answer */ + text: string; + /** Content of the attachment */ + attachments: AnyAmino[]; +} +export interface Poll_ProvidedAnswerAminoMsg { + type: "/desmos.posts.v3.ProvidedAnswer"; + value: Poll_ProvidedAnswerAmino; +} /** UserAnswer represents a user answer to a poll */ export interface UserAnswer { /** Subspace id inside which the post related to this attachment is located */ @@ -236,10 +421,43 @@ export interface UserAnswer { /** Address of the user answering the poll */ user: string; } +export interface UserAnswerProtoMsg { + typeUrl: "/desmos.posts.v3.UserAnswer"; + value: Uint8Array; +} +/** UserAnswer represents a user answer to a poll */ +export interface UserAnswerAmino { + /** Subspace id inside which the post related to this attachment is located */ + subspace_id: string; + /** Id of the post associated to this attachment */ + post_id: string; + /** Id of the poll to which this answer is associated */ + poll_id: number; + /** Indexes of the answers inside the ProvidedAnswers array */ + answers_indexes: number[]; + /** Address of the user answering the poll */ + user: string; +} +export interface UserAnswerAminoMsg { + type: "/desmos.posts.v3.UserAnswer"; + value: UserAnswerAmino; +} /** PollTallyResults contains the tally results for a poll */ export interface PollTallyResults { results: PollTallyResults_AnswerResult[]; } +export interface PollTallyResultsProtoMsg { + typeUrl: "/desmos.posts.v3.PollTallyResults"; + value: Uint8Array; +} +/** PollTallyResults contains the tally results for a poll */ +export interface PollTallyResultsAmino { + results: PollTallyResults_AnswerResultAmino[]; +} +export interface PollTallyResultsAminoMsg { + type: "/desmos.posts.v3.PollTallyResults"; + value: PollTallyResultsAmino; +} /** AnswerResult contains the result of a single poll provided answer */ export interface PollTallyResults_AnswerResult { /** Index of the answer inside the poll's ProvidedAnswers slice */ @@ -247,11 +465,39 @@ export interface PollTallyResults_AnswerResult { /** Number of votes the answer has received */ votes: Long; } +export interface PollTallyResults_AnswerResultProtoMsg { + typeUrl: "/desmos.posts.v3.AnswerResult"; + value: Uint8Array; +} +/** AnswerResult contains the result of a single poll provided answer */ +export interface PollTallyResults_AnswerResultAmino { + /** Index of the answer inside the poll's ProvidedAnswers slice */ + answer_index: number; + /** Number of votes the answer has received */ + votes: string; +} +export interface PollTallyResults_AnswerResultAminoMsg { + type: "/desmos.posts.v3.AnswerResult"; + value: PollTallyResults_AnswerResultAmino; +} /** Params contains the parameters for the posts module */ export interface Params { /** Maximum length of the post text */ maxTextLength: number; } +export interface ParamsProtoMsg { + typeUrl: "/desmos.posts.v3.Params"; + value: Uint8Array; +} +/** Params contains the parameters for the posts module */ +export interface ParamsAmino { + /** Maximum length of the post text */ + max_text_length: number; +} +export interface ParamsAminoMsg { + type: "/desmos.posts.v3.Params"; + value: ParamsAmino; +} function createBasePost(): Post { return { subspaceId: Long.UZERO, @@ -478,6 +724,85 @@ export const Post = { : undefined; return message; }, + fromAmino(object: PostAmino): Post { + return { + subspaceId: Long.fromString(object.subspace_id), + sectionId: object.section_id, + id: Long.fromString(object.id), + externalId: object.external_id, + text: object.text, + entities: object?.entities + ? Entities.fromAmino(object.entities) + : undefined, + tags: Array.isArray(object?.tags) ? object.tags.map((e: any) => e) : [], + author: object.author, + conversationId: Long.fromString(object.conversation_id), + referencedPosts: Array.isArray(object?.referenced_posts) + ? object.referenced_posts.map((e: any) => PostReference.fromAmino(e)) + : [], + replySettings: isSet(object.reply_settings) + ? replySettingFromJSON(object.reply_settings) + : 0, + creationDate: object?.creation_date + ? Timestamp.fromAmino(object.creation_date) + : undefined, + lastEditedDate: object?.last_edited_date + ? Timestamp.fromAmino(object.last_edited_date) + : undefined, + }; + }, + toAmino(message: Post): PostAmino { + const obj: any = {}; + obj.subspace_id = message.subspaceId + ? message.subspaceId.toString() + : undefined; + obj.section_id = message.sectionId; + obj.id = message.id ? message.id.toString() : undefined; + obj.external_id = message.externalId; + obj.text = message.text; + obj.entities = message.entities + ? Entities.toAmino(message.entities) + : undefined; + if (message.tags) { + obj.tags = message.tags.map((e) => e); + } else { + obj.tags = []; + } + obj.author = message.author; + obj.conversation_id = message.conversationId + ? message.conversationId.toString() + : undefined; + if (message.referencedPosts) { + obj.referenced_posts = message.referencedPosts.map((e) => + e ? PostReference.toAmino(e) : undefined + ); + } else { + obj.referenced_posts = []; + } + obj.reply_settings = message.replySettings; + obj.creation_date = message.creationDate + ? Timestamp.toAmino(message.creationDate) + : undefined; + obj.last_edited_date = message.lastEditedDate + ? Timestamp.toAmino(message.lastEditedDate) + : undefined; + return obj; + }, + fromAminoMsg(object: PostAminoMsg): Post { + return Post.fromAmino(object.value); + }, + fromProtoMsg(message: PostProtoMsg): Post { + return Post.decode(message.value); + }, + toProto(message: Post): Uint8Array { + return Post.encode(message).finish(); + }, + toProtoMsg(message: Post): PostProtoMsg { + return { + typeUrl: "/desmos.posts.v3.Post", + value: Post.encode(message).finish(), + }; + }, }; function createBasePostReference(): PostReference { return { @@ -559,6 +884,35 @@ export const PostReference = { : Long.UZERO; return message; }, + fromAmino(object: PostReferenceAmino): PostReference { + return { + type: isSet(object.type) ? postReferenceTypeFromJSON(object.type) : 0, + postId: Long.fromString(object.post_id), + position: Long.fromString(object.position), + }; + }, + toAmino(message: PostReference): PostReferenceAmino { + const obj: any = {}; + obj.type = message.type; + obj.post_id = message.postId ? message.postId.toString() : undefined; + obj.position = message.position ? message.position.toString() : undefined; + return obj; + }, + fromAminoMsg(object: PostReferenceAminoMsg): PostReference { + return PostReference.fromAmino(object.value); + }, + fromProtoMsg(message: PostReferenceProtoMsg): PostReference { + return PostReference.decode(message.value); + }, + toProto(message: PostReference): Uint8Array { + return PostReference.encode(message).finish(); + }, + toProtoMsg(message: PostReference): PostReferenceProtoMsg { + return { + typeUrl: "/desmos.posts.v3.PostReference", + value: PostReference.encode(message).finish(), + }; + }, }; function createBaseEntities(): Entities { return { @@ -651,6 +1005,57 @@ export const Entities = { message.urls = object.urls?.map((e) => Url.fromPartial(e)) || []; return message; }, + fromAmino(object: EntitiesAmino): Entities { + return { + hashtags: Array.isArray(object?.hashtags) + ? object.hashtags.map((e: any) => TextTag.fromAmino(e)) + : [], + mentions: Array.isArray(object?.mentions) + ? object.mentions.map((e: any) => TextTag.fromAmino(e)) + : [], + urls: Array.isArray(object?.urls) + ? object.urls.map((e: any) => Url.fromAmino(e)) + : [], + }; + }, + toAmino(message: Entities): EntitiesAmino { + const obj: any = {}; + if (message.hashtags) { + obj.hashtags = message.hashtags.map((e) => + e ? TextTag.toAmino(e) : undefined + ); + } else { + obj.hashtags = []; + } + if (message.mentions) { + obj.mentions = message.mentions.map((e) => + e ? TextTag.toAmino(e) : undefined + ); + } else { + obj.mentions = []; + } + if (message.urls) { + obj.urls = message.urls.map((e) => (e ? Url.toAmino(e) : undefined)); + } else { + obj.urls = []; + } + return obj; + }, + fromAminoMsg(object: EntitiesAminoMsg): Entities { + return Entities.fromAmino(object.value); + }, + fromProtoMsg(message: EntitiesProtoMsg): Entities { + return Entities.decode(message.value); + }, + toProto(message: Entities): Uint8Array { + return Entities.encode(message).finish(); + }, + toProtoMsg(message: Entities): EntitiesProtoMsg { + return { + typeUrl: "/desmos.posts.v3.Entities", + value: Entities.encode(message).finish(), + }; + }, }; function createBaseTextTag(): TextTag { return { @@ -727,6 +1132,35 @@ export const TextTag = { message.tag = object.tag ?? ""; return message; }, + fromAmino(object: TextTagAmino): TextTag { + return { + start: Long.fromString(object.start), + end: Long.fromString(object.end), + tag: object.tag, + }; + }, + toAmino(message: TextTag): TextTagAmino { + const obj: any = {}; + obj.start = message.start ? message.start.toString() : undefined; + obj.end = message.end ? message.end.toString() : undefined; + obj.tag = message.tag; + return obj; + }, + fromAminoMsg(object: TextTagAminoMsg): TextTag { + return TextTag.fromAmino(object.value); + }, + fromProtoMsg(message: TextTagProtoMsg): TextTag { + return TextTag.decode(message.value); + }, + toProto(message: TextTag): Uint8Array { + return TextTag.encode(message).finish(); + }, + toProtoMsg(message: TextTag): TextTagProtoMsg { + return { + typeUrl: "/desmos.posts.v3.TextTag", + value: TextTag.encode(message).finish(), + }; + }, }; function createBaseUrl(): Url { return { @@ -810,6 +1244,37 @@ export const Url = { message.displayUrl = object.displayUrl ?? ""; return message; }, + fromAmino(object: UrlAmino): Url { + return { + start: Long.fromString(object.start), + end: Long.fromString(object.end), + url: object.url, + displayUrl: object.display_url, + }; + }, + toAmino(message: Url): UrlAmino { + const obj: any = {}; + obj.start = message.start ? message.start.toString() : undefined; + obj.end = message.end ? message.end.toString() : undefined; + obj.url = message.url; + obj.display_url = message.displayUrl; + return obj; + }, + fromAminoMsg(object: UrlAminoMsg): Url { + return Url.fromAmino(object.value); + }, + fromProtoMsg(message: UrlProtoMsg): Url { + return Url.decode(message.value); + }, + toProto(message: Url): Uint8Array { + return Url.encode(message).finish(); + }, + toProtoMsg(message: Url): UrlProtoMsg { + return { + typeUrl: "/desmos.posts.v3.Url", + value: Url.encode(message).finish(), + }; + }, }; function createBaseAttachment(): Attachment { return { @@ -904,6 +1369,39 @@ export const Attachment = { : undefined; return message; }, + fromAmino(object: AttachmentAmino): Attachment { + return { + subspaceId: Long.fromString(object.subspace_id), + postId: Long.fromString(object.post_id), + id: object.id, + content: object?.content ? Any.fromAmino(object.content) : undefined, + }; + }, + toAmino(message: Attachment): AttachmentAmino { + const obj: any = {}; + obj.subspace_id = message.subspaceId + ? message.subspaceId.toString() + : undefined; + obj.post_id = message.postId ? message.postId.toString() : undefined; + obj.id = message.id; + obj.content = message.content ? Any.toAmino(message.content) : undefined; + return obj; + }, + fromAminoMsg(object: AttachmentAminoMsg): Attachment { + return Attachment.fromAmino(object.value); + }, + fromProtoMsg(message: AttachmentProtoMsg): Attachment { + return Attachment.decode(message.value); + }, + toProto(message: Attachment): Uint8Array { + return Attachment.encode(message).finish(); + }, + toProtoMsg(message: Attachment): AttachmentProtoMsg { + return { + typeUrl: "/desmos.posts.v3.Attachment", + value: Attachment.encode(message).finish(), + }; + }, }; function createBaseMedia(): Media { return { @@ -959,6 +1457,33 @@ export const Media = { message.mimeType = object.mimeType ?? ""; return message; }, + fromAmino(object: MediaAmino): Media { + return { + uri: object.uri, + mimeType: object.mime_type, + }; + }, + toAmino(message: Media): MediaAmino { + const obj: any = {}; + obj.uri = message.uri; + obj.mime_type = message.mimeType; + return obj; + }, + fromAminoMsg(object: MediaAminoMsg): Media { + return Media.fromAmino(object.value); + }, + fromProtoMsg(message: MediaProtoMsg): Media { + return Media.decode(message.value); + }, + toProto(message: Media): Uint8Array { + return Media.encode(message).finish(); + }, + toProtoMsg(message: Media): MediaProtoMsg { + return { + typeUrl: "/desmos.posts.v3.Media", + value: Media.encode(message).finish(), + }; + }, }; function createBasePoll(): Poll { return { @@ -1095,6 +1620,59 @@ export const Poll = { : undefined; return message; }, + fromAmino(object: PollAmino): Poll { + return { + question: object.question, + providedAnswers: Array.isArray(object?.provided_answers) + ? object.provided_answers.map((e: any) => + Poll_ProvidedAnswer.fromAmino(e) + ) + : [], + endDate: object?.end_date + ? Timestamp.fromAmino(object.end_date) + : undefined, + allowsMultipleAnswers: object.allows_multiple_answers, + allowsAnswerEdits: object.allows_answer_edits, + finalTallyResults: object?.final_tally_results + ? PollTallyResults.fromAmino(object.final_tally_results) + : undefined, + }; + }, + toAmino(message: Poll): PollAmino { + const obj: any = {}; + obj.question = message.question; + if (message.providedAnswers) { + obj.provided_answers = message.providedAnswers.map((e) => + e ? Poll_ProvidedAnswer.toAmino(e) : undefined + ); + } else { + obj.provided_answers = []; + } + obj.end_date = message.endDate + ? Timestamp.toAmino(message.endDate) + : undefined; + obj.allows_multiple_answers = message.allowsMultipleAnswers; + obj.allows_answer_edits = message.allowsAnswerEdits; + obj.final_tally_results = message.finalTallyResults + ? PollTallyResults.toAmino(message.finalTallyResults) + : undefined; + return obj; + }, + fromAminoMsg(object: PollAminoMsg): Poll { + return Poll.fromAmino(object.value); + }, + fromProtoMsg(message: PollProtoMsg): Poll { + return Poll.decode(message.value); + }, + toProto(message: Poll): Uint8Array { + return Poll.encode(message).finish(); + }, + toProtoMsg(message: Poll): PollProtoMsg { + return { + typeUrl: "/desmos.posts.v3.Poll", + value: Poll.encode(message).finish(), + }; + }, }; function createBasePoll_ProvidedAnswer(): Poll_ProvidedAnswer { return { @@ -1164,6 +1742,41 @@ export const Poll_ProvidedAnswer = { object.attachments?.map((e) => Any.fromPartial(e)) || []; return message; }, + fromAmino(object: Poll_ProvidedAnswerAmino): Poll_ProvidedAnswer { + return { + text: object.text, + attachments: Array.isArray(object?.attachments) + ? object.attachments.map((e: any) => Any.fromAmino(e)) + : [], + }; + }, + toAmino(message: Poll_ProvidedAnswer): Poll_ProvidedAnswerAmino { + const obj: any = {}; + obj.text = message.text; + if (message.attachments) { + obj.attachments = message.attachments.map((e) => + e ? Any.toAmino(e) : undefined + ); + } else { + obj.attachments = []; + } + return obj; + }, + fromAminoMsg(object: Poll_ProvidedAnswerAminoMsg): Poll_ProvidedAnswer { + return Poll_ProvidedAnswer.fromAmino(object.value); + }, + fromProtoMsg(message: Poll_ProvidedAnswerProtoMsg): Poll_ProvidedAnswer { + return Poll_ProvidedAnswer.decode(message.value); + }, + toProto(message: Poll_ProvidedAnswer): Uint8Array { + return Poll_ProvidedAnswer.encode(message).finish(); + }, + toProtoMsg(message: Poll_ProvidedAnswer): Poll_ProvidedAnswerProtoMsg { + return { + typeUrl: "/desmos.posts.v3.ProvidedAnswer", + value: Poll_ProvidedAnswer.encode(message).finish(), + }; + }, }; function createBaseUserAnswer(): UserAnswer { return { @@ -1279,6 +1892,47 @@ export const UserAnswer = { message.user = object.user ?? ""; return message; }, + fromAmino(object: UserAnswerAmino): UserAnswer { + return { + subspaceId: Long.fromString(object.subspace_id), + postId: Long.fromString(object.post_id), + pollId: object.poll_id, + answersIndexes: Array.isArray(object?.answers_indexes) + ? object.answers_indexes.map((e: any) => e) + : [], + user: object.user, + }; + }, + toAmino(message: UserAnswer): UserAnswerAmino { + const obj: any = {}; + obj.subspace_id = message.subspaceId + ? message.subspaceId.toString() + : undefined; + obj.post_id = message.postId ? message.postId.toString() : undefined; + obj.poll_id = message.pollId; + if (message.answersIndexes) { + obj.answers_indexes = message.answersIndexes.map((e) => e); + } else { + obj.answers_indexes = []; + } + obj.user = message.user; + return obj; + }, + fromAminoMsg(object: UserAnswerAminoMsg): UserAnswer { + return UserAnswer.fromAmino(object.value); + }, + fromProtoMsg(message: UserAnswerProtoMsg): UserAnswer { + return UserAnswer.decode(message.value); + }, + toProto(message: UserAnswer): Uint8Array { + return UserAnswer.encode(message).finish(); + }, + toProtoMsg(message: UserAnswer): UserAnswerProtoMsg { + return { + typeUrl: "/desmos.posts.v3.UserAnswer", + value: UserAnswer.encode(message).finish(), + }; + }, }; function createBasePollTallyResults(): PollTallyResults { return { @@ -1347,6 +2001,41 @@ export const PollTallyResults = { ) || []; return message; }, + fromAmino(object: PollTallyResultsAmino): PollTallyResults { + return { + results: Array.isArray(object?.results) + ? object.results.map((e: any) => + PollTallyResults_AnswerResult.fromAmino(e) + ) + : [], + }; + }, + toAmino(message: PollTallyResults): PollTallyResultsAmino { + const obj: any = {}; + if (message.results) { + obj.results = message.results.map((e) => + e ? PollTallyResults_AnswerResult.toAmino(e) : undefined + ); + } else { + obj.results = []; + } + return obj; + }, + fromAminoMsg(object: PollTallyResultsAminoMsg): PollTallyResults { + return PollTallyResults.fromAmino(object.value); + }, + fromProtoMsg(message: PollTallyResultsProtoMsg): PollTallyResults { + return PollTallyResults.decode(message.value); + }, + toProto(message: PollTallyResults): Uint8Array { + return PollTallyResults.encode(message).finish(); + }, + toProtoMsg(message: PollTallyResults): PollTallyResultsProtoMsg { + return { + typeUrl: "/desmos.posts.v3.PollTallyResults", + value: PollTallyResults.encode(message).finish(), + }; + }, }; function createBasePollTallyResults_AnswerResult(): PollTallyResults_AnswerResult { return { @@ -1415,6 +2104,43 @@ export const PollTallyResults_AnswerResult = { : Long.UZERO; return message; }, + fromAmino( + object: PollTallyResults_AnswerResultAmino + ): PollTallyResults_AnswerResult { + return { + answerIndex: object.answer_index, + votes: Long.fromString(object.votes), + }; + }, + toAmino( + message: PollTallyResults_AnswerResult + ): PollTallyResults_AnswerResultAmino { + const obj: any = {}; + obj.answer_index = message.answerIndex; + obj.votes = message.votes ? message.votes.toString() : undefined; + return obj; + }, + fromAminoMsg( + object: PollTallyResults_AnswerResultAminoMsg + ): PollTallyResults_AnswerResult { + return PollTallyResults_AnswerResult.fromAmino(object.value); + }, + fromProtoMsg( + message: PollTallyResults_AnswerResultProtoMsg + ): PollTallyResults_AnswerResult { + return PollTallyResults_AnswerResult.decode(message.value); + }, + toProto(message: PollTallyResults_AnswerResult): Uint8Array { + return PollTallyResults_AnswerResult.encode(message).finish(); + }, + toProtoMsg( + message: PollTallyResults_AnswerResult + ): PollTallyResults_AnswerResultProtoMsg { + return { + typeUrl: "/desmos.posts.v3.AnswerResult", + value: PollTallyResults_AnswerResult.encode(message).finish(), + }; + }, }; function createBaseParams(): Params { return { @@ -1466,4 +2192,29 @@ export const Params = { message.maxTextLength = object.maxTextLength ?? 0; return message; }, + fromAmino(object: ParamsAmino): Params { + return { + maxTextLength: object.max_text_length, + }; + }, + toAmino(message: Params): ParamsAmino { + const obj: any = {}; + obj.max_text_length = message.maxTextLength; + return obj; + }, + fromAminoMsg(object: ParamsAminoMsg): Params { + return Params.fromAmino(object.value); + }, + fromProtoMsg(message: ParamsProtoMsg): Params { + return Params.decode(message.value); + }, + toProto(message: Params): Uint8Array { + return Params.encode(message).finish(); + }, + toProtoMsg(message: Params): ParamsProtoMsg { + return { + typeUrl: "/desmos.posts.v3.Params", + value: Params.encode(message).finish(), + }; + }, }; diff --git a/packages/types/src/desmos/posts/v3/msgs.amino.ts b/packages/types/src/desmos/posts/v3/msgs.amino.ts new file mode 100644 index 000000000..7498de332 --- /dev/null +++ b/packages/types/src/desmos/posts/v3/msgs.amino.ts @@ -0,0 +1,47 @@ +/* eslint-disable */ +import { + MsgCreatePost, + MsgEditPost, + MsgDeletePost, + MsgAddPostAttachment, + MsgRemovePostAttachment, + MsgAnswerPoll, + MsgUpdateParams, +} from "./msgs"; +export const AminoConverter = { + "/desmos.posts.v3.MsgCreatePost": { + aminoType: "/desmos.posts.v3.MsgCreatePost", + toAmino: MsgCreatePost.toAmino, + fromAmino: MsgCreatePost.fromAmino, + }, + "/desmos.posts.v3.MsgEditPost": { + aminoType: "/desmos.posts.v3.MsgEditPost", + toAmino: MsgEditPost.toAmino, + fromAmino: MsgEditPost.fromAmino, + }, + "/desmos.posts.v3.MsgDeletePost": { + aminoType: "/desmos.posts.v3.MsgDeletePost", + toAmino: MsgDeletePost.toAmino, + fromAmino: MsgDeletePost.fromAmino, + }, + "/desmos.posts.v3.MsgAddPostAttachment": { + aminoType: "/desmos.posts.v3.MsgAddPostAttachment", + toAmino: MsgAddPostAttachment.toAmino, + fromAmino: MsgAddPostAttachment.fromAmino, + }, + "/desmos.posts.v3.MsgRemovePostAttachment": { + aminoType: "/desmos.posts.v3.MsgRemovePostAttachment", + toAmino: MsgRemovePostAttachment.toAmino, + fromAmino: MsgRemovePostAttachment.fromAmino, + }, + "/desmos.posts.v3.MsgAnswerPoll": { + aminoType: "/desmos.posts.v3.MsgAnswerPoll", + toAmino: MsgAnswerPoll.toAmino, + fromAmino: MsgAnswerPoll.fromAmino, + }, + "/desmos.posts.v3.MsgUpdateParams": { + aminoType: "/desmos.posts.v3.MsgUpdateParams", + toAmino: MsgUpdateParams.toAmino, + fromAmino: MsgUpdateParams.fromAmino, + }, +}; diff --git a/packages/types/src/desmos/posts/v3/msgs.registry.ts b/packages/types/src/desmos/posts/v3/msgs.registry.ts new file mode 100644 index 000000000..074f3f41f --- /dev/null +++ b/packages/types/src/desmos/posts/v3/msgs.registry.ts @@ -0,0 +1,247 @@ +/* eslint-disable */ +import { GeneratedType, Registry } from "@cosmjs/proto-signing"; +import { + MsgCreatePost, + MsgEditPost, + MsgDeletePost, + MsgAddPostAttachment, + MsgRemovePostAttachment, + MsgAnswerPoll, + MsgUpdateParams, +} from "./msgs"; +export const registry: ReadonlyArray<[string, GeneratedType]> = [ + ["/desmos.posts.v3.MsgCreatePost", MsgCreatePost], + ["/desmos.posts.v3.MsgEditPost", MsgEditPost], + ["/desmos.posts.v3.MsgDeletePost", MsgDeletePost], + ["/desmos.posts.v3.MsgAddPostAttachment", MsgAddPostAttachment], + ["/desmos.posts.v3.MsgRemovePostAttachment", MsgRemovePostAttachment], + ["/desmos.posts.v3.MsgAnswerPoll", MsgAnswerPoll], + ["/desmos.posts.v3.MsgUpdateParams", MsgUpdateParams], +]; +export const load = (protoRegistry: Registry) => { + registry.forEach(([typeUrl, mod]) => { + protoRegistry.register(typeUrl, mod); + }); +}; +export const MessageComposer = { + encoded: { + createPost(value: MsgCreatePost) { + return { + typeUrl: "/desmos.posts.v3.MsgCreatePost", + value: MsgCreatePost.encode(value).finish(), + }; + }, + editPost(value: MsgEditPost) { + return { + typeUrl: "/desmos.posts.v3.MsgEditPost", + value: MsgEditPost.encode(value).finish(), + }; + }, + deletePost(value: MsgDeletePost) { + return { + typeUrl: "/desmos.posts.v3.MsgDeletePost", + value: MsgDeletePost.encode(value).finish(), + }; + }, + addPostAttachment(value: MsgAddPostAttachment) { + return { + typeUrl: "/desmos.posts.v3.MsgAddPostAttachment", + value: MsgAddPostAttachment.encode(value).finish(), + }; + }, + removePostAttachment(value: MsgRemovePostAttachment) { + return { + typeUrl: "/desmos.posts.v3.MsgRemovePostAttachment", + value: MsgRemovePostAttachment.encode(value).finish(), + }; + }, + answerPoll(value: MsgAnswerPoll) { + return { + typeUrl: "/desmos.posts.v3.MsgAnswerPoll", + value: MsgAnswerPoll.encode(value).finish(), + }; + }, + updateParams(value: MsgUpdateParams) { + return { + typeUrl: "/desmos.posts.v3.MsgUpdateParams", + value: MsgUpdateParams.encode(value).finish(), + }; + }, + }, + withTypeUrl: { + createPost(value: MsgCreatePost) { + return { + typeUrl: "/desmos.posts.v3.MsgCreatePost", + value, + }; + }, + editPost(value: MsgEditPost) { + return { + typeUrl: "/desmos.posts.v3.MsgEditPost", + value, + }; + }, + deletePost(value: MsgDeletePost) { + return { + typeUrl: "/desmos.posts.v3.MsgDeletePost", + value, + }; + }, + addPostAttachment(value: MsgAddPostAttachment) { + return { + typeUrl: "/desmos.posts.v3.MsgAddPostAttachment", + value, + }; + }, + removePostAttachment(value: MsgRemovePostAttachment) { + return { + typeUrl: "/desmos.posts.v3.MsgRemovePostAttachment", + value, + }; + }, + answerPoll(value: MsgAnswerPoll) { + return { + typeUrl: "/desmos.posts.v3.MsgAnswerPoll", + value, + }; + }, + updateParams(value: MsgUpdateParams) { + return { + typeUrl: "/desmos.posts.v3.MsgUpdateParams", + value, + }; + }, + }, + toJSON: { + createPost(value: MsgCreatePost) { + return { + typeUrl: "/desmos.posts.v3.MsgCreatePost", + value: MsgCreatePost.toJSON(value), + }; + }, + editPost(value: MsgEditPost) { + return { + typeUrl: "/desmos.posts.v3.MsgEditPost", + value: MsgEditPost.toJSON(value), + }; + }, + deletePost(value: MsgDeletePost) { + return { + typeUrl: "/desmos.posts.v3.MsgDeletePost", + value: MsgDeletePost.toJSON(value), + }; + }, + addPostAttachment(value: MsgAddPostAttachment) { + return { + typeUrl: "/desmos.posts.v3.MsgAddPostAttachment", + value: MsgAddPostAttachment.toJSON(value), + }; + }, + removePostAttachment(value: MsgRemovePostAttachment) { + return { + typeUrl: "/desmos.posts.v3.MsgRemovePostAttachment", + value: MsgRemovePostAttachment.toJSON(value), + }; + }, + answerPoll(value: MsgAnswerPoll) { + return { + typeUrl: "/desmos.posts.v3.MsgAnswerPoll", + value: MsgAnswerPoll.toJSON(value), + }; + }, + updateParams(value: MsgUpdateParams) { + return { + typeUrl: "/desmos.posts.v3.MsgUpdateParams", + value: MsgUpdateParams.toJSON(value), + }; + }, + }, + fromJSON: { + createPost(value: any) { + return { + typeUrl: "/desmos.posts.v3.MsgCreatePost", + value: MsgCreatePost.fromJSON(value), + }; + }, + editPost(value: any) { + return { + typeUrl: "/desmos.posts.v3.MsgEditPost", + value: MsgEditPost.fromJSON(value), + }; + }, + deletePost(value: any) { + return { + typeUrl: "/desmos.posts.v3.MsgDeletePost", + value: MsgDeletePost.fromJSON(value), + }; + }, + addPostAttachment(value: any) { + return { + typeUrl: "/desmos.posts.v3.MsgAddPostAttachment", + value: MsgAddPostAttachment.fromJSON(value), + }; + }, + removePostAttachment(value: any) { + return { + typeUrl: "/desmos.posts.v3.MsgRemovePostAttachment", + value: MsgRemovePostAttachment.fromJSON(value), + }; + }, + answerPoll(value: any) { + return { + typeUrl: "/desmos.posts.v3.MsgAnswerPoll", + value: MsgAnswerPoll.fromJSON(value), + }; + }, + updateParams(value: any) { + return { + typeUrl: "/desmos.posts.v3.MsgUpdateParams", + value: MsgUpdateParams.fromJSON(value), + }; + }, + }, + fromPartial: { + createPost(value: MsgCreatePost) { + return { + typeUrl: "/desmos.posts.v3.MsgCreatePost", + value: MsgCreatePost.fromPartial(value), + }; + }, + editPost(value: MsgEditPost) { + return { + typeUrl: "/desmos.posts.v3.MsgEditPost", + value: MsgEditPost.fromPartial(value), + }; + }, + deletePost(value: MsgDeletePost) { + return { + typeUrl: "/desmos.posts.v3.MsgDeletePost", + value: MsgDeletePost.fromPartial(value), + }; + }, + addPostAttachment(value: MsgAddPostAttachment) { + return { + typeUrl: "/desmos.posts.v3.MsgAddPostAttachment", + value: MsgAddPostAttachment.fromPartial(value), + }; + }, + removePostAttachment(value: MsgRemovePostAttachment) { + return { + typeUrl: "/desmos.posts.v3.MsgRemovePostAttachment", + value: MsgRemovePostAttachment.fromPartial(value), + }; + }, + answerPoll(value: MsgAnswerPoll) { + return { + typeUrl: "/desmos.posts.v3.MsgAnswerPoll", + value: MsgAnswerPoll.fromPartial(value), + }; + }, + updateParams(value: MsgUpdateParams) { + return { + typeUrl: "/desmos.posts.v3.MsgUpdateParams", + value: MsgUpdateParams.fromPartial(value), + }; + }, + }, +}; diff --git a/packages/types/src/desmos/posts/v3/msgs.ts b/packages/types/src/desmos/posts/v3/msgs.ts index 49a3c4949..4351e10ac 100644 --- a/packages/types/src/desmos/posts/v3/msgs.ts +++ b/packages/types/src/desmos/posts/v3/msgs.ts @@ -1,14 +1,17 @@ /* eslint-disable */ import { Entities, + EntitiesAmino, ReplySetting, PostReference, + PostReferenceAmino, Params, + ParamsAmino, replySettingFromJSON, replySettingToJSON, } from "./models"; -import { Any } from "../../../google/protobuf/any"; -import { Timestamp } from "../../../google/protobuf/timestamp"; +import { Any, AnyAmino } from "../../../google/protobuf/any"; +import { Timestamp, TimestampAmino } from "../../../google/protobuf/timestamp"; import { Long, isSet, @@ -45,6 +48,39 @@ export interface MsgCreatePost { /** A list this posts references (either as a reply, repost or quote) */ referencedPosts: PostReference[]; } +export interface MsgCreatePostProtoMsg { + typeUrl: "/desmos.posts.v3.MsgCreatePost"; + value: Uint8Array; +} +/** MsgCreatePost represents the message to be used to create a post. */ +export interface MsgCreatePostAmino { + /** Id of the subspace inside which the post must be created */ + subspace_id: string; + /** Id of the section inside which the post must be created */ + section_id: number; + /** (optional) External id for this post */ + external_id: string; + /** (optional) Text of the post */ + text: string; + /** (optional) Entities connected to this post */ + entities?: EntitiesAmino; + /** Tags connected to this post */ + tags: string[]; + /** Attachments of the post */ + attachments: AnyAmino[]; + /** Author of the post */ + author: string; + /** (optional) Id of the original post of the conversation */ + conversation_id: string; + /** Reply settings of this post */ + reply_settings: ReplySetting; + /** A list this posts references (either as a reply, repost or quote) */ + referenced_posts: PostReferenceAmino[]; +} +export interface MsgCreatePostAminoMsg { + type: "/desmos.posts.v3.MsgCreatePost"; + value: MsgCreatePostAmino; +} /** MsgCreatePostResponse defines the Msg/CreatePost response type. */ export interface MsgCreatePostResponse { /** Id of the newly created post */ @@ -52,6 +88,21 @@ export interface MsgCreatePostResponse { /** Creation date of the post */ creationDate?: Timestamp; } +export interface MsgCreatePostResponseProtoMsg { + typeUrl: "/desmos.posts.v3.MsgCreatePostResponse"; + value: Uint8Array; +} +/** MsgCreatePostResponse defines the Msg/CreatePost response type. */ +export interface MsgCreatePostResponseAmino { + /** Id of the newly created post */ + post_id: string; + /** Creation date of the post */ + creation_date?: TimestampAmino; +} +export interface MsgCreatePostResponseAminoMsg { + type: "/desmos.posts.v3.MsgCreatePostResponse"; + value: MsgCreatePostResponseAmino; +} /** MsgEditPost represents the message to be used to edit a post. */ export interface MsgEditPost { /** Id of the subspace inside which the post is */ @@ -76,11 +127,56 @@ export interface MsgEditPost { /** Editor of the post */ editor: string; } +export interface MsgEditPostProtoMsg { + typeUrl: "/desmos.posts.v3.MsgEditPost"; + value: Uint8Array; +} +/** MsgEditPost represents the message to be used to edit a post. */ +export interface MsgEditPostAmino { + /** Id of the subspace inside which the post is */ + subspace_id: string; + /** Id of the post to edit */ + post_id: string; + /** + * New text of the post. If set to [do-not-modify] it will change the current + * post's text. + */ + text: string; + /** + * New entities connected to this post. These will always replace the current + * post's entities + */ + entities?: EntitiesAmino; + /** + * New tags connected to this post. These will always replace the current + * post's tags + */ + tags: string[]; + /** Editor of the post */ + editor: string; +} +export interface MsgEditPostAminoMsg { + type: "/desmos.posts.v3.MsgEditPost"; + value: MsgEditPostAmino; +} /** MsgCreatePostResponse defines the Msg/EditPost response type. */ export interface MsgEditPostResponse { /** Edit date of the post */ editDate?: Timestamp; } +export interface MsgEditPostResponseProtoMsg { + typeUrl: "/desmos.posts.v3.MsgEditPostResponse"; + value: Uint8Array; +} +/** MsgCreatePostResponse defines the Msg/EditPost response type. */ +export interface MsgEditPostResponseAmino { + /** Edit date of the post */ + edit_date?: TimestampAmino; +} +export interface MsgEditPostResponseAminoMsg { + type: "/desmos.posts.v3.MsgEditPostResponse"; + value: MsgEditPostResponseAmino; +} /** MsgDeletePost represents the message used when deleting a post. */ export interface MsgDeletePost { /** Id of the subspace containing the post */ @@ -90,8 +186,35 @@ export interface MsgDeletePost { /** User that is deleting the post */ signer: string; } +export interface MsgDeletePostProtoMsg { + typeUrl: "/desmos.posts.v3.MsgDeletePost"; + value: Uint8Array; +} +/** MsgDeletePost represents the message used when deleting a post. */ +export interface MsgDeletePostAmino { + /** Id of the subspace containing the post */ + subspace_id: string; + /** Id of the post to be deleted */ + post_id: string; + /** User that is deleting the post */ + signer: string; +} +export interface MsgDeletePostAminoMsg { + type: "/desmos.posts.v3.MsgDeletePost"; + value: MsgDeletePostAmino; +} /** MsgDeletePostResponse represents the Msg/DeletePost response type */ export interface MsgDeletePostResponse {} +export interface MsgDeletePostResponseProtoMsg { + typeUrl: "/desmos.posts.v3.MsgDeletePostResponse"; + value: Uint8Array; +} +/** MsgDeletePostResponse represents the Msg/DeletePost response type */ +export interface MsgDeletePostResponseAmino {} +export interface MsgDeletePostResponseAminoMsg { + type: "/desmos.posts.v3.MsgDeletePostResponse"; + value: MsgDeletePostResponseAmino; +} /** * MsgAddPostAttachment represents the message that should be * used when adding an attachment to post @@ -106,6 +229,28 @@ export interface MsgAddPostAttachment { /** Editor of the post */ editor: string; } +export interface MsgAddPostAttachmentProtoMsg { + typeUrl: "/desmos.posts.v3.MsgAddPostAttachment"; + value: Uint8Array; +} +/** + * MsgAddPostAttachment represents the message that should be + * used when adding an attachment to post + */ +export interface MsgAddPostAttachmentAmino { + /** Id of the subspace containing the post */ + subspace_id: string; + /** Id of the post to which to add the attachment */ + post_id: string; + /** Content of the attachment */ + content?: AnyAmino; + /** Editor of the post */ + editor: string; +} +export interface MsgAddPostAttachmentAminoMsg { + type: "/desmos.posts.v3.MsgAddPostAttachment"; + value: MsgAddPostAttachmentAmino; +} /** MsgAddPostAttachmentResponse defines the Msg/AddPostAttachment response type. */ export interface MsgAddPostAttachmentResponse { /** New id of the uploaded attachment */ @@ -113,6 +258,21 @@ export interface MsgAddPostAttachmentResponse { /** Edit date of the post */ editDate?: Timestamp; } +export interface MsgAddPostAttachmentResponseProtoMsg { + typeUrl: "/desmos.posts.v3.MsgAddPostAttachmentResponse"; + value: Uint8Array; +} +/** MsgAddPostAttachmentResponse defines the Msg/AddPostAttachment response type. */ +export interface MsgAddPostAttachmentResponseAmino { + /** New id of the uploaded attachment */ + attachment_id: number; + /** Edit date of the post */ + edit_date?: TimestampAmino; +} +export interface MsgAddPostAttachmentResponseAminoMsg { + type: "/desmos.posts.v3.MsgAddPostAttachmentResponse"; + value: MsgAddPostAttachmentResponseAmino; +} /** * MsgRemovePostAttachment represents the message to be used when * removing an attachment from a post @@ -127,6 +287,28 @@ export interface MsgRemovePostAttachment { /** User that is removing the attachment */ editor: string; } +export interface MsgRemovePostAttachmentProtoMsg { + typeUrl: "/desmos.posts.v3.MsgRemovePostAttachment"; + value: Uint8Array; +} +/** + * MsgRemovePostAttachment represents the message to be used when + * removing an attachment from a post + */ +export interface MsgRemovePostAttachmentAmino { + /** Id of the subspace containing the post */ + subspace_id: string; + /** Id of the post from which to remove the attachment */ + post_id: string; + /** Id of the attachment to be removed */ + attachment_id: number; + /** User that is removing the attachment */ + editor: string; +} +export interface MsgRemovePostAttachmentAminoMsg { + type: "/desmos.posts.v3.MsgRemovePostAttachment"; + value: MsgRemovePostAttachmentAmino; +} /** * MsgRemovePostAttachmentResponse defines the * Msg/RemovePostAttachment response type. @@ -135,6 +317,22 @@ export interface MsgRemovePostAttachmentResponse { /** Edit date of the post */ editDate?: Timestamp; } +export interface MsgRemovePostAttachmentResponseProtoMsg { + typeUrl: "/desmos.posts.v3.MsgRemovePostAttachmentResponse"; + value: Uint8Array; +} +/** + * MsgRemovePostAttachmentResponse defines the + * Msg/RemovePostAttachment response type. + */ +export interface MsgRemovePostAttachmentResponseAmino { + /** Edit date of the post */ + edit_date?: TimestampAmino; +} +export interface MsgRemovePostAttachmentResponseAminoMsg { + type: "/desmos.posts.v3.MsgRemovePostAttachmentResponse"; + value: MsgRemovePostAttachmentResponseAmino; +} /** MsgAnswerPoll represents the message used to answer a poll */ export interface MsgAnswerPoll { /** Id of the subspace containing the post */ @@ -148,8 +346,39 @@ export interface MsgAnswerPoll { /** Address of the user answering the poll */ signer: string; } +export interface MsgAnswerPollProtoMsg { + typeUrl: "/desmos.posts.v3.MsgAnswerPoll"; + value: Uint8Array; +} +/** MsgAnswerPoll represents the message used to answer a poll */ +export interface MsgAnswerPollAmino { + /** Id of the subspace containing the post */ + subspace_id: string; + /** Id of the post that contains the poll to be answered */ + post_id: string; + /** Id of the poll to be answered */ + poll_id: number; + /** Indexes of the answer inside the ProvidedAnswers array */ + answers_indexes: number[]; + /** Address of the user answering the poll */ + signer: string; +} +export interface MsgAnswerPollAminoMsg { + type: "/desmos.posts.v3.MsgAnswerPoll"; + value: MsgAnswerPollAmino; +} /** MsgAnswerPollResponse represents the MSg/AnswerPoll response type */ export interface MsgAnswerPollResponse {} +export interface MsgAnswerPollResponseProtoMsg { + typeUrl: "/desmos.posts.v3.MsgAnswerPollResponse"; + value: Uint8Array; +} +/** MsgAnswerPollResponse represents the MSg/AnswerPoll response type */ +export interface MsgAnswerPollResponseAmino {} +export interface MsgAnswerPollResponseAminoMsg { + type: "/desmos.posts.v3.MsgAnswerPollResponse"; + value: MsgAnswerPollResponseAmino; +} /** * MsgUpdateParams is the Msg/UpdateParams request type. * @@ -168,6 +397,32 @@ export interface MsgUpdateParams { */ params?: Params; } +export interface MsgUpdateParamsProtoMsg { + typeUrl: "/desmos.posts.v3.MsgUpdateParams"; + value: Uint8Array; +} +/** + * MsgUpdateParams is the Msg/UpdateParams request type. + * + * Since: Desmos 5.0.0 + */ +export interface MsgUpdateParamsAmino { + /** + * authority is the address that controls the module (defaults to x/gov unless + * overwritten). + */ + authority: string; + /** + * params defines the parameters to update. + * + * NOTE: All parameters must be supplied. + */ + params?: ParamsAmino; +} +export interface MsgUpdateParamsAminoMsg { + type: "/desmos.posts.v3.MsgUpdateParams"; + value: MsgUpdateParamsAmino; +} /** * MsgUpdateParamsResponse defines the response structure for executing a * MsgUpdateParams message. @@ -175,6 +430,21 @@ export interface MsgUpdateParams { * Since: Desmos 5.0.0 */ export interface MsgUpdateParamsResponse {} +export interface MsgUpdateParamsResponseProtoMsg { + typeUrl: "/desmos.posts.v3.MsgUpdateParamsResponse"; + value: Uint8Array; +} +/** + * MsgUpdateParamsResponse defines the response structure for executing a + * MsgUpdateParams message. + * + * Since: Desmos 5.0.0 + */ +export interface MsgUpdateParamsResponseAmino {} +export interface MsgUpdateParamsResponseAminoMsg { + type: "/desmos.posts.v3.MsgUpdateParamsResponse"; + value: MsgUpdateParamsResponseAmino; +} function createBaseMsgCreatePost(): MsgCreatePost { return { subspaceId: Long.UZERO, @@ -374,6 +644,81 @@ export const MsgCreatePost = { object.referencedPosts?.map((e) => PostReference.fromPartial(e)) || []; return message; }, + fromAmino(object: MsgCreatePostAmino): MsgCreatePost { + return { + subspaceId: Long.fromString(object.subspace_id), + sectionId: object.section_id, + externalId: object.external_id, + text: object.text, + entities: object?.entities + ? Entities.fromAmino(object.entities) + : undefined, + tags: Array.isArray(object?.tags) ? object.tags.map((e: any) => e) : [], + attachments: Array.isArray(object?.attachments) + ? object.attachments.map((e: any) => Any.fromAmino(e)) + : [], + author: object.author, + conversationId: Long.fromString(object.conversation_id), + replySettings: isSet(object.reply_settings) + ? replySettingFromJSON(object.reply_settings) + : 0, + referencedPosts: Array.isArray(object?.referenced_posts) + ? object.referenced_posts.map((e: any) => PostReference.fromAmino(e)) + : [], + }; + }, + toAmino(message: MsgCreatePost): MsgCreatePostAmino { + const obj: any = {}; + obj.subspace_id = message.subspaceId + ? message.subspaceId.toString() + : undefined; + obj.section_id = message.sectionId; + obj.external_id = message.externalId; + obj.text = message.text; + obj.entities = message.entities + ? Entities.toAmino(message.entities) + : undefined; + if (message.tags) { + obj.tags = message.tags.map((e) => e); + } else { + obj.tags = []; + } + if (message.attachments) { + obj.attachments = message.attachments.map((e) => + e ? Any.toAmino(e) : undefined + ); + } else { + obj.attachments = []; + } + obj.author = message.author; + obj.conversation_id = message.conversationId + ? message.conversationId.toString() + : undefined; + obj.reply_settings = message.replySettings; + if (message.referencedPosts) { + obj.referenced_posts = message.referencedPosts.map((e) => + e ? PostReference.toAmino(e) : undefined + ); + } else { + obj.referenced_posts = []; + } + return obj; + }, + fromAminoMsg(object: MsgCreatePostAminoMsg): MsgCreatePost { + return MsgCreatePost.fromAmino(object.value); + }, + fromProtoMsg(message: MsgCreatePostProtoMsg): MsgCreatePost { + return MsgCreatePost.decode(message.value); + }, + toProto(message: MsgCreatePost): Uint8Array { + return MsgCreatePost.encode(message).finish(); + }, + toProtoMsg(message: MsgCreatePost): MsgCreatePostProtoMsg { + return { + typeUrl: "/desmos.posts.v3.MsgCreatePost", + value: MsgCreatePost.encode(message).finish(), + }; + }, }; function createBaseMsgCreatePostResponse(): MsgCreatePostResponse { return { @@ -447,6 +792,37 @@ export const MsgCreatePostResponse = { : undefined; return message; }, + fromAmino(object: MsgCreatePostResponseAmino): MsgCreatePostResponse { + return { + postId: Long.fromString(object.post_id), + creationDate: object?.creation_date + ? Timestamp.fromAmino(object.creation_date) + : undefined, + }; + }, + toAmino(message: MsgCreatePostResponse): MsgCreatePostResponseAmino { + const obj: any = {}; + obj.post_id = message.postId ? message.postId.toString() : undefined; + obj.creation_date = message.creationDate + ? Timestamp.toAmino(message.creationDate) + : undefined; + return obj; + }, + fromAminoMsg(object: MsgCreatePostResponseAminoMsg): MsgCreatePostResponse { + return MsgCreatePostResponse.fromAmino(object.value); + }, + fromProtoMsg(message: MsgCreatePostResponseProtoMsg): MsgCreatePostResponse { + return MsgCreatePostResponse.decode(message.value); + }, + toProto(message: MsgCreatePostResponse): Uint8Array { + return MsgCreatePostResponse.encode(message).finish(); + }, + toProtoMsg(message: MsgCreatePostResponse): MsgCreatePostResponseProtoMsg { + return { + typeUrl: "/desmos.posts.v3.MsgCreatePostResponse", + value: MsgCreatePostResponse.encode(message).finish(), + }; + }, }; function createBaseMsgEditPost(): MsgEditPost { return { @@ -571,6 +947,51 @@ export const MsgEditPost = { message.editor = object.editor ?? ""; return message; }, + fromAmino(object: MsgEditPostAmino): MsgEditPost { + return { + subspaceId: Long.fromString(object.subspace_id), + postId: Long.fromString(object.post_id), + text: object.text, + entities: object?.entities + ? Entities.fromAmino(object.entities) + : undefined, + tags: Array.isArray(object?.tags) ? object.tags.map((e: any) => e) : [], + editor: object.editor, + }; + }, + toAmino(message: MsgEditPost): MsgEditPostAmino { + const obj: any = {}; + obj.subspace_id = message.subspaceId + ? message.subspaceId.toString() + : undefined; + obj.post_id = message.postId ? message.postId.toString() : undefined; + obj.text = message.text; + obj.entities = message.entities + ? Entities.toAmino(message.entities) + : undefined; + if (message.tags) { + obj.tags = message.tags.map((e) => e); + } else { + obj.tags = []; + } + obj.editor = message.editor; + return obj; + }, + fromAminoMsg(object: MsgEditPostAminoMsg): MsgEditPost { + return MsgEditPost.fromAmino(object.value); + }, + fromProtoMsg(message: MsgEditPostProtoMsg): MsgEditPost { + return MsgEditPost.decode(message.value); + }, + toProto(message: MsgEditPost): Uint8Array { + return MsgEditPost.encode(message).finish(); + }, + toProtoMsg(message: MsgEditPost): MsgEditPostProtoMsg { + return { + typeUrl: "/desmos.posts.v3.MsgEditPost", + value: MsgEditPost.encode(message).finish(), + }; + }, }; function createBaseMsgEditPostResponse(): MsgEditPostResponse { return { @@ -627,6 +1048,35 @@ export const MsgEditPostResponse = { : undefined; return message; }, + fromAmino(object: MsgEditPostResponseAmino): MsgEditPostResponse { + return { + editDate: object?.edit_date + ? Timestamp.fromAmino(object.edit_date) + : undefined, + }; + }, + toAmino(message: MsgEditPostResponse): MsgEditPostResponseAmino { + const obj: any = {}; + obj.edit_date = message.editDate + ? Timestamp.toAmino(message.editDate) + : undefined; + return obj; + }, + fromAminoMsg(object: MsgEditPostResponseAminoMsg): MsgEditPostResponse { + return MsgEditPostResponse.fromAmino(object.value); + }, + fromProtoMsg(message: MsgEditPostResponseProtoMsg): MsgEditPostResponse { + return MsgEditPostResponse.decode(message.value); + }, + toProto(message: MsgEditPostResponse): Uint8Array { + return MsgEditPostResponse.encode(message).finish(); + }, + toProtoMsg(message: MsgEditPostResponse): MsgEditPostResponseProtoMsg { + return { + typeUrl: "/desmos.posts.v3.MsgEditPostResponse", + value: MsgEditPostResponse.encode(message).finish(), + }; + }, }; function createBaseMsgDeletePost(): MsgDeletePost { return { @@ -707,6 +1157,37 @@ export const MsgDeletePost = { message.signer = object.signer ?? ""; return message; }, + fromAmino(object: MsgDeletePostAmino): MsgDeletePost { + return { + subspaceId: Long.fromString(object.subspace_id), + postId: Long.fromString(object.post_id), + signer: object.signer, + }; + }, + toAmino(message: MsgDeletePost): MsgDeletePostAmino { + const obj: any = {}; + obj.subspace_id = message.subspaceId + ? message.subspaceId.toString() + : undefined; + obj.post_id = message.postId ? message.postId.toString() : undefined; + obj.signer = message.signer; + return obj; + }, + fromAminoMsg(object: MsgDeletePostAminoMsg): MsgDeletePost { + return MsgDeletePost.fromAmino(object.value); + }, + fromProtoMsg(message: MsgDeletePostProtoMsg): MsgDeletePost { + return MsgDeletePost.decode(message.value); + }, + toProto(message: MsgDeletePost): Uint8Array { + return MsgDeletePost.encode(message).finish(); + }, + toProtoMsg(message: MsgDeletePost): MsgDeletePostProtoMsg { + return { + typeUrl: "/desmos.posts.v3.MsgDeletePost", + value: MsgDeletePost.encode(message).finish(), + }; + }, }; function createBaseMsgDeletePostResponse(): MsgDeletePostResponse { return {}; @@ -748,6 +1229,28 @@ export const MsgDeletePostResponse = { const message = createBaseMsgDeletePostResponse(); return message; }, + fromAmino(_: MsgDeletePostResponseAmino): MsgDeletePostResponse { + return {}; + }, + toAmino(_: MsgDeletePostResponse): MsgDeletePostResponseAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg(object: MsgDeletePostResponseAminoMsg): MsgDeletePostResponse { + return MsgDeletePostResponse.fromAmino(object.value); + }, + fromProtoMsg(message: MsgDeletePostResponseProtoMsg): MsgDeletePostResponse { + return MsgDeletePostResponse.decode(message.value); + }, + toProto(message: MsgDeletePostResponse): Uint8Array { + return MsgDeletePostResponse.encode(message).finish(); + }, + toProtoMsg(message: MsgDeletePostResponse): MsgDeletePostResponseProtoMsg { + return { + typeUrl: "/desmos.posts.v3.MsgDeletePostResponse", + value: MsgDeletePostResponse.encode(message).finish(), + }; + }, }; function createBaseMsgAddPostAttachment(): MsgAddPostAttachment { return { @@ -845,6 +1348,39 @@ export const MsgAddPostAttachment = { message.editor = object.editor ?? ""; return message; }, + fromAmino(object: MsgAddPostAttachmentAmino): MsgAddPostAttachment { + return { + subspaceId: Long.fromString(object.subspace_id), + postId: Long.fromString(object.post_id), + content: object?.content ? Any.fromAmino(object.content) : undefined, + editor: object.editor, + }; + }, + toAmino(message: MsgAddPostAttachment): MsgAddPostAttachmentAmino { + const obj: any = {}; + obj.subspace_id = message.subspaceId + ? message.subspaceId.toString() + : undefined; + obj.post_id = message.postId ? message.postId.toString() : undefined; + obj.content = message.content ? Any.toAmino(message.content) : undefined; + obj.editor = message.editor; + return obj; + }, + fromAminoMsg(object: MsgAddPostAttachmentAminoMsg): MsgAddPostAttachment { + return MsgAddPostAttachment.fromAmino(object.value); + }, + fromProtoMsg(message: MsgAddPostAttachmentProtoMsg): MsgAddPostAttachment { + return MsgAddPostAttachment.decode(message.value); + }, + toProto(message: MsgAddPostAttachment): Uint8Array { + return MsgAddPostAttachment.encode(message).finish(); + }, + toProtoMsg(message: MsgAddPostAttachment): MsgAddPostAttachmentProtoMsg { + return { + typeUrl: "/desmos.posts.v3.MsgAddPostAttachment", + value: MsgAddPostAttachment.encode(message).finish(), + }; + }, }; function createBaseMsgAddPostAttachmentResponse(): MsgAddPostAttachmentResponse { return { @@ -917,6 +1453,47 @@ export const MsgAddPostAttachmentResponse = { : undefined; return message; }, + fromAmino( + object: MsgAddPostAttachmentResponseAmino + ): MsgAddPostAttachmentResponse { + return { + attachmentId: object.attachment_id, + editDate: object?.edit_date + ? Timestamp.fromAmino(object.edit_date) + : undefined, + }; + }, + toAmino( + message: MsgAddPostAttachmentResponse + ): MsgAddPostAttachmentResponseAmino { + const obj: any = {}; + obj.attachment_id = message.attachmentId; + obj.edit_date = message.editDate + ? Timestamp.toAmino(message.editDate) + : undefined; + return obj; + }, + fromAminoMsg( + object: MsgAddPostAttachmentResponseAminoMsg + ): MsgAddPostAttachmentResponse { + return MsgAddPostAttachmentResponse.fromAmino(object.value); + }, + fromProtoMsg( + message: MsgAddPostAttachmentResponseProtoMsg + ): MsgAddPostAttachmentResponse { + return MsgAddPostAttachmentResponse.decode(message.value); + }, + toProto(message: MsgAddPostAttachmentResponse): Uint8Array { + return MsgAddPostAttachmentResponse.encode(message).finish(); + }, + toProtoMsg( + message: MsgAddPostAttachmentResponse + ): MsgAddPostAttachmentResponseProtoMsg { + return { + typeUrl: "/desmos.posts.v3.MsgAddPostAttachmentResponse", + value: MsgAddPostAttachmentResponse.encode(message).finish(), + }; + }, }; function createBaseMsgRemovePostAttachment(): MsgRemovePostAttachment { return { @@ -1013,6 +1590,45 @@ export const MsgRemovePostAttachment = { message.editor = object.editor ?? ""; return message; }, + fromAmino(object: MsgRemovePostAttachmentAmino): MsgRemovePostAttachment { + return { + subspaceId: Long.fromString(object.subspace_id), + postId: Long.fromString(object.post_id), + attachmentId: object.attachment_id, + editor: object.editor, + }; + }, + toAmino(message: MsgRemovePostAttachment): MsgRemovePostAttachmentAmino { + const obj: any = {}; + obj.subspace_id = message.subspaceId + ? message.subspaceId.toString() + : undefined; + obj.post_id = message.postId ? message.postId.toString() : undefined; + obj.attachment_id = message.attachmentId; + obj.editor = message.editor; + return obj; + }, + fromAminoMsg( + object: MsgRemovePostAttachmentAminoMsg + ): MsgRemovePostAttachment { + return MsgRemovePostAttachment.fromAmino(object.value); + }, + fromProtoMsg( + message: MsgRemovePostAttachmentProtoMsg + ): MsgRemovePostAttachment { + return MsgRemovePostAttachment.decode(message.value); + }, + toProto(message: MsgRemovePostAttachment): Uint8Array { + return MsgRemovePostAttachment.encode(message).finish(); + }, + toProtoMsg( + message: MsgRemovePostAttachment + ): MsgRemovePostAttachmentProtoMsg { + return { + typeUrl: "/desmos.posts.v3.MsgRemovePostAttachment", + value: MsgRemovePostAttachment.encode(message).finish(), + }; + }, }; function createBaseMsgRemovePostAttachmentResponse(): MsgRemovePostAttachmentResponse { return { @@ -1072,6 +1688,45 @@ export const MsgRemovePostAttachmentResponse = { : undefined; return message; }, + fromAmino( + object: MsgRemovePostAttachmentResponseAmino + ): MsgRemovePostAttachmentResponse { + return { + editDate: object?.edit_date + ? Timestamp.fromAmino(object.edit_date) + : undefined, + }; + }, + toAmino( + message: MsgRemovePostAttachmentResponse + ): MsgRemovePostAttachmentResponseAmino { + const obj: any = {}; + obj.edit_date = message.editDate + ? Timestamp.toAmino(message.editDate) + : undefined; + return obj; + }, + fromAminoMsg( + object: MsgRemovePostAttachmentResponseAminoMsg + ): MsgRemovePostAttachmentResponse { + return MsgRemovePostAttachmentResponse.fromAmino(object.value); + }, + fromProtoMsg( + message: MsgRemovePostAttachmentResponseProtoMsg + ): MsgRemovePostAttachmentResponse { + return MsgRemovePostAttachmentResponse.decode(message.value); + }, + toProto(message: MsgRemovePostAttachmentResponse): Uint8Array { + return MsgRemovePostAttachmentResponse.encode(message).finish(); + }, + toProtoMsg( + message: MsgRemovePostAttachmentResponse + ): MsgRemovePostAttachmentResponseProtoMsg { + return { + typeUrl: "/desmos.posts.v3.MsgRemovePostAttachmentResponse", + value: MsgRemovePostAttachmentResponse.encode(message).finish(), + }; + }, }; function createBaseMsgAnswerPoll(): MsgAnswerPoll { return { @@ -1187,6 +1842,47 @@ export const MsgAnswerPoll = { message.signer = object.signer ?? ""; return message; }, + fromAmino(object: MsgAnswerPollAmino): MsgAnswerPoll { + return { + subspaceId: Long.fromString(object.subspace_id), + postId: Long.fromString(object.post_id), + pollId: object.poll_id, + answersIndexes: Array.isArray(object?.answers_indexes) + ? object.answers_indexes.map((e: any) => e) + : [], + signer: object.signer, + }; + }, + toAmino(message: MsgAnswerPoll): MsgAnswerPollAmino { + const obj: any = {}; + obj.subspace_id = message.subspaceId + ? message.subspaceId.toString() + : undefined; + obj.post_id = message.postId ? message.postId.toString() : undefined; + obj.poll_id = message.pollId; + if (message.answersIndexes) { + obj.answers_indexes = message.answersIndexes.map((e) => e); + } else { + obj.answers_indexes = []; + } + obj.signer = message.signer; + return obj; + }, + fromAminoMsg(object: MsgAnswerPollAminoMsg): MsgAnswerPoll { + return MsgAnswerPoll.fromAmino(object.value); + }, + fromProtoMsg(message: MsgAnswerPollProtoMsg): MsgAnswerPoll { + return MsgAnswerPoll.decode(message.value); + }, + toProto(message: MsgAnswerPoll): Uint8Array { + return MsgAnswerPoll.encode(message).finish(); + }, + toProtoMsg(message: MsgAnswerPoll): MsgAnswerPollProtoMsg { + return { + typeUrl: "/desmos.posts.v3.MsgAnswerPoll", + value: MsgAnswerPoll.encode(message).finish(), + }; + }, }; function createBaseMsgAnswerPollResponse(): MsgAnswerPollResponse { return {}; @@ -1228,6 +1924,28 @@ export const MsgAnswerPollResponse = { const message = createBaseMsgAnswerPollResponse(); return message; }, + fromAmino(_: MsgAnswerPollResponseAmino): MsgAnswerPollResponse { + return {}; + }, + toAmino(_: MsgAnswerPollResponse): MsgAnswerPollResponseAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg(object: MsgAnswerPollResponseAminoMsg): MsgAnswerPollResponse { + return MsgAnswerPollResponse.fromAmino(object.value); + }, + fromProtoMsg(message: MsgAnswerPollResponseProtoMsg): MsgAnswerPollResponse { + return MsgAnswerPollResponse.decode(message.value); + }, + toProto(message: MsgAnswerPollResponse): Uint8Array { + return MsgAnswerPollResponse.encode(message).finish(); + }, + toProtoMsg(message: MsgAnswerPollResponse): MsgAnswerPollResponseProtoMsg { + return { + typeUrl: "/desmos.posts.v3.MsgAnswerPollResponse", + value: MsgAnswerPollResponse.encode(message).finish(), + }; + }, }; function createBaseMsgUpdateParams(): MsgUpdateParams { return { @@ -1292,6 +2010,33 @@ export const MsgUpdateParams = { : undefined; return message; }, + fromAmino(object: MsgUpdateParamsAmino): MsgUpdateParams { + return { + authority: object.authority, + params: object?.params ? Params.fromAmino(object.params) : undefined, + }; + }, + toAmino(message: MsgUpdateParams): MsgUpdateParamsAmino { + const obj: any = {}; + obj.authority = message.authority; + obj.params = message.params ? Params.toAmino(message.params) : undefined; + return obj; + }, + fromAminoMsg(object: MsgUpdateParamsAminoMsg): MsgUpdateParams { + return MsgUpdateParams.fromAmino(object.value); + }, + fromProtoMsg(message: MsgUpdateParamsProtoMsg): MsgUpdateParams { + return MsgUpdateParams.decode(message.value); + }, + toProto(message: MsgUpdateParams): Uint8Array { + return MsgUpdateParams.encode(message).finish(); + }, + toProtoMsg(message: MsgUpdateParams): MsgUpdateParamsProtoMsg { + return { + typeUrl: "/desmos.posts.v3.MsgUpdateParams", + value: MsgUpdateParams.encode(message).finish(), + }; + }, }; function createBaseMsgUpdateParamsResponse(): MsgUpdateParamsResponse { return {}; @@ -1333,6 +2078,34 @@ export const MsgUpdateParamsResponse = { const message = createBaseMsgUpdateParamsResponse(); return message; }, + fromAmino(_: MsgUpdateParamsResponseAmino): MsgUpdateParamsResponse { + return {}; + }, + toAmino(_: MsgUpdateParamsResponse): MsgUpdateParamsResponseAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg( + object: MsgUpdateParamsResponseAminoMsg + ): MsgUpdateParamsResponse { + return MsgUpdateParamsResponse.fromAmino(object.value); + }, + fromProtoMsg( + message: MsgUpdateParamsResponseProtoMsg + ): MsgUpdateParamsResponse { + return MsgUpdateParamsResponse.decode(message.value); + }, + toProto(message: MsgUpdateParamsResponse): Uint8Array { + return MsgUpdateParamsResponse.encode(message).finish(); + }, + toProtoMsg( + message: MsgUpdateParamsResponse + ): MsgUpdateParamsResponseProtoMsg { + return { + typeUrl: "/desmos.posts.v3.MsgUpdateParamsResponse", + value: MsgUpdateParamsResponse.encode(message).finish(), + }; + }, }; /** Msg defines the posts Msg service. */ export interface Msg { diff --git a/packages/types/src/desmos/posts/v3/query.ts b/packages/types/src/desmos/posts/v3/query.ts index f6e6e2d61..939dd224a 100644 --- a/packages/types/src/desmos/posts/v3/query.ts +++ b/packages/types/src/desmos/posts/v3/query.ts @@ -1,9 +1,20 @@ /* eslint-disable */ import { PageRequest, + PageRequestAmino, PageResponse, + PageResponseAmino, } from "../../../cosmos/base/query/v1beta1/pagination"; -import { Post, Attachment, UserAnswer, Params } from "./models"; +import { + Post, + PostAmino, + Attachment, + AttachmentAmino, + UserAnswer, + UserAnswerAmino, + Params, + ParamsAmino, +} from "./models"; import { Long, isSet, DeepPartial, Exact, Rpc } from "../../../helpers"; import * as _m0 from "protobufjs/minimal"; export const protobufPackage = "desmos.posts.v3"; @@ -17,6 +28,24 @@ export interface QuerySubspacePostsRequest { /** pagination defines an optional pagination for the request. */ pagination?: PageRequest; } +export interface QuerySubspacePostsRequestProtoMsg { + typeUrl: "/desmos.posts.v3.QuerySubspacePostsRequest"; + value: Uint8Array; +} +/** + * QuerySubspacePostsRequest is the request type for the Query/SubspacePosts RPC + * method + */ +export interface QuerySubspacePostsRequestAmino { + /** Id of the subspace to query the posts for */ + subspace_id: string; + /** pagination defines an optional pagination for the request. */ + pagination?: PageRequestAmino; +} +export interface QuerySubspacePostsRequestAminoMsg { + type: "/desmos.posts.v3.QuerySubspacePostsRequest"; + value: QuerySubspacePostsRequestAmino; +} /** * QuerySubspacePostsResponse is the response type for the Query/SubspacePosts * RPC method @@ -25,6 +54,22 @@ export interface QuerySubspacePostsResponse { posts: Post[]; pagination?: PageResponse; } +export interface QuerySubspacePostsResponseProtoMsg { + typeUrl: "/desmos.posts.v3.QuerySubspacePostsResponse"; + value: Uint8Array; +} +/** + * QuerySubspacePostsResponse is the response type for the Query/SubspacePosts + * RPC method + */ +export interface QuerySubspacePostsResponseAmino { + posts: PostAmino[]; + pagination?: PageResponseAmino; +} +export interface QuerySubspacePostsResponseAminoMsg { + type: "/desmos.posts.v3.QuerySubspacePostsResponse"; + value: QuerySubspacePostsResponseAmino; +} /** * QuerySectionPostsRequest is the request type for the Query/SectionPosts RPC * method @@ -37,6 +82,26 @@ export interface QuerySectionPostsRequest { /** pagination defines an optional pagination for the request. */ pagination?: PageRequest; } +export interface QuerySectionPostsRequestProtoMsg { + typeUrl: "/desmos.posts.v3.QuerySectionPostsRequest"; + value: Uint8Array; +} +/** + * QuerySectionPostsRequest is the request type for the Query/SectionPosts RPC + * method + */ +export interface QuerySectionPostsRequestAmino { + /** Id of the subspace to query the posts for */ + subspace_id: string; + /** Id of the section to query the posts for */ + section_id: number; + /** pagination defines an optional pagination for the request. */ + pagination?: PageRequestAmino; +} +export interface QuerySectionPostsRequestAminoMsg { + type: "/desmos.posts.v3.QuerySectionPostsRequest"; + value: QuerySectionPostsRequestAmino; +} /** * QuerySectionPostsResponse is the response type for the Query/SectionPosts RPC * method @@ -45,6 +110,22 @@ export interface QuerySectionPostsResponse { posts: Post[]; pagination?: PageResponse; } +export interface QuerySectionPostsResponseProtoMsg { + typeUrl: "/desmos.posts.v3.QuerySectionPostsResponse"; + value: Uint8Array; +} +/** + * QuerySectionPostsResponse is the response type for the Query/SectionPosts RPC + * method + */ +export interface QuerySectionPostsResponseAmino { + posts: PostAmino[]; + pagination?: PageResponseAmino; +} +export interface QuerySectionPostsResponseAminoMsg { + type: "/desmos.posts.v3.QuerySectionPostsResponse"; + value: QuerySectionPostsResponseAmino; +} /** QueryPostRequest is the request type for the Query/Post RPC method */ export interface QueryPostRequest { /** Id of the subspace inside which the post lies */ @@ -52,11 +133,39 @@ export interface QueryPostRequest { /** Id of the post to query for */ postId: Long; } +export interface QueryPostRequestProtoMsg { + typeUrl: "/desmos.posts.v3.QueryPostRequest"; + value: Uint8Array; +} +/** QueryPostRequest is the request type for the Query/Post RPC method */ +export interface QueryPostRequestAmino { + /** Id of the subspace inside which the post lies */ + subspace_id: string; + /** Id of the post to query for */ + post_id: string; +} +export interface QueryPostRequestAminoMsg { + type: "/desmos.posts.v3.QueryPostRequest"; + value: QueryPostRequestAmino; +} /** QueryPostResponse is the response type for the Query/Post RPC method */ export interface QueryPostResponse { /** QueryPostResponse is the response type for the Query/Post RPC method */ post?: Post; } +export interface QueryPostResponseProtoMsg { + typeUrl: "/desmos.posts.v3.QueryPostResponse"; + value: Uint8Array; +} +/** QueryPostResponse is the response type for the Query/Post RPC method */ +export interface QueryPostResponseAmino { + /** QueryPostResponse is the response type for the Query/Post RPC method */ + post?: PostAmino; +} +export interface QueryPostResponseAminoMsg { + type: "/desmos.posts.v3.QueryPostResponse"; + value: QueryPostResponseAmino; +} /** * QueryPostsRequest is the request type for the Query/PostAttachments RPC * method @@ -69,6 +178,26 @@ export interface QueryPostAttachmentsRequest { /** pagination defines an optional pagination for the request. */ pagination?: PageRequest; } +export interface QueryPostAttachmentsRequestProtoMsg { + typeUrl: "/desmos.posts.v3.QueryPostAttachmentsRequest"; + value: Uint8Array; +} +/** + * QueryPostsRequest is the request type for the Query/PostAttachments RPC + * method + */ +export interface QueryPostAttachmentsRequestAmino { + /** Id of the subspace where the post is stored */ + subspace_id: string; + /** Id of the post to query the attachments for */ + post_id: string; + /** pagination defines an optional pagination for the request. */ + pagination?: PageRequestAmino; +} +export interface QueryPostAttachmentsRequestAminoMsg { + type: "/desmos.posts.v3.QueryPostAttachmentsRequest"; + value: QueryPostAttachmentsRequestAmino; +} /** * QueryPostAttachmentsResponse is the response type for the * Query/PostAttachments RPC method @@ -77,6 +206,22 @@ export interface QueryPostAttachmentsResponse { attachments: Attachment[]; pagination?: PageResponse; } +export interface QueryPostAttachmentsResponseProtoMsg { + typeUrl: "/desmos.posts.v3.QueryPostAttachmentsResponse"; + value: Uint8Array; +} +/** + * QueryPostAttachmentsResponse is the response type for the + * Query/PostAttachments RPC method + */ +export interface QueryPostAttachmentsResponseAmino { + attachments: AttachmentAmino[]; + pagination?: PageResponseAmino; +} +export interface QueryPostAttachmentsResponseAminoMsg { + type: "/desmos.posts.v3.QueryPostAttachmentsResponse"; + value: QueryPostAttachmentsResponseAmino; +} /** * QueryPollAnswersRequest is the request type for the Query/PollAnswers RPC * method @@ -93,6 +238,30 @@ export interface QueryPollAnswersRequest { /** pagination defines an optional pagination for the request. */ pagination?: PageRequest; } +export interface QueryPollAnswersRequestProtoMsg { + typeUrl: "/desmos.posts.v3.QueryPollAnswersRequest"; + value: Uint8Array; +} +/** + * QueryPollAnswersRequest is the request type for the Query/PollAnswers RPC + * method + */ +export interface QueryPollAnswersRequestAmino { + /** Id of the subspace where the post is stored */ + subspace_id: string; + /** Id of the post that holds the poll */ + post_id: string; + /** Id of the poll to query the answers for */ + poll_id: number; + /** (Optional) Address of the user to query the responses for */ + user: string; + /** pagination defines an optional pagination for the request. */ + pagination?: PageRequestAmino; +} +export interface QueryPollAnswersRequestAminoMsg { + type: "/desmos.posts.v3.QueryPollAnswersRequest"; + value: QueryPollAnswersRequestAmino; +} /** * QueryPollAnswersResponse is the response type for the Query/PollAnswers RPC * method @@ -101,12 +270,50 @@ export interface QueryPollAnswersResponse { answers: UserAnswer[]; pagination?: PageResponse; } +export interface QueryPollAnswersResponseProtoMsg { + typeUrl: "/desmos.posts.v3.QueryPollAnswersResponse"; + value: Uint8Array; +} +/** + * QueryPollAnswersResponse is the response type for the Query/PollAnswers RPC + * method + */ +export interface QueryPollAnswersResponseAmino { + answers: UserAnswerAmino[]; + pagination?: PageResponseAmino; +} +export interface QueryPollAnswersResponseAminoMsg { + type: "/desmos.posts.v3.QueryPollAnswersResponse"; + value: QueryPollAnswersResponseAmino; +} /** QueryParamsRequest is the request type for the Query/Params RPC method */ export interface QueryParamsRequest {} +export interface QueryParamsRequestProtoMsg { + typeUrl: "/desmos.posts.v3.QueryParamsRequest"; + value: Uint8Array; +} +/** QueryParamsRequest is the request type for the Query/Params RPC method */ +export interface QueryParamsRequestAmino {} +export interface QueryParamsRequestAminoMsg { + type: "/desmos.posts.v3.QueryParamsRequest"; + value: QueryParamsRequestAmino; +} /** QueryParamsResponse is the response type for the Query/Params RPC method */ export interface QueryParamsResponse { params?: Params; } +export interface QueryParamsResponseProtoMsg { + typeUrl: "/desmos.posts.v3.QueryParamsResponse"; + value: Uint8Array; +} +/** QueryParamsResponse is the response type for the Query/Params RPC method */ +export interface QueryParamsResponseAmino { + params?: ParamsAmino; +} +export interface QueryParamsResponseAminoMsg { + type: "/desmos.posts.v3.QueryParamsResponse"; + value: QueryParamsResponseAmino; +} function createBaseQuerySubspacePostsRequest(): QuerySubspacePostsRequest { return { subspaceId: Long.UZERO, @@ -183,6 +390,45 @@ export const QuerySubspacePostsRequest = { : undefined; return message; }, + fromAmino(object: QuerySubspacePostsRequestAmino): QuerySubspacePostsRequest { + return { + subspaceId: Long.fromString(object.subspace_id), + pagination: object?.pagination + ? PageRequest.fromAmino(object.pagination) + : undefined, + }; + }, + toAmino(message: QuerySubspacePostsRequest): QuerySubspacePostsRequestAmino { + const obj: any = {}; + obj.subspace_id = message.subspaceId + ? message.subspaceId.toString() + : undefined; + obj.pagination = message.pagination + ? PageRequest.toAmino(message.pagination) + : undefined; + return obj; + }, + fromAminoMsg( + object: QuerySubspacePostsRequestAminoMsg + ): QuerySubspacePostsRequest { + return QuerySubspacePostsRequest.fromAmino(object.value); + }, + fromProtoMsg( + message: QuerySubspacePostsRequestProtoMsg + ): QuerySubspacePostsRequest { + return QuerySubspacePostsRequest.decode(message.value); + }, + toProto(message: QuerySubspacePostsRequest): Uint8Array { + return QuerySubspacePostsRequest.encode(message).finish(); + }, + toProtoMsg( + message: QuerySubspacePostsRequest + ): QuerySubspacePostsRequestProtoMsg { + return { + typeUrl: "/desmos.posts.v3.QuerySubspacePostsRequest", + value: QuerySubspacePostsRequest.encode(message).finish(), + }; + }, }; function createBaseQuerySubspacePostsResponse(): QuerySubspacePostsResponse { return { @@ -263,6 +509,53 @@ export const QuerySubspacePostsResponse = { : undefined; return message; }, + fromAmino( + object: QuerySubspacePostsResponseAmino + ): QuerySubspacePostsResponse { + return { + posts: Array.isArray(object?.posts) + ? object.posts.map((e: any) => Post.fromAmino(e)) + : [], + pagination: object?.pagination + ? PageResponse.fromAmino(object.pagination) + : undefined, + }; + }, + toAmino( + message: QuerySubspacePostsResponse + ): QuerySubspacePostsResponseAmino { + const obj: any = {}; + if (message.posts) { + obj.posts = message.posts.map((e) => (e ? Post.toAmino(e) : undefined)); + } else { + obj.posts = []; + } + obj.pagination = message.pagination + ? PageResponse.toAmino(message.pagination) + : undefined; + return obj; + }, + fromAminoMsg( + object: QuerySubspacePostsResponseAminoMsg + ): QuerySubspacePostsResponse { + return QuerySubspacePostsResponse.fromAmino(object.value); + }, + fromProtoMsg( + message: QuerySubspacePostsResponseProtoMsg + ): QuerySubspacePostsResponse { + return QuerySubspacePostsResponse.decode(message.value); + }, + toProto(message: QuerySubspacePostsResponse): Uint8Array { + return QuerySubspacePostsResponse.encode(message).finish(); + }, + toProtoMsg( + message: QuerySubspacePostsResponse + ): QuerySubspacePostsResponseProtoMsg { + return { + typeUrl: "/desmos.posts.v3.QuerySubspacePostsResponse", + value: QuerySubspacePostsResponse.encode(message).finish(), + }; + }, }; function createBaseQuerySectionPostsRequest(): QuerySectionPostsRequest { return { @@ -351,6 +644,47 @@ export const QuerySectionPostsRequest = { : undefined; return message; }, + fromAmino(object: QuerySectionPostsRequestAmino): QuerySectionPostsRequest { + return { + subspaceId: Long.fromString(object.subspace_id), + sectionId: object.section_id, + pagination: object?.pagination + ? PageRequest.fromAmino(object.pagination) + : undefined, + }; + }, + toAmino(message: QuerySectionPostsRequest): QuerySectionPostsRequestAmino { + const obj: any = {}; + obj.subspace_id = message.subspaceId + ? message.subspaceId.toString() + : undefined; + obj.section_id = message.sectionId; + obj.pagination = message.pagination + ? PageRequest.toAmino(message.pagination) + : undefined; + return obj; + }, + fromAminoMsg( + object: QuerySectionPostsRequestAminoMsg + ): QuerySectionPostsRequest { + return QuerySectionPostsRequest.fromAmino(object.value); + }, + fromProtoMsg( + message: QuerySectionPostsRequestProtoMsg + ): QuerySectionPostsRequest { + return QuerySectionPostsRequest.decode(message.value); + }, + toProto(message: QuerySectionPostsRequest): Uint8Array { + return QuerySectionPostsRequest.encode(message).finish(); + }, + toProtoMsg( + message: QuerySectionPostsRequest + ): QuerySectionPostsRequestProtoMsg { + return { + typeUrl: "/desmos.posts.v3.QuerySectionPostsRequest", + value: QuerySectionPostsRequest.encode(message).finish(), + }; + }, }; function createBaseQuerySectionPostsResponse(): QuerySectionPostsResponse { return { @@ -431,6 +765,49 @@ export const QuerySectionPostsResponse = { : undefined; return message; }, + fromAmino(object: QuerySectionPostsResponseAmino): QuerySectionPostsResponse { + return { + posts: Array.isArray(object?.posts) + ? object.posts.map((e: any) => Post.fromAmino(e)) + : [], + pagination: object?.pagination + ? PageResponse.fromAmino(object.pagination) + : undefined, + }; + }, + toAmino(message: QuerySectionPostsResponse): QuerySectionPostsResponseAmino { + const obj: any = {}; + if (message.posts) { + obj.posts = message.posts.map((e) => (e ? Post.toAmino(e) : undefined)); + } else { + obj.posts = []; + } + obj.pagination = message.pagination + ? PageResponse.toAmino(message.pagination) + : undefined; + return obj; + }, + fromAminoMsg( + object: QuerySectionPostsResponseAminoMsg + ): QuerySectionPostsResponse { + return QuerySectionPostsResponse.fromAmino(object.value); + }, + fromProtoMsg( + message: QuerySectionPostsResponseProtoMsg + ): QuerySectionPostsResponse { + return QuerySectionPostsResponse.decode(message.value); + }, + toProto(message: QuerySectionPostsResponse): Uint8Array { + return QuerySectionPostsResponse.encode(message).finish(); + }, + toProtoMsg( + message: QuerySectionPostsResponse + ): QuerySectionPostsResponseProtoMsg { + return { + typeUrl: "/desmos.posts.v3.QuerySectionPostsResponse", + value: QuerySectionPostsResponse.encode(message).finish(), + }; + }, }; function createBaseQueryPostRequest(): QueryPostRequest { return { @@ -501,6 +878,35 @@ export const QueryPostRequest = { : Long.UZERO; return message; }, + fromAmino(object: QueryPostRequestAmino): QueryPostRequest { + return { + subspaceId: Long.fromString(object.subspace_id), + postId: Long.fromString(object.post_id), + }; + }, + toAmino(message: QueryPostRequest): QueryPostRequestAmino { + const obj: any = {}; + obj.subspace_id = message.subspaceId + ? message.subspaceId.toString() + : undefined; + obj.post_id = message.postId ? message.postId.toString() : undefined; + return obj; + }, + fromAminoMsg(object: QueryPostRequestAminoMsg): QueryPostRequest { + return QueryPostRequest.fromAmino(object.value); + }, + fromProtoMsg(message: QueryPostRequestProtoMsg): QueryPostRequest { + return QueryPostRequest.decode(message.value); + }, + toProto(message: QueryPostRequest): Uint8Array { + return QueryPostRequest.encode(message).finish(); + }, + toProtoMsg(message: QueryPostRequest): QueryPostRequestProtoMsg { + return { + typeUrl: "/desmos.posts.v3.QueryPostRequest", + value: QueryPostRequest.encode(message).finish(), + }; + }, }; function createBaseQueryPostResponse(): QueryPostResponse { return { @@ -555,6 +961,31 @@ export const QueryPostResponse = { : undefined; return message; }, + fromAmino(object: QueryPostResponseAmino): QueryPostResponse { + return { + post: object?.post ? Post.fromAmino(object.post) : undefined, + }; + }, + toAmino(message: QueryPostResponse): QueryPostResponseAmino { + const obj: any = {}; + obj.post = message.post ? Post.toAmino(message.post) : undefined; + return obj; + }, + fromAminoMsg(object: QueryPostResponseAminoMsg): QueryPostResponse { + return QueryPostResponse.fromAmino(object.value); + }, + fromProtoMsg(message: QueryPostResponseProtoMsg): QueryPostResponse { + return QueryPostResponse.decode(message.value); + }, + toProto(message: QueryPostResponse): Uint8Array { + return QueryPostResponse.encode(message).finish(); + }, + toProtoMsg(message: QueryPostResponse): QueryPostResponseProtoMsg { + return { + typeUrl: "/desmos.posts.v3.QueryPostResponse", + value: QueryPostResponse.encode(message).finish(), + }; + }, }; function createBaseQueryPostAttachmentsRequest(): QueryPostAttachmentsRequest { return { @@ -646,6 +1077,51 @@ export const QueryPostAttachmentsRequest = { : undefined; return message; }, + fromAmino( + object: QueryPostAttachmentsRequestAmino + ): QueryPostAttachmentsRequest { + return { + subspaceId: Long.fromString(object.subspace_id), + postId: Long.fromString(object.post_id), + pagination: object?.pagination + ? PageRequest.fromAmino(object.pagination) + : undefined, + }; + }, + toAmino( + message: QueryPostAttachmentsRequest + ): QueryPostAttachmentsRequestAmino { + const obj: any = {}; + obj.subspace_id = message.subspaceId + ? message.subspaceId.toString() + : undefined; + obj.post_id = message.postId ? message.postId.toString() : undefined; + obj.pagination = message.pagination + ? PageRequest.toAmino(message.pagination) + : undefined; + return obj; + }, + fromAminoMsg( + object: QueryPostAttachmentsRequestAminoMsg + ): QueryPostAttachmentsRequest { + return QueryPostAttachmentsRequest.fromAmino(object.value); + }, + fromProtoMsg( + message: QueryPostAttachmentsRequestProtoMsg + ): QueryPostAttachmentsRequest { + return QueryPostAttachmentsRequest.decode(message.value); + }, + toProto(message: QueryPostAttachmentsRequest): Uint8Array { + return QueryPostAttachmentsRequest.encode(message).finish(); + }, + toProtoMsg( + message: QueryPostAttachmentsRequest + ): QueryPostAttachmentsRequestProtoMsg { + return { + typeUrl: "/desmos.posts.v3.QueryPostAttachmentsRequest", + value: QueryPostAttachmentsRequest.encode(message).finish(), + }; + }, }; function createBaseQueryPostAttachmentsResponse(): QueryPostAttachmentsResponse { return { @@ -729,6 +1205,55 @@ export const QueryPostAttachmentsResponse = { : undefined; return message; }, + fromAmino( + object: QueryPostAttachmentsResponseAmino + ): QueryPostAttachmentsResponse { + return { + attachments: Array.isArray(object?.attachments) + ? object.attachments.map((e: any) => Attachment.fromAmino(e)) + : [], + pagination: object?.pagination + ? PageResponse.fromAmino(object.pagination) + : undefined, + }; + }, + toAmino( + message: QueryPostAttachmentsResponse + ): QueryPostAttachmentsResponseAmino { + const obj: any = {}; + if (message.attachments) { + obj.attachments = message.attachments.map((e) => + e ? Attachment.toAmino(e) : undefined + ); + } else { + obj.attachments = []; + } + obj.pagination = message.pagination + ? PageResponse.toAmino(message.pagination) + : undefined; + return obj; + }, + fromAminoMsg( + object: QueryPostAttachmentsResponseAminoMsg + ): QueryPostAttachmentsResponse { + return QueryPostAttachmentsResponse.fromAmino(object.value); + }, + fromProtoMsg( + message: QueryPostAttachmentsResponseProtoMsg + ): QueryPostAttachmentsResponse { + return QueryPostAttachmentsResponse.decode(message.value); + }, + toProto(message: QueryPostAttachmentsResponse): Uint8Array { + return QueryPostAttachmentsResponse.encode(message).finish(); + }, + toProtoMsg( + message: QueryPostAttachmentsResponse + ): QueryPostAttachmentsResponseProtoMsg { + return { + typeUrl: "/desmos.posts.v3.QueryPostAttachmentsResponse", + value: QueryPostAttachmentsResponse.encode(message).finish(), + }; + }, }; function createBaseQueryPollAnswersRequest(): QueryPollAnswersRequest { return { @@ -840,6 +1365,51 @@ export const QueryPollAnswersRequest = { : undefined; return message; }, + fromAmino(object: QueryPollAnswersRequestAmino): QueryPollAnswersRequest { + return { + subspaceId: Long.fromString(object.subspace_id), + postId: Long.fromString(object.post_id), + pollId: object.poll_id, + user: object.user, + pagination: object?.pagination + ? PageRequest.fromAmino(object.pagination) + : undefined, + }; + }, + toAmino(message: QueryPollAnswersRequest): QueryPollAnswersRequestAmino { + const obj: any = {}; + obj.subspace_id = message.subspaceId + ? message.subspaceId.toString() + : undefined; + obj.post_id = message.postId ? message.postId.toString() : undefined; + obj.poll_id = message.pollId; + obj.user = message.user; + obj.pagination = message.pagination + ? PageRequest.toAmino(message.pagination) + : undefined; + return obj; + }, + fromAminoMsg( + object: QueryPollAnswersRequestAminoMsg + ): QueryPollAnswersRequest { + return QueryPollAnswersRequest.fromAmino(object.value); + }, + fromProtoMsg( + message: QueryPollAnswersRequestProtoMsg + ): QueryPollAnswersRequest { + return QueryPollAnswersRequest.decode(message.value); + }, + toProto(message: QueryPollAnswersRequest): Uint8Array { + return QueryPollAnswersRequest.encode(message).finish(); + }, + toProtoMsg( + message: QueryPollAnswersRequest + ): QueryPollAnswersRequestProtoMsg { + return { + typeUrl: "/desmos.posts.v3.QueryPollAnswersRequest", + value: QueryPollAnswersRequest.encode(message).finish(), + }; + }, }; function createBaseQueryPollAnswersResponse(): QueryPollAnswersResponse { return { @@ -923,6 +1493,51 @@ export const QueryPollAnswersResponse = { : undefined; return message; }, + fromAmino(object: QueryPollAnswersResponseAmino): QueryPollAnswersResponse { + return { + answers: Array.isArray(object?.answers) + ? object.answers.map((e: any) => UserAnswer.fromAmino(e)) + : [], + pagination: object?.pagination + ? PageResponse.fromAmino(object.pagination) + : undefined, + }; + }, + toAmino(message: QueryPollAnswersResponse): QueryPollAnswersResponseAmino { + const obj: any = {}; + if (message.answers) { + obj.answers = message.answers.map((e) => + e ? UserAnswer.toAmino(e) : undefined + ); + } else { + obj.answers = []; + } + obj.pagination = message.pagination + ? PageResponse.toAmino(message.pagination) + : undefined; + return obj; + }, + fromAminoMsg( + object: QueryPollAnswersResponseAminoMsg + ): QueryPollAnswersResponse { + return QueryPollAnswersResponse.fromAmino(object.value); + }, + fromProtoMsg( + message: QueryPollAnswersResponseProtoMsg + ): QueryPollAnswersResponse { + return QueryPollAnswersResponse.decode(message.value); + }, + toProto(message: QueryPollAnswersResponse): Uint8Array { + return QueryPollAnswersResponse.encode(message).finish(); + }, + toProtoMsg( + message: QueryPollAnswersResponse + ): QueryPollAnswersResponseProtoMsg { + return { + typeUrl: "/desmos.posts.v3.QueryPollAnswersResponse", + value: QueryPollAnswersResponse.encode(message).finish(), + }; + }, }; function createBaseQueryParamsRequest(): QueryParamsRequest { return {}; @@ -961,6 +1576,28 @@ export const QueryParamsRequest = { const message = createBaseQueryParamsRequest(); return message; }, + fromAmino(_: QueryParamsRequestAmino): QueryParamsRequest { + return {}; + }, + toAmino(_: QueryParamsRequest): QueryParamsRequestAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg(object: QueryParamsRequestAminoMsg): QueryParamsRequest { + return QueryParamsRequest.fromAmino(object.value); + }, + fromProtoMsg(message: QueryParamsRequestProtoMsg): QueryParamsRequest { + return QueryParamsRequest.decode(message.value); + }, + toProto(message: QueryParamsRequest): Uint8Array { + return QueryParamsRequest.encode(message).finish(); + }, + toProtoMsg(message: QueryParamsRequest): QueryParamsRequestProtoMsg { + return { + typeUrl: "/desmos.posts.v3.QueryParamsRequest", + value: QueryParamsRequest.encode(message).finish(), + }; + }, }; function createBaseQueryParamsResponse(): QueryParamsResponse { return { @@ -1015,6 +1652,31 @@ export const QueryParamsResponse = { : undefined; return message; }, + fromAmino(object: QueryParamsResponseAmino): QueryParamsResponse { + return { + params: object?.params ? Params.fromAmino(object.params) : undefined, + }; + }, + toAmino(message: QueryParamsResponse): QueryParamsResponseAmino { + const obj: any = {}; + obj.params = message.params ? Params.toAmino(message.params) : undefined; + return obj; + }, + fromAminoMsg(object: QueryParamsResponseAminoMsg): QueryParamsResponse { + return QueryParamsResponse.fromAmino(object.value); + }, + fromProtoMsg(message: QueryParamsResponseProtoMsg): QueryParamsResponse { + return QueryParamsResponse.decode(message.value); + }, + toProto(message: QueryParamsResponse): Uint8Array { + return QueryParamsResponse.encode(message).finish(); + }, + toProtoMsg(message: QueryParamsResponse): QueryParamsResponseProtoMsg { + return { + typeUrl: "/desmos.posts.v3.QueryParamsResponse", + value: QueryParamsResponse.encode(message).finish(), + }; + }, }; /** Query defines the gRPC querier service */ export interface Query { diff --git a/packages/types/src/desmos/profiles/v3/client/cli.ts b/packages/types/src/desmos/profiles/v3/client/cli.ts deleted file mode 100644 index 1371a3a9e..000000000 --- a/packages/types/src/desmos/profiles/v3/client/cli.ts +++ /dev/null @@ -1,110 +0,0 @@ -/* eslint-disable */ -import { Any } from "../../../../google/protobuf/any"; -import { Proof, ChainConfig } from "../models_chain_links"; -import * as _m0 from "protobufjs/minimal"; -import { isSet, DeepPartial, Exact } from "../../../../helpers"; -export const protobufPackage = "desmos.profiles.v3.client"; -/** - * ChainLinkJSON contains the data required to create a ChainLink using the CLI - * command - */ -export interface ChainLinkJSON { - /** - * Address contains the data of the external chain address to be connected - * with the Desmos profile - */ - address?: Any; - /** Proof contains the ownership proof of the external chain address */ - proof?: Proof; - /** ChainConfig contains the configuration of the external chain */ - chainConfig?: ChainConfig; -} -function createBaseChainLinkJSON(): ChainLinkJSON { - return { - address: undefined, - proof: undefined, - chainConfig: undefined, - }; -} -export const ChainLinkJSON = { - encode( - message: ChainLinkJSON, - writer: _m0.Writer = _m0.Writer.create() - ): _m0.Writer { - if (message.address !== undefined) { - Any.encode(message.address, writer.uint32(10).fork()).ldelim(); - } - if (message.proof !== undefined) { - Proof.encode(message.proof, writer.uint32(18).fork()).ldelim(); - } - if (message.chainConfig !== undefined) { - ChainConfig.encode( - message.chainConfig, - writer.uint32(26).fork() - ).ldelim(); - } - return writer; - }, - decode(input: _m0.Reader | Uint8Array, length?: number): ChainLinkJSON { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseChainLinkJSON(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.address = Any.decode(reader, reader.uint32()); - break; - case 2: - message.proof = Proof.decode(reader, reader.uint32()); - break; - case 3: - message.chainConfig = ChainConfig.decode(reader, reader.uint32()); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }, - fromJSON(object: any): ChainLinkJSON { - return { - address: isSet(object.address) ? Any.fromJSON(object.address) : undefined, - proof: isSet(object.proof) ? Proof.fromJSON(object.proof) : undefined, - chainConfig: isSet(object.chainConfig) - ? ChainConfig.fromJSON(object.chainConfig) - : undefined, - }; - }, - toJSON(message: ChainLinkJSON): unknown { - const obj: any = {}; - message.address !== undefined && - (obj.address = message.address ? Any.toJSON(message.address) : undefined); - message.proof !== undefined && - (obj.proof = message.proof ? Proof.toJSON(message.proof) : undefined); - message.chainConfig !== undefined && - (obj.chainConfig = message.chainConfig - ? ChainConfig.toJSON(message.chainConfig) - : undefined); - return obj; - }, - fromPartial, I>>( - object: I - ): ChainLinkJSON { - const message = createBaseChainLinkJSON(); - message.address = - object.address !== undefined && object.address !== null - ? Any.fromPartial(object.address) - : undefined; - message.proof = - object.proof !== undefined && object.proof !== null - ? Proof.fromPartial(object.proof) - : undefined; - message.chainConfig = - object.chainConfig !== undefined && object.chainConfig !== null - ? ChainConfig.fromPartial(object.chainConfig) - : undefined; - return message; - }, -}; diff --git a/packages/types/src/desmos/profiles/v3/genesis.ts b/packages/types/src/desmos/profiles/v3/genesis.ts index 6115d4872..ac3737f2e 100644 --- a/packages/types/src/desmos/profiles/v3/genesis.ts +++ b/packages/types/src/desmos/profiles/v3/genesis.ts @@ -1,8 +1,11 @@ /* eslint-disable */ -import { DTagTransferRequest } from "./models_dtag_requests"; -import { ChainLink } from "./models_chain_links"; -import { ApplicationLink } from "./models_app_links"; -import { Params } from "./models_params"; +import { + DTagTransferRequest, + DTagTransferRequestAmino, +} from "./models_dtag_requests"; +import { ChainLink, ChainLinkAmino } from "./models_chain_links"; +import { ApplicationLink, ApplicationLinkAmino } from "./models_app_links"; +import { Params, ParamsAmino } from "./models_params"; import * as _m0 from "protobufjs/minimal"; import { isSet, DeepPartial, Exact } from "../../../helpers"; export const protobufPackage = "desmos.profiles.v3"; @@ -15,12 +18,43 @@ export interface GenesisState { ibcPortId: string; params?: Params; } +export interface GenesisStateProtoMsg { + typeUrl: "/desmos.profiles.v3.GenesisState"; + value: Uint8Array; +} +/** GenesisState defines the profiles module's genesis state. */ +export interface GenesisStateAmino { + dtag_transfer_requests: DTagTransferRequestAmino[]; + chain_links: ChainLinkAmino[]; + application_links: ApplicationLinkAmino[]; + default_external_addresses: DefaultExternalAddressEntryAmino[]; + ibc_port_id: string; + params?: ParamsAmino; +} +export interface GenesisStateAminoMsg { + type: "/desmos.profiles.v3.GenesisState"; + value: GenesisStateAmino; +} /** DefaultExternalAddressEntry contains the data of a default extnernal address */ export interface DefaultExternalAddressEntry { owner: string; chainName: string; target: string; } +export interface DefaultExternalAddressEntryProtoMsg { + typeUrl: "/desmos.profiles.v3.DefaultExternalAddressEntry"; + value: Uint8Array; +} +/** DefaultExternalAddressEntry contains the data of a default extnernal address */ +export interface DefaultExternalAddressEntryAmino { + owner: string; + chain_name: string; + target: string; +} +export interface DefaultExternalAddressEntryAminoMsg { + type: "/desmos.profiles.v3.DefaultExternalAddressEntry"; + value: DefaultExternalAddressEntryAmino; +} function createBaseGenesisState(): GenesisState { return { dtagTransferRequests: [], @@ -174,6 +208,79 @@ export const GenesisState = { : undefined; return message; }, + fromAmino(object: GenesisStateAmino): GenesisState { + return { + dtagTransferRequests: Array.isArray(object?.dtag_transfer_requests) + ? object.dtag_transfer_requests.map((e: any) => + DTagTransferRequest.fromAmino(e) + ) + : [], + chainLinks: Array.isArray(object?.chain_links) + ? object.chain_links.map((e: any) => ChainLink.fromAmino(e)) + : [], + applicationLinks: Array.isArray(object?.application_links) + ? object.application_links.map((e: any) => ApplicationLink.fromAmino(e)) + : [], + defaultExternalAddresses: Array.isArray( + object?.default_external_addresses + ) + ? object.default_external_addresses.map((e: any) => + DefaultExternalAddressEntry.fromAmino(e) + ) + : [], + ibcPortId: object.ibc_port_id, + params: object?.params ? Params.fromAmino(object.params) : undefined, + }; + }, + toAmino(message: GenesisState): GenesisStateAmino { + const obj: any = {}; + if (message.dtagTransferRequests) { + obj.dtag_transfer_requests = message.dtagTransferRequests.map((e) => + e ? DTagTransferRequest.toAmino(e) : undefined + ); + } else { + obj.dtag_transfer_requests = []; + } + if (message.chainLinks) { + obj.chain_links = message.chainLinks.map((e) => + e ? ChainLink.toAmino(e) : undefined + ); + } else { + obj.chain_links = []; + } + if (message.applicationLinks) { + obj.application_links = message.applicationLinks.map((e) => + e ? ApplicationLink.toAmino(e) : undefined + ); + } else { + obj.application_links = []; + } + if (message.defaultExternalAddresses) { + obj.default_external_addresses = message.defaultExternalAddresses.map( + (e) => (e ? DefaultExternalAddressEntry.toAmino(e) : undefined) + ); + } else { + obj.default_external_addresses = []; + } + obj.ibc_port_id = message.ibcPortId; + obj.params = message.params ? Params.toAmino(message.params) : undefined; + return obj; + }, + fromAminoMsg(object: GenesisStateAminoMsg): GenesisState { + return GenesisState.fromAmino(object.value); + }, + fromProtoMsg(message: GenesisStateProtoMsg): GenesisState { + return GenesisState.decode(message.value); + }, + toProto(message: GenesisState): Uint8Array { + return GenesisState.encode(message).finish(); + }, + toProtoMsg(message: GenesisState): GenesisStateProtoMsg { + return { + typeUrl: "/desmos.profiles.v3.GenesisState", + value: GenesisState.encode(message).finish(), + }; + }, }; function createBaseDefaultExternalAddressEntry(): DefaultExternalAddressEntry { return { @@ -247,4 +354,43 @@ export const DefaultExternalAddressEntry = { message.target = object.target ?? ""; return message; }, + fromAmino( + object: DefaultExternalAddressEntryAmino + ): DefaultExternalAddressEntry { + return { + owner: object.owner, + chainName: object.chain_name, + target: object.target, + }; + }, + toAmino( + message: DefaultExternalAddressEntry + ): DefaultExternalAddressEntryAmino { + const obj: any = {}; + obj.owner = message.owner; + obj.chain_name = message.chainName; + obj.target = message.target; + return obj; + }, + fromAminoMsg( + object: DefaultExternalAddressEntryAminoMsg + ): DefaultExternalAddressEntry { + return DefaultExternalAddressEntry.fromAmino(object.value); + }, + fromProtoMsg( + message: DefaultExternalAddressEntryProtoMsg + ): DefaultExternalAddressEntry { + return DefaultExternalAddressEntry.decode(message.value); + }, + toProto(message: DefaultExternalAddressEntry): Uint8Array { + return DefaultExternalAddressEntry.encode(message).finish(); + }, + toProtoMsg( + message: DefaultExternalAddressEntry + ): DefaultExternalAddressEntryProtoMsg { + return { + typeUrl: "/desmos.profiles.v3.DefaultExternalAddressEntry", + value: DefaultExternalAddressEntry.encode(message).finish(), + }; + }, }; diff --git a/packages/types/src/desmos/profiles/v3/models_app_links.ts b/packages/types/src/desmos/profiles/v3/models_app_links.ts index 47f4942a5..ac20d4a09 100644 --- a/packages/types/src/desmos/profiles/v3/models_app_links.ts +++ b/packages/types/src/desmos/profiles/v3/models_app_links.ts @@ -1,5 +1,5 @@ /* eslint-disable */ -import { Timestamp } from "../../../google/protobuf/timestamp"; +import { Timestamp, TimestampAmino } from "../../../google/protobuf/timestamp"; import { Long, isSet, @@ -27,6 +27,7 @@ export enum ApplicationLinkState { APPLICATION_LINK_STATE_TIMED_OUT = 4, UNRECOGNIZED = -1, } +export const ApplicationLinkStateAmino = ApplicationLinkState; export function applicationLinkStateFromJSON( object: any ): ApplicationLinkState { @@ -91,6 +92,34 @@ export interface ApplicationLink { /** ExpirationTime represents the time in which the link will expire */ expirationTime?: Timestamp; } +export interface ApplicationLinkProtoMsg { + typeUrl: "/desmos.profiles.v3.ApplicationLink"; + value: Uint8Array; +} +/** ApplicationLink contains the data of a link to a centralized application */ +export interface ApplicationLinkAmino { + /** User to which the link is associated */ + user: string; + /** Data contains the details of this specific link */ + data?: DataAmino; + /** State of the link */ + state: ApplicationLinkState; + /** OracleRequest represents the request that has been made to the oracle */ + oracle_request?: OracleRequestAmino; + /** + * Data coming from the result of the verification. + * Only available when the state is STATE_SUCCESS + */ + result?: ResultAmino; + /** CreationTime represents the time in which the link was created */ + creation_time?: TimestampAmino; + /** ExpirationTime represents the time in which the link will expire */ + expiration_time?: TimestampAmino; +} +export interface ApplicationLinkAminoMsg { + type: "/desmos.profiles.v3.ApplicationLink"; + value: ApplicationLinkAmino; +} /** * Data contains the data associated to a specific user of a * generic centralized application @@ -101,6 +130,24 @@ export interface Data { /** Username on the application (eg. Twitter tag, GitHub profile, etc) */ username: string; } +export interface DataProtoMsg { + typeUrl: "/desmos.profiles.v3.Data"; + value: Uint8Array; +} +/** + * Data contains the data associated to a specific user of a + * generic centralized application + */ +export interface DataAmino { + /** The application name (eg. Twitter, GitHub, etc) */ + application: string; + /** Username on the application (eg. Twitter tag, GitHub profile, etc) */ + username: string; +} +export interface DataAminoMsg { + type: "/desmos.profiles.v3.Data"; + value: DataAmino; +} /** * OracleRequest represents a generic oracle request used to * verify the ownership of a centralized application account @@ -115,6 +162,28 @@ export interface OracleRequest { /** ClientID represents the ID of the client that has called the oracle script */ clientId: string; } +export interface OracleRequestProtoMsg { + typeUrl: "/desmos.profiles.v3.OracleRequest"; + value: Uint8Array; +} +/** + * OracleRequest represents a generic oracle request used to + * verify the ownership of a centralized application account + */ +export interface OracleRequestAmino { + /** ID is the ID of the request */ + id: string; + /** OracleScriptID is ID of an oracle script */ + oracle_script_id: string; + /** CallData contains the data used to perform the oracle request */ + call_data?: OracleRequest_CallDataAmino; + /** ClientID represents the ID of the client that has called the oracle script */ + client_id: string; +} +export interface OracleRequestAminoMsg { + type: "/desmos.profiles.v3.OracleRequest"; + value: OracleRequestAmino; +} /** * CallData contains the data sent to a single oracle request in order to * verify the ownership of a centralized application by a Desmos profile @@ -128,6 +197,27 @@ export interface OracleRequest_CallData { */ callData: string; } +export interface OracleRequest_CallDataProtoMsg { + typeUrl: "/desmos.profiles.v3.CallData"; + value: Uint8Array; +} +/** + * CallData contains the data sent to a single oracle request in order to + * verify the ownership of a centralized application by a Desmos profile + */ +export interface OracleRequest_CallDataAmino { + /** The application for which the ownership should be verified */ + application: string; + /** + * The hex encoded call data that should be used to verify the application + * account ownership + */ + call_data: string; +} +export interface OracleRequest_CallDataAminoMsg { + type: "/desmos.profiles.v3.CallData"; + value: OracleRequest_CallDataAmino; +} /** Result represents a verification result */ export interface Result { /** Success represents a successful verification */ @@ -135,6 +225,21 @@ export interface Result { /** Failed represents a failed verification */ failed?: Result_Failed; } +export interface ResultProtoMsg { + typeUrl: "/desmos.profiles.v3.Result"; + value: Uint8Array; +} +/** Result represents a verification result */ +export interface ResultAmino { + /** Success represents a successful verification */ + success?: Result_SuccessAmino; + /** Failed represents a failed verification */ + failed?: Result_FailedAmino; +} +export interface ResultAminoMsg { + type: "/desmos.profiles.v3.Result"; + value: ResultAmino; +} /** * Success is the result of an application link that has been successfully * verified @@ -145,6 +250,24 @@ export interface Result_Success { /** Hex-encoded signature that has been produced by signing the value */ signature: string; } +export interface Result_SuccessProtoMsg { + typeUrl: "/desmos.profiles.v3.Success"; + value: Uint8Array; +} +/** + * Success is the result of an application link that has been successfully + * verified + */ +export interface Result_SuccessAmino { + /** Hex-encoded value that has be signed by the profile */ + value: string; + /** Hex-encoded signature that has been produced by signing the value */ + signature: string; +} +export interface Result_SuccessAminoMsg { + type: "/desmos.profiles.v3.Success"; + value: Result_SuccessAmino; +} /** * Failed is the result of an application link that has not been verified * successfully @@ -153,6 +276,22 @@ export interface Result_Failed { /** Error that is associated with the failure */ error: string; } +export interface Result_FailedProtoMsg { + typeUrl: "/desmos.profiles.v3.Failed"; + value: Uint8Array; +} +/** + * Failed is the result of an application link that has not been verified + * successfully + */ +export interface Result_FailedAmino { + /** Error that is associated with the failure */ + error: string; +} +export interface Result_FailedAminoMsg { + type: "/desmos.profiles.v3.Failed"; + value: Result_FailedAmino; +} function createBaseApplicationLink(): ApplicationLink { return { user: "", @@ -301,6 +440,57 @@ export const ApplicationLink = { : undefined; return message; }, + fromAmino(object: ApplicationLinkAmino): ApplicationLink { + return { + user: object.user, + data: object?.data ? Data.fromAmino(object.data) : undefined, + state: isSet(object.state) + ? applicationLinkStateFromJSON(object.state) + : 0, + oracleRequest: object?.oracle_request + ? OracleRequest.fromAmino(object.oracle_request) + : undefined, + result: object?.result ? Result.fromAmino(object.result) : undefined, + creationTime: object?.creation_time + ? Timestamp.fromAmino(object.creation_time) + : undefined, + expirationTime: object?.expiration_time + ? Timestamp.fromAmino(object.expiration_time) + : undefined, + }; + }, + toAmino(message: ApplicationLink): ApplicationLinkAmino { + const obj: any = {}; + obj.user = message.user; + obj.data = message.data ? Data.toAmino(message.data) : undefined; + obj.state = message.state; + obj.oracle_request = message.oracleRequest + ? OracleRequest.toAmino(message.oracleRequest) + : undefined; + obj.result = message.result ? Result.toAmino(message.result) : undefined; + obj.creation_time = message.creationTime + ? Timestamp.toAmino(message.creationTime) + : undefined; + obj.expiration_time = message.expirationTime + ? Timestamp.toAmino(message.expirationTime) + : undefined; + return obj; + }, + fromAminoMsg(object: ApplicationLinkAminoMsg): ApplicationLink { + return ApplicationLink.fromAmino(object.value); + }, + fromProtoMsg(message: ApplicationLinkProtoMsg): ApplicationLink { + return ApplicationLink.decode(message.value); + }, + toProto(message: ApplicationLink): Uint8Array { + return ApplicationLink.encode(message).finish(); + }, + toProtoMsg(message: ApplicationLink): ApplicationLinkProtoMsg { + return { + typeUrl: "/desmos.profiles.v3.ApplicationLink", + value: ApplicationLink.encode(message).finish(), + }; + }, }; function createBaseData(): Data { return { @@ -357,6 +547,33 @@ export const Data = { message.username = object.username ?? ""; return message; }, + fromAmino(object: DataAmino): Data { + return { + application: object.application, + username: object.username, + }; + }, + toAmino(message: Data): DataAmino { + const obj: any = {}; + obj.application = message.application; + obj.username = message.username; + return obj; + }, + fromAminoMsg(object: DataAminoMsg): Data { + return Data.fromAmino(object.value); + }, + fromProtoMsg(message: DataProtoMsg): Data { + return Data.decode(message.value); + }, + toProto(message: Data): Uint8Array { + return Data.encode(message).finish(); + }, + toProtoMsg(message: Data): DataProtoMsg { + return { + typeUrl: "/desmos.profiles.v3.Data", + value: Data.encode(message).finish(), + }; + }, }; function createBaseOracleRequest(): OracleRequest { return { @@ -461,6 +678,43 @@ export const OracleRequest = { message.clientId = object.clientId ?? ""; return message; }, + fromAmino(object: OracleRequestAmino): OracleRequest { + return { + id: Long.fromString(object.id), + oracleScriptId: Long.fromString(object.oracle_script_id), + callData: object?.call_data + ? OracleRequest_CallData.fromAmino(object.call_data) + : undefined, + clientId: object.client_id, + }; + }, + toAmino(message: OracleRequest): OracleRequestAmino { + const obj: any = {}; + obj.id = message.id ? message.id.toString() : undefined; + obj.oracle_script_id = message.oracleScriptId + ? message.oracleScriptId.toString() + : undefined; + obj.call_data = message.callData + ? OracleRequest_CallData.toAmino(message.callData) + : undefined; + obj.client_id = message.clientId; + return obj; + }, + fromAminoMsg(object: OracleRequestAminoMsg): OracleRequest { + return OracleRequest.fromAmino(object.value); + }, + fromProtoMsg(message: OracleRequestProtoMsg): OracleRequest { + return OracleRequest.decode(message.value); + }, + toProto(message: OracleRequest): Uint8Array { + return OracleRequest.encode(message).finish(); + }, + toProtoMsg(message: OracleRequest): OracleRequestProtoMsg { + return { + typeUrl: "/desmos.profiles.v3.OracleRequest", + value: OracleRequest.encode(message).finish(), + }; + }, }; function createBaseOracleRequest_CallData(): OracleRequest_CallData { return { @@ -525,6 +779,35 @@ export const OracleRequest_CallData = { message.callData = object.callData ?? ""; return message; }, + fromAmino(object: OracleRequest_CallDataAmino): OracleRequest_CallData { + return { + application: object.application, + callData: object.call_data, + }; + }, + toAmino(message: OracleRequest_CallData): OracleRequest_CallDataAmino { + const obj: any = {}; + obj.application = message.application; + obj.call_data = message.callData; + return obj; + }, + fromAminoMsg(object: OracleRequest_CallDataAminoMsg): OracleRequest_CallData { + return OracleRequest_CallData.fromAmino(object.value); + }, + fromProtoMsg( + message: OracleRequest_CallDataProtoMsg + ): OracleRequest_CallData { + return OracleRequest_CallData.decode(message.value); + }, + toProto(message: OracleRequest_CallData): Uint8Array { + return OracleRequest_CallData.encode(message).finish(); + }, + toProtoMsg(message: OracleRequest_CallData): OracleRequest_CallDataProtoMsg { + return { + typeUrl: "/desmos.profiles.v3.CallData", + value: OracleRequest_CallData.encode(message).finish(), + }; + }, }; function createBaseResult(): Result { return { @@ -599,6 +882,41 @@ export const Result = { : undefined; return message; }, + fromAmino(object: ResultAmino): Result { + return { + success: object?.success + ? Result_Success.fromAmino(object.success) + : undefined, + failed: object?.failed + ? Result_Failed.fromAmino(object.failed) + : undefined, + }; + }, + toAmino(message: Result): ResultAmino { + const obj: any = {}; + obj.success = message.success + ? Result_Success.toAmino(message.success) + : undefined; + obj.failed = message.failed + ? Result_Failed.toAmino(message.failed) + : undefined; + return obj; + }, + fromAminoMsg(object: ResultAminoMsg): Result { + return Result.fromAmino(object.value); + }, + fromProtoMsg(message: ResultProtoMsg): Result { + return Result.decode(message.value); + }, + toProto(message: Result): Uint8Array { + return Result.encode(message).finish(); + }, + toProtoMsg(message: Result): ResultProtoMsg { + return { + typeUrl: "/desmos.profiles.v3.Result", + value: Result.encode(message).finish(), + }; + }, }; function createBaseResult_Success(): Result_Success { return { @@ -659,6 +977,33 @@ export const Result_Success = { message.signature = object.signature ?? ""; return message; }, + fromAmino(object: Result_SuccessAmino): Result_Success { + return { + value: object.value, + signature: object.signature, + }; + }, + toAmino(message: Result_Success): Result_SuccessAmino { + const obj: any = {}; + obj.value = message.value; + obj.signature = message.signature; + return obj; + }, + fromAminoMsg(object: Result_SuccessAminoMsg): Result_Success { + return Result_Success.fromAmino(object.value); + }, + fromProtoMsg(message: Result_SuccessProtoMsg): Result_Success { + return Result_Success.decode(message.value); + }, + toProto(message: Result_Success): Uint8Array { + return Result_Success.encode(message).finish(); + }, + toProtoMsg(message: Result_Success): Result_SuccessProtoMsg { + return { + typeUrl: "/desmos.profiles.v3.Success", + value: Result_Success.encode(message).finish(), + }; + }, }; function createBaseResult_Failed(): Result_Failed { return { @@ -709,4 +1054,29 @@ export const Result_Failed = { message.error = object.error ?? ""; return message; }, + fromAmino(object: Result_FailedAmino): Result_Failed { + return { + error: object.error, + }; + }, + toAmino(message: Result_Failed): Result_FailedAmino { + const obj: any = {}; + obj.error = message.error; + return obj; + }, + fromAminoMsg(object: Result_FailedAminoMsg): Result_Failed { + return Result_Failed.fromAmino(object.value); + }, + fromProtoMsg(message: Result_FailedProtoMsg): Result_Failed { + return Result_Failed.decode(message.value); + }, + toProto(message: Result_Failed): Uint8Array { + return Result_Failed.encode(message).finish(); + }, + toProtoMsg(message: Result_Failed): Result_FailedProtoMsg { + return { + typeUrl: "/desmos.profiles.v3.Failed", + value: Result_Failed.encode(message).finish(), + }; + }, }; diff --git a/packages/types/src/desmos/profiles/v3/models_chain_links.ts b/packages/types/src/desmos/profiles/v3/models_chain_links.ts index b1a3e4955..dde3cfd16 100644 --- a/packages/types/src/desmos/profiles/v3/models_chain_links.ts +++ b/packages/types/src/desmos/profiles/v3/models_chain_links.ts @@ -1,7 +1,10 @@ /* eslint-disable */ -import { Any } from "../../../google/protobuf/any"; -import { Timestamp } from "../../../google/protobuf/timestamp"; -import { CompactBitArray } from "../../../cosmos/crypto/multisig/v1beta1/multisig"; +import { Any, AnyAmino } from "../../../google/protobuf/any"; +import { Timestamp, TimestampAmino } from "../../../google/protobuf/timestamp"; +import { + CompactBitArray, + CompactBitArrayAmino, +} from "../../../cosmos/crypto/multisig/v1beta1/multisig"; import * as _m0 from "protobufjs/minimal"; import { isSet, @@ -44,6 +47,7 @@ export enum SignatureValueType { SIGNATURE_VALUE_TYPE_EVM_PERSONAL_SIGN = 4, UNRECOGNIZED = -1, } +export const SignatureValueTypeAmino = SignatureValueType; export function signatureValueTypeFromJSON(object: any): SignatureValueType { switch (object) { case 0: @@ -103,10 +107,49 @@ export interface ChainLink { /** CreationTime represents the time in which the link has been created */ creationTime?: Timestamp; } +export interface ChainLinkProtoMsg { + typeUrl: "/desmos.profiles.v3.ChainLink"; + value: Uint8Array; +} +/** + * ChainLink contains the data representing either an inter- or cross- chain + * link + */ +export interface ChainLinkAmino { + /** User defines the destination profile address to link */ + user: string; + /** + * Address contains the data of the external chain address to be connected + * with the Desmos profile + */ + address?: AnyAmino; + /** Proof contains the ownership proof of the external chain address */ + proof?: ProofAmino; + /** ChainConfig contains the configuration of the external chain */ + chain_config?: ChainConfigAmino; + /** CreationTime represents the time in which the link has been created */ + creation_time?: TimestampAmino; +} +export interface ChainLinkAminoMsg { + type: "/desmos.profiles.v3.ChainLink"; + value: ChainLinkAmino; +} /** ChainConfig contains the data of the chain with which the link is made. */ export interface ChainConfig { name: string; } +export interface ChainConfigProtoMsg { + typeUrl: "/desmos.profiles.v3.ChainConfig"; + value: Uint8Array; +} +/** ChainConfig contains the data of the chain with which the link is made. */ +export interface ChainConfigAmino { + name: string; +} +export interface ChainConfigAminoMsg { + type: "/desmos.profiles.v3.ChainConfig"; + value: ChainConfigAmino; +} /** * Proof contains all the data used to verify a signature when linking an * account to a profile @@ -125,6 +168,32 @@ export interface Proof { */ plainText: string; } +export interface ProofProtoMsg { + typeUrl: "/desmos.profiles.v3.Proof"; + value: Uint8Array; +} +/** + * Proof contains all the data used to verify a signature when linking an + * account to a profile + */ +export interface ProofAmino { + /** + * PubKey represents the public key associated with the address for which to + * prove the ownership + */ + pub_key?: AnyAmino; + /** Signature represents the hex-encoded signature of the PlainText value */ + signature?: AnyAmino; + /** + * PlainText represents the hex-encoded value signed in order to produce the + * Signature + */ + plain_text: string; +} +export interface ProofAminoMsg { + type: "/desmos.profiles.v3.Proof"; + value: ProofAmino; +} /** Bech32Address represents a Bech32-encoded address */ export interface Bech32Address { /** Value represents the Bech-32 encoded address value */ @@ -132,11 +201,39 @@ export interface Bech32Address { /** Prefix represents the HRP of the Bech32 address */ prefix: string; } +export interface Bech32AddressProtoMsg { + typeUrl: "/desmos.profiles.v3.Bech32Address"; + value: Uint8Array; +} +/** Bech32Address represents a Bech32-encoded address */ +export interface Bech32AddressAmino { + /** Value represents the Bech-32 encoded address value */ + value: string; + /** Prefix represents the HRP of the Bech32 address */ + prefix: string; +} +export interface Bech32AddressAminoMsg { + type: "/desmos.profiles.v3.Bech32Address"; + value: Bech32AddressAmino; +} /** Base58Address represents a Base58-encoded address */ export interface Base58Address { /** Value contains the Base58-encoded address */ value: string; } +export interface Base58AddressProtoMsg { + typeUrl: "/desmos.profiles.v3.Base58Address"; + value: Uint8Array; +} +/** Base58Address represents a Base58-encoded address */ +export interface Base58AddressAmino { + /** Value contains the Base58-encoded address */ + value: string; +} +export interface Base58AddressAminoMsg { + type: "/desmos.profiles.v3.Base58Address"; + value: Base58AddressAmino; +} /** * HexAddress represents an Hex-encoded address * NOTE: Currently it only supports keccak256-uncompressed addresses @@ -150,6 +247,27 @@ export interface HexAddress { */ prefix: string; } +export interface HexAddressProtoMsg { + typeUrl: "/desmos.profiles.v3.HexAddress"; + value: Uint8Array; +} +/** + * HexAddress represents an Hex-encoded address + * NOTE: Currently it only supports keccak256-uncompressed addresses + */ +export interface HexAddressAmino { + /** Value represents the hex address value */ + value: string; + /** + * Prefix represents the optional prefix used during address encoding (e.g. + * 0x) + */ + prefix: string; +} +export interface HexAddressAminoMsg { + type: "/desmos.profiles.v3.HexAddress"; + value: HexAddressAmino; +} /** SingleSignature is the signature data for a single signer */ export interface SingleSignature { /** Type represents the type of the signature value */ @@ -157,6 +275,21 @@ export interface SingleSignature { /** Signature is the raw signature bytes */ signature: Uint8Array; } +export interface SingleSignatureProtoMsg { + typeUrl: "/desmos.profiles.v3.SingleSignature"; + value: Uint8Array; +} +/** SingleSignature is the signature data for a single signer */ +export interface SingleSignatureAmino { + /** Type represents the type of the signature value */ + value_type: SignatureValueType; + /** Signature is the raw signature bytes */ + signature: Uint8Array; +} +export interface SingleSignatureAminoMsg { + type: "/desmos.profiles.v3.SingleSignature"; + value: SingleSignatureAmino; +} /** CosmosMultiSignature is the signature data for a multisig public key */ export interface CosmosMultiSignature { /** Bitarray specifies which keys within the multisig are signing */ @@ -164,6 +297,21 @@ export interface CosmosMultiSignature { /** Signatures is the signatures of the multi-signature */ signatures: Any[]; } +export interface CosmosMultiSignatureProtoMsg { + typeUrl: "/desmos.profiles.v3.CosmosMultiSignature"; + value: Uint8Array; +} +/** CosmosMultiSignature is the signature data for a multisig public key */ +export interface CosmosMultiSignatureAmino { + /** Bitarray specifies which keys within the multisig are signing */ + bit_array?: CompactBitArrayAmino; + /** Signatures is the signatures of the multi-signature */ + signatures: AnyAmino[]; +} +export interface CosmosMultiSignatureAminoMsg { + type: "/desmos.profiles.v3.CosmosMultiSignature"; + value: CosmosMultiSignatureAmino; +} function createBaseChainLink(): ChainLink { return { user: "", @@ -278,6 +426,47 @@ export const ChainLink = { : undefined; return message; }, + fromAmino(object: ChainLinkAmino): ChainLink { + return { + user: object.user, + address: object?.address ? Any.fromAmino(object.address) : undefined, + proof: object?.proof ? Proof.fromAmino(object.proof) : undefined, + chainConfig: object?.chain_config + ? ChainConfig.fromAmino(object.chain_config) + : undefined, + creationTime: object?.creation_time + ? Timestamp.fromAmino(object.creation_time) + : undefined, + }; + }, + toAmino(message: ChainLink): ChainLinkAmino { + const obj: any = {}; + obj.user = message.user; + obj.address = message.address ? Any.toAmino(message.address) : undefined; + obj.proof = message.proof ? Proof.toAmino(message.proof) : undefined; + obj.chain_config = message.chainConfig + ? ChainConfig.toAmino(message.chainConfig) + : undefined; + obj.creation_time = message.creationTime + ? Timestamp.toAmino(message.creationTime) + : undefined; + return obj; + }, + fromAminoMsg(object: ChainLinkAminoMsg): ChainLink { + return ChainLink.fromAmino(object.value); + }, + fromProtoMsg(message: ChainLinkProtoMsg): ChainLink { + return ChainLink.decode(message.value); + }, + toProto(message: ChainLink): Uint8Array { + return ChainLink.encode(message).finish(); + }, + toProtoMsg(message: ChainLink): ChainLinkProtoMsg { + return { + typeUrl: "/desmos.profiles.v3.ChainLink", + value: ChainLink.encode(message).finish(), + }; + }, }; function createBaseChainConfig(): ChainConfig { return { @@ -328,6 +517,31 @@ export const ChainConfig = { message.name = object.name ?? ""; return message; }, + fromAmino(object: ChainConfigAmino): ChainConfig { + return { + name: object.name, + }; + }, + toAmino(message: ChainConfig): ChainConfigAmino { + const obj: any = {}; + obj.name = message.name; + return obj; + }, + fromAminoMsg(object: ChainConfigAminoMsg): ChainConfig { + return ChainConfig.fromAmino(object.value); + }, + fromProtoMsg(message: ChainConfigProtoMsg): ChainConfig { + return ChainConfig.decode(message.value); + }, + toProto(message: ChainConfig): Uint8Array { + return ChainConfig.encode(message).finish(); + }, + toProtoMsg(message: ChainConfig): ChainConfigProtoMsg { + return { + typeUrl: "/desmos.profiles.v3.ChainConfig", + value: ChainConfig.encode(message).finish(), + }; + }, }; function createBaseProof(): Proof { return { @@ -405,6 +619,39 @@ export const Proof = { message.plainText = object.plainText ?? ""; return message; }, + fromAmino(object: ProofAmino): Proof { + return { + pubKey: object?.pub_key ? Any.fromAmino(object.pub_key) : undefined, + signature: object?.signature + ? Any.fromAmino(object.signature) + : undefined, + plainText: object.plain_text, + }; + }, + toAmino(message: Proof): ProofAmino { + const obj: any = {}; + obj.pub_key = message.pubKey ? Any.toAmino(message.pubKey) : undefined; + obj.signature = message.signature + ? Any.toAmino(message.signature) + : undefined; + obj.plain_text = message.plainText; + return obj; + }, + fromAminoMsg(object: ProofAminoMsg): Proof { + return Proof.fromAmino(object.value); + }, + fromProtoMsg(message: ProofProtoMsg): Proof { + return Proof.decode(message.value); + }, + toProto(message: Proof): Uint8Array { + return Proof.encode(message).finish(); + }, + toProtoMsg(message: Proof): ProofProtoMsg { + return { + typeUrl: "/desmos.profiles.v3.Proof", + value: Proof.encode(message).finish(), + }; + }, }; function createBaseBech32Address(): Bech32Address { return { @@ -465,6 +712,33 @@ export const Bech32Address = { message.prefix = object.prefix ?? ""; return message; }, + fromAmino(object: Bech32AddressAmino): Bech32Address { + return { + value: object.value, + prefix: object.prefix, + }; + }, + toAmino(message: Bech32Address): Bech32AddressAmino { + const obj: any = {}; + obj.value = message.value; + obj.prefix = message.prefix; + return obj; + }, + fromAminoMsg(object: Bech32AddressAminoMsg): Bech32Address { + return Bech32Address.fromAmino(object.value); + }, + fromProtoMsg(message: Bech32AddressProtoMsg): Bech32Address { + return Bech32Address.decode(message.value); + }, + toProto(message: Bech32Address): Uint8Array { + return Bech32Address.encode(message).finish(); + }, + toProtoMsg(message: Bech32Address): Bech32AddressProtoMsg { + return { + typeUrl: "/desmos.profiles.v3.Bech32Address", + value: Bech32Address.encode(message).finish(), + }; + }, }; function createBaseBase58Address(): Base58Address { return { @@ -515,6 +789,31 @@ export const Base58Address = { message.value = object.value ?? ""; return message; }, + fromAmino(object: Base58AddressAmino): Base58Address { + return { + value: object.value, + }; + }, + toAmino(message: Base58Address): Base58AddressAmino { + const obj: any = {}; + obj.value = message.value; + return obj; + }, + fromAminoMsg(object: Base58AddressAminoMsg): Base58Address { + return Base58Address.fromAmino(object.value); + }, + fromProtoMsg(message: Base58AddressProtoMsg): Base58Address { + return Base58Address.decode(message.value); + }, + toProto(message: Base58Address): Uint8Array { + return Base58Address.encode(message).finish(); + }, + toProtoMsg(message: Base58Address): Base58AddressProtoMsg { + return { + typeUrl: "/desmos.profiles.v3.Base58Address", + value: Base58Address.encode(message).finish(), + }; + }, }; function createBaseHexAddress(): HexAddress { return { @@ -575,6 +874,33 @@ export const HexAddress = { message.prefix = object.prefix ?? ""; return message; }, + fromAmino(object: HexAddressAmino): HexAddress { + return { + value: object.value, + prefix: object.prefix, + }; + }, + toAmino(message: HexAddress): HexAddressAmino { + const obj: any = {}; + obj.value = message.value; + obj.prefix = message.prefix; + return obj; + }, + fromAminoMsg(object: HexAddressAminoMsg): HexAddress { + return HexAddress.fromAmino(object.value); + }, + fromProtoMsg(message: HexAddressProtoMsg): HexAddress { + return HexAddress.decode(message.value); + }, + toProto(message: HexAddress): Uint8Array { + return HexAddress.encode(message).finish(); + }, + toProtoMsg(message: HexAddress): HexAddressProtoMsg { + return { + typeUrl: "/desmos.profiles.v3.HexAddress", + value: HexAddress.encode(message).finish(), + }; + }, }; function createBaseSingleSignature(): SingleSignature { return { @@ -643,6 +969,35 @@ export const SingleSignature = { message.signature = object.signature ?? new Uint8Array(); return message; }, + fromAmino(object: SingleSignatureAmino): SingleSignature { + return { + valueType: isSet(object.value_type) + ? signatureValueTypeFromJSON(object.value_type) + : 0, + signature: object.signature, + }; + }, + toAmino(message: SingleSignature): SingleSignatureAmino { + const obj: any = {}; + obj.value_type = message.valueType; + obj.signature = message.signature; + return obj; + }, + fromAminoMsg(object: SingleSignatureAminoMsg): SingleSignature { + return SingleSignature.fromAmino(object.value); + }, + fromProtoMsg(message: SingleSignatureProtoMsg): SingleSignature { + return SingleSignature.decode(message.value); + }, + toProto(message: SingleSignature): Uint8Array { + return SingleSignature.encode(message).finish(); + }, + toProtoMsg(message: SingleSignature): SingleSignatureProtoMsg { + return { + typeUrl: "/desmos.profiles.v3.SingleSignature", + value: SingleSignature.encode(message).finish(), + }; + }, }; function createBaseCosmosMultiSignature(): CosmosMultiSignature { return { @@ -726,4 +1081,43 @@ export const CosmosMultiSignature = { object.signatures?.map((e) => Any.fromPartial(e)) || []; return message; }, + fromAmino(object: CosmosMultiSignatureAmino): CosmosMultiSignature { + return { + bitArray: object?.bit_array + ? CompactBitArray.fromAmino(object.bit_array) + : undefined, + signatures: Array.isArray(object?.signatures) + ? object.signatures.map((e: any) => Any.fromAmino(e)) + : [], + }; + }, + toAmino(message: CosmosMultiSignature): CosmosMultiSignatureAmino { + const obj: any = {}; + obj.bit_array = message.bitArray + ? CompactBitArray.toAmino(message.bitArray) + : undefined; + if (message.signatures) { + obj.signatures = message.signatures.map((e) => + e ? Any.toAmino(e) : undefined + ); + } else { + obj.signatures = []; + } + return obj; + }, + fromAminoMsg(object: CosmosMultiSignatureAminoMsg): CosmosMultiSignature { + return CosmosMultiSignature.fromAmino(object.value); + }, + fromProtoMsg(message: CosmosMultiSignatureProtoMsg): CosmosMultiSignature { + return CosmosMultiSignature.decode(message.value); + }, + toProto(message: CosmosMultiSignature): Uint8Array { + return CosmosMultiSignature.encode(message).finish(); + }, + toProtoMsg(message: CosmosMultiSignature): CosmosMultiSignatureProtoMsg { + return { + typeUrl: "/desmos.profiles.v3.CosmosMultiSignature", + value: CosmosMultiSignature.encode(message).finish(), + }; + }, }; diff --git a/packages/types/src/desmos/profiles/v3/models_dtag_requests.ts b/packages/types/src/desmos/profiles/v3/models_dtag_requests.ts index 9efd2694a..14c925864 100644 --- a/packages/types/src/desmos/profiles/v3/models_dtag_requests.ts +++ b/packages/types/src/desmos/profiles/v3/models_dtag_requests.ts @@ -17,6 +17,29 @@ export interface DTagTransferRequest { */ receiver: string; } +export interface DTagTransferRequestProtoMsg { + typeUrl: "/desmos.profiles.v3.DTagTransferRequest"; + value: Uint8Array; +} +/** DTagTransferRequest represent a DTag transfer request between two users */ +export interface DTagTransferRequestAmino { + /** + * DTagToTrade contains the value of the DTag that should be transferred from + * the receiver of the request to the sender + */ + dtag_to_trade: string; + /** Sender represents the address of the account that sent the request */ + sender: string; + /** + * Receiver represents the receiver of the request that, if accepted, will + * give to the sender their DTag + */ + receiver: string; +} +export interface DTagTransferRequestAminoMsg { + type: "/desmos.profiles.v3.DTagTransferRequest"; + value: DTagTransferRequestAmino; +} function createBaseDTagTransferRequest(): DTagTransferRequest { return { dtagToTrade: "", @@ -87,4 +110,33 @@ export const DTagTransferRequest = { message.receiver = object.receiver ?? ""; return message; }, + fromAmino(object: DTagTransferRequestAmino): DTagTransferRequest { + return { + dtagToTrade: object.dtag_to_trade, + sender: object.sender, + receiver: object.receiver, + }; + }, + toAmino(message: DTagTransferRequest): DTagTransferRequestAmino { + const obj: any = {}; + obj.dtag_to_trade = message.dtagToTrade; + obj.sender = message.sender; + obj.receiver = message.receiver; + return obj; + }, + fromAminoMsg(object: DTagTransferRequestAminoMsg): DTagTransferRequest { + return DTagTransferRequest.fromAmino(object.value); + }, + fromProtoMsg(message: DTagTransferRequestProtoMsg): DTagTransferRequest { + return DTagTransferRequest.decode(message.value); + }, + toProto(message: DTagTransferRequest): Uint8Array { + return DTagTransferRequest.encode(message).finish(); + }, + toProtoMsg(message: DTagTransferRequest): DTagTransferRequestProtoMsg { + return { + typeUrl: "/desmos.profiles.v3.DTagTransferRequest", + value: DTagTransferRequest.encode(message).finish(), + }; + }, }; diff --git a/packages/types/src/desmos/profiles/v3/models_packets.ts b/packages/types/src/desmos/profiles/v3/models_packets.ts index ca6a33cd3..c95dfe8b6 100644 --- a/packages/types/src/desmos/profiles/v3/models_packets.ts +++ b/packages/types/src/desmos/profiles/v3/models_packets.ts @@ -1,6 +1,11 @@ /* eslint-disable */ -import { Any } from "../../../google/protobuf/any"; -import { Proof, ChainConfig } from "./models_chain_links"; +import { Any, AnyAmino } from "../../../google/protobuf/any"; +import { + Proof, + ProofAmino, + ChainConfig, + ChainConfigAmino, +} from "./models_chain_links"; import * as _m0 from "protobufjs/minimal"; import { isSet, DeepPartial, Exact } from "../../../helpers"; export const protobufPackage = "desmos.profiles.v3"; @@ -24,6 +29,34 @@ export interface LinkChainAccountPacketData { /** DestinationProof contains the proof of ownership of the DestinationAddress */ destinationProof?: Proof; } +export interface LinkChainAccountPacketDataProtoMsg { + typeUrl: "/desmos.profiles.v3.LinkChainAccountPacketData"; + value: Uint8Array; +} +/** + * LinkChainAccountPacketData defines the object that should be sent inside a + * MsgSendPacket when wanting to link an external chain to a Desmos profile + * using IBC + */ +export interface LinkChainAccountPacketDataAmino { + /** SourceAddress contains the details of the external chain address */ + source_address?: AnyAmino; + /** SourceProof represents the proof of ownership of the source address */ + source_proof?: ProofAmino; + /** SourceChainConfig contains the details of the source chain */ + source_chain_config?: ChainConfigAmino; + /** + * DestinationAddress represents the Desmos address of the profile that should + * be linked with the external account + */ + destination_address: string; + /** DestinationProof contains the proof of ownership of the DestinationAddress */ + destination_proof?: ProofAmino; +} +export interface LinkChainAccountPacketDataAminoMsg { + type: "/desmos.profiles.v3.LinkChainAccountPacketData"; + value: LinkChainAccountPacketDataAmino; +} /** LinkChainAccountPacketAck defines a struct for the packet acknowledgment */ export interface LinkChainAccountPacketAck { /** @@ -32,6 +65,22 @@ export interface LinkChainAccountPacketAck { */ sourceAddress: string; } +export interface LinkChainAccountPacketAckProtoMsg { + typeUrl: "/desmos.profiles.v3.LinkChainAccountPacketAck"; + value: Uint8Array; +} +/** LinkChainAccountPacketAck defines a struct for the packet acknowledgment */ +export interface LinkChainAccountPacketAckAmino { + /** + * SourceAddress contains the external address that has been linked properly + * with the profile + */ + source_address: string; +} +export interface LinkChainAccountPacketAckAminoMsg { + type: "/desmos.profiles.v3.LinkChainAccountPacketAck"; + value: LinkChainAccountPacketAckAmino; +} function createBaseLinkChainAccountPacketData(): LinkChainAccountPacketData { return { sourceAddress: undefined, @@ -166,6 +215,65 @@ export const LinkChainAccountPacketData = { : undefined; return message; }, + fromAmino( + object: LinkChainAccountPacketDataAmino + ): LinkChainAccountPacketData { + return { + sourceAddress: object?.source_address + ? Any.fromAmino(object.source_address) + : undefined, + sourceProof: object?.source_proof + ? Proof.fromAmino(object.source_proof) + : undefined, + sourceChainConfig: object?.source_chain_config + ? ChainConfig.fromAmino(object.source_chain_config) + : undefined, + destinationAddress: object.destination_address, + destinationProof: object?.destination_proof + ? Proof.fromAmino(object.destination_proof) + : undefined, + }; + }, + toAmino( + message: LinkChainAccountPacketData + ): LinkChainAccountPacketDataAmino { + const obj: any = {}; + obj.source_address = message.sourceAddress + ? Any.toAmino(message.sourceAddress) + : undefined; + obj.source_proof = message.sourceProof + ? Proof.toAmino(message.sourceProof) + : undefined; + obj.source_chain_config = message.sourceChainConfig + ? ChainConfig.toAmino(message.sourceChainConfig) + : undefined; + obj.destination_address = message.destinationAddress; + obj.destination_proof = message.destinationProof + ? Proof.toAmino(message.destinationProof) + : undefined; + return obj; + }, + fromAminoMsg( + object: LinkChainAccountPacketDataAminoMsg + ): LinkChainAccountPacketData { + return LinkChainAccountPacketData.fromAmino(object.value); + }, + fromProtoMsg( + message: LinkChainAccountPacketDataProtoMsg + ): LinkChainAccountPacketData { + return LinkChainAccountPacketData.decode(message.value); + }, + toProto(message: LinkChainAccountPacketData): Uint8Array { + return LinkChainAccountPacketData.encode(message).finish(); + }, + toProtoMsg( + message: LinkChainAccountPacketData + ): LinkChainAccountPacketDataProtoMsg { + return { + typeUrl: "/desmos.profiles.v3.LinkChainAccountPacketData", + value: LinkChainAccountPacketData.encode(message).finish(), + }; + }, }; function createBaseLinkChainAccountPacketAck(): LinkChainAccountPacketAck { return { @@ -222,4 +330,35 @@ export const LinkChainAccountPacketAck = { message.sourceAddress = object.sourceAddress ?? ""; return message; }, + fromAmino(object: LinkChainAccountPacketAckAmino): LinkChainAccountPacketAck { + return { + sourceAddress: object.source_address, + }; + }, + toAmino(message: LinkChainAccountPacketAck): LinkChainAccountPacketAckAmino { + const obj: any = {}; + obj.source_address = message.sourceAddress; + return obj; + }, + fromAminoMsg( + object: LinkChainAccountPacketAckAminoMsg + ): LinkChainAccountPacketAck { + return LinkChainAccountPacketAck.fromAmino(object.value); + }, + fromProtoMsg( + message: LinkChainAccountPacketAckProtoMsg + ): LinkChainAccountPacketAck { + return LinkChainAccountPacketAck.decode(message.value); + }, + toProto(message: LinkChainAccountPacketAck): Uint8Array { + return LinkChainAccountPacketAck.encode(message).finish(); + }, + toProtoMsg( + message: LinkChainAccountPacketAck + ): LinkChainAccountPacketAckProtoMsg { + return { + typeUrl: "/desmos.profiles.v3.LinkChainAccountPacketAck", + value: LinkChainAccountPacketAck.encode(message).finish(), + }; + }, }; diff --git a/packages/types/src/desmos/profiles/v3/models_params.ts b/packages/types/src/desmos/profiles/v3/models_params.ts index d640a8143..2aede0670 100644 --- a/packages/types/src/desmos/profiles/v3/models_params.ts +++ b/packages/types/src/desmos/profiles/v3/models_params.ts @@ -1,6 +1,6 @@ /* eslint-disable */ -import { Coin } from "../../../cosmos/base/v1beta1/coin"; -import { Duration } from "../../../google/protobuf/duration"; +import { Coin, CoinAmino } from "../../../cosmos/base/v1beta1/coin"; +import { Duration, DurationAmino } from "../../../google/protobuf/duration"; import { Long, isSet, @@ -19,21 +19,76 @@ export interface Params { oracle?: OracleParams; appLinks?: AppLinksParams; } +export interface ParamsProtoMsg { + typeUrl: "/desmos.profiles.v3.Params"; + value: Uint8Array; +} +/** Params contains the parameters for the profiles module */ +export interface ParamsAmino { + nickname?: NicknameParamsAmino; + dtag?: DTagParamsAmino; + bio?: BioParamsAmino; + oracle?: OracleParamsAmino; + app_links?: AppLinksParamsAmino; +} +export interface ParamsAminoMsg { + type: "/desmos.profiles.v3.Params"; + value: ParamsAmino; +} /** NicknameParams defines the parameters related to the profiles nicknames */ export interface NicknameParams { minLength: Uint8Array; maxLength: Uint8Array; } +export interface NicknameParamsProtoMsg { + typeUrl: "/desmos.profiles.v3.NicknameParams"; + value: Uint8Array; +} +/** NicknameParams defines the parameters related to the profiles nicknames */ +export interface NicknameParamsAmino { + min_length: Uint8Array; + max_length: Uint8Array; +} +export interface NicknameParamsAminoMsg { + type: "/desmos.profiles.v3.NicknameParams"; + value: NicknameParamsAmino; +} /** DTagParams defines the parameters related to profile DTags */ export interface DTagParams { regEx: string; minLength: Uint8Array; maxLength: Uint8Array; } +export interface DTagParamsProtoMsg { + typeUrl: "/desmos.profiles.v3.DTagParams"; + value: Uint8Array; +} +/** DTagParams defines the parameters related to profile DTags */ +export interface DTagParamsAmino { + reg_ex: string; + min_length: Uint8Array; + max_length: Uint8Array; +} +export interface DTagParamsAminoMsg { + type: "/desmos.profiles.v3.DTagParams"; + value: DTagParamsAmino; +} /** BioParams defines the parameters related to profile biography */ export interface BioParams { maxLength: Uint8Array; } +export interface BioParamsProtoMsg { + typeUrl: "/desmos.profiles.v3.BioParams"; + value: Uint8Array; +} +/** BioParams defines the parameters related to profile biography */ +export interface BioParamsAmino { + max_length: Uint8Array; +} +export interface BioParamsAminoMsg { + type: "/desmos.profiles.v3.BioParams"; + value: BioParamsAmino; +} /** * OracleParams defines the parameters related to the oracle * that will be used to verify the ownership of a centralized @@ -68,11 +123,66 @@ export interface OracleParams { */ feeAmount: Coin[]; } +export interface OracleParamsProtoMsg { + typeUrl: "/desmos.profiles.v3.OracleParams"; + value: Uint8Array; +} +/** + * OracleParams defines the parameters related to the oracle + * that will be used to verify the ownership of a centralized + * application account by a Desmos profile + */ +export interface OracleParamsAmino { + /** + * ScriptID represents the ID of the oracle script to be called to verify the + * data + */ + script_id: string; + /** AskCount represents the number of oracles to which ask to verify the data */ + ask_count: string; + /** + * MinCount represents the minimum count of oracles that should complete the + * verification successfully + */ + min_count: string; + /** + * PrepareGas represents the amount of gas to be used during the preparation + * stage of the oracle script + */ + prepare_gas: string; + /** + * ExecuteGas represents the amount of gas to be used during the execution of + * the oracle script + */ + execute_gas: string; + /** + * FeeAmount represents the amount of fees to be payed in order to execute the + * oracle script + */ + fee_amount: CoinAmino[]; +} +export interface OracleParamsAminoMsg { + type: "/desmos.profiles.v3.OracleParams"; + value: OracleParamsAmino; +} /** AppLinksParams define the parameters related to the app links */ export interface AppLinksParams { /** Default validity duration before an application link expires */ validityDuration?: Duration; } +export interface AppLinksParamsProtoMsg { + typeUrl: "/desmos.profiles.v3.AppLinksParams"; + value: Uint8Array; +} +/** AppLinksParams define the parameters related to the app links */ +export interface AppLinksParamsAmino { + /** Default validity duration before an application link expires */ + validity_duration?: DurationAmino; +} +export interface AppLinksParamsAminoMsg { + type: "/desmos.profiles.v3.AppLinksParams"; + value: AppLinksParamsAmino; +} function createBaseParams(): Params { return { nickname: undefined, @@ -198,6 +308,51 @@ export const Params = { : undefined; return message; }, + fromAmino(object: ParamsAmino): Params { + return { + nickname: object?.nickname + ? NicknameParams.fromAmino(object.nickname) + : undefined, + dtag: object?.dtag ? DTagParams.fromAmino(object.dtag) : undefined, + bio: object?.bio ? BioParams.fromAmino(object.bio) : undefined, + oracle: object?.oracle + ? OracleParams.fromAmino(object.oracle) + : undefined, + appLinks: object?.app_links + ? AppLinksParams.fromAmino(object.app_links) + : undefined, + }; + }, + toAmino(message: Params): ParamsAmino { + const obj: any = {}; + obj.nickname = message.nickname + ? NicknameParams.toAmino(message.nickname) + : undefined; + obj.dtag = message.dtag ? DTagParams.toAmino(message.dtag) : undefined; + obj.bio = message.bio ? BioParams.toAmino(message.bio) : undefined; + obj.oracle = message.oracle + ? OracleParams.toAmino(message.oracle) + : undefined; + obj.app_links = message.appLinks + ? AppLinksParams.toAmino(message.appLinks) + : undefined; + return obj; + }, + fromAminoMsg(object: ParamsAminoMsg): Params { + return Params.fromAmino(object.value); + }, + fromProtoMsg(message: ParamsProtoMsg): Params { + return Params.decode(message.value); + }, + toProto(message: Params): Uint8Array { + return Params.encode(message).finish(); + }, + toProtoMsg(message: Params): ParamsProtoMsg { + return { + typeUrl: "/desmos.profiles.v3.Params", + value: Params.encode(message).finish(), + }; + }, }; function createBaseNicknameParams(): NicknameParams { return { @@ -268,6 +423,33 @@ export const NicknameParams = { message.maxLength = object.maxLength ?? new Uint8Array(); return message; }, + fromAmino(object: NicknameParamsAmino): NicknameParams { + return { + minLength: object.min_length, + maxLength: object.max_length, + }; + }, + toAmino(message: NicknameParams): NicknameParamsAmino { + const obj: any = {}; + obj.min_length = message.minLength; + obj.max_length = message.maxLength; + return obj; + }, + fromAminoMsg(object: NicknameParamsAminoMsg): NicknameParams { + return NicknameParams.fromAmino(object.value); + }, + fromProtoMsg(message: NicknameParamsProtoMsg): NicknameParams { + return NicknameParams.decode(message.value); + }, + toProto(message: NicknameParams): Uint8Array { + return NicknameParams.encode(message).finish(); + }, + toProtoMsg(message: NicknameParams): NicknameParamsProtoMsg { + return { + typeUrl: "/desmos.profiles.v3.NicknameParams", + value: NicknameParams.encode(message).finish(), + }; + }, }; function createBaseDTagParams(): DTagParams { return { @@ -348,6 +530,35 @@ export const DTagParams = { message.maxLength = object.maxLength ?? new Uint8Array(); return message; }, + fromAmino(object: DTagParamsAmino): DTagParams { + return { + regEx: object.reg_ex, + minLength: object.min_length, + maxLength: object.max_length, + }; + }, + toAmino(message: DTagParams): DTagParamsAmino { + const obj: any = {}; + obj.reg_ex = message.regEx; + obj.min_length = message.minLength; + obj.max_length = message.maxLength; + return obj; + }, + fromAminoMsg(object: DTagParamsAminoMsg): DTagParams { + return DTagParams.fromAmino(object.value); + }, + fromProtoMsg(message: DTagParamsProtoMsg): DTagParams { + return DTagParams.decode(message.value); + }, + toProto(message: DTagParams): Uint8Array { + return DTagParams.encode(message).finish(); + }, + toProtoMsg(message: DTagParams): DTagParamsProtoMsg { + return { + typeUrl: "/desmos.profiles.v3.DTagParams", + value: DTagParams.encode(message).finish(), + }; + }, }; function createBaseBioParams(): BioParams { return { @@ -403,6 +614,31 @@ export const BioParams = { message.maxLength = object.maxLength ?? new Uint8Array(); return message; }, + fromAmino(object: BioParamsAmino): BioParams { + return { + maxLength: object.max_length, + }; + }, + toAmino(message: BioParams): BioParamsAmino { + const obj: any = {}; + obj.max_length = message.maxLength; + return obj; + }, + fromAminoMsg(object: BioParamsAminoMsg): BioParams { + return BioParams.fromAmino(object.value); + }, + fromProtoMsg(message: BioParamsProtoMsg): BioParams { + return BioParams.decode(message.value); + }, + toProto(message: BioParams): Uint8Array { + return BioParams.encode(message).finish(); + }, + toProtoMsg(message: BioParams): BioParamsProtoMsg { + return { + typeUrl: "/desmos.profiles.v3.BioParams", + value: BioParams.encode(message).finish(), + }; + }, }; function createBaseOracleParams(): OracleParams { return { @@ -541,6 +777,53 @@ export const OracleParams = { message.feeAmount = object.feeAmount?.map((e) => Coin.fromPartial(e)) || []; return message; }, + fromAmino(object: OracleParamsAmino): OracleParams { + return { + scriptId: Long.fromString(object.script_id), + askCount: Long.fromString(object.ask_count), + minCount: Long.fromString(object.min_count), + prepareGas: Long.fromString(object.prepare_gas), + executeGas: Long.fromString(object.execute_gas), + feeAmount: Array.isArray(object?.fee_amount) + ? object.fee_amount.map((e: any) => Coin.fromAmino(e)) + : [], + }; + }, + toAmino(message: OracleParams): OracleParamsAmino { + const obj: any = {}; + obj.script_id = message.scriptId ? message.scriptId.toString() : undefined; + obj.ask_count = message.askCount ? message.askCount.toString() : undefined; + obj.min_count = message.minCount ? message.minCount.toString() : undefined; + obj.prepare_gas = message.prepareGas + ? message.prepareGas.toString() + : undefined; + obj.execute_gas = message.executeGas + ? message.executeGas.toString() + : undefined; + if (message.feeAmount) { + obj.fee_amount = message.feeAmount.map((e) => + e ? Coin.toAmino(e) : undefined + ); + } else { + obj.fee_amount = []; + } + return obj; + }, + fromAminoMsg(object: OracleParamsAminoMsg): OracleParams { + return OracleParams.fromAmino(object.value); + }, + fromProtoMsg(message: OracleParamsProtoMsg): OracleParams { + return OracleParams.decode(message.value); + }, + toProto(message: OracleParams): Uint8Array { + return OracleParams.encode(message).finish(); + }, + toProtoMsg(message: OracleParams): OracleParamsProtoMsg { + return { + typeUrl: "/desmos.profiles.v3.OracleParams", + value: OracleParams.encode(message).finish(), + }; + }, }; function createBaseAppLinksParams(): AppLinksParams { return { @@ -602,4 +885,33 @@ export const AppLinksParams = { : undefined; return message; }, + fromAmino(object: AppLinksParamsAmino): AppLinksParams { + return { + validityDuration: object?.validity_duration + ? Duration.fromAmino(object.validity_duration) + : undefined, + }; + }, + toAmino(message: AppLinksParams): AppLinksParamsAmino { + const obj: any = {}; + obj.validity_duration = message.validityDuration + ? Duration.toAmino(message.validityDuration) + : undefined; + return obj; + }, + fromAminoMsg(object: AppLinksParamsAminoMsg): AppLinksParams { + return AppLinksParams.fromAmino(object.value); + }, + fromProtoMsg(message: AppLinksParamsProtoMsg): AppLinksParams { + return AppLinksParams.decode(message.value); + }, + toProto(message: AppLinksParams): Uint8Array { + return AppLinksParams.encode(message).finish(); + }, + toProtoMsg(message: AppLinksParams): AppLinksParamsProtoMsg { + return { + typeUrl: "/desmos.profiles.v3.AppLinksParams", + value: AppLinksParams.encode(message).finish(), + }; + }, }; diff --git a/packages/types/src/desmos/profiles/v3/models_profile.ts b/packages/types/src/desmos/profiles/v3/models_profile.ts index 163436baf..bfd864810 100644 --- a/packages/types/src/desmos/profiles/v3/models_profile.ts +++ b/packages/types/src/desmos/profiles/v3/models_profile.ts @@ -1,6 +1,6 @@ /* eslint-disable */ -import { Any } from "../../../google/protobuf/any"; -import { Timestamp } from "../../../google/protobuf/timestamp"; +import { Any, AnyAmino } from "../../../google/protobuf/any"; +import { Timestamp, TimestampAmino } from "../../../google/protobuf/timestamp"; import * as _m0 from "protobufjs/minimal"; import { isSet, @@ -28,6 +28,32 @@ export interface Profile { /** CreationTime represents the time in which the profile has been created */ creationDate?: Timestamp; } +export interface ProfileProtoMsg { + typeUrl: "/desmos.profiles.v3.Profile"; + value: Uint8Array; +} +/** + * Profile represents a generic first on Desmos, containing the information of a + * single user + */ +export interface ProfileAmino { + /** Account represents the base Cosmos account associated with this profile */ + account?: AnyAmino; + /** DTag represents the unique tag of this profile */ + dtag: string; + /** Nickname contains the custom human readable name of the profile */ + nickname: string; + /** Bio contains the biography of the profile */ + bio: string; + /** Pictures contains the data about the pictures associated with he profile */ + pictures?: PicturesAmino; + /** CreationTime represents the time in which the profile has been created */ + creation_date?: TimestampAmino; +} +export interface ProfileAminoMsg { + type: "/desmos.profiles.v3.Profile"; + value: ProfileAmino; +} /** Pictures contains the data of a user profile's related pictures */ export interface Pictures { /** Profile contains the URL to the profile picture */ @@ -35,6 +61,21 @@ export interface Pictures { /** Cover contains the URL to the cover picture */ cover: string; } +export interface PicturesProtoMsg { + typeUrl: "/desmos.profiles.v3.Pictures"; + value: Uint8Array; +} +/** Pictures contains the data of a user profile's related pictures */ +export interface PicturesAmino { + /** Profile contains the URL to the profile picture */ + profile: string; + /** Cover contains the URL to the cover picture */ + cover: string; +} +export interface PicturesAminoMsg { + type: "/desmos.profiles.v3.Pictures"; + value: PicturesAmino; +} function createBaseProfile(): Profile { return { account: undefined, @@ -150,6 +191,49 @@ export const Profile = { : undefined; return message; }, + fromAmino(object: ProfileAmino): Profile { + return { + account: object?.account ? Any.fromAmino(object.account) : undefined, + dtag: object.dtag, + nickname: object.nickname, + bio: object.bio, + pictures: object?.pictures + ? Pictures.fromAmino(object.pictures) + : undefined, + creationDate: object?.creation_date + ? Timestamp.fromAmino(object.creation_date) + : undefined, + }; + }, + toAmino(message: Profile): ProfileAmino { + const obj: any = {}; + obj.account = message.account ? Any.toAmino(message.account) : undefined; + obj.dtag = message.dtag; + obj.nickname = message.nickname; + obj.bio = message.bio; + obj.pictures = message.pictures + ? Pictures.toAmino(message.pictures) + : undefined; + obj.creation_date = message.creationDate + ? Timestamp.toAmino(message.creationDate) + : undefined; + return obj; + }, + fromAminoMsg(object: ProfileAminoMsg): Profile { + return Profile.fromAmino(object.value); + }, + fromProtoMsg(message: ProfileProtoMsg): Profile { + return Profile.decode(message.value); + }, + toProto(message: Profile): Uint8Array { + return Profile.encode(message).finish(); + }, + toProtoMsg(message: Profile): ProfileProtoMsg { + return { + typeUrl: "/desmos.profiles.v3.Profile", + value: Profile.encode(message).finish(), + }; + }, }; function createBasePictures(): Pictures { return { @@ -208,4 +292,31 @@ export const Pictures = { message.cover = object.cover ?? ""; return message; }, + fromAmino(object: PicturesAmino): Pictures { + return { + profile: object.profile, + cover: object.cover, + }; + }, + toAmino(message: Pictures): PicturesAmino { + const obj: any = {}; + obj.profile = message.profile; + obj.cover = message.cover; + return obj; + }, + fromAminoMsg(object: PicturesAminoMsg): Pictures { + return Pictures.fromAmino(object.value); + }, + fromProtoMsg(message: PicturesProtoMsg): Pictures { + return Pictures.decode(message.value); + }, + toProto(message: Pictures): Uint8Array { + return Pictures.encode(message).finish(); + }, + toProtoMsg(message: Pictures): PicturesProtoMsg { + return { + typeUrl: "/desmos.profiles.v3.Pictures", + value: Pictures.encode(message).finish(), + }; + }, }; diff --git a/packages/types/src/desmos/profiles/v3/msg_server.amino.ts b/packages/types/src/desmos/profiles/v3/msg_server.amino.ts new file mode 100644 index 000000000..b2055c294 --- /dev/null +++ b/packages/types/src/desmos/profiles/v3/msg_server.amino.ts @@ -0,0 +1,77 @@ +/* eslint-disable */ +import { MsgSaveProfile, MsgDeleteProfile } from "./msgs_profile"; +import { + MsgRequestDTagTransfer, + MsgCancelDTagTransferRequest, + MsgAcceptDTagTransferRequest, + MsgRefuseDTagTransferRequest, +} from "./msgs_dtag_requests"; +import { + MsgLinkChainAccount, + MsgUnlinkChainAccount, + MsgSetDefaultExternalAddress, +} from "./msgs_chain_links"; +import { MsgLinkApplication, MsgUnlinkApplication } from "./msgs_app_links"; +import { MsgUpdateParams } from "./msgs_params"; +export const AminoConverter = { + "/desmos.profiles.v3.MsgSaveProfile": { + aminoType: "/desmos.profiles.v3.MsgSaveProfile", + toAmino: MsgSaveProfile.toAmino, + fromAmino: MsgSaveProfile.fromAmino, + }, + "/desmos.profiles.v3.MsgDeleteProfile": { + aminoType: "/desmos.profiles.v3.MsgDeleteProfile", + toAmino: MsgDeleteProfile.toAmino, + fromAmino: MsgDeleteProfile.fromAmino, + }, + "/desmos.profiles.v3.MsgRequestDTagTransfer": { + aminoType: "/desmos.profiles.v3.MsgRequestDTagTransfer", + toAmino: MsgRequestDTagTransfer.toAmino, + fromAmino: MsgRequestDTagTransfer.fromAmino, + }, + "/desmos.profiles.v3.MsgCancelDTagTransferRequest": { + aminoType: "/desmos.profiles.v3.MsgCancelDTagTransferRequest", + toAmino: MsgCancelDTagTransferRequest.toAmino, + fromAmino: MsgCancelDTagTransferRequest.fromAmino, + }, + "/desmos.profiles.v3.MsgAcceptDTagTransferRequest": { + aminoType: "/desmos.profiles.v3.MsgAcceptDTagTransferRequest", + toAmino: MsgAcceptDTagTransferRequest.toAmino, + fromAmino: MsgAcceptDTagTransferRequest.fromAmino, + }, + "/desmos.profiles.v3.MsgRefuseDTagTransferRequest": { + aminoType: "/desmos.profiles.v3.MsgRefuseDTagTransferRequest", + toAmino: MsgRefuseDTagTransferRequest.toAmino, + fromAmino: MsgRefuseDTagTransferRequest.fromAmino, + }, + "/desmos.profiles.v3.MsgLinkChainAccount": { + aminoType: "/desmos.profiles.v3.MsgLinkChainAccount", + toAmino: MsgLinkChainAccount.toAmino, + fromAmino: MsgLinkChainAccount.fromAmino, + }, + "/desmos.profiles.v3.MsgUnlinkChainAccount": { + aminoType: "/desmos.profiles.v3.MsgUnlinkChainAccount", + toAmino: MsgUnlinkChainAccount.toAmino, + fromAmino: MsgUnlinkChainAccount.fromAmino, + }, + "/desmos.profiles.v3.MsgSetDefaultExternalAddress": { + aminoType: "/desmos.profiles.v3.MsgSetDefaultExternalAddress", + toAmino: MsgSetDefaultExternalAddress.toAmino, + fromAmino: MsgSetDefaultExternalAddress.fromAmino, + }, + "/desmos.profiles.v3.MsgLinkApplication": { + aminoType: "/desmos.profiles.v3.MsgLinkApplication", + toAmino: MsgLinkApplication.toAmino, + fromAmino: MsgLinkApplication.fromAmino, + }, + "/desmos.profiles.v3.MsgUnlinkApplication": { + aminoType: "/desmos.profiles.v3.MsgUnlinkApplication", + toAmino: MsgUnlinkApplication.toAmino, + fromAmino: MsgUnlinkApplication.fromAmino, + }, + "/desmos.profiles.v3.MsgUpdateParams": { + aminoType: "/desmos.profiles.v3.MsgUpdateParams", + toAmino: MsgUpdateParams.toAmino, + fromAmino: MsgUpdateParams.fromAmino, + }, +}; diff --git a/packages/types/src/desmos/profiles/v3/msg_server.registry.ts b/packages/types/src/desmos/profiles/v3/msg_server.registry.ts new file mode 100644 index 000000000..1839b05e7 --- /dev/null +++ b/packages/types/src/desmos/profiles/v3/msg_server.registry.ts @@ -0,0 +1,419 @@ +/* eslint-disable */ +import { GeneratedType, Registry } from "@cosmjs/proto-signing"; +import { MsgSaveProfile, MsgDeleteProfile } from "./msgs_profile"; +import { + MsgRequestDTagTransfer, + MsgCancelDTagTransferRequest, + MsgAcceptDTagTransferRequest, + MsgRefuseDTagTransferRequest, +} from "./msgs_dtag_requests"; +import { + MsgLinkChainAccount, + MsgUnlinkChainAccount, + MsgSetDefaultExternalAddress, +} from "./msgs_chain_links"; +import { MsgLinkApplication, MsgUnlinkApplication } from "./msgs_app_links"; +import { MsgUpdateParams } from "./msgs_params"; +export const registry: ReadonlyArray<[string, GeneratedType]> = [ + ["/desmos.profiles.v3.MsgSaveProfile", MsgSaveProfile], + ["/desmos.profiles.v3.MsgDeleteProfile", MsgDeleteProfile], + ["/desmos.profiles.v3.MsgRequestDTagTransfer", MsgRequestDTagTransfer], + [ + "/desmos.profiles.v3.MsgCancelDTagTransferRequest", + MsgCancelDTagTransferRequest, + ], + [ + "/desmos.profiles.v3.MsgAcceptDTagTransferRequest", + MsgAcceptDTagTransferRequest, + ], + [ + "/desmos.profiles.v3.MsgRefuseDTagTransferRequest", + MsgRefuseDTagTransferRequest, + ], + ["/desmos.profiles.v3.MsgLinkChainAccount", MsgLinkChainAccount], + ["/desmos.profiles.v3.MsgUnlinkChainAccount", MsgUnlinkChainAccount], + [ + "/desmos.profiles.v3.MsgSetDefaultExternalAddress", + MsgSetDefaultExternalAddress, + ], + ["/desmos.profiles.v3.MsgLinkApplication", MsgLinkApplication], + ["/desmos.profiles.v3.MsgUnlinkApplication", MsgUnlinkApplication], + ["/desmos.profiles.v3.MsgUpdateParams", MsgUpdateParams], +]; +export const load = (protoRegistry: Registry) => { + registry.forEach(([typeUrl, mod]) => { + protoRegistry.register(typeUrl, mod); + }); +}; +export const MessageComposer = { + encoded: { + saveProfile(value: MsgSaveProfile) { + return { + typeUrl: "/desmos.profiles.v3.MsgSaveProfile", + value: MsgSaveProfile.encode(value).finish(), + }; + }, + deleteProfile(value: MsgDeleteProfile) { + return { + typeUrl: "/desmos.profiles.v3.MsgDeleteProfile", + value: MsgDeleteProfile.encode(value).finish(), + }; + }, + requestDTagTransfer(value: MsgRequestDTagTransfer) { + return { + typeUrl: "/desmos.profiles.v3.MsgRequestDTagTransfer", + value: MsgRequestDTagTransfer.encode(value).finish(), + }; + }, + cancelDTagTransferRequest(value: MsgCancelDTagTransferRequest) { + return { + typeUrl: "/desmos.profiles.v3.MsgCancelDTagTransferRequest", + value: MsgCancelDTagTransferRequest.encode(value).finish(), + }; + }, + acceptDTagTransferRequest(value: MsgAcceptDTagTransferRequest) { + return { + typeUrl: "/desmos.profiles.v3.MsgAcceptDTagTransferRequest", + value: MsgAcceptDTagTransferRequest.encode(value).finish(), + }; + }, + refuseDTagTransferRequest(value: MsgRefuseDTagTransferRequest) { + return { + typeUrl: "/desmos.profiles.v3.MsgRefuseDTagTransferRequest", + value: MsgRefuseDTagTransferRequest.encode(value).finish(), + }; + }, + linkChainAccount(value: MsgLinkChainAccount) { + return { + typeUrl: "/desmos.profiles.v3.MsgLinkChainAccount", + value: MsgLinkChainAccount.encode(value).finish(), + }; + }, + unlinkChainAccount(value: MsgUnlinkChainAccount) { + return { + typeUrl: "/desmos.profiles.v3.MsgUnlinkChainAccount", + value: MsgUnlinkChainAccount.encode(value).finish(), + }; + }, + setDefaultExternalAddress(value: MsgSetDefaultExternalAddress) { + return { + typeUrl: "/desmos.profiles.v3.MsgSetDefaultExternalAddress", + value: MsgSetDefaultExternalAddress.encode(value).finish(), + }; + }, + linkApplication(value: MsgLinkApplication) { + return { + typeUrl: "/desmos.profiles.v3.MsgLinkApplication", + value: MsgLinkApplication.encode(value).finish(), + }; + }, + unlinkApplication(value: MsgUnlinkApplication) { + return { + typeUrl: "/desmos.profiles.v3.MsgUnlinkApplication", + value: MsgUnlinkApplication.encode(value).finish(), + }; + }, + updateParams(value: MsgUpdateParams) { + return { + typeUrl: "/desmos.profiles.v3.MsgUpdateParams", + value: MsgUpdateParams.encode(value).finish(), + }; + }, + }, + withTypeUrl: { + saveProfile(value: MsgSaveProfile) { + return { + typeUrl: "/desmos.profiles.v3.MsgSaveProfile", + value, + }; + }, + deleteProfile(value: MsgDeleteProfile) { + return { + typeUrl: "/desmos.profiles.v3.MsgDeleteProfile", + value, + }; + }, + requestDTagTransfer(value: MsgRequestDTagTransfer) { + return { + typeUrl: "/desmos.profiles.v3.MsgRequestDTagTransfer", + value, + }; + }, + cancelDTagTransferRequest(value: MsgCancelDTagTransferRequest) { + return { + typeUrl: "/desmos.profiles.v3.MsgCancelDTagTransferRequest", + value, + }; + }, + acceptDTagTransferRequest(value: MsgAcceptDTagTransferRequest) { + return { + typeUrl: "/desmos.profiles.v3.MsgAcceptDTagTransferRequest", + value, + }; + }, + refuseDTagTransferRequest(value: MsgRefuseDTagTransferRequest) { + return { + typeUrl: "/desmos.profiles.v3.MsgRefuseDTagTransferRequest", + value, + }; + }, + linkChainAccount(value: MsgLinkChainAccount) { + return { + typeUrl: "/desmos.profiles.v3.MsgLinkChainAccount", + value, + }; + }, + unlinkChainAccount(value: MsgUnlinkChainAccount) { + return { + typeUrl: "/desmos.profiles.v3.MsgUnlinkChainAccount", + value, + }; + }, + setDefaultExternalAddress(value: MsgSetDefaultExternalAddress) { + return { + typeUrl: "/desmos.profiles.v3.MsgSetDefaultExternalAddress", + value, + }; + }, + linkApplication(value: MsgLinkApplication) { + return { + typeUrl: "/desmos.profiles.v3.MsgLinkApplication", + value, + }; + }, + unlinkApplication(value: MsgUnlinkApplication) { + return { + typeUrl: "/desmos.profiles.v3.MsgUnlinkApplication", + value, + }; + }, + updateParams(value: MsgUpdateParams) { + return { + typeUrl: "/desmos.profiles.v3.MsgUpdateParams", + value, + }; + }, + }, + toJSON: { + saveProfile(value: MsgSaveProfile) { + return { + typeUrl: "/desmos.profiles.v3.MsgSaveProfile", + value: MsgSaveProfile.toJSON(value), + }; + }, + deleteProfile(value: MsgDeleteProfile) { + return { + typeUrl: "/desmos.profiles.v3.MsgDeleteProfile", + value: MsgDeleteProfile.toJSON(value), + }; + }, + requestDTagTransfer(value: MsgRequestDTagTransfer) { + return { + typeUrl: "/desmos.profiles.v3.MsgRequestDTagTransfer", + value: MsgRequestDTagTransfer.toJSON(value), + }; + }, + cancelDTagTransferRequest(value: MsgCancelDTagTransferRequest) { + return { + typeUrl: "/desmos.profiles.v3.MsgCancelDTagTransferRequest", + value: MsgCancelDTagTransferRequest.toJSON(value), + }; + }, + acceptDTagTransferRequest(value: MsgAcceptDTagTransferRequest) { + return { + typeUrl: "/desmos.profiles.v3.MsgAcceptDTagTransferRequest", + value: MsgAcceptDTagTransferRequest.toJSON(value), + }; + }, + refuseDTagTransferRequest(value: MsgRefuseDTagTransferRequest) { + return { + typeUrl: "/desmos.profiles.v3.MsgRefuseDTagTransferRequest", + value: MsgRefuseDTagTransferRequest.toJSON(value), + }; + }, + linkChainAccount(value: MsgLinkChainAccount) { + return { + typeUrl: "/desmos.profiles.v3.MsgLinkChainAccount", + value: MsgLinkChainAccount.toJSON(value), + }; + }, + unlinkChainAccount(value: MsgUnlinkChainAccount) { + return { + typeUrl: "/desmos.profiles.v3.MsgUnlinkChainAccount", + value: MsgUnlinkChainAccount.toJSON(value), + }; + }, + setDefaultExternalAddress(value: MsgSetDefaultExternalAddress) { + return { + typeUrl: "/desmos.profiles.v3.MsgSetDefaultExternalAddress", + value: MsgSetDefaultExternalAddress.toJSON(value), + }; + }, + linkApplication(value: MsgLinkApplication) { + return { + typeUrl: "/desmos.profiles.v3.MsgLinkApplication", + value: MsgLinkApplication.toJSON(value), + }; + }, + unlinkApplication(value: MsgUnlinkApplication) { + return { + typeUrl: "/desmos.profiles.v3.MsgUnlinkApplication", + value: MsgUnlinkApplication.toJSON(value), + }; + }, + updateParams(value: MsgUpdateParams) { + return { + typeUrl: "/desmos.profiles.v3.MsgUpdateParams", + value: MsgUpdateParams.toJSON(value), + }; + }, + }, + fromJSON: { + saveProfile(value: any) { + return { + typeUrl: "/desmos.profiles.v3.MsgSaveProfile", + value: MsgSaveProfile.fromJSON(value), + }; + }, + deleteProfile(value: any) { + return { + typeUrl: "/desmos.profiles.v3.MsgDeleteProfile", + value: MsgDeleteProfile.fromJSON(value), + }; + }, + requestDTagTransfer(value: any) { + return { + typeUrl: "/desmos.profiles.v3.MsgRequestDTagTransfer", + value: MsgRequestDTagTransfer.fromJSON(value), + }; + }, + cancelDTagTransferRequest(value: any) { + return { + typeUrl: "/desmos.profiles.v3.MsgCancelDTagTransferRequest", + value: MsgCancelDTagTransferRequest.fromJSON(value), + }; + }, + acceptDTagTransferRequest(value: any) { + return { + typeUrl: "/desmos.profiles.v3.MsgAcceptDTagTransferRequest", + value: MsgAcceptDTagTransferRequest.fromJSON(value), + }; + }, + refuseDTagTransferRequest(value: any) { + return { + typeUrl: "/desmos.profiles.v3.MsgRefuseDTagTransferRequest", + value: MsgRefuseDTagTransferRequest.fromJSON(value), + }; + }, + linkChainAccount(value: any) { + return { + typeUrl: "/desmos.profiles.v3.MsgLinkChainAccount", + value: MsgLinkChainAccount.fromJSON(value), + }; + }, + unlinkChainAccount(value: any) { + return { + typeUrl: "/desmos.profiles.v3.MsgUnlinkChainAccount", + value: MsgUnlinkChainAccount.fromJSON(value), + }; + }, + setDefaultExternalAddress(value: any) { + return { + typeUrl: "/desmos.profiles.v3.MsgSetDefaultExternalAddress", + value: MsgSetDefaultExternalAddress.fromJSON(value), + }; + }, + linkApplication(value: any) { + return { + typeUrl: "/desmos.profiles.v3.MsgLinkApplication", + value: MsgLinkApplication.fromJSON(value), + }; + }, + unlinkApplication(value: any) { + return { + typeUrl: "/desmos.profiles.v3.MsgUnlinkApplication", + value: MsgUnlinkApplication.fromJSON(value), + }; + }, + updateParams(value: any) { + return { + typeUrl: "/desmos.profiles.v3.MsgUpdateParams", + value: MsgUpdateParams.fromJSON(value), + }; + }, + }, + fromPartial: { + saveProfile(value: MsgSaveProfile) { + return { + typeUrl: "/desmos.profiles.v3.MsgSaveProfile", + value: MsgSaveProfile.fromPartial(value), + }; + }, + deleteProfile(value: MsgDeleteProfile) { + return { + typeUrl: "/desmos.profiles.v3.MsgDeleteProfile", + value: MsgDeleteProfile.fromPartial(value), + }; + }, + requestDTagTransfer(value: MsgRequestDTagTransfer) { + return { + typeUrl: "/desmos.profiles.v3.MsgRequestDTagTransfer", + value: MsgRequestDTagTransfer.fromPartial(value), + }; + }, + cancelDTagTransferRequest(value: MsgCancelDTagTransferRequest) { + return { + typeUrl: "/desmos.profiles.v3.MsgCancelDTagTransferRequest", + value: MsgCancelDTagTransferRequest.fromPartial(value), + }; + }, + acceptDTagTransferRequest(value: MsgAcceptDTagTransferRequest) { + return { + typeUrl: "/desmos.profiles.v3.MsgAcceptDTagTransferRequest", + value: MsgAcceptDTagTransferRequest.fromPartial(value), + }; + }, + refuseDTagTransferRequest(value: MsgRefuseDTagTransferRequest) { + return { + typeUrl: "/desmos.profiles.v3.MsgRefuseDTagTransferRequest", + value: MsgRefuseDTagTransferRequest.fromPartial(value), + }; + }, + linkChainAccount(value: MsgLinkChainAccount) { + return { + typeUrl: "/desmos.profiles.v3.MsgLinkChainAccount", + value: MsgLinkChainAccount.fromPartial(value), + }; + }, + unlinkChainAccount(value: MsgUnlinkChainAccount) { + return { + typeUrl: "/desmos.profiles.v3.MsgUnlinkChainAccount", + value: MsgUnlinkChainAccount.fromPartial(value), + }; + }, + setDefaultExternalAddress(value: MsgSetDefaultExternalAddress) { + return { + typeUrl: "/desmos.profiles.v3.MsgSetDefaultExternalAddress", + value: MsgSetDefaultExternalAddress.fromPartial(value), + }; + }, + linkApplication(value: MsgLinkApplication) { + return { + typeUrl: "/desmos.profiles.v3.MsgLinkApplication", + value: MsgLinkApplication.fromPartial(value), + }; + }, + unlinkApplication(value: MsgUnlinkApplication) { + return { + typeUrl: "/desmos.profiles.v3.MsgUnlinkApplication", + value: MsgUnlinkApplication.fromPartial(value), + }; + }, + updateParams(value: MsgUpdateParams) { + return { + typeUrl: "/desmos.profiles.v3.MsgUpdateParams", + value: MsgUpdateParams.fromPartial(value), + }; + }, + }, +}; diff --git a/packages/types/src/desmos/profiles/v3/msg_server.ts b/packages/types/src/desmos/profiles/v3/msg_server.ts index 51f116843..421e6613a 100644 --- a/packages/types/src/desmos/profiles/v3/msg_server.ts +++ b/packages/types/src/desmos/profiles/v3/msg_server.ts @@ -32,6 +32,7 @@ import { MsgUnlinkApplicationResponse, } from "./msgs_app_links"; import { MsgUpdateParams, MsgUpdateParamsResponse } from "./msgs_params"; + export const protobufPackage = "desmos.profiles.v3"; /** Msg defines the relationships Msg service. */ export interface Msg { diff --git a/packages/types/src/desmos/profiles/v3/msgs_app_links.ts b/packages/types/src/desmos/profiles/v3/msgs_app_links.ts index a6f04e92e..2c764274b 100644 --- a/packages/types/src/desmos/profiles/v3/msgs_app_links.ts +++ b/packages/types/src/desmos/profiles/v3/msgs_app_links.ts @@ -1,6 +1,6 @@ /* eslint-disable */ -import { Data } from "./models_app_links"; -import { Height } from "../../../ibc/core/client/v1/client"; +import { Data, DataAmino } from "./models_app_links"; +import { Height, HeightAmino } from "../../../ibc/core/client/v1/client"; import { Long, isSet, DeepPartial, Exact } from "../../../helpers"; import * as _m0 from "protobufjs/minimal"; export const protobufPackage = "desmos.profiles.v3"; @@ -33,11 +33,61 @@ export interface MsgLinkApplication { */ timeoutTimestamp: Long; } +export interface MsgLinkApplicationProtoMsg { + typeUrl: "/desmos.profiles.v3.MsgLinkApplication"; + value: Uint8Array; +} +/** + * MsgLinkApplication defines a msg to connect a profile with a + * centralized application account (eg. Twitter, GitHub, etc). + */ +export interface MsgLinkApplicationAmino { + /** The sender of the connection request */ + sender: string; + /** LinkData contains the data related to the application to which connect */ + link_data?: DataAmino; + /** + * Hex encoded call data that will be sent to the data source in order to + * verify the link + */ + call_data: string; + /** The port on which the packet will be sent */ + source_port: string; + /** The channel by which the packet will be sent */ + source_channel: string; + /** + * Timeout height relative to the current block height. + * The timeout is disabled when set to 0. + */ + timeout_height?: HeightAmino; + /** + * Timeout timestamp (in nanoseconds) relative to the current block timestamp. + * The timeout is disabled when set to 0. + */ + timeout_timestamp: string; +} +export interface MsgLinkApplicationAminoMsg { + type: "/desmos.profiles.v3.MsgLinkApplication"; + value: MsgLinkApplicationAmino; +} /** * MsgLinkApplicationResponse defines the Msg/LinkApplication * response type. */ export interface MsgLinkApplicationResponse {} +export interface MsgLinkApplicationResponseProtoMsg { + typeUrl: "/desmos.profiles.v3.MsgLinkApplicationResponse"; + value: Uint8Array; +} +/** + * MsgLinkApplicationResponse defines the Msg/LinkApplication + * response type. + */ +export interface MsgLinkApplicationResponseAmino {} +export interface MsgLinkApplicationResponseAminoMsg { + type: "/desmos.profiles.v3.MsgLinkApplicationResponse"; + value: MsgLinkApplicationResponseAmino; +} /** * MsgUnlinkApplication defines a msg to delete an application link from a user * profile @@ -53,11 +103,47 @@ export interface MsgUnlinkApplication { */ signer: string; } +export interface MsgUnlinkApplicationProtoMsg { + typeUrl: "/desmos.profiles.v3.MsgUnlinkApplication"; + value: Uint8Array; +} +/** + * MsgUnlinkApplication defines a msg to delete an application link from a user + * profile + */ +export interface MsgUnlinkApplicationAmino { + /** Application represents the name of the application to unlink */ + application: string; + /** Username represents the username inside the application to unlink */ + username: string; + /** + * Signer represents the Desmos account to which the application should be + * unlinked + */ + signer: string; +} +export interface MsgUnlinkApplicationAminoMsg { + type: "/desmos.profiles.v3.MsgUnlinkApplication"; + value: MsgUnlinkApplicationAmino; +} /** * MsgUnlinkApplicationResponse defines the Msg/UnlinkApplication response * type. */ export interface MsgUnlinkApplicationResponse {} +export interface MsgUnlinkApplicationResponseProtoMsg { + typeUrl: "/desmos.profiles.v3.MsgUnlinkApplicationResponse"; + value: Uint8Array; +} +/** + * MsgUnlinkApplicationResponse defines the Msg/UnlinkApplication response + * type. + */ +export interface MsgUnlinkApplicationResponseAmino {} +export interface MsgUnlinkApplicationResponseAminoMsg { + type: "/desmos.profiles.v3.MsgUnlinkApplicationResponse"; + value: MsgUnlinkApplicationResponseAmino; +} function createBaseMsgLinkApplication(): MsgLinkApplication { return { sender: "", @@ -194,6 +280,53 @@ export const MsgLinkApplication = { : Long.UZERO; return message; }, + fromAmino(object: MsgLinkApplicationAmino): MsgLinkApplication { + return { + sender: object.sender, + linkData: object?.link_data + ? Data.fromAmino(object.link_data) + : undefined, + callData: object.call_data, + sourcePort: object.source_port, + sourceChannel: object.source_channel, + timeoutHeight: object?.timeout_height + ? Height.fromAmino(object.timeout_height) + : undefined, + timeoutTimestamp: Long.fromString(object.timeout_timestamp), + }; + }, + toAmino(message: MsgLinkApplication): MsgLinkApplicationAmino { + const obj: any = {}; + obj.sender = message.sender; + obj.link_data = message.linkData + ? Data.toAmino(message.linkData) + : undefined; + obj.call_data = message.callData; + obj.source_port = message.sourcePort; + obj.source_channel = message.sourceChannel; + obj.timeout_height = message.timeoutHeight + ? Height.toAmino(message.timeoutHeight) + : {}; + obj.timeout_timestamp = message.timeoutTimestamp + ? message.timeoutTimestamp.toString() + : undefined; + return obj; + }, + fromAminoMsg(object: MsgLinkApplicationAminoMsg): MsgLinkApplication { + return MsgLinkApplication.fromAmino(object.value); + }, + fromProtoMsg(message: MsgLinkApplicationProtoMsg): MsgLinkApplication { + return MsgLinkApplication.decode(message.value); + }, + toProto(message: MsgLinkApplication): Uint8Array { + return MsgLinkApplication.encode(message).finish(); + }, + toProtoMsg(message: MsgLinkApplication): MsgLinkApplicationProtoMsg { + return { + typeUrl: "/desmos.profiles.v3.MsgLinkApplication", + value: MsgLinkApplication.encode(message).finish(), + }; + }, }; function createBaseMsgLinkApplicationResponse(): MsgLinkApplicationResponse { return {}; @@ -235,6 +368,34 @@ export const MsgLinkApplicationResponse = { const message = createBaseMsgLinkApplicationResponse(); return message; }, + fromAmino(_: MsgLinkApplicationResponseAmino): MsgLinkApplicationResponse { + return {}; + }, + toAmino(_: MsgLinkApplicationResponse): MsgLinkApplicationResponseAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg( + object: MsgLinkApplicationResponseAminoMsg + ): MsgLinkApplicationResponse { + return MsgLinkApplicationResponse.fromAmino(object.value); + }, + fromProtoMsg( + message: MsgLinkApplicationResponseProtoMsg + ): MsgLinkApplicationResponse { + return MsgLinkApplicationResponse.decode(message.value); + }, + toProto(message: MsgLinkApplicationResponse): Uint8Array { + return MsgLinkApplicationResponse.encode(message).finish(); + }, + toProtoMsg( + message: MsgLinkApplicationResponse + ): MsgLinkApplicationResponseProtoMsg { + return { + typeUrl: "/desmos.profiles.v3.MsgLinkApplicationResponse", + value: MsgLinkApplicationResponse.encode(message).finish(), + }; + }, }; function createBaseMsgUnlinkApplication(): MsgUnlinkApplication { return { @@ -309,6 +470,35 @@ export const MsgUnlinkApplication = { message.signer = object.signer ?? ""; return message; }, + fromAmino(object: MsgUnlinkApplicationAmino): MsgUnlinkApplication { + return { + application: object.application, + username: object.username, + signer: object.signer, + }; + }, + toAmino(message: MsgUnlinkApplication): MsgUnlinkApplicationAmino { + const obj: any = {}; + obj.application = message.application; + obj.username = message.username; + obj.signer = message.signer; + return obj; + }, + fromAminoMsg(object: MsgUnlinkApplicationAminoMsg): MsgUnlinkApplication { + return MsgUnlinkApplication.fromAmino(object.value); + }, + fromProtoMsg(message: MsgUnlinkApplicationProtoMsg): MsgUnlinkApplication { + return MsgUnlinkApplication.decode(message.value); + }, + toProto(message: MsgUnlinkApplication): Uint8Array { + return MsgUnlinkApplication.encode(message).finish(); + }, + toProtoMsg(message: MsgUnlinkApplication): MsgUnlinkApplicationProtoMsg { + return { + typeUrl: "/desmos.profiles.v3.MsgUnlinkApplication", + value: MsgUnlinkApplication.encode(message).finish(), + }; + }, }; function createBaseMsgUnlinkApplicationResponse(): MsgUnlinkApplicationResponse { return {}; @@ -350,4 +540,34 @@ export const MsgUnlinkApplicationResponse = { const message = createBaseMsgUnlinkApplicationResponse(); return message; }, + fromAmino( + _: MsgUnlinkApplicationResponseAmino + ): MsgUnlinkApplicationResponse { + return {}; + }, + toAmino(_: MsgUnlinkApplicationResponse): MsgUnlinkApplicationResponseAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg( + object: MsgUnlinkApplicationResponseAminoMsg + ): MsgUnlinkApplicationResponse { + return MsgUnlinkApplicationResponse.fromAmino(object.value); + }, + fromProtoMsg( + message: MsgUnlinkApplicationResponseProtoMsg + ): MsgUnlinkApplicationResponse { + return MsgUnlinkApplicationResponse.decode(message.value); + }, + toProto(message: MsgUnlinkApplicationResponse): Uint8Array { + return MsgUnlinkApplicationResponse.encode(message).finish(); + }, + toProtoMsg( + message: MsgUnlinkApplicationResponse + ): MsgUnlinkApplicationResponseProtoMsg { + return { + typeUrl: "/desmos.profiles.v3.MsgUnlinkApplicationResponse", + value: MsgUnlinkApplicationResponse.encode(message).finish(), + }; + }, }; diff --git a/packages/types/src/desmos/profiles/v3/msgs_chain_links.ts b/packages/types/src/desmos/profiles/v3/msgs_chain_links.ts index efc7c0846..89804b24f 100644 --- a/packages/types/src/desmos/profiles/v3/msgs_chain_links.ts +++ b/packages/types/src/desmos/profiles/v3/msgs_chain_links.ts @@ -1,6 +1,11 @@ /* eslint-disable */ -import { Any } from "../../../google/protobuf/any"; -import { Proof, ChainConfig } from "./models_chain_links"; +import { Any, AnyAmino } from "../../../google/protobuf/any"; +import { + Proof, + ProofAmino, + ChainConfig, + ChainConfigAmino, +} from "./models_chain_links"; import * as _m0 from "protobufjs/minimal"; import { isSet, DeepPartial, Exact } from "../../../helpers"; export const protobufPackage = "desmos.profiles.v3"; @@ -21,8 +26,43 @@ export interface MsgLinkChainAccount { */ signer: string; } +export interface MsgLinkChainAccountProtoMsg { + typeUrl: "/desmos.profiles.v3.MsgLinkChainAccount"; + value: Uint8Array; +} +/** MsgLinkChainAccount represents a message to link an account to a profile. */ +export interface MsgLinkChainAccountAmino { + /** + * ChainAddress contains the details of the external chain address to be + * linked + */ + chain_address?: AnyAmino; + /** Proof contains the proof of ownership of the external chain address */ + proof?: ProofAmino; + /** ChainConfig contains the configuration of the external chain */ + chain_config?: ChainConfigAmino; + /** + * Signer represents the Desmos address associated with the + * profile to which link the external account + */ + signer: string; +} +export interface MsgLinkChainAccountAminoMsg { + type: "/desmos.profiles.v3.MsgLinkChainAccount"; + value: MsgLinkChainAccountAmino; +} /** MsgLinkChainAccountResponse defines the Msg/LinkAccount response type. */ export interface MsgLinkChainAccountResponse {} +export interface MsgLinkChainAccountResponseProtoMsg { + typeUrl: "/desmos.profiles.v3.MsgLinkChainAccountResponse"; + value: Uint8Array; +} +/** MsgLinkChainAccountResponse defines the Msg/LinkAccount response type. */ +export interface MsgLinkChainAccountResponseAmino {} +export interface MsgLinkChainAccountResponseAminoMsg { + type: "/desmos.profiles.v3.MsgLinkChainAccountResponse"; + value: MsgLinkChainAccountResponseAmino; +} /** * MsgUnlinkChainAccount represents a message to unlink an account from a * profile. @@ -38,8 +78,41 @@ export interface MsgUnlinkChainAccount { /** Target represents the external address to be removed */ target: string; } +export interface MsgUnlinkChainAccountProtoMsg { + typeUrl: "/desmos.profiles.v3.MsgUnlinkChainAccount"; + value: Uint8Array; +} +/** + * MsgUnlinkChainAccount represents a message to unlink an account from a + * profile. + */ +export interface MsgUnlinkChainAccountAmino { + /** Owner represents the Desmos profile from which to remove the link */ + owner: string; + /** + * ChainName represents the name of the chain to which the link to remove is + * associated + */ + chain_name: string; + /** Target represents the external address to be removed */ + target: string; +} +export interface MsgUnlinkChainAccountAminoMsg { + type: "/desmos.profiles.v3.MsgUnlinkChainAccount"; + value: MsgUnlinkChainAccountAmino; +} /** MsgUnlinkChainAccountResponse defines the Msg/UnlinkAccount response type. */ export interface MsgUnlinkChainAccountResponse {} +export interface MsgUnlinkChainAccountResponseProtoMsg { + typeUrl: "/desmos.profiles.v3.MsgUnlinkChainAccountResponse"; + value: Uint8Array; +} +/** MsgUnlinkChainAccountResponse defines the Msg/UnlinkAccount response type. */ +export interface MsgUnlinkChainAccountResponseAmino {} +export interface MsgUnlinkChainAccountResponseAminoMsg { + type: "/desmos.profiles.v3.MsgUnlinkChainAccountResponse"; + value: MsgUnlinkChainAccountResponseAmino; +} /** * MsgSetDefaultExternalAddress represents the message used to set a default * address for a specific chain @@ -52,11 +125,44 @@ export interface MsgSetDefaultExternalAddress { /** User signing the message */ signer: string; } +export interface MsgSetDefaultExternalAddressProtoMsg { + typeUrl: "/desmos.profiles.v3.MsgSetDefaultExternalAddress"; + value: Uint8Array; +} +/** + * MsgSetDefaultExternalAddress represents the message used to set a default + * address for a specific chain + */ +export interface MsgSetDefaultExternalAddressAmino { + /** Name of the chain for which to set the default address */ + chain_name: string; + /** Address to be set as the default one */ + target: string; + /** User signing the message */ + signer: string; +} +export interface MsgSetDefaultExternalAddressAminoMsg { + type: "/desmos.profiles.v3.MsgSetDefaultExternalAddress"; + value: MsgSetDefaultExternalAddressAmino; +} /** * MsgSetDefaultExternalAddressResponse represents the * Msg/SetDefaultExternalAddress response type */ export interface MsgSetDefaultExternalAddressResponse {} +export interface MsgSetDefaultExternalAddressResponseProtoMsg { + typeUrl: "/desmos.profiles.v3.MsgSetDefaultExternalAddressResponse"; + value: Uint8Array; +} +/** + * MsgSetDefaultExternalAddressResponse represents the + * Msg/SetDefaultExternalAddress response type + */ +export interface MsgSetDefaultExternalAddressResponseAmino {} +export interface MsgSetDefaultExternalAddressResponseAminoMsg { + type: "/desmos.profiles.v3.MsgSetDefaultExternalAddressResponse"; + value: MsgSetDefaultExternalAddressResponseAmino; +} function createBaseMsgLinkChainAccount(): MsgLinkChainAccount { return { chainAddress: undefined, @@ -159,6 +265,45 @@ export const MsgLinkChainAccount = { message.signer = object.signer ?? ""; return message; }, + fromAmino(object: MsgLinkChainAccountAmino): MsgLinkChainAccount { + return { + chainAddress: object?.chain_address + ? Any.fromAmino(object.chain_address) + : undefined, + proof: object?.proof ? Proof.fromAmino(object.proof) : undefined, + chainConfig: object?.chain_config + ? ChainConfig.fromAmino(object.chain_config) + : undefined, + signer: object.signer, + }; + }, + toAmino(message: MsgLinkChainAccount): MsgLinkChainAccountAmino { + const obj: any = {}; + obj.chain_address = message.chainAddress + ? Any.toAmino(message.chainAddress) + : undefined; + obj.proof = message.proof ? Proof.toAmino(message.proof) : undefined; + obj.chain_config = message.chainConfig + ? ChainConfig.toAmino(message.chainConfig) + : undefined; + obj.signer = message.signer; + return obj; + }, + fromAminoMsg(object: MsgLinkChainAccountAminoMsg): MsgLinkChainAccount { + return MsgLinkChainAccount.fromAmino(object.value); + }, + fromProtoMsg(message: MsgLinkChainAccountProtoMsg): MsgLinkChainAccount { + return MsgLinkChainAccount.decode(message.value); + }, + toProto(message: MsgLinkChainAccount): Uint8Array { + return MsgLinkChainAccount.encode(message).finish(); + }, + toProtoMsg(message: MsgLinkChainAccount): MsgLinkChainAccountProtoMsg { + return { + typeUrl: "/desmos.profiles.v3.MsgLinkChainAccount", + value: MsgLinkChainAccount.encode(message).finish(), + }; + }, }; function createBaseMsgLinkChainAccountResponse(): MsgLinkChainAccountResponse { return {}; @@ -200,6 +345,34 @@ export const MsgLinkChainAccountResponse = { const message = createBaseMsgLinkChainAccountResponse(); return message; }, + fromAmino(_: MsgLinkChainAccountResponseAmino): MsgLinkChainAccountResponse { + return {}; + }, + toAmino(_: MsgLinkChainAccountResponse): MsgLinkChainAccountResponseAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg( + object: MsgLinkChainAccountResponseAminoMsg + ): MsgLinkChainAccountResponse { + return MsgLinkChainAccountResponse.fromAmino(object.value); + }, + fromProtoMsg( + message: MsgLinkChainAccountResponseProtoMsg + ): MsgLinkChainAccountResponse { + return MsgLinkChainAccountResponse.decode(message.value); + }, + toProto(message: MsgLinkChainAccountResponse): Uint8Array { + return MsgLinkChainAccountResponse.encode(message).finish(); + }, + toProtoMsg( + message: MsgLinkChainAccountResponse + ): MsgLinkChainAccountResponseProtoMsg { + return { + typeUrl: "/desmos.profiles.v3.MsgLinkChainAccountResponse", + value: MsgLinkChainAccountResponse.encode(message).finish(), + }; + }, }; function createBaseMsgUnlinkChainAccount(): MsgUnlinkChainAccount { return { @@ -273,6 +446,35 @@ export const MsgUnlinkChainAccount = { message.target = object.target ?? ""; return message; }, + fromAmino(object: MsgUnlinkChainAccountAmino): MsgUnlinkChainAccount { + return { + owner: object.owner, + chainName: object.chain_name, + target: object.target, + }; + }, + toAmino(message: MsgUnlinkChainAccount): MsgUnlinkChainAccountAmino { + const obj: any = {}; + obj.owner = message.owner; + obj.chain_name = message.chainName; + obj.target = message.target; + return obj; + }, + fromAminoMsg(object: MsgUnlinkChainAccountAminoMsg): MsgUnlinkChainAccount { + return MsgUnlinkChainAccount.fromAmino(object.value); + }, + fromProtoMsg(message: MsgUnlinkChainAccountProtoMsg): MsgUnlinkChainAccount { + return MsgUnlinkChainAccount.decode(message.value); + }, + toProto(message: MsgUnlinkChainAccount): Uint8Array { + return MsgUnlinkChainAccount.encode(message).finish(); + }, + toProtoMsg(message: MsgUnlinkChainAccount): MsgUnlinkChainAccountProtoMsg { + return { + typeUrl: "/desmos.profiles.v3.MsgUnlinkChainAccount", + value: MsgUnlinkChainAccount.encode(message).finish(), + }; + }, }; function createBaseMsgUnlinkChainAccountResponse(): MsgUnlinkChainAccountResponse { return {}; @@ -314,6 +516,38 @@ export const MsgUnlinkChainAccountResponse = { const message = createBaseMsgUnlinkChainAccountResponse(); return message; }, + fromAmino( + _: MsgUnlinkChainAccountResponseAmino + ): MsgUnlinkChainAccountResponse { + return {}; + }, + toAmino( + _: MsgUnlinkChainAccountResponse + ): MsgUnlinkChainAccountResponseAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg( + object: MsgUnlinkChainAccountResponseAminoMsg + ): MsgUnlinkChainAccountResponse { + return MsgUnlinkChainAccountResponse.fromAmino(object.value); + }, + fromProtoMsg( + message: MsgUnlinkChainAccountResponseProtoMsg + ): MsgUnlinkChainAccountResponse { + return MsgUnlinkChainAccountResponse.decode(message.value); + }, + toProto(message: MsgUnlinkChainAccountResponse): Uint8Array { + return MsgUnlinkChainAccountResponse.encode(message).finish(); + }, + toProtoMsg( + message: MsgUnlinkChainAccountResponse + ): MsgUnlinkChainAccountResponseProtoMsg { + return { + typeUrl: "/desmos.profiles.v3.MsgUnlinkChainAccountResponse", + value: MsgUnlinkChainAccountResponse.encode(message).finish(), + }; + }, }; function createBaseMsgSetDefaultExternalAddress(): MsgSetDefaultExternalAddress { return { @@ -387,6 +621,45 @@ export const MsgSetDefaultExternalAddress = { message.signer = object.signer ?? ""; return message; }, + fromAmino( + object: MsgSetDefaultExternalAddressAmino + ): MsgSetDefaultExternalAddress { + return { + chainName: object.chain_name, + target: object.target, + signer: object.signer, + }; + }, + toAmino( + message: MsgSetDefaultExternalAddress + ): MsgSetDefaultExternalAddressAmino { + const obj: any = {}; + obj.chain_name = message.chainName; + obj.target = message.target; + obj.signer = message.signer; + return obj; + }, + fromAminoMsg( + object: MsgSetDefaultExternalAddressAminoMsg + ): MsgSetDefaultExternalAddress { + return MsgSetDefaultExternalAddress.fromAmino(object.value); + }, + fromProtoMsg( + message: MsgSetDefaultExternalAddressProtoMsg + ): MsgSetDefaultExternalAddress { + return MsgSetDefaultExternalAddress.decode(message.value); + }, + toProto(message: MsgSetDefaultExternalAddress): Uint8Array { + return MsgSetDefaultExternalAddress.encode(message).finish(); + }, + toProtoMsg( + message: MsgSetDefaultExternalAddress + ): MsgSetDefaultExternalAddressProtoMsg { + return { + typeUrl: "/desmos.profiles.v3.MsgSetDefaultExternalAddress", + value: MsgSetDefaultExternalAddress.encode(message).finish(), + }; + }, }; function createBaseMsgSetDefaultExternalAddressResponse(): MsgSetDefaultExternalAddressResponse { return {}; @@ -428,4 +701,36 @@ export const MsgSetDefaultExternalAddressResponse = { const message = createBaseMsgSetDefaultExternalAddressResponse(); return message; }, + fromAmino( + _: MsgSetDefaultExternalAddressResponseAmino + ): MsgSetDefaultExternalAddressResponse { + return {}; + }, + toAmino( + _: MsgSetDefaultExternalAddressResponse + ): MsgSetDefaultExternalAddressResponseAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg( + object: MsgSetDefaultExternalAddressResponseAminoMsg + ): MsgSetDefaultExternalAddressResponse { + return MsgSetDefaultExternalAddressResponse.fromAmino(object.value); + }, + fromProtoMsg( + message: MsgSetDefaultExternalAddressResponseProtoMsg + ): MsgSetDefaultExternalAddressResponse { + return MsgSetDefaultExternalAddressResponse.decode(message.value); + }, + toProto(message: MsgSetDefaultExternalAddressResponse): Uint8Array { + return MsgSetDefaultExternalAddressResponse.encode(message).finish(); + }, + toProtoMsg( + message: MsgSetDefaultExternalAddressResponse + ): MsgSetDefaultExternalAddressResponseProtoMsg { + return { + typeUrl: "/desmos.profiles.v3.MsgSetDefaultExternalAddressResponse", + value: MsgSetDefaultExternalAddressResponse.encode(message).finish(), + }; + }, }; diff --git a/packages/types/src/desmos/profiles/v3/msgs_dtag_requests.ts b/packages/types/src/desmos/profiles/v3/msgs_dtag_requests.ts index f93f0ac36..8bf64356a 100644 --- a/packages/types/src/desmos/profiles/v3/msgs_dtag_requests.ts +++ b/packages/types/src/desmos/profiles/v3/msgs_dtag_requests.ts @@ -18,11 +18,48 @@ export interface MsgRequestDTagTransfer { */ sender: string; } +export interface MsgRequestDTagTransferProtoMsg { + typeUrl: "/desmos.profiles.v3.MsgRequestDTagTransfer"; + value: Uint8Array; +} +/** + * MsgRequestDTagTransfer represents the message used to request the DTag + * transfer to another user. + */ +export interface MsgRequestDTagTransferAmino { + /** + * Receiver contains the address of the request receiver that owns the DTag to + * transfer if the request is accepted + */ + receiver: string; + /** + * Sender contains the address of the request sender that will receive the + * receiver DTag if the requet is accepted + */ + sender: string; +} +export interface MsgRequestDTagTransferAminoMsg { + type: "/desmos.profiles.v3.MsgRequestDTagTransfer"; + value: MsgRequestDTagTransferAmino; +} /** * MsgRequestDTagTransferResponse defines the Msg/RequestDTagTransfer response * type. */ export interface MsgRequestDTagTransferResponse {} +export interface MsgRequestDTagTransferResponseProtoMsg { + typeUrl: "/desmos.profiles.v3.MsgRequestDTagTransferResponse"; + value: Uint8Array; +} +/** + * MsgRequestDTagTransferResponse defines the Msg/RequestDTagTransfer response + * type. + */ +export interface MsgRequestDTagTransferResponseAmino {} +export interface MsgRequestDTagTransferResponseAminoMsg { + type: "/desmos.profiles.v3.MsgRequestDTagTransferResponse"; + value: MsgRequestDTagTransferResponseAmino; +} /** * MsgCancelDTagTransferRequest represents the message used to cancel a DTag * transfer request. @@ -33,11 +70,42 @@ export interface MsgCancelDTagTransferRequest { /** Sender contains the address of the requets sender */ sender: string; } +export interface MsgCancelDTagTransferRequestProtoMsg { + typeUrl: "/desmos.profiles.v3.MsgCancelDTagTransferRequest"; + value: Uint8Array; +} +/** + * MsgCancelDTagTransferRequest represents the message used to cancel a DTag + * transfer request. + */ +export interface MsgCancelDTagTransferRequestAmino { + /** Receiver contains the address of the request receiver */ + receiver: string; + /** Sender contains the address of the requets sender */ + sender: string; +} +export interface MsgCancelDTagTransferRequestAminoMsg { + type: "/desmos.profiles.v3.MsgCancelDTagTransferRequest"; + value: MsgCancelDTagTransferRequestAmino; +} /** * MsgCancelDTagTransferRequestResponse represents the * Msg/CancelDTagTransferRequest response type. */ export interface MsgCancelDTagTransferRequestResponse {} +export interface MsgCancelDTagTransferRequestResponseProtoMsg { + typeUrl: "/desmos.profiles.v3.MsgCancelDTagTransferRequestResponse"; + value: Uint8Array; +} +/** + * MsgCancelDTagTransferRequestResponse represents the + * Msg/CancelDTagTransferRequest response type. + */ +export interface MsgCancelDTagTransferRequestResponseAmino {} +export interface MsgCancelDTagTransferRequestResponseAminoMsg { + type: "/desmos.profiles.v3.MsgCancelDTagTransferRequestResponse"; + value: MsgCancelDTagTransferRequestResponseAmino; +} /** * MsgAcceptDTagTransferRequest represents the message used to accept a DTag * transfer request. @@ -53,11 +121,47 @@ export interface MsgAcceptDTagTransferRequest { /** Receiver represents the request receiver */ receiver: string; } +export interface MsgAcceptDTagTransferRequestProtoMsg { + typeUrl: "/desmos.profiles.v3.MsgAcceptDTagTransferRequest"; + value: Uint8Array; +} +/** + * MsgAcceptDTagTransferRequest represents the message used to accept a DTag + * transfer request. + */ +export interface MsgAcceptDTagTransferRequestAmino { + /** + * NewDTag represents the DTag that the request receiver will obtain if they + * accept the request + */ + new_dtag: string; + /** Sender represents the request sender */ + sender: string; + /** Receiver represents the request receiver */ + receiver: string; +} +export interface MsgAcceptDTagTransferRequestAminoMsg { + type: "/desmos.profiles.v3.MsgAcceptDTagTransferRequest"; + value: MsgAcceptDTagTransferRequestAmino; +} /** * MsgAcceptDTagTransferRequestResponse defines the * Msg/AcceptDTagTransferRequest response. */ export interface MsgAcceptDTagTransferRequestResponse {} +export interface MsgAcceptDTagTransferRequestResponseProtoMsg { + typeUrl: "/desmos.profiles.v3.MsgAcceptDTagTransferRequestResponse"; + value: Uint8Array; +} +/** + * MsgAcceptDTagTransferRequestResponse defines the + * Msg/AcceptDTagTransferRequest response. + */ +export interface MsgAcceptDTagTransferRequestResponseAmino {} +export interface MsgAcceptDTagTransferRequestResponseAminoMsg { + type: "/desmos.profiles.v3.MsgAcceptDTagTransferRequestResponse"; + value: MsgAcceptDTagTransferRequestResponseAmino; +} /** * MsgRefuseDTagTransferRequest represents the message used to refuse a DTag * transfer request. @@ -68,11 +172,42 @@ export interface MsgRefuseDTagTransferRequest { /** Receiver represents the request receiver */ receiver: string; } +export interface MsgRefuseDTagTransferRequestProtoMsg { + typeUrl: "/desmos.profiles.v3.MsgRefuseDTagTransferRequest"; + value: Uint8Array; +} +/** + * MsgRefuseDTagTransferRequest represents the message used to refuse a DTag + * transfer request. + */ +export interface MsgRefuseDTagTransferRequestAmino { + /** Sender represents the request sender */ + sender: string; + /** Receiver represents the request receiver */ + receiver: string; +} +export interface MsgRefuseDTagTransferRequestAminoMsg { + type: "/desmos.profiles.v3.MsgRefuseDTagTransferRequest"; + value: MsgRefuseDTagTransferRequestAmino; +} /** * MsgRefuseDTagTransferRequestResponse defines the * Msg/RefuseDTagTransferRequest response. */ export interface MsgRefuseDTagTransferRequestResponse {} +export interface MsgRefuseDTagTransferRequestResponseProtoMsg { + typeUrl: "/desmos.profiles.v3.MsgRefuseDTagTransferRequestResponse"; + value: Uint8Array; +} +/** + * MsgRefuseDTagTransferRequestResponse defines the + * Msg/RefuseDTagTransferRequest response. + */ +export interface MsgRefuseDTagTransferRequestResponseAmino {} +export interface MsgRefuseDTagTransferRequestResponseAminoMsg { + type: "/desmos.profiles.v3.MsgRefuseDTagTransferRequestResponse"; + value: MsgRefuseDTagTransferRequestResponseAmino; +} function createBaseMsgRequestDTagTransfer(): MsgRequestDTagTransfer { return { receiver: "", @@ -135,6 +270,35 @@ export const MsgRequestDTagTransfer = { message.sender = object.sender ?? ""; return message; }, + fromAmino(object: MsgRequestDTagTransferAmino): MsgRequestDTagTransfer { + return { + receiver: object.receiver, + sender: object.sender, + }; + }, + toAmino(message: MsgRequestDTagTransfer): MsgRequestDTagTransferAmino { + const obj: any = {}; + obj.receiver = message.receiver; + obj.sender = message.sender; + return obj; + }, + fromAminoMsg(object: MsgRequestDTagTransferAminoMsg): MsgRequestDTagTransfer { + return MsgRequestDTagTransfer.fromAmino(object.value); + }, + fromProtoMsg( + message: MsgRequestDTagTransferProtoMsg + ): MsgRequestDTagTransfer { + return MsgRequestDTagTransfer.decode(message.value); + }, + toProto(message: MsgRequestDTagTransfer): Uint8Array { + return MsgRequestDTagTransfer.encode(message).finish(); + }, + toProtoMsg(message: MsgRequestDTagTransfer): MsgRequestDTagTransferProtoMsg { + return { + typeUrl: "/desmos.profiles.v3.MsgRequestDTagTransfer", + value: MsgRequestDTagTransfer.encode(message).finish(), + }; + }, }; function createBaseMsgRequestDTagTransferResponse(): MsgRequestDTagTransferResponse { return {}; @@ -176,6 +340,38 @@ export const MsgRequestDTagTransferResponse = { const message = createBaseMsgRequestDTagTransferResponse(); return message; }, + fromAmino( + _: MsgRequestDTagTransferResponseAmino + ): MsgRequestDTagTransferResponse { + return {}; + }, + toAmino( + _: MsgRequestDTagTransferResponse + ): MsgRequestDTagTransferResponseAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg( + object: MsgRequestDTagTransferResponseAminoMsg + ): MsgRequestDTagTransferResponse { + return MsgRequestDTagTransferResponse.fromAmino(object.value); + }, + fromProtoMsg( + message: MsgRequestDTagTransferResponseProtoMsg + ): MsgRequestDTagTransferResponse { + return MsgRequestDTagTransferResponse.decode(message.value); + }, + toProto(message: MsgRequestDTagTransferResponse): Uint8Array { + return MsgRequestDTagTransferResponse.encode(message).finish(); + }, + toProtoMsg( + message: MsgRequestDTagTransferResponse + ): MsgRequestDTagTransferResponseProtoMsg { + return { + typeUrl: "/desmos.profiles.v3.MsgRequestDTagTransferResponse", + value: MsgRequestDTagTransferResponse.encode(message).finish(), + }; + }, }; function createBaseMsgCancelDTagTransferRequest(): MsgCancelDTagTransferRequest { return { @@ -239,6 +435,43 @@ export const MsgCancelDTagTransferRequest = { message.sender = object.sender ?? ""; return message; }, + fromAmino( + object: MsgCancelDTagTransferRequestAmino + ): MsgCancelDTagTransferRequest { + return { + receiver: object.receiver, + sender: object.sender, + }; + }, + toAmino( + message: MsgCancelDTagTransferRequest + ): MsgCancelDTagTransferRequestAmino { + const obj: any = {}; + obj.receiver = message.receiver; + obj.sender = message.sender; + return obj; + }, + fromAminoMsg( + object: MsgCancelDTagTransferRequestAminoMsg + ): MsgCancelDTagTransferRequest { + return MsgCancelDTagTransferRequest.fromAmino(object.value); + }, + fromProtoMsg( + message: MsgCancelDTagTransferRequestProtoMsg + ): MsgCancelDTagTransferRequest { + return MsgCancelDTagTransferRequest.decode(message.value); + }, + toProto(message: MsgCancelDTagTransferRequest): Uint8Array { + return MsgCancelDTagTransferRequest.encode(message).finish(); + }, + toProtoMsg( + message: MsgCancelDTagTransferRequest + ): MsgCancelDTagTransferRequestProtoMsg { + return { + typeUrl: "/desmos.profiles.v3.MsgCancelDTagTransferRequest", + value: MsgCancelDTagTransferRequest.encode(message).finish(), + }; + }, }; function createBaseMsgCancelDTagTransferRequestResponse(): MsgCancelDTagTransferRequestResponse { return {}; @@ -280,6 +513,38 @@ export const MsgCancelDTagTransferRequestResponse = { const message = createBaseMsgCancelDTagTransferRequestResponse(); return message; }, + fromAmino( + _: MsgCancelDTagTransferRequestResponseAmino + ): MsgCancelDTagTransferRequestResponse { + return {}; + }, + toAmino( + _: MsgCancelDTagTransferRequestResponse + ): MsgCancelDTagTransferRequestResponseAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg( + object: MsgCancelDTagTransferRequestResponseAminoMsg + ): MsgCancelDTagTransferRequestResponse { + return MsgCancelDTagTransferRequestResponse.fromAmino(object.value); + }, + fromProtoMsg( + message: MsgCancelDTagTransferRequestResponseProtoMsg + ): MsgCancelDTagTransferRequestResponse { + return MsgCancelDTagTransferRequestResponse.decode(message.value); + }, + toProto(message: MsgCancelDTagTransferRequestResponse): Uint8Array { + return MsgCancelDTagTransferRequestResponse.encode(message).finish(); + }, + toProtoMsg( + message: MsgCancelDTagTransferRequestResponse + ): MsgCancelDTagTransferRequestResponseProtoMsg { + return { + typeUrl: "/desmos.profiles.v3.MsgCancelDTagTransferRequestResponse", + value: MsgCancelDTagTransferRequestResponse.encode(message).finish(), + }; + }, }; function createBaseMsgAcceptDTagTransferRequest(): MsgAcceptDTagTransferRequest { return { @@ -353,6 +618,45 @@ export const MsgAcceptDTagTransferRequest = { message.receiver = object.receiver ?? ""; return message; }, + fromAmino( + object: MsgAcceptDTagTransferRequestAmino + ): MsgAcceptDTagTransferRequest { + return { + newDtag: object.new_dtag, + sender: object.sender, + receiver: object.receiver, + }; + }, + toAmino( + message: MsgAcceptDTagTransferRequest + ): MsgAcceptDTagTransferRequestAmino { + const obj: any = {}; + obj.new_dtag = message.newDtag; + obj.sender = message.sender; + obj.receiver = message.receiver; + return obj; + }, + fromAminoMsg( + object: MsgAcceptDTagTransferRequestAminoMsg + ): MsgAcceptDTagTransferRequest { + return MsgAcceptDTagTransferRequest.fromAmino(object.value); + }, + fromProtoMsg( + message: MsgAcceptDTagTransferRequestProtoMsg + ): MsgAcceptDTagTransferRequest { + return MsgAcceptDTagTransferRequest.decode(message.value); + }, + toProto(message: MsgAcceptDTagTransferRequest): Uint8Array { + return MsgAcceptDTagTransferRequest.encode(message).finish(); + }, + toProtoMsg( + message: MsgAcceptDTagTransferRequest + ): MsgAcceptDTagTransferRequestProtoMsg { + return { + typeUrl: "/desmos.profiles.v3.MsgAcceptDTagTransferRequest", + value: MsgAcceptDTagTransferRequest.encode(message).finish(), + }; + }, }; function createBaseMsgAcceptDTagTransferRequestResponse(): MsgAcceptDTagTransferRequestResponse { return {}; @@ -394,6 +698,38 @@ export const MsgAcceptDTagTransferRequestResponse = { const message = createBaseMsgAcceptDTagTransferRequestResponse(); return message; }, + fromAmino( + _: MsgAcceptDTagTransferRequestResponseAmino + ): MsgAcceptDTagTransferRequestResponse { + return {}; + }, + toAmino( + _: MsgAcceptDTagTransferRequestResponse + ): MsgAcceptDTagTransferRequestResponseAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg( + object: MsgAcceptDTagTransferRequestResponseAminoMsg + ): MsgAcceptDTagTransferRequestResponse { + return MsgAcceptDTagTransferRequestResponse.fromAmino(object.value); + }, + fromProtoMsg( + message: MsgAcceptDTagTransferRequestResponseProtoMsg + ): MsgAcceptDTagTransferRequestResponse { + return MsgAcceptDTagTransferRequestResponse.decode(message.value); + }, + toProto(message: MsgAcceptDTagTransferRequestResponse): Uint8Array { + return MsgAcceptDTagTransferRequestResponse.encode(message).finish(); + }, + toProtoMsg( + message: MsgAcceptDTagTransferRequestResponse + ): MsgAcceptDTagTransferRequestResponseProtoMsg { + return { + typeUrl: "/desmos.profiles.v3.MsgAcceptDTagTransferRequestResponse", + value: MsgAcceptDTagTransferRequestResponse.encode(message).finish(), + }; + }, }; function createBaseMsgRefuseDTagTransferRequest(): MsgRefuseDTagTransferRequest { return { @@ -457,6 +793,43 @@ export const MsgRefuseDTagTransferRequest = { message.receiver = object.receiver ?? ""; return message; }, + fromAmino( + object: MsgRefuseDTagTransferRequestAmino + ): MsgRefuseDTagTransferRequest { + return { + sender: object.sender, + receiver: object.receiver, + }; + }, + toAmino( + message: MsgRefuseDTagTransferRequest + ): MsgRefuseDTagTransferRequestAmino { + const obj: any = {}; + obj.sender = message.sender; + obj.receiver = message.receiver; + return obj; + }, + fromAminoMsg( + object: MsgRefuseDTagTransferRequestAminoMsg + ): MsgRefuseDTagTransferRequest { + return MsgRefuseDTagTransferRequest.fromAmino(object.value); + }, + fromProtoMsg( + message: MsgRefuseDTagTransferRequestProtoMsg + ): MsgRefuseDTagTransferRequest { + return MsgRefuseDTagTransferRequest.decode(message.value); + }, + toProto(message: MsgRefuseDTagTransferRequest): Uint8Array { + return MsgRefuseDTagTransferRequest.encode(message).finish(); + }, + toProtoMsg( + message: MsgRefuseDTagTransferRequest + ): MsgRefuseDTagTransferRequestProtoMsg { + return { + typeUrl: "/desmos.profiles.v3.MsgRefuseDTagTransferRequest", + value: MsgRefuseDTagTransferRequest.encode(message).finish(), + }; + }, }; function createBaseMsgRefuseDTagTransferRequestResponse(): MsgRefuseDTagTransferRequestResponse { return {}; @@ -498,4 +871,36 @@ export const MsgRefuseDTagTransferRequestResponse = { const message = createBaseMsgRefuseDTagTransferRequestResponse(); return message; }, + fromAmino( + _: MsgRefuseDTagTransferRequestResponseAmino + ): MsgRefuseDTagTransferRequestResponse { + return {}; + }, + toAmino( + _: MsgRefuseDTagTransferRequestResponse + ): MsgRefuseDTagTransferRequestResponseAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg( + object: MsgRefuseDTagTransferRequestResponseAminoMsg + ): MsgRefuseDTagTransferRequestResponse { + return MsgRefuseDTagTransferRequestResponse.fromAmino(object.value); + }, + fromProtoMsg( + message: MsgRefuseDTagTransferRequestResponseProtoMsg + ): MsgRefuseDTagTransferRequestResponse { + return MsgRefuseDTagTransferRequestResponse.decode(message.value); + }, + toProto(message: MsgRefuseDTagTransferRequestResponse): Uint8Array { + return MsgRefuseDTagTransferRequestResponse.encode(message).finish(); + }, + toProtoMsg( + message: MsgRefuseDTagTransferRequestResponse + ): MsgRefuseDTagTransferRequestResponseProtoMsg { + return { + typeUrl: "/desmos.profiles.v3.MsgRefuseDTagTransferRequestResponse", + value: MsgRefuseDTagTransferRequestResponse.encode(message).finish(), + }; + }, }; diff --git a/packages/types/src/desmos/profiles/v3/msgs_params.ts b/packages/types/src/desmos/profiles/v3/msgs_params.ts index 4c9406835..221196c90 100644 --- a/packages/types/src/desmos/profiles/v3/msgs_params.ts +++ b/packages/types/src/desmos/profiles/v3/msgs_params.ts @@ -1,5 +1,5 @@ /* eslint-disable */ -import { Params } from "./models_params"; +import { Params, ParamsAmino } from "./models_params"; import * as _m0 from "protobufjs/minimal"; import { isSet, DeepPartial, Exact } from "../../../helpers"; export const protobufPackage = "desmos.profiles.v3"; @@ -21,6 +21,32 @@ export interface MsgUpdateParams { */ params?: Params; } +export interface MsgUpdateParamsProtoMsg { + typeUrl: "/desmos.profiles.v3.MsgUpdateParams"; + value: Uint8Array; +} +/** + * MsgUpdateParams is the Msg/UpdateParams request type. + * + * Since: Desmos 5.0.0 + */ +export interface MsgUpdateParamsAmino { + /** + * authority is the address that controls the module (defaults to x/gov unless + * overwritten). + */ + authority: string; + /** + * params defines the parameters to update. + * + * NOTE: All parameters must be supplied. + */ + params?: ParamsAmino; +} +export interface MsgUpdateParamsAminoMsg { + type: "/desmos.profiles.v3.MsgUpdateParams"; + value: MsgUpdateParamsAmino; +} /** * MsgUpdateParamsResponse defines the response structure for executing a * MsgUpdateParams message. @@ -28,6 +54,21 @@ export interface MsgUpdateParams { * Since: Desmos 5.0.0 */ export interface MsgUpdateParamsResponse {} +export interface MsgUpdateParamsResponseProtoMsg { + typeUrl: "/desmos.profiles.v3.MsgUpdateParamsResponse"; + value: Uint8Array; +} +/** + * MsgUpdateParamsResponse defines the response structure for executing a + * MsgUpdateParams message. + * + * Since: Desmos 5.0.0 + */ +export interface MsgUpdateParamsResponseAmino {} +export interface MsgUpdateParamsResponseAminoMsg { + type: "/desmos.profiles.v3.MsgUpdateParamsResponse"; + value: MsgUpdateParamsResponseAmino; +} function createBaseMsgUpdateParams(): MsgUpdateParams { return { authority: "", @@ -91,6 +132,33 @@ export const MsgUpdateParams = { : undefined; return message; }, + fromAmino(object: MsgUpdateParamsAmino): MsgUpdateParams { + return { + authority: object.authority, + params: object?.params ? Params.fromAmino(object.params) : undefined, + }; + }, + toAmino(message: MsgUpdateParams): MsgUpdateParamsAmino { + const obj: any = {}; + obj.authority = message.authority; + obj.params = message.params ? Params.toAmino(message.params) : undefined; + return obj; + }, + fromAminoMsg(object: MsgUpdateParamsAminoMsg): MsgUpdateParams { + return MsgUpdateParams.fromAmino(object.value); + }, + fromProtoMsg(message: MsgUpdateParamsProtoMsg): MsgUpdateParams { + return MsgUpdateParams.decode(message.value); + }, + toProto(message: MsgUpdateParams): Uint8Array { + return MsgUpdateParams.encode(message).finish(); + }, + toProtoMsg(message: MsgUpdateParams): MsgUpdateParamsProtoMsg { + return { + typeUrl: "/desmos.profiles.v3.MsgUpdateParams", + value: MsgUpdateParams.encode(message).finish(), + }; + }, }; function createBaseMsgUpdateParamsResponse(): MsgUpdateParamsResponse { return {}; @@ -132,4 +200,32 @@ export const MsgUpdateParamsResponse = { const message = createBaseMsgUpdateParamsResponse(); return message; }, + fromAmino(_: MsgUpdateParamsResponseAmino): MsgUpdateParamsResponse { + return {}; + }, + toAmino(_: MsgUpdateParamsResponse): MsgUpdateParamsResponseAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg( + object: MsgUpdateParamsResponseAminoMsg + ): MsgUpdateParamsResponse { + return MsgUpdateParamsResponse.fromAmino(object.value); + }, + fromProtoMsg( + message: MsgUpdateParamsResponseProtoMsg + ): MsgUpdateParamsResponse { + return MsgUpdateParamsResponse.decode(message.value); + }, + toProto(message: MsgUpdateParamsResponse): Uint8Array { + return MsgUpdateParamsResponse.encode(message).finish(); + }, + toProtoMsg( + message: MsgUpdateParamsResponse + ): MsgUpdateParamsResponseProtoMsg { + return { + typeUrl: "/desmos.profiles.v3.MsgUpdateParamsResponse", + value: MsgUpdateParamsResponse.encode(message).finish(), + }; + }, }; diff --git a/packages/types/src/desmos/profiles/v3/msgs_profile.ts b/packages/types/src/desmos/profiles/v3/msgs_profile.ts index 6a75ba37e..5f3c21503 100644 --- a/packages/types/src/desmos/profiles/v3/msgs_profile.ts +++ b/packages/types/src/desmos/profiles/v3/msgs_profile.ts @@ -32,15 +32,86 @@ export interface MsgSaveProfile { /** Address of the user associated to the profile */ creator: string; } +export interface MsgSaveProfileProtoMsg { + typeUrl: "/desmos.profiles.v3.MsgSaveProfile"; + value: Uint8Array; +} +/** MsgSaveProfile represents a message to save a profile. */ +export interface MsgSaveProfileAmino { + /** + * DTag of the profile. If it shouldn't be changed, [do-no-modify] can be used + * instead. + */ + dtag: string; + /** + * Nickname of the profile. If it shouldn't be changed, [do-no-modify] can be + * used instead. + */ + nickname: string; + /** + * Bio of the profile. If it shouldn't be changed, [do-no-modify] can be used + * instead. + */ + bio: string; + /** + * URL to the profile picture. If it shouldn't be changed, [do-no-modify] can + * be used instead. + */ + profile_picture: string; + /** + * URL to the profile cover. If it shouldn't be changed, [do-no-modify] can be + * used instead. + */ + cover_picture: string; + /** Address of the user associated to the profile */ + creator: string; +} +export interface MsgSaveProfileAminoMsg { + type: "/desmos.profiles.v3.MsgSaveProfile"; + value: MsgSaveProfileAmino; +} /** MsgSaveProfileResponse defines the Msg/SaveProfile response type. */ export interface MsgSaveProfileResponse {} +export interface MsgSaveProfileResponseProtoMsg { + typeUrl: "/desmos.profiles.v3.MsgSaveProfileResponse"; + value: Uint8Array; +} +/** MsgSaveProfileResponse defines the Msg/SaveProfile response type. */ +export interface MsgSaveProfileResponseAmino {} +export interface MsgSaveProfileResponseAminoMsg { + type: "/desmos.profiles.v3.MsgSaveProfileResponse"; + value: MsgSaveProfileResponseAmino; +} /** MsgDeleteProfile represents the message used to delete an existing profile. */ export interface MsgDeleteProfile { /** Address associated to the profile to be deleted */ creator: string; } +export interface MsgDeleteProfileProtoMsg { + typeUrl: "/desmos.profiles.v3.MsgDeleteProfile"; + value: Uint8Array; +} +/** MsgDeleteProfile represents the message used to delete an existing profile. */ +export interface MsgDeleteProfileAmino { + /** Address associated to the profile to be deleted */ + creator: string; +} +export interface MsgDeleteProfileAminoMsg { + type: "/desmos.profiles.v3.MsgDeleteProfile"; + value: MsgDeleteProfileAmino; +} /** MsgDeleteProfileResponse defines the Msg/DeleteProfile response type. */ export interface MsgDeleteProfileResponse {} +export interface MsgDeleteProfileResponseProtoMsg { + typeUrl: "/desmos.profiles.v3.MsgDeleteProfileResponse"; + value: Uint8Array; +} +/** MsgDeleteProfileResponse defines the Msg/DeleteProfile response type. */ +export interface MsgDeleteProfileResponseAmino {} +export interface MsgDeleteProfileResponseAminoMsg { + type: "/desmos.profiles.v3.MsgDeleteProfileResponse"; + value: MsgDeleteProfileResponseAmino; +} function createBaseMsgSaveProfile(): MsgSaveProfile { return { dtag: "", @@ -146,6 +217,41 @@ export const MsgSaveProfile = { message.creator = object.creator ?? ""; return message; }, + fromAmino(object: MsgSaveProfileAmino): MsgSaveProfile { + return { + dtag: object.dtag, + nickname: object.nickname, + bio: object.bio, + profilePicture: object.profile_picture, + coverPicture: object.cover_picture, + creator: object.creator, + }; + }, + toAmino(message: MsgSaveProfile): MsgSaveProfileAmino { + const obj: any = {}; + obj.dtag = message.dtag; + obj.nickname = message.nickname; + obj.bio = message.bio; + obj.profile_picture = message.profilePicture; + obj.cover_picture = message.coverPicture; + obj.creator = message.creator; + return obj; + }, + fromAminoMsg(object: MsgSaveProfileAminoMsg): MsgSaveProfile { + return MsgSaveProfile.fromAmino(object.value); + }, + fromProtoMsg(message: MsgSaveProfileProtoMsg): MsgSaveProfile { + return MsgSaveProfile.decode(message.value); + }, + toProto(message: MsgSaveProfile): Uint8Array { + return MsgSaveProfile.encode(message).finish(); + }, + toProtoMsg(message: MsgSaveProfile): MsgSaveProfileProtoMsg { + return { + typeUrl: "/desmos.profiles.v3.MsgSaveProfile", + value: MsgSaveProfile.encode(message).finish(), + }; + }, }; function createBaseMsgSaveProfileResponse(): MsgSaveProfileResponse { return {}; @@ -187,6 +293,30 @@ export const MsgSaveProfileResponse = { const message = createBaseMsgSaveProfileResponse(); return message; }, + fromAmino(_: MsgSaveProfileResponseAmino): MsgSaveProfileResponse { + return {}; + }, + toAmino(_: MsgSaveProfileResponse): MsgSaveProfileResponseAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg(object: MsgSaveProfileResponseAminoMsg): MsgSaveProfileResponse { + return MsgSaveProfileResponse.fromAmino(object.value); + }, + fromProtoMsg( + message: MsgSaveProfileResponseProtoMsg + ): MsgSaveProfileResponse { + return MsgSaveProfileResponse.decode(message.value); + }, + toProto(message: MsgSaveProfileResponse): Uint8Array { + return MsgSaveProfileResponse.encode(message).finish(); + }, + toProtoMsg(message: MsgSaveProfileResponse): MsgSaveProfileResponseProtoMsg { + return { + typeUrl: "/desmos.profiles.v3.MsgSaveProfileResponse", + value: MsgSaveProfileResponse.encode(message).finish(), + }; + }, }; function createBaseMsgDeleteProfile(): MsgDeleteProfile { return { @@ -237,6 +367,31 @@ export const MsgDeleteProfile = { message.creator = object.creator ?? ""; return message; }, + fromAmino(object: MsgDeleteProfileAmino): MsgDeleteProfile { + return { + creator: object.creator, + }; + }, + toAmino(message: MsgDeleteProfile): MsgDeleteProfileAmino { + const obj: any = {}; + obj.creator = message.creator; + return obj; + }, + fromAminoMsg(object: MsgDeleteProfileAminoMsg): MsgDeleteProfile { + return MsgDeleteProfile.fromAmino(object.value); + }, + fromProtoMsg(message: MsgDeleteProfileProtoMsg): MsgDeleteProfile { + return MsgDeleteProfile.decode(message.value); + }, + toProto(message: MsgDeleteProfile): Uint8Array { + return MsgDeleteProfile.encode(message).finish(); + }, + toProtoMsg(message: MsgDeleteProfile): MsgDeleteProfileProtoMsg { + return { + typeUrl: "/desmos.profiles.v3.MsgDeleteProfile", + value: MsgDeleteProfile.encode(message).finish(), + }; + }, }; function createBaseMsgDeleteProfileResponse(): MsgDeleteProfileResponse { return {}; @@ -278,4 +433,32 @@ export const MsgDeleteProfileResponse = { const message = createBaseMsgDeleteProfileResponse(); return message; }, + fromAmino(_: MsgDeleteProfileResponseAmino): MsgDeleteProfileResponse { + return {}; + }, + toAmino(_: MsgDeleteProfileResponse): MsgDeleteProfileResponseAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg( + object: MsgDeleteProfileResponseAminoMsg + ): MsgDeleteProfileResponse { + return MsgDeleteProfileResponse.fromAmino(object.value); + }, + fromProtoMsg( + message: MsgDeleteProfileResponseProtoMsg + ): MsgDeleteProfileResponse { + return MsgDeleteProfileResponse.decode(message.value); + }, + toProto(message: MsgDeleteProfileResponse): Uint8Array { + return MsgDeleteProfileResponse.encode(message).finish(); + }, + toProtoMsg( + message: MsgDeleteProfileResponse + ): MsgDeleteProfileResponseProtoMsg { + return { + typeUrl: "/desmos.profiles.v3.MsgDeleteProfileResponse", + value: MsgDeleteProfileResponse.encode(message).finish(), + }; + }, }; diff --git a/packages/types/src/desmos/profiles/v3/query.ts b/packages/types/src/desmos/profiles/v3/query.ts index daecf06c2..39d31c91f 100644 --- a/packages/types/src/desmos/profiles/v3/query.ts +++ b/packages/types/src/desmos/profiles/v3/query.ts @@ -23,6 +23,7 @@ import { QueryApplicationLinksResponse, } from "./query_app_links"; import { QueryParamsRequest, QueryParamsResponse } from "./query_params"; + export const protobufPackage = "desmos.profiles.v3"; /** Query defines the gRPC querier service. */ export interface Query { diff --git a/packages/types/src/desmos/profiles/v3/query_app_links.ts b/packages/types/src/desmos/profiles/v3/query_app_links.ts index 3243d1e1e..53e9c4e61 100644 --- a/packages/types/src/desmos/profiles/v3/query_app_links.ts +++ b/packages/types/src/desmos/profiles/v3/query_app_links.ts @@ -1,9 +1,11 @@ /* eslint-disable */ import { PageRequest, + PageRequestAmino, PageResponse, + PageResponseAmino, } from "../../../cosmos/base/query/v1beta1/pagination"; -import { ApplicationLink } from "./models_app_links"; +import { ApplicationLink, ApplicationLinkAmino } from "./models_app_links"; import * as _m0 from "protobufjs/minimal"; import { isSet, DeepPartial, Exact } from "../../../helpers"; export const protobufPackage = "desmos.profiles.v3"; @@ -30,6 +32,37 @@ export interface QueryApplicationLinksRequest { /** Pagination defines an optional pagination for the request */ pagination?: PageRequest; } +export interface QueryApplicationLinksRequestProtoMsg { + typeUrl: "/desmos.profiles.v3.QueryApplicationLinksRequest"; + value: Uint8Array; +} +/** + * QueryUserApplicationLinkRequest represents the request used when querying an + * application link using an application name and username for a given user + */ +export interface QueryApplicationLinksRequestAmino { + /** + * (Optional) User contains the Desmos profile address associated for which + * the link should be searched for + */ + user: string; + /** + * (Optional) Application represents the application name associated with the + * link. Used only if user is also set. + */ + application: string; + /** + * Username represents the username inside the application associated with the + * link. Used only if application is also set. + */ + username: string; + /** Pagination defines an optional pagination for the request */ + pagination?: PageRequestAmino; +} +export interface QueryApplicationLinksRequestAminoMsg { + type: "/desmos.profiles.v3.QueryApplicationLinksRequest"; + value: QueryApplicationLinksRequestAmino; +} /** * QueryApplicationLinksResponse represents the response to the query used * to get the application links for a specific user @@ -39,6 +72,23 @@ export interface QueryApplicationLinksResponse { /** Pagination defines the pagination response */ pagination?: PageResponse; } +export interface QueryApplicationLinksResponseProtoMsg { + typeUrl: "/desmos.profiles.v3.QueryApplicationLinksResponse"; + value: Uint8Array; +} +/** + * QueryApplicationLinksResponse represents the response to the query used + * to get the application links for a specific user + */ +export interface QueryApplicationLinksResponseAmino { + links: ApplicationLinkAmino[]; + /** Pagination defines the pagination response */ + pagination?: PageResponseAmino; +} +export interface QueryApplicationLinksResponseAminoMsg { + type: "/desmos.profiles.v3.QueryApplicationLinksResponse"; + value: QueryApplicationLinksResponseAmino; +} /** * QueryApplicationLinkByClientIDRequest contains the data of the request that * can be used to get an application link based on a client id @@ -47,6 +97,22 @@ export interface QueryApplicationLinkByClientIDRequest { /** ClientID represents the ID of the client to which search the link for */ clientId: string; } +export interface QueryApplicationLinkByClientIDRequestProtoMsg { + typeUrl: "/desmos.profiles.v3.QueryApplicationLinkByClientIDRequest"; + value: Uint8Array; +} +/** + * QueryApplicationLinkByClientIDRequest contains the data of the request that + * can be used to get an application link based on a client id + */ +export interface QueryApplicationLinkByClientIDRequestAmino { + /** ClientID represents the ID of the client to which search the link for */ + client_id: string; +} +export interface QueryApplicationLinkByClientIDRequestAminoMsg { + type: "/desmos.profiles.v3.QueryApplicationLinkByClientIDRequest"; + value: QueryApplicationLinkByClientIDRequestAmino; +} /** * QueryApplicationLinkByClientIDResponse contains the data returned by the * request allowing to get an application link using a client id @@ -54,6 +120,21 @@ export interface QueryApplicationLinkByClientIDRequest { export interface QueryApplicationLinkByClientIDResponse { link?: ApplicationLink; } +export interface QueryApplicationLinkByClientIDResponseProtoMsg { + typeUrl: "/desmos.profiles.v3.QueryApplicationLinkByClientIDResponse"; + value: Uint8Array; +} +/** + * QueryApplicationLinkByClientIDResponse contains the data returned by the + * request allowing to get an application link using a client id + */ +export interface QueryApplicationLinkByClientIDResponseAmino { + link?: ApplicationLinkAmino; +} +export interface QueryApplicationLinkByClientIDResponseAminoMsg { + type: "/desmos.profiles.v3.QueryApplicationLinkByClientIDResponse"; + value: QueryApplicationLinkByClientIDResponseAmino; +} /** * QueryApplicationLinkOwnersRequest contains the data of the request that can * be used to get application link owners @@ -72,6 +153,32 @@ export interface QueryApplicationLinkOwnersRequest { /** Pagination defines an optional pagination for the request */ pagination?: PageRequest; } +export interface QueryApplicationLinkOwnersRequestProtoMsg { + typeUrl: "/desmos.profiles.v3.QueryApplicationLinkOwnersRequest"; + value: Uint8Array; +} +/** + * QueryApplicationLinkOwnersRequest contains the data of the request that can + * be used to get application link owners + */ +export interface QueryApplicationLinkOwnersRequestAmino { + /** + * (Optional) Application name to search link owners of. If not specified, all + * links stored will be searched instead. + */ + application: string; + /** + * (Optional) Username to search for. This will only be used if the + * application is specified as well + */ + username: string; + /** Pagination defines an optional pagination for the request */ + pagination?: PageRequestAmino; +} +export interface QueryApplicationLinkOwnersRequestAminoMsg { + type: "/desmos.profiles.v3.QueryApplicationLinkOwnersRequest"; + value: QueryApplicationLinkOwnersRequestAmino; +} /** * QueryApplicationLinkOwnersResponse contains the data returned by the request * allowing to get application link owners. @@ -82,6 +189,24 @@ export interface QueryApplicationLinkOwnersResponse { /** Pagination defines the pagination response */ pagination?: PageResponse; } +export interface QueryApplicationLinkOwnersResponseProtoMsg { + typeUrl: "/desmos.profiles.v3.QueryApplicationLinkOwnersResponse"; + value: Uint8Array; +} +/** + * QueryApplicationLinkOwnersResponse contains the data returned by the request + * allowing to get application link owners. + */ +export interface QueryApplicationLinkOwnersResponseAmino { + /** Addresses of the application links owners */ + owners: QueryApplicationLinkOwnersResponse_ApplicationLinkOwnerDetailsAmino[]; + /** Pagination defines the pagination response */ + pagination?: PageResponseAmino; +} +export interface QueryApplicationLinkOwnersResponseAminoMsg { + type: "/desmos.profiles.v3.QueryApplicationLinkOwnersResponse"; + value: QueryApplicationLinkOwnersResponseAmino; +} /** * ApplicationLinkOwnerDetails contains the details of a single application * link owner @@ -91,6 +216,23 @@ export interface QueryApplicationLinkOwnersResponse_ApplicationLinkOwnerDetails application: string; username: string; } +export interface QueryApplicationLinkOwnersResponse_ApplicationLinkOwnerDetailsProtoMsg { + typeUrl: "/desmos.profiles.v3.ApplicationLinkOwnerDetails"; + value: Uint8Array; +} +/** + * ApplicationLinkOwnerDetails contains the details of a single application + * link owner + */ +export interface QueryApplicationLinkOwnersResponse_ApplicationLinkOwnerDetailsAmino { + user: string; + application: string; + username: string; +} +export interface QueryApplicationLinkOwnersResponse_ApplicationLinkOwnerDetailsAminoMsg { + type: "/desmos.profiles.v3.ApplicationLinkOwnerDetails"; + value: QueryApplicationLinkOwnersResponse_ApplicationLinkOwnerDetailsAmino; +} function createBaseQueryApplicationLinksRequest(): QueryApplicationLinksRequest { return { user: "", @@ -182,6 +324,51 @@ export const QueryApplicationLinksRequest = { : undefined; return message; }, + fromAmino( + object: QueryApplicationLinksRequestAmino + ): QueryApplicationLinksRequest { + return { + user: object.user, + application: object.application, + username: object.username, + pagination: object?.pagination + ? PageRequest.fromAmino(object.pagination) + : undefined, + }; + }, + toAmino( + message: QueryApplicationLinksRequest + ): QueryApplicationLinksRequestAmino { + const obj: any = {}; + obj.user = message.user; + obj.application = message.application; + obj.username = message.username; + obj.pagination = message.pagination + ? PageRequest.toAmino(message.pagination) + : undefined; + return obj; + }, + fromAminoMsg( + object: QueryApplicationLinksRequestAminoMsg + ): QueryApplicationLinksRequest { + return QueryApplicationLinksRequest.fromAmino(object.value); + }, + fromProtoMsg( + message: QueryApplicationLinksRequestProtoMsg + ): QueryApplicationLinksRequest { + return QueryApplicationLinksRequest.decode(message.value); + }, + toProto(message: QueryApplicationLinksRequest): Uint8Array { + return QueryApplicationLinksRequest.encode(message).finish(); + }, + toProtoMsg( + message: QueryApplicationLinksRequest + ): QueryApplicationLinksRequestProtoMsg { + return { + typeUrl: "/desmos.profiles.v3.QueryApplicationLinksRequest", + value: QueryApplicationLinksRequest.encode(message).finish(), + }; + }, }; function createBaseQueryApplicationLinksResponse(): QueryApplicationLinksResponse { return { @@ -265,6 +452,55 @@ export const QueryApplicationLinksResponse = { : undefined; return message; }, + fromAmino( + object: QueryApplicationLinksResponseAmino + ): QueryApplicationLinksResponse { + return { + links: Array.isArray(object?.links) + ? object.links.map((e: any) => ApplicationLink.fromAmino(e)) + : [], + pagination: object?.pagination + ? PageResponse.fromAmino(object.pagination) + : undefined, + }; + }, + toAmino( + message: QueryApplicationLinksResponse + ): QueryApplicationLinksResponseAmino { + const obj: any = {}; + if (message.links) { + obj.links = message.links.map((e) => + e ? ApplicationLink.toAmino(e) : undefined + ); + } else { + obj.links = []; + } + obj.pagination = message.pagination + ? PageResponse.toAmino(message.pagination) + : undefined; + return obj; + }, + fromAminoMsg( + object: QueryApplicationLinksResponseAminoMsg + ): QueryApplicationLinksResponse { + return QueryApplicationLinksResponse.fromAmino(object.value); + }, + fromProtoMsg( + message: QueryApplicationLinksResponseProtoMsg + ): QueryApplicationLinksResponse { + return QueryApplicationLinksResponse.decode(message.value); + }, + toProto(message: QueryApplicationLinksResponse): Uint8Array { + return QueryApplicationLinksResponse.encode(message).finish(); + }, + toProtoMsg( + message: QueryApplicationLinksResponse + ): QueryApplicationLinksResponseProtoMsg { + return { + typeUrl: "/desmos.profiles.v3.QueryApplicationLinksResponse", + value: QueryApplicationLinksResponse.encode(message).finish(), + }; + }, }; function createBaseQueryApplicationLinkByClientIDRequest(): QueryApplicationLinkByClientIDRequest { return { @@ -318,6 +554,41 @@ export const QueryApplicationLinkByClientIDRequest = { message.clientId = object.clientId ?? ""; return message; }, + fromAmino( + object: QueryApplicationLinkByClientIDRequestAmino + ): QueryApplicationLinkByClientIDRequest { + return { + clientId: object.client_id, + }; + }, + toAmino( + message: QueryApplicationLinkByClientIDRequest + ): QueryApplicationLinkByClientIDRequestAmino { + const obj: any = {}; + obj.client_id = message.clientId; + return obj; + }, + fromAminoMsg( + object: QueryApplicationLinkByClientIDRequestAminoMsg + ): QueryApplicationLinkByClientIDRequest { + return QueryApplicationLinkByClientIDRequest.fromAmino(object.value); + }, + fromProtoMsg( + message: QueryApplicationLinkByClientIDRequestProtoMsg + ): QueryApplicationLinkByClientIDRequest { + return QueryApplicationLinkByClientIDRequest.decode(message.value); + }, + toProto(message: QueryApplicationLinkByClientIDRequest): Uint8Array { + return QueryApplicationLinkByClientIDRequest.encode(message).finish(); + }, + toProtoMsg( + message: QueryApplicationLinkByClientIDRequest + ): QueryApplicationLinkByClientIDRequestProtoMsg { + return { + typeUrl: "/desmos.profiles.v3.QueryApplicationLinkByClientIDRequest", + value: QueryApplicationLinkByClientIDRequest.encode(message).finish(), + }; + }, }; function createBaseQueryApplicationLinkByClientIDResponse(): QueryApplicationLinkByClientIDResponse { return { @@ -379,6 +650,41 @@ export const QueryApplicationLinkByClientIDResponse = { : undefined; return message; }, + fromAmino( + object: QueryApplicationLinkByClientIDResponseAmino + ): QueryApplicationLinkByClientIDResponse { + return { + link: object?.link ? ApplicationLink.fromAmino(object.link) : undefined, + }; + }, + toAmino( + message: QueryApplicationLinkByClientIDResponse + ): QueryApplicationLinkByClientIDResponseAmino { + const obj: any = {}; + obj.link = message.link ? ApplicationLink.toAmino(message.link) : undefined; + return obj; + }, + fromAminoMsg( + object: QueryApplicationLinkByClientIDResponseAminoMsg + ): QueryApplicationLinkByClientIDResponse { + return QueryApplicationLinkByClientIDResponse.fromAmino(object.value); + }, + fromProtoMsg( + message: QueryApplicationLinkByClientIDResponseProtoMsg + ): QueryApplicationLinkByClientIDResponse { + return QueryApplicationLinkByClientIDResponse.decode(message.value); + }, + toProto(message: QueryApplicationLinkByClientIDResponse): Uint8Array { + return QueryApplicationLinkByClientIDResponse.encode(message).finish(); + }, + toProtoMsg( + message: QueryApplicationLinkByClientIDResponse + ): QueryApplicationLinkByClientIDResponseProtoMsg { + return { + typeUrl: "/desmos.profiles.v3.QueryApplicationLinkByClientIDResponse", + value: QueryApplicationLinkByClientIDResponse.encode(message).finish(), + }; + }, }; function createBaseQueryApplicationLinkOwnersRequest(): QueryApplicationLinkOwnersRequest { return { @@ -461,6 +767,49 @@ export const QueryApplicationLinkOwnersRequest = { : undefined; return message; }, + fromAmino( + object: QueryApplicationLinkOwnersRequestAmino + ): QueryApplicationLinkOwnersRequest { + return { + application: object.application, + username: object.username, + pagination: object?.pagination + ? PageRequest.fromAmino(object.pagination) + : undefined, + }; + }, + toAmino( + message: QueryApplicationLinkOwnersRequest + ): QueryApplicationLinkOwnersRequestAmino { + const obj: any = {}; + obj.application = message.application; + obj.username = message.username; + obj.pagination = message.pagination + ? PageRequest.toAmino(message.pagination) + : undefined; + return obj; + }, + fromAminoMsg( + object: QueryApplicationLinkOwnersRequestAminoMsg + ): QueryApplicationLinkOwnersRequest { + return QueryApplicationLinkOwnersRequest.fromAmino(object.value); + }, + fromProtoMsg( + message: QueryApplicationLinkOwnersRequestProtoMsg + ): QueryApplicationLinkOwnersRequest { + return QueryApplicationLinkOwnersRequest.decode(message.value); + }, + toProto(message: QueryApplicationLinkOwnersRequest): Uint8Array { + return QueryApplicationLinkOwnersRequest.encode(message).finish(); + }, + toProtoMsg( + message: QueryApplicationLinkOwnersRequest + ): QueryApplicationLinkOwnersRequestProtoMsg { + return { + typeUrl: "/desmos.profiles.v3.QueryApplicationLinkOwnersRequest", + value: QueryApplicationLinkOwnersRequest.encode(message).finish(), + }; + }, }; function createBaseQueryApplicationLinkOwnersResponse(): QueryApplicationLinkOwnersResponse { return { @@ -564,6 +913,63 @@ export const QueryApplicationLinkOwnersResponse = { : undefined; return message; }, + fromAmino( + object: QueryApplicationLinkOwnersResponseAmino + ): QueryApplicationLinkOwnersResponse { + return { + owners: Array.isArray(object?.owners) + ? object.owners.map((e: any) => + QueryApplicationLinkOwnersResponse_ApplicationLinkOwnerDetails.fromAmino( + e + ) + ) + : [], + pagination: object?.pagination + ? PageResponse.fromAmino(object.pagination) + : undefined, + }; + }, + toAmino( + message: QueryApplicationLinkOwnersResponse + ): QueryApplicationLinkOwnersResponseAmino { + const obj: any = {}; + if (message.owners) { + obj.owners = message.owners.map((e) => + e + ? QueryApplicationLinkOwnersResponse_ApplicationLinkOwnerDetails.toAmino( + e + ) + : undefined + ); + } else { + obj.owners = []; + } + obj.pagination = message.pagination + ? PageResponse.toAmino(message.pagination) + : undefined; + return obj; + }, + fromAminoMsg( + object: QueryApplicationLinkOwnersResponseAminoMsg + ): QueryApplicationLinkOwnersResponse { + return QueryApplicationLinkOwnersResponse.fromAmino(object.value); + }, + fromProtoMsg( + message: QueryApplicationLinkOwnersResponseProtoMsg + ): QueryApplicationLinkOwnersResponse { + return QueryApplicationLinkOwnersResponse.decode(message.value); + }, + toProto(message: QueryApplicationLinkOwnersResponse): Uint8Array { + return QueryApplicationLinkOwnersResponse.encode(message).finish(); + }, + toProtoMsg( + message: QueryApplicationLinkOwnersResponse + ): QueryApplicationLinkOwnersResponseProtoMsg { + return { + typeUrl: "/desmos.profiles.v3.QueryApplicationLinkOwnersResponse", + value: QueryApplicationLinkOwnersResponse.encode(message).finish(), + }; + }, }; function createBaseQueryApplicationLinkOwnersResponse_ApplicationLinkOwnerDetails(): QueryApplicationLinkOwnersResponse_ApplicationLinkOwnerDetails { return { @@ -647,4 +1053,54 @@ export const QueryApplicationLinkOwnersResponse_ApplicationLinkOwnerDetails = { message.username = object.username ?? ""; return message; }, + fromAmino( + object: QueryApplicationLinkOwnersResponse_ApplicationLinkOwnerDetailsAmino + ): QueryApplicationLinkOwnersResponse_ApplicationLinkOwnerDetails { + return { + user: object.user, + application: object.application, + username: object.username, + }; + }, + toAmino( + message: QueryApplicationLinkOwnersResponse_ApplicationLinkOwnerDetails + ): QueryApplicationLinkOwnersResponse_ApplicationLinkOwnerDetailsAmino { + const obj: any = {}; + obj.user = message.user; + obj.application = message.application; + obj.username = message.username; + return obj; + }, + fromAminoMsg( + object: QueryApplicationLinkOwnersResponse_ApplicationLinkOwnerDetailsAminoMsg + ): QueryApplicationLinkOwnersResponse_ApplicationLinkOwnerDetails { + return QueryApplicationLinkOwnersResponse_ApplicationLinkOwnerDetails.fromAmino( + object.value + ); + }, + fromProtoMsg( + message: QueryApplicationLinkOwnersResponse_ApplicationLinkOwnerDetailsProtoMsg + ): QueryApplicationLinkOwnersResponse_ApplicationLinkOwnerDetails { + return QueryApplicationLinkOwnersResponse_ApplicationLinkOwnerDetails.decode( + message.value + ); + }, + toProto( + message: QueryApplicationLinkOwnersResponse_ApplicationLinkOwnerDetails + ): Uint8Array { + return QueryApplicationLinkOwnersResponse_ApplicationLinkOwnerDetails.encode( + message + ).finish(); + }, + toProtoMsg( + message: QueryApplicationLinkOwnersResponse_ApplicationLinkOwnerDetails + ): QueryApplicationLinkOwnersResponse_ApplicationLinkOwnerDetailsProtoMsg { + return { + typeUrl: "/desmos.profiles.v3.ApplicationLinkOwnerDetails", + value: + QueryApplicationLinkOwnersResponse_ApplicationLinkOwnerDetails.encode( + message + ).finish(), + }; + }, }; diff --git a/packages/types/src/desmos/profiles/v3/query_chain_links.ts b/packages/types/src/desmos/profiles/v3/query_chain_links.ts index 59f2de97f..cf010097b 100644 --- a/packages/types/src/desmos/profiles/v3/query_chain_links.ts +++ b/packages/types/src/desmos/profiles/v3/query_chain_links.ts @@ -1,9 +1,11 @@ /* eslint-disable */ import { PageRequest, + PageRequestAmino, PageResponse, + PageResponseAmino, } from "../../../cosmos/base/query/v1beta1/pagination"; -import { ChainLink } from "./models_chain_links"; +import { ChainLink, ChainLinkAmino } from "./models_chain_links"; import * as _m0 from "protobufjs/minimal"; import { isSet, DeepPartial, Exact } from "../../../helpers"; export const protobufPackage = "desmos.profiles.v3"; @@ -31,6 +33,38 @@ export interface QueryChainLinksRequest { /** Pagination defines an optional pagination for the request */ pagination?: PageRequest; } +export interface QueryChainLinksRequestProtoMsg { + typeUrl: "/desmos.profiles.v3.QueryChainLinksRequest"; + value: Uint8Array; +} +/** + * QueryChainLinksRequest represents the request that should be used in order + * to retrieve the link associated with the provided user, for the given chain + * and having the given target address + */ +export interface QueryChainLinksRequestAmino { + /** + * (optional) User represents the Desmos address of the user to which search + * the link for + */ + user: string; + /** + * (optional) ChainName contains the name of the chain to which search the + * link for. Used only if user is also set + */ + chain_name: string; + /** + * (optional) Target must contain the external address to which query the link + * for. Used only if chain name is also set + */ + target: string; + /** Pagination defines an optional pagination for the request */ + pagination?: PageRequestAmino; +} +export interface QueryChainLinksRequestAminoMsg { + type: "/desmos.profiles.v3.QueryChainLinksRequest"; + value: QueryChainLinksRequestAmino; +} /** * QueryChainLinksResponse is the response type for the * Query/ChainLinks RPC method. @@ -40,6 +74,23 @@ export interface QueryChainLinksResponse { /** Pagination defines the pagination response */ pagination?: PageResponse; } +export interface QueryChainLinksResponseProtoMsg { + typeUrl: "/desmos.profiles.v3.QueryChainLinksResponse"; + value: Uint8Array; +} +/** + * QueryChainLinksResponse is the response type for the + * Query/ChainLinks RPC method. + */ +export interface QueryChainLinksResponseAmino { + links: ChainLinkAmino[]; + /** Pagination defines the pagination response */ + pagination?: PageResponseAmino; +} +export interface QueryChainLinksResponseAminoMsg { + type: "/desmos.profiles.v3.QueryChainLinksResponse"; + value: QueryChainLinksResponseAmino; +} /** * QueryChainLinkOwnersRequest contains the data of the request that can * be used to get chain link owners @@ -58,6 +109,32 @@ export interface QueryChainLinkOwnersRequest { /** Pagination defines an optional pagination for the request */ pagination?: PageRequest; } +export interface QueryChainLinkOwnersRequestProtoMsg { + typeUrl: "/desmos.profiles.v3.QueryChainLinkOwnersRequest"; + value: Uint8Array; +} +/** + * QueryChainLinkOwnersRequest contains the data of the request that can + * be used to get chain link owners + */ +export interface QueryChainLinkOwnersRequestAmino { + /** + * (Optional) Chain name to search link owners of. If not specified, all + * links stored will be searched instead. + */ + chain_name: string; + /** + * (Optional) External address to search for. This will only be used if the + * chain name is specified as well + */ + target: string; + /** Pagination defines an optional pagination for the request */ + pagination?: PageRequestAmino; +} +export interface QueryChainLinkOwnersRequestAminoMsg { + type: "/desmos.profiles.v3.QueryChainLinkOwnersRequest"; + value: QueryChainLinkOwnersRequestAmino; +} /** * QueryChainLinkOwnersResponse contains the data returned by the request * allowing to get chain link owners. @@ -68,12 +145,44 @@ export interface QueryChainLinkOwnersResponse { /** Pagination defines the pagination response */ pagination?: PageResponse; } +export interface QueryChainLinkOwnersResponseProtoMsg { + typeUrl: "/desmos.profiles.v3.QueryChainLinkOwnersResponse"; + value: Uint8Array; +} +/** + * QueryChainLinkOwnersResponse contains the data returned by the request + * allowing to get chain link owners. + */ +export interface QueryChainLinkOwnersResponseAmino { + /** Addresses of the chain links owners */ + owners: QueryChainLinkOwnersResponse_ChainLinkOwnerDetailsAmino[]; + /** Pagination defines the pagination response */ + pagination?: PageResponseAmino; +} +export interface QueryChainLinkOwnersResponseAminoMsg { + type: "/desmos.profiles.v3.QueryChainLinkOwnersResponse"; + value: QueryChainLinkOwnersResponseAmino; +} /** ChainLinkOwnerDetails contains the details of a single chain link owner */ export interface QueryChainLinkOwnersResponse_ChainLinkOwnerDetails { user: string; chainName: string; target: string; } +export interface QueryChainLinkOwnersResponse_ChainLinkOwnerDetailsProtoMsg { + typeUrl: "/desmos.profiles.v3.ChainLinkOwnerDetails"; + value: Uint8Array; +} +/** ChainLinkOwnerDetails contains the details of a single chain link owner */ +export interface QueryChainLinkOwnersResponse_ChainLinkOwnerDetailsAmino { + user: string; + chain_name: string; + target: string; +} +export interface QueryChainLinkOwnersResponse_ChainLinkOwnerDetailsAminoMsg { + type: "/desmos.profiles.v3.ChainLinkOwnerDetails"; + value: QueryChainLinkOwnersResponse_ChainLinkOwnerDetailsAmino; +} /** * QueryDefaultExternalAddressesRequest is the request type for * Query/DefaultExternalAddresses RPC method @@ -86,6 +195,26 @@ export interface QueryDefaultExternalAddressesRequest { /** Pagination defines an optional pagination for the request. */ pagination?: PageRequest; } +export interface QueryDefaultExternalAddressesRequestProtoMsg { + typeUrl: "/desmos.profiles.v3.QueryDefaultExternalAddressesRequest"; + value: Uint8Array; +} +/** + * QueryDefaultExternalAddressesRequest is the request type for + * Query/DefaultExternalAddresses RPC method + */ +export interface QueryDefaultExternalAddressesRequestAmino { + /** (Optional) Owner for which to query the default addresses */ + owner: string; + /** (Optional) Chain name to query the default address for */ + chain_name: string; + /** Pagination defines an optional pagination for the request. */ + pagination?: PageRequestAmino; +} +export interface QueryDefaultExternalAddressesRequestAminoMsg { + type: "/desmos.profiles.v3.QueryDefaultExternalAddressesRequest"; + value: QueryDefaultExternalAddressesRequestAmino; +} /** * QueryDefaultExternalAddressesResponse is the response type for * Query/DefaultExternalAddresses RPC method @@ -98,6 +227,26 @@ export interface QueryDefaultExternalAddressesResponse { links: ChainLink[]; pagination?: PageResponse; } +export interface QueryDefaultExternalAddressesResponseProtoMsg { + typeUrl: "/desmos.profiles.v3.QueryDefaultExternalAddressesResponse"; + value: Uint8Array; +} +/** + * QueryDefaultExternalAddressesResponse is the response type for + * Query/DefaultExternalAddresses RPC method + */ +export interface QueryDefaultExternalAddressesResponseAmino { + /** + * List of default addresses, each one represented by the associated chain + * link + */ + links: ChainLinkAmino[]; + pagination?: PageResponseAmino; +} +export interface QueryDefaultExternalAddressesResponseAminoMsg { + type: "/desmos.profiles.v3.QueryDefaultExternalAddressesResponse"; + value: QueryDefaultExternalAddressesResponseAmino; +} function createBaseQueryChainLinksRequest(): QueryChainLinksRequest { return { user: "", @@ -188,6 +337,43 @@ export const QueryChainLinksRequest = { : undefined; return message; }, + fromAmino(object: QueryChainLinksRequestAmino): QueryChainLinksRequest { + return { + user: object.user, + chainName: object.chain_name, + target: object.target, + pagination: object?.pagination + ? PageRequest.fromAmino(object.pagination) + : undefined, + }; + }, + toAmino(message: QueryChainLinksRequest): QueryChainLinksRequestAmino { + const obj: any = {}; + obj.user = message.user; + obj.chain_name = message.chainName; + obj.target = message.target; + obj.pagination = message.pagination + ? PageRequest.toAmino(message.pagination) + : undefined; + return obj; + }, + fromAminoMsg(object: QueryChainLinksRequestAminoMsg): QueryChainLinksRequest { + return QueryChainLinksRequest.fromAmino(object.value); + }, + fromProtoMsg( + message: QueryChainLinksRequestProtoMsg + ): QueryChainLinksRequest { + return QueryChainLinksRequest.decode(message.value); + }, + toProto(message: QueryChainLinksRequest): Uint8Array { + return QueryChainLinksRequest.encode(message).finish(); + }, + toProtoMsg(message: QueryChainLinksRequest): QueryChainLinksRequestProtoMsg { + return { + typeUrl: "/desmos.profiles.v3.QueryChainLinksRequest", + value: QueryChainLinksRequest.encode(message).finish(), + }; + }, }; function createBaseQueryChainLinksResponse(): QueryChainLinksResponse { return { @@ -270,6 +456,51 @@ export const QueryChainLinksResponse = { : undefined; return message; }, + fromAmino(object: QueryChainLinksResponseAmino): QueryChainLinksResponse { + return { + links: Array.isArray(object?.links) + ? object.links.map((e: any) => ChainLink.fromAmino(e)) + : [], + pagination: object?.pagination + ? PageResponse.fromAmino(object.pagination) + : undefined, + }; + }, + toAmino(message: QueryChainLinksResponse): QueryChainLinksResponseAmino { + const obj: any = {}; + if (message.links) { + obj.links = message.links.map((e) => + e ? ChainLink.toAmino(e) : undefined + ); + } else { + obj.links = []; + } + obj.pagination = message.pagination + ? PageResponse.toAmino(message.pagination) + : undefined; + return obj; + }, + fromAminoMsg( + object: QueryChainLinksResponseAminoMsg + ): QueryChainLinksResponse { + return QueryChainLinksResponse.fromAmino(object.value); + }, + fromProtoMsg( + message: QueryChainLinksResponseProtoMsg + ): QueryChainLinksResponse { + return QueryChainLinksResponse.decode(message.value); + }, + toProto(message: QueryChainLinksResponse): Uint8Array { + return QueryChainLinksResponse.encode(message).finish(); + }, + toProtoMsg( + message: QueryChainLinksResponse + ): QueryChainLinksResponseProtoMsg { + return { + typeUrl: "/desmos.profiles.v3.QueryChainLinksResponse", + value: QueryChainLinksResponse.encode(message).finish(), + }; + }, }; function createBaseQueryChainLinkOwnersRequest(): QueryChainLinkOwnersRequest { return { @@ -351,6 +582,49 @@ export const QueryChainLinkOwnersRequest = { : undefined; return message; }, + fromAmino( + object: QueryChainLinkOwnersRequestAmino + ): QueryChainLinkOwnersRequest { + return { + chainName: object.chain_name, + target: object.target, + pagination: object?.pagination + ? PageRequest.fromAmino(object.pagination) + : undefined, + }; + }, + toAmino( + message: QueryChainLinkOwnersRequest + ): QueryChainLinkOwnersRequestAmino { + const obj: any = {}; + obj.chain_name = message.chainName; + obj.target = message.target; + obj.pagination = message.pagination + ? PageRequest.toAmino(message.pagination) + : undefined; + return obj; + }, + fromAminoMsg( + object: QueryChainLinkOwnersRequestAminoMsg + ): QueryChainLinkOwnersRequest { + return QueryChainLinkOwnersRequest.fromAmino(object.value); + }, + fromProtoMsg( + message: QueryChainLinkOwnersRequestProtoMsg + ): QueryChainLinkOwnersRequest { + return QueryChainLinkOwnersRequest.decode(message.value); + }, + toProto(message: QueryChainLinkOwnersRequest): Uint8Array { + return QueryChainLinkOwnersRequest.encode(message).finish(); + }, + toProtoMsg( + message: QueryChainLinkOwnersRequest + ): QueryChainLinkOwnersRequestProtoMsg { + return { + typeUrl: "/desmos.profiles.v3.QueryChainLinkOwnersRequest", + value: QueryChainLinkOwnersRequest.encode(message).finish(), + }; + }, }; function createBaseQueryChainLinkOwnersResponse(): QueryChainLinkOwnersResponse { return { @@ -448,6 +722,59 @@ export const QueryChainLinkOwnersResponse = { : undefined; return message; }, + fromAmino( + object: QueryChainLinkOwnersResponseAmino + ): QueryChainLinkOwnersResponse { + return { + owners: Array.isArray(object?.owners) + ? object.owners.map((e: any) => + QueryChainLinkOwnersResponse_ChainLinkOwnerDetails.fromAmino(e) + ) + : [], + pagination: object?.pagination + ? PageResponse.fromAmino(object.pagination) + : undefined, + }; + }, + toAmino( + message: QueryChainLinkOwnersResponse + ): QueryChainLinkOwnersResponseAmino { + const obj: any = {}; + if (message.owners) { + obj.owners = message.owners.map((e) => + e + ? QueryChainLinkOwnersResponse_ChainLinkOwnerDetails.toAmino(e) + : undefined + ); + } else { + obj.owners = []; + } + obj.pagination = message.pagination + ? PageResponse.toAmino(message.pagination) + : undefined; + return obj; + }, + fromAminoMsg( + object: QueryChainLinkOwnersResponseAminoMsg + ): QueryChainLinkOwnersResponse { + return QueryChainLinkOwnersResponse.fromAmino(object.value); + }, + fromProtoMsg( + message: QueryChainLinkOwnersResponseProtoMsg + ): QueryChainLinkOwnersResponse { + return QueryChainLinkOwnersResponse.decode(message.value); + }, + toProto(message: QueryChainLinkOwnersResponse): Uint8Array { + return QueryChainLinkOwnersResponse.encode(message).finish(); + }, + toProtoMsg( + message: QueryChainLinkOwnersResponse + ): QueryChainLinkOwnersResponseProtoMsg { + return { + typeUrl: "/desmos.profiles.v3.QueryChainLinkOwnersResponse", + value: QueryChainLinkOwnersResponse.encode(message).finish(), + }; + }, }; function createBaseQueryChainLinkOwnersResponse_ChainLinkOwnerDetails(): QueryChainLinkOwnersResponse_ChainLinkOwnerDetails { return { @@ -526,6 +853,56 @@ export const QueryChainLinkOwnersResponse_ChainLinkOwnerDetails = { message.target = object.target ?? ""; return message; }, + fromAmino( + object: QueryChainLinkOwnersResponse_ChainLinkOwnerDetailsAmino + ): QueryChainLinkOwnersResponse_ChainLinkOwnerDetails { + return { + user: object.user, + chainName: object.chain_name, + target: object.target, + }; + }, + toAmino( + message: QueryChainLinkOwnersResponse_ChainLinkOwnerDetails + ): QueryChainLinkOwnersResponse_ChainLinkOwnerDetailsAmino { + const obj: any = {}; + obj.user = message.user; + obj.chain_name = message.chainName; + obj.target = message.target; + return obj; + }, + fromAminoMsg( + object: QueryChainLinkOwnersResponse_ChainLinkOwnerDetailsAminoMsg + ): QueryChainLinkOwnersResponse_ChainLinkOwnerDetails { + return QueryChainLinkOwnersResponse_ChainLinkOwnerDetails.fromAmino( + object.value + ); + }, + fromProtoMsg( + message: QueryChainLinkOwnersResponse_ChainLinkOwnerDetailsProtoMsg + ): QueryChainLinkOwnersResponse_ChainLinkOwnerDetails { + return QueryChainLinkOwnersResponse_ChainLinkOwnerDetails.decode( + message.value + ); + }, + toProto( + message: QueryChainLinkOwnersResponse_ChainLinkOwnerDetails + ): Uint8Array { + return QueryChainLinkOwnersResponse_ChainLinkOwnerDetails.encode( + message + ).finish(); + }, + toProtoMsg( + message: QueryChainLinkOwnersResponse_ChainLinkOwnerDetails + ): QueryChainLinkOwnersResponse_ChainLinkOwnerDetailsProtoMsg { + return { + typeUrl: "/desmos.profiles.v3.ChainLinkOwnerDetails", + value: + QueryChainLinkOwnersResponse_ChainLinkOwnerDetails.encode( + message + ).finish(), + }; + }, }; function createBaseQueryDefaultExternalAddressesRequest(): QueryDefaultExternalAddressesRequest { return { @@ -607,6 +984,49 @@ export const QueryDefaultExternalAddressesRequest = { : undefined; return message; }, + fromAmino( + object: QueryDefaultExternalAddressesRequestAmino + ): QueryDefaultExternalAddressesRequest { + return { + owner: object.owner, + chainName: object.chain_name, + pagination: object?.pagination + ? PageRequest.fromAmino(object.pagination) + : undefined, + }; + }, + toAmino( + message: QueryDefaultExternalAddressesRequest + ): QueryDefaultExternalAddressesRequestAmino { + const obj: any = {}; + obj.owner = message.owner; + obj.chain_name = message.chainName; + obj.pagination = message.pagination + ? PageRequest.toAmino(message.pagination) + : undefined; + return obj; + }, + fromAminoMsg( + object: QueryDefaultExternalAddressesRequestAminoMsg + ): QueryDefaultExternalAddressesRequest { + return QueryDefaultExternalAddressesRequest.fromAmino(object.value); + }, + fromProtoMsg( + message: QueryDefaultExternalAddressesRequestProtoMsg + ): QueryDefaultExternalAddressesRequest { + return QueryDefaultExternalAddressesRequest.decode(message.value); + }, + toProto(message: QueryDefaultExternalAddressesRequest): Uint8Array { + return QueryDefaultExternalAddressesRequest.encode(message).finish(); + }, + toProtoMsg( + message: QueryDefaultExternalAddressesRequest + ): QueryDefaultExternalAddressesRequestProtoMsg { + return { + typeUrl: "/desmos.profiles.v3.QueryDefaultExternalAddressesRequest", + value: QueryDefaultExternalAddressesRequest.encode(message).finish(), + }; + }, }; function createBaseQueryDefaultExternalAddressesResponse(): QueryDefaultExternalAddressesResponse { return { @@ -689,4 +1109,53 @@ export const QueryDefaultExternalAddressesResponse = { : undefined; return message; }, + fromAmino( + object: QueryDefaultExternalAddressesResponseAmino + ): QueryDefaultExternalAddressesResponse { + return { + links: Array.isArray(object?.links) + ? object.links.map((e: any) => ChainLink.fromAmino(e)) + : [], + pagination: object?.pagination + ? PageResponse.fromAmino(object.pagination) + : undefined, + }; + }, + toAmino( + message: QueryDefaultExternalAddressesResponse + ): QueryDefaultExternalAddressesResponseAmino { + const obj: any = {}; + if (message.links) { + obj.links = message.links.map((e) => + e ? ChainLink.toAmino(e) : undefined + ); + } else { + obj.links = []; + } + obj.pagination = message.pagination + ? PageResponse.toAmino(message.pagination) + : undefined; + return obj; + }, + fromAminoMsg( + object: QueryDefaultExternalAddressesResponseAminoMsg + ): QueryDefaultExternalAddressesResponse { + return QueryDefaultExternalAddressesResponse.fromAmino(object.value); + }, + fromProtoMsg( + message: QueryDefaultExternalAddressesResponseProtoMsg + ): QueryDefaultExternalAddressesResponse { + return QueryDefaultExternalAddressesResponse.decode(message.value); + }, + toProto(message: QueryDefaultExternalAddressesResponse): Uint8Array { + return QueryDefaultExternalAddressesResponse.encode(message).finish(); + }, + toProtoMsg( + message: QueryDefaultExternalAddressesResponse + ): QueryDefaultExternalAddressesResponseProtoMsg { + return { + typeUrl: "/desmos.profiles.v3.QueryDefaultExternalAddressesResponse", + value: QueryDefaultExternalAddressesResponse.encode(message).finish(), + }; + }, }; diff --git a/packages/types/src/desmos/profiles/v3/query_dtag_requests.ts b/packages/types/src/desmos/profiles/v3/query_dtag_requests.ts index aec7ed2b2..4a94a282c 100644 --- a/packages/types/src/desmos/profiles/v3/query_dtag_requests.ts +++ b/packages/types/src/desmos/profiles/v3/query_dtag_requests.ts @@ -1,9 +1,14 @@ /* eslint-disable */ import { PageRequest, + PageRequestAmino, PageResponse, + PageResponseAmino, } from "../../../cosmos/base/query/v1beta1/pagination"; -import { DTagTransferRequest } from "./models_dtag_requests"; +import { + DTagTransferRequest, + DTagTransferRequestAmino, +} from "./models_dtag_requests"; import * as _m0 from "protobufjs/minimal"; import { isSet, DeepPartial, Exact } from "../../../helpers"; export const protobufPackage = "desmos.profiles.v3"; @@ -20,6 +25,27 @@ export interface QueryIncomingDTagTransferRequestsRequest { /** Pagination defines an optional pagination for the request */ pagination?: PageRequest; } +export interface QueryIncomingDTagTransferRequestsRequestProtoMsg { + typeUrl: "/desmos.profiles.v3.QueryIncomingDTagTransferRequestsRequest"; + value: Uint8Array; +} +/** + * QueryIncomingDTagTransferRequestsRequest is the request type for the + * Query/IncomingDTagTransferRequests RPC endpoint + */ +export interface QueryIncomingDTagTransferRequestsRequestAmino { + /** + * (optional) Receiver represents the address of the user to which query the + * incoming requests for + */ + receiver: string; + /** Pagination defines an optional pagination for the request */ + pagination?: PageRequestAmino; +} +export interface QueryIncomingDTagTransferRequestsRequestAminoMsg { + type: "/desmos.profiles.v3.QueryIncomingDTagTransferRequestsRequest"; + value: QueryIncomingDTagTransferRequestsRequestAmino; +} /** * QueryIncomingDTagTransferRequestsResponse is the response type for the * Query/IncomingDTagTransferRequests RPC method. @@ -33,6 +59,27 @@ export interface QueryIncomingDTagTransferRequestsResponse { /** Pagination defines the pagination response */ pagination?: PageResponse; } +export interface QueryIncomingDTagTransferRequestsResponseProtoMsg { + typeUrl: "/desmos.profiles.v3.QueryIncomingDTagTransferRequestsResponse"; + value: Uint8Array; +} +/** + * QueryIncomingDTagTransferRequestsResponse is the response type for the + * Query/IncomingDTagTransferRequests RPC method. + */ +export interface QueryIncomingDTagTransferRequestsResponseAmino { + /** + * Requests represent the list of all the DTag transfer requests made towards + * the user + */ + requests: DTagTransferRequestAmino[]; + /** Pagination defines the pagination response */ + pagination?: PageResponseAmino; +} +export interface QueryIncomingDTagTransferRequestsResponseAminoMsg { + type: "/desmos.profiles.v3.QueryIncomingDTagTransferRequestsResponse"; + value: QueryIncomingDTagTransferRequestsResponseAmino; +} function createBaseQueryIncomingDTagTransferRequestsRequest(): QueryIncomingDTagTransferRequestsRequest { return { receiver: "", @@ -103,6 +150,47 @@ export const QueryIncomingDTagTransferRequestsRequest = { : undefined; return message; }, + fromAmino( + object: QueryIncomingDTagTransferRequestsRequestAmino + ): QueryIncomingDTagTransferRequestsRequest { + return { + receiver: object.receiver, + pagination: object?.pagination + ? PageRequest.fromAmino(object.pagination) + : undefined, + }; + }, + toAmino( + message: QueryIncomingDTagTransferRequestsRequest + ): QueryIncomingDTagTransferRequestsRequestAmino { + const obj: any = {}; + obj.receiver = message.receiver; + obj.pagination = message.pagination + ? PageRequest.toAmino(message.pagination) + : undefined; + return obj; + }, + fromAminoMsg( + object: QueryIncomingDTagTransferRequestsRequestAminoMsg + ): QueryIncomingDTagTransferRequestsRequest { + return QueryIncomingDTagTransferRequestsRequest.fromAmino(object.value); + }, + fromProtoMsg( + message: QueryIncomingDTagTransferRequestsRequestProtoMsg + ): QueryIncomingDTagTransferRequestsRequest { + return QueryIncomingDTagTransferRequestsRequest.decode(message.value); + }, + toProto(message: QueryIncomingDTagTransferRequestsRequest): Uint8Array { + return QueryIncomingDTagTransferRequestsRequest.encode(message).finish(); + }, + toProtoMsg( + message: QueryIncomingDTagTransferRequestsRequest + ): QueryIncomingDTagTransferRequestsRequestProtoMsg { + return { + typeUrl: "/desmos.profiles.v3.QueryIncomingDTagTransferRequestsRequest", + value: QueryIncomingDTagTransferRequestsRequest.encode(message).finish(), + }; + }, }; function createBaseQueryIncomingDTagTransferRequestsResponse(): QueryIncomingDTagTransferRequestsResponse { return { @@ -188,4 +276,53 @@ export const QueryIncomingDTagTransferRequestsResponse = { : undefined; return message; }, + fromAmino( + object: QueryIncomingDTagTransferRequestsResponseAmino + ): QueryIncomingDTagTransferRequestsResponse { + return { + requests: Array.isArray(object?.requests) + ? object.requests.map((e: any) => DTagTransferRequest.fromAmino(e)) + : [], + pagination: object?.pagination + ? PageResponse.fromAmino(object.pagination) + : undefined, + }; + }, + toAmino( + message: QueryIncomingDTagTransferRequestsResponse + ): QueryIncomingDTagTransferRequestsResponseAmino { + const obj: any = {}; + if (message.requests) { + obj.requests = message.requests.map((e) => + e ? DTagTransferRequest.toAmino(e) : undefined + ); + } else { + obj.requests = []; + } + obj.pagination = message.pagination + ? PageResponse.toAmino(message.pagination) + : undefined; + return obj; + }, + fromAminoMsg( + object: QueryIncomingDTagTransferRequestsResponseAminoMsg + ): QueryIncomingDTagTransferRequestsResponse { + return QueryIncomingDTagTransferRequestsResponse.fromAmino(object.value); + }, + fromProtoMsg( + message: QueryIncomingDTagTransferRequestsResponseProtoMsg + ): QueryIncomingDTagTransferRequestsResponse { + return QueryIncomingDTagTransferRequestsResponse.decode(message.value); + }, + toProto(message: QueryIncomingDTagTransferRequestsResponse): Uint8Array { + return QueryIncomingDTagTransferRequestsResponse.encode(message).finish(); + }, + toProtoMsg( + message: QueryIncomingDTagTransferRequestsResponse + ): QueryIncomingDTagTransferRequestsResponseProtoMsg { + return { + typeUrl: "/desmos.profiles.v3.QueryIncomingDTagTransferRequestsResponse", + value: QueryIncomingDTagTransferRequestsResponse.encode(message).finish(), + }; + }, }; diff --git a/packages/types/src/desmos/profiles/v3/query_params.ts b/packages/types/src/desmos/profiles/v3/query_params.ts index d54cdfc2f..aa039e8ed 100644 --- a/packages/types/src/desmos/profiles/v3/query_params.ts +++ b/packages/types/src/desmos/profiles/v3/query_params.ts @@ -1,14 +1,36 @@ /* eslint-disable */ -import { Params } from "./models_params"; +import { Params, ParamsAmino } from "./models_params"; import * as _m0 from "protobufjs/minimal"; import { DeepPartial, Exact, isSet } from "../../../helpers"; export const protobufPackage = "desmos.profiles.v3"; /** QueryParamsRequest is the request type for the Query/Params RPC endpoint */ export interface QueryParamsRequest {} +export interface QueryParamsRequestProtoMsg { + typeUrl: "/desmos.profiles.v3.QueryParamsRequest"; + value: Uint8Array; +} +/** QueryParamsRequest is the request type for the Query/Params RPC endpoint */ +export interface QueryParamsRequestAmino {} +export interface QueryParamsRequestAminoMsg { + type: "/desmos.profiles.v3.QueryParamsRequest"; + value: QueryParamsRequestAmino; +} /** QueryParamsResponse is the response type for the Query/Params RPC method. */ export interface QueryParamsResponse { params?: Params; } +export interface QueryParamsResponseProtoMsg { + typeUrl: "/desmos.profiles.v3.QueryParamsResponse"; + value: Uint8Array; +} +/** QueryParamsResponse is the response type for the Query/Params RPC method. */ +export interface QueryParamsResponseAmino { + params?: ParamsAmino; +} +export interface QueryParamsResponseAminoMsg { + type: "/desmos.profiles.v3.QueryParamsResponse"; + value: QueryParamsResponseAmino; +} function createBaseQueryParamsRequest(): QueryParamsRequest { return {}; } @@ -46,6 +68,28 @@ export const QueryParamsRequest = { const message = createBaseQueryParamsRequest(); return message; }, + fromAmino(_: QueryParamsRequestAmino): QueryParamsRequest { + return {}; + }, + toAmino(_: QueryParamsRequest): QueryParamsRequestAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg(object: QueryParamsRequestAminoMsg): QueryParamsRequest { + return QueryParamsRequest.fromAmino(object.value); + }, + fromProtoMsg(message: QueryParamsRequestProtoMsg): QueryParamsRequest { + return QueryParamsRequest.decode(message.value); + }, + toProto(message: QueryParamsRequest): Uint8Array { + return QueryParamsRequest.encode(message).finish(); + }, + toProtoMsg(message: QueryParamsRequest): QueryParamsRequestProtoMsg { + return { + typeUrl: "/desmos.profiles.v3.QueryParamsRequest", + value: QueryParamsRequest.encode(message).finish(), + }; + }, }; function createBaseQueryParamsResponse(): QueryParamsResponse { return { @@ -100,4 +144,29 @@ export const QueryParamsResponse = { : undefined; return message; }, + fromAmino(object: QueryParamsResponseAmino): QueryParamsResponse { + return { + params: object?.params ? Params.fromAmino(object.params) : undefined, + }; + }, + toAmino(message: QueryParamsResponse): QueryParamsResponseAmino { + const obj: any = {}; + obj.params = message.params ? Params.toAmino(message.params) : undefined; + return obj; + }, + fromAminoMsg(object: QueryParamsResponseAminoMsg): QueryParamsResponse { + return QueryParamsResponse.fromAmino(object.value); + }, + fromProtoMsg(message: QueryParamsResponseProtoMsg): QueryParamsResponse { + return QueryParamsResponse.decode(message.value); + }, + toProto(message: QueryParamsResponse): Uint8Array { + return QueryParamsResponse.encode(message).finish(); + }, + toProtoMsg(message: QueryParamsResponse): QueryParamsResponseProtoMsg { + return { + typeUrl: "/desmos.profiles.v3.QueryParamsResponse", + value: QueryParamsResponse.encode(message).finish(), + }; + }, }; diff --git a/packages/types/src/desmos/profiles/v3/query_profile.ts b/packages/types/src/desmos/profiles/v3/query_profile.ts index f95a0eca4..a0c7130e6 100644 --- a/packages/types/src/desmos/profiles/v3/query_profile.ts +++ b/packages/types/src/desmos/profiles/v3/query_profile.ts @@ -1,5 +1,5 @@ /* eslint-disable */ -import { Any } from "../../../google/protobuf/any"; +import { Any, AnyAmino } from "../../../google/protobuf/any"; import * as _m0 from "protobufjs/minimal"; import { isSet, DeepPartial, Exact } from "../../../helpers"; export const protobufPackage = "desmos.profiles.v3"; @@ -8,10 +8,35 @@ export interface QueryProfileRequest { /** Address or DTag of the user to query the profile for */ user: string; } +export interface QueryProfileRequestProtoMsg { + typeUrl: "/desmos.profiles.v3.QueryProfileRequest"; + value: Uint8Array; +} +/** QueryProfileRequest is the request type for the Query/Profile RPC method. */ +export interface QueryProfileRequestAmino { + /** Address or DTag of the user to query the profile for */ + user: string; +} +export interface QueryProfileRequestAminoMsg { + type: "/desmos.profiles.v3.QueryProfileRequest"; + value: QueryProfileRequestAmino; +} /** QueryProfileResponse is the response type for the Query/Profile RPC method. */ export interface QueryProfileResponse { profile?: Any; } +export interface QueryProfileResponseProtoMsg { + typeUrl: "/desmos.profiles.v3.QueryProfileResponse"; + value: Uint8Array; +} +/** QueryProfileResponse is the response type for the Query/Profile RPC method. */ +export interface QueryProfileResponseAmino { + profile?: AnyAmino; +} +export interface QueryProfileResponseAminoMsg { + type: "/desmos.profiles.v3.QueryProfileResponse"; + value: QueryProfileResponseAmino; +} function createBaseQueryProfileRequest(): QueryProfileRequest { return { user: "", @@ -61,6 +86,31 @@ export const QueryProfileRequest = { message.user = object.user ?? ""; return message; }, + fromAmino(object: QueryProfileRequestAmino): QueryProfileRequest { + return { + user: object.user, + }; + }, + toAmino(message: QueryProfileRequest): QueryProfileRequestAmino { + const obj: any = {}; + obj.user = message.user; + return obj; + }, + fromAminoMsg(object: QueryProfileRequestAminoMsg): QueryProfileRequest { + return QueryProfileRequest.fromAmino(object.value); + }, + fromProtoMsg(message: QueryProfileRequestProtoMsg): QueryProfileRequest { + return QueryProfileRequest.decode(message.value); + }, + toProto(message: QueryProfileRequest): Uint8Array { + return QueryProfileRequest.encode(message).finish(); + }, + toProtoMsg(message: QueryProfileRequest): QueryProfileRequestProtoMsg { + return { + typeUrl: "/desmos.profiles.v3.QueryProfileRequest", + value: QueryProfileRequest.encode(message).finish(), + }; + }, }; function createBaseQueryProfileResponse(): QueryProfileResponse { return { @@ -118,4 +168,29 @@ export const QueryProfileResponse = { : undefined; return message; }, + fromAmino(object: QueryProfileResponseAmino): QueryProfileResponse { + return { + profile: object?.profile ? Any.fromAmino(object.profile) : undefined, + }; + }, + toAmino(message: QueryProfileResponse): QueryProfileResponseAmino { + const obj: any = {}; + obj.profile = message.profile ? Any.toAmino(message.profile) : undefined; + return obj; + }, + fromAminoMsg(object: QueryProfileResponseAminoMsg): QueryProfileResponse { + return QueryProfileResponse.fromAmino(object.value); + }, + fromProtoMsg(message: QueryProfileResponseProtoMsg): QueryProfileResponse { + return QueryProfileResponse.decode(message.value); + }, + toProto(message: QueryProfileResponse): Uint8Array { + return QueryProfileResponse.encode(message).finish(); + }, + toProtoMsg(message: QueryProfileResponse): QueryProfileResponseProtoMsg { + return { + typeUrl: "/desmos.profiles.v3.QueryProfileResponse", + value: QueryProfileResponse.encode(message).finish(), + }; + }, }; diff --git a/packages/types/src/desmos/reactions/v1/client/cli.ts b/packages/types/src/desmos/reactions/v1/client/cli.ts deleted file mode 100644 index c19a4d34c..000000000 --- a/packages/types/src/desmos/reactions/v1/client/cli.ts +++ /dev/null @@ -1,109 +0,0 @@ -/* eslint-disable */ -import { RegisteredReactionValueParams, FreeTextValueParams } from "../models"; -import * as _m0 from "protobufjs/minimal"; -import { isSet, DeepPartial, Exact } from "../../../../helpers"; -export const protobufPackage = "desmos.reactions.v1.client"; -/** - * SetReactionsParamsJSON contains the data that can be specified when setting a - * subspace reactions params using the CLI command - */ -export interface SetReactionsParamsJSON { - /** Params related to RegisteredReactionValue reactions */ - registeredReactionParams?: RegisteredReactionValueParams; - /** Params related to FreeTextValue reactions */ - freeTextParams?: FreeTextValueParams; -} -function createBaseSetReactionsParamsJSON(): SetReactionsParamsJSON { - return { - registeredReactionParams: undefined, - freeTextParams: undefined, - }; -} -export const SetReactionsParamsJSON = { - encode( - message: SetReactionsParamsJSON, - writer: _m0.Writer = _m0.Writer.create() - ): _m0.Writer { - if (message.registeredReactionParams !== undefined) { - RegisteredReactionValueParams.encode( - message.registeredReactionParams, - writer.uint32(10).fork() - ).ldelim(); - } - if (message.freeTextParams !== undefined) { - FreeTextValueParams.encode( - message.freeTextParams, - writer.uint32(18).fork() - ).ldelim(); - } - return writer; - }, - decode( - input: _m0.Reader | Uint8Array, - length?: number - ): SetReactionsParamsJSON { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseSetReactionsParamsJSON(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.registeredReactionParams = - RegisteredReactionValueParams.decode(reader, reader.uint32()); - break; - case 2: - message.freeTextParams = FreeTextValueParams.decode( - reader, - reader.uint32() - ); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }, - fromJSON(object: any): SetReactionsParamsJSON { - return { - registeredReactionParams: isSet(object.registeredReactionParams) - ? RegisteredReactionValueParams.fromJSON( - object.registeredReactionParams - ) - : undefined, - freeTextParams: isSet(object.freeTextParams) - ? FreeTextValueParams.fromJSON(object.freeTextParams) - : undefined, - }; - }, - toJSON(message: SetReactionsParamsJSON): unknown { - const obj: any = {}; - message.registeredReactionParams !== undefined && - (obj.registeredReactionParams = message.registeredReactionParams - ? RegisteredReactionValueParams.toJSON(message.registeredReactionParams) - : undefined); - message.freeTextParams !== undefined && - (obj.freeTextParams = message.freeTextParams - ? FreeTextValueParams.toJSON(message.freeTextParams) - : undefined); - return obj; - }, - fromPartial, I>>( - object: I - ): SetReactionsParamsJSON { - const message = createBaseSetReactionsParamsJSON(); - message.registeredReactionParams = - object.registeredReactionParams !== undefined && - object.registeredReactionParams !== null - ? RegisteredReactionValueParams.fromPartial( - object.registeredReactionParams - ) - : undefined; - message.freeTextParams = - object.freeTextParams !== undefined && object.freeTextParams !== null - ? FreeTextValueParams.fromPartial(object.freeTextParams) - : undefined; - return message; - }, -}; diff --git a/packages/types/src/desmos/reactions/v1/genesis.ts b/packages/types/src/desmos/reactions/v1/genesis.ts index 6bc20896e..825ba9311 100644 --- a/packages/types/src/desmos/reactions/v1/genesis.ts +++ b/packages/types/src/desmos/reactions/v1/genesis.ts @@ -1,8 +1,11 @@ /* eslint-disable */ import { RegisteredReaction, + RegisteredReactionAmino, Reaction, + ReactionAmino, SubspaceReactionsParams, + SubspaceReactionsParamsAmino, } from "./models"; import { Long, DeepPartial, Exact, isSet } from "../../../helpers"; import * as _m0 from "protobufjs/minimal"; @@ -15,17 +18,60 @@ export interface GenesisState { reactions: Reaction[]; subspacesParams: SubspaceReactionsParams[]; } +export interface GenesisStateProtoMsg { + typeUrl: "/desmos.reactions.v1.GenesisState"; + value: Uint8Array; +} +/** GenesisState contains the data of the genesis state for the reactions module */ +export interface GenesisStateAmino { + subspaces_data: SubspaceDataEntryAmino[]; + registered_reactions: RegisteredReactionAmino[]; + posts_data: PostDataEntryAmino[]; + reactions: ReactionAmino[]; + subspaces_params: SubspaceReactionsParamsAmino[]; +} +export interface GenesisStateAminoMsg { + type: "/desmos.reactions.v1.GenesisState"; + value: GenesisStateAmino; +} /** SubspaceDataEntry contains the data related to a single subspace */ export interface SubspaceDataEntry { subspaceId: Long; registeredReactionId: number; } +export interface SubspaceDataEntryProtoMsg { + typeUrl: "/desmos.reactions.v1.SubspaceDataEntry"; + value: Uint8Array; +} +/** SubspaceDataEntry contains the data related to a single subspace */ +export interface SubspaceDataEntryAmino { + subspace_id: string; + registered_reaction_id: number; +} +export interface SubspaceDataEntryAminoMsg { + type: "/desmos.reactions.v1.SubspaceDataEntry"; + value: SubspaceDataEntryAmino; +} /** PostDataEntry contains the data related to a single post */ export interface PostDataEntry { subspaceId: Long; postId: Long; reactionId: number; } +export interface PostDataEntryProtoMsg { + typeUrl: "/desmos.reactions.v1.PostDataEntry"; + value: Uint8Array; +} +/** PostDataEntry contains the data related to a single post */ +export interface PostDataEntryAmino { + subspace_id: string; + post_id: string; + reaction_id: number; +} +export interface PostDataEntryAminoMsg { + type: "/desmos.reactions.v1.PostDataEntry"; + value: PostDataEntryAmino; +} function createBaseGenesisState(): GenesisState { return { subspacesData: [], @@ -174,6 +220,83 @@ export const GenesisState = { ) || []; return message; }, + fromAmino(object: GenesisStateAmino): GenesisState { + return { + subspacesData: Array.isArray(object?.subspaces_data) + ? object.subspaces_data.map((e: any) => SubspaceDataEntry.fromAmino(e)) + : [], + registeredReactions: Array.isArray(object?.registered_reactions) + ? object.registered_reactions.map((e: any) => + RegisteredReaction.fromAmino(e) + ) + : [], + postsData: Array.isArray(object?.posts_data) + ? object.posts_data.map((e: any) => PostDataEntry.fromAmino(e)) + : [], + reactions: Array.isArray(object?.reactions) + ? object.reactions.map((e: any) => Reaction.fromAmino(e)) + : [], + subspacesParams: Array.isArray(object?.subspaces_params) + ? object.subspaces_params.map((e: any) => + SubspaceReactionsParams.fromAmino(e) + ) + : [], + }; + }, + toAmino(message: GenesisState): GenesisStateAmino { + const obj: any = {}; + if (message.subspacesData) { + obj.subspaces_data = message.subspacesData.map((e) => + e ? SubspaceDataEntry.toAmino(e) : undefined + ); + } else { + obj.subspaces_data = []; + } + if (message.registeredReactions) { + obj.registered_reactions = message.registeredReactions.map((e) => + e ? RegisteredReaction.toAmino(e) : undefined + ); + } else { + obj.registered_reactions = []; + } + if (message.postsData) { + obj.posts_data = message.postsData.map((e) => + e ? PostDataEntry.toAmino(e) : undefined + ); + } else { + obj.posts_data = []; + } + if (message.reactions) { + obj.reactions = message.reactions.map((e) => + e ? Reaction.toAmino(e) : undefined + ); + } else { + obj.reactions = []; + } + if (message.subspacesParams) { + obj.subspaces_params = message.subspacesParams.map((e) => + e ? SubspaceReactionsParams.toAmino(e) : undefined + ); + } else { + obj.subspaces_params = []; + } + return obj; + }, + fromAminoMsg(object: GenesisStateAminoMsg): GenesisState { + return GenesisState.fromAmino(object.value); + }, + fromProtoMsg(message: GenesisStateProtoMsg): GenesisState { + return GenesisState.decode(message.value); + }, + toProto(message: GenesisState): Uint8Array { + return GenesisState.encode(message).finish(); + }, + toProtoMsg(message: GenesisState): GenesisStateProtoMsg { + return { + typeUrl: "/desmos.reactions.v1.GenesisState", + value: GenesisState.encode(message).finish(), + }; + }, }; function createBaseSubspaceDataEntry(): SubspaceDataEntry { return { @@ -243,6 +366,35 @@ export const SubspaceDataEntry = { message.registeredReactionId = object.registeredReactionId ?? 0; return message; }, + fromAmino(object: SubspaceDataEntryAmino): SubspaceDataEntry { + return { + subspaceId: Long.fromString(object.subspace_id), + registeredReactionId: object.registered_reaction_id, + }; + }, + toAmino(message: SubspaceDataEntry): SubspaceDataEntryAmino { + const obj: any = {}; + obj.subspace_id = message.subspaceId + ? message.subspaceId.toString() + : undefined; + obj.registered_reaction_id = message.registeredReactionId; + return obj; + }, + fromAminoMsg(object: SubspaceDataEntryAminoMsg): SubspaceDataEntry { + return SubspaceDataEntry.fromAmino(object.value); + }, + fromProtoMsg(message: SubspaceDataEntryProtoMsg): SubspaceDataEntry { + return SubspaceDataEntry.decode(message.value); + }, + toProto(message: SubspaceDataEntry): Uint8Array { + return SubspaceDataEntry.encode(message).finish(); + }, + toProtoMsg(message: SubspaceDataEntry): SubspaceDataEntryProtoMsg { + return { + typeUrl: "/desmos.reactions.v1.SubspaceDataEntry", + value: SubspaceDataEntry.encode(message).finish(), + }; + }, }; function createBasePostDataEntry(): PostDataEntry { return { @@ -324,4 +476,35 @@ export const PostDataEntry = { message.reactionId = object.reactionId ?? 0; return message; }, + fromAmino(object: PostDataEntryAmino): PostDataEntry { + return { + subspaceId: Long.fromString(object.subspace_id), + postId: Long.fromString(object.post_id), + reactionId: object.reaction_id, + }; + }, + toAmino(message: PostDataEntry): PostDataEntryAmino { + const obj: any = {}; + obj.subspace_id = message.subspaceId + ? message.subspaceId.toString() + : undefined; + obj.post_id = message.postId ? message.postId.toString() : undefined; + obj.reaction_id = message.reactionId; + return obj; + }, + fromAminoMsg(object: PostDataEntryAminoMsg): PostDataEntry { + return PostDataEntry.fromAmino(object.value); + }, + fromProtoMsg(message: PostDataEntryProtoMsg): PostDataEntry { + return PostDataEntry.decode(message.value); + }, + toProto(message: PostDataEntry): Uint8Array { + return PostDataEntry.encode(message).finish(); + }, + toProtoMsg(message: PostDataEntry): PostDataEntryProtoMsg { + return { + typeUrl: "/desmos.reactions.v1.PostDataEntry", + value: PostDataEntry.encode(message).finish(), + }; + }, }; diff --git a/packages/types/src/desmos/reactions/v1/models.ts b/packages/types/src/desmos/reactions/v1/models.ts index 9e7c730f4..d7e2f85b2 100644 --- a/packages/types/src/desmos/reactions/v1/models.ts +++ b/packages/types/src/desmos/reactions/v1/models.ts @@ -1,5 +1,5 @@ /* eslint-disable */ -import { Any } from "../../../google/protobuf/any"; +import { Any, AnyAmino } from "../../../google/protobuf/any"; import { Long, isSet, DeepPartial, Exact } from "../../../helpers"; import * as _m0 from "protobufjs/minimal"; export const protobufPackage = "desmos.reactions.v1"; @@ -16,6 +16,27 @@ export interface Reaction { /** Author of the reaction */ author: string; } +export interface ReactionProtoMsg { + typeUrl: "/desmos.reactions.v1.Reaction"; + value: Uint8Array; +} +/** Reaction contains the data of a single post reaction */ +export interface ReactionAmino { + /** Id of the subspace inside which the reaction has been put */ + subspace_id: string; + /** Id of the post to which the reaction is associated */ + post_id: string; + /** Id of the reaction within the post */ + id: number; + /** Value of the reaction. */ + value?: AnyAmino; + /** Author of the reaction */ + author: string; +} +export interface ReactionAminoMsg { + type: "/desmos.reactions.v1.Reaction"; + value: ReactionAmino; +} /** * RegisteredReactionValue contains the details of a reaction value that * references a reaction registered within the subspace @@ -24,6 +45,22 @@ export interface RegisteredReactionValue { /** Id of the registered reaction */ registeredReactionId: number; } +export interface RegisteredReactionValueProtoMsg { + typeUrl: "/desmos.reactions.v1.RegisteredReactionValue"; + value: Uint8Array; +} +/** + * RegisteredReactionValue contains the details of a reaction value that + * references a reaction registered within the subspace + */ +export interface RegisteredReactionValueAmino { + /** Id of the registered reaction */ + registered_reaction_id: number; +} +export interface RegisteredReactionValueAminoMsg { + type: "/desmos.reactions.v1.RegisteredReactionValue"; + value: RegisteredReactionValueAmino; +} /** * FreeTextValue contains the details of a reaction value that * is made of free text @@ -31,6 +68,21 @@ export interface RegisteredReactionValue { export interface FreeTextValue { text: string; } +export interface FreeTextValueProtoMsg { + typeUrl: "/desmos.reactions.v1.FreeTextValue"; + value: Uint8Array; +} +/** + * FreeTextValue contains the details of a reaction value that + * is made of free text + */ +export interface FreeTextValueAmino { + text: string; +} +export interface FreeTextValueAminoMsg { + type: "/desmos.reactions.v1.FreeTextValue"; + value: FreeTextValueAmino; +} /** * RegisteredReaction contains the details of a registered reaction within a * subspace @@ -45,6 +97,28 @@ export interface RegisteredReaction { /** Value that should be displayed when using this reaction */ displayValue: string; } +export interface RegisteredReactionProtoMsg { + typeUrl: "/desmos.reactions.v1.RegisteredReaction"; + value: Uint8Array; +} +/** + * RegisteredReaction contains the details of a registered reaction within a + * subspace + */ +export interface RegisteredReactionAmino { + /** Id of the subspace for which this reaction has been registered */ + subspace_id: string; + /** Id of the registered reaction */ + id: number; + /** Unique shorthand code associated to this reaction */ + shorthand_code: string; + /** Value that should be displayed when using this reaction */ + display_value: string; +} +export interface RegisteredReactionAminoMsg { + type: "/desmos.reactions.v1.RegisteredReaction"; + value: RegisteredReactionAmino; +} /** * SubspaceReactionsParams contains the params related to a single subspace * reactions @@ -57,6 +131,26 @@ export interface SubspaceReactionsParams { /** Params related to FreeTextValue reactions */ freeText?: FreeTextValueParams; } +export interface SubspaceReactionsParamsProtoMsg { + typeUrl: "/desmos.reactions.v1.SubspaceReactionsParams"; + value: Uint8Array; +} +/** + * SubspaceReactionsParams contains the params related to a single subspace + * reactions + */ +export interface SubspaceReactionsParamsAmino { + /** Id of the subspace for which these params are valid */ + subspace_id: string; + /** Params related to RegisteredReactionValue reactions */ + registered_reaction?: RegisteredReactionValueParamsAmino; + /** Params related to FreeTextValue reactions */ + free_text?: FreeTextValueParamsAmino; +} +export interface SubspaceReactionsParamsAminoMsg { + type: "/desmos.reactions.v1.SubspaceReactionsParams"; + value: SubspaceReactionsParamsAmino; +} /** FreeTextValueParams contains the params for FreeTextValue based reactions */ export interface FreeTextValueParams { /** Whether FreeTextValue reactions should be enabled */ @@ -69,6 +163,26 @@ export interface FreeTextValueParams { */ regEx: string; } +export interface FreeTextValueParamsProtoMsg { + typeUrl: "/desmos.reactions.v1.FreeTextValueParams"; + value: Uint8Array; +} +/** FreeTextValueParams contains the params for FreeTextValue based reactions */ +export interface FreeTextValueParamsAmino { + /** Whether FreeTextValue reactions should be enabled */ + enabled: boolean; + /** The max length that FreeTextValue reactions should have */ + max_length: number; + /** + * RegEx that each FreeTextValue should respect. + * This is useful to limit what characters can be used as a reaction. + */ + reg_ex: string; +} +export interface FreeTextValueParamsAminoMsg { + type: "/desmos.reactions.v1.FreeTextValueParams"; + value: FreeTextValueParamsAmino; +} /** * RegisteredReactionValueParams contains the params for RegisteredReactionValue * based reactions @@ -77,6 +191,22 @@ export interface RegisteredReactionValueParams { /** Whether RegisteredReactionValue reactions should be enabled */ enabled: boolean; } +export interface RegisteredReactionValueParamsProtoMsg { + typeUrl: "/desmos.reactions.v1.RegisteredReactionValueParams"; + value: Uint8Array; +} +/** + * RegisteredReactionValueParams contains the params for RegisteredReactionValue + * based reactions + */ +export interface RegisteredReactionValueParamsAmino { + /** Whether RegisteredReactionValue reactions should be enabled */ + enabled: boolean; +} +export interface RegisteredReactionValueParamsAminoMsg { + type: "/desmos.reactions.v1.RegisteredReactionValueParams"; + value: RegisteredReactionValueParamsAmino; +} function createBaseReaction(): Reaction { return { subspaceId: Long.UZERO, @@ -178,6 +308,41 @@ export const Reaction = { message.author = object.author ?? ""; return message; }, + fromAmino(object: ReactionAmino): Reaction { + return { + subspaceId: Long.fromString(object.subspace_id), + postId: Long.fromString(object.post_id), + id: object.id, + value: object?.value ? Any.fromAmino(object.value) : undefined, + author: object.author, + }; + }, + toAmino(message: Reaction): ReactionAmino { + const obj: any = {}; + obj.subspace_id = message.subspaceId + ? message.subspaceId.toString() + : undefined; + obj.post_id = message.postId ? message.postId.toString() : undefined; + obj.id = message.id; + obj.value = message.value ? Any.toAmino(message.value) : undefined; + obj.author = message.author; + return obj; + }, + fromAminoMsg(object: ReactionAminoMsg): Reaction { + return Reaction.fromAmino(object.value); + }, + fromProtoMsg(message: ReactionProtoMsg): Reaction { + return Reaction.decode(message.value); + }, + toProto(message: Reaction): Uint8Array { + return Reaction.encode(message).finish(); + }, + toProtoMsg(message: Reaction): ReactionProtoMsg { + return { + typeUrl: "/desmos.reactions.v1.Reaction", + value: Reaction.encode(message).finish(), + }; + }, }; function createBaseRegisteredReactionValue(): RegisteredReactionValue { return { @@ -234,6 +399,37 @@ export const RegisteredReactionValue = { message.registeredReactionId = object.registeredReactionId ?? 0; return message; }, + fromAmino(object: RegisteredReactionValueAmino): RegisteredReactionValue { + return { + registeredReactionId: object.registered_reaction_id, + }; + }, + toAmino(message: RegisteredReactionValue): RegisteredReactionValueAmino { + const obj: any = {}; + obj.registered_reaction_id = message.registeredReactionId; + return obj; + }, + fromAminoMsg( + object: RegisteredReactionValueAminoMsg + ): RegisteredReactionValue { + return RegisteredReactionValue.fromAmino(object.value); + }, + fromProtoMsg( + message: RegisteredReactionValueProtoMsg + ): RegisteredReactionValue { + return RegisteredReactionValue.decode(message.value); + }, + toProto(message: RegisteredReactionValue): Uint8Array { + return RegisteredReactionValue.encode(message).finish(); + }, + toProtoMsg( + message: RegisteredReactionValue + ): RegisteredReactionValueProtoMsg { + return { + typeUrl: "/desmos.reactions.v1.RegisteredReactionValue", + value: RegisteredReactionValue.encode(message).finish(), + }; + }, }; function createBaseFreeTextValue(): FreeTextValue { return { @@ -284,6 +480,31 @@ export const FreeTextValue = { message.text = object.text ?? ""; return message; }, + fromAmino(object: FreeTextValueAmino): FreeTextValue { + return { + text: object.text, + }; + }, + toAmino(message: FreeTextValue): FreeTextValueAmino { + const obj: any = {}; + obj.text = message.text; + return obj; + }, + fromAminoMsg(object: FreeTextValueAminoMsg): FreeTextValue { + return FreeTextValue.fromAmino(object.value); + }, + fromProtoMsg(message: FreeTextValueProtoMsg): FreeTextValue { + return FreeTextValue.decode(message.value); + }, + toProto(message: FreeTextValue): Uint8Array { + return FreeTextValue.encode(message).finish(); + }, + toProtoMsg(message: FreeTextValue): FreeTextValueProtoMsg { + return { + typeUrl: "/desmos.reactions.v1.FreeTextValue", + value: FreeTextValue.encode(message).finish(), + }; + }, }; function createBaseRegisteredReaction(): RegisteredReaction { return { @@ -376,6 +597,39 @@ export const RegisteredReaction = { message.displayValue = object.displayValue ?? ""; return message; }, + fromAmino(object: RegisteredReactionAmino): RegisteredReaction { + return { + subspaceId: Long.fromString(object.subspace_id), + id: object.id, + shorthandCode: object.shorthand_code, + displayValue: object.display_value, + }; + }, + toAmino(message: RegisteredReaction): RegisteredReactionAmino { + const obj: any = {}; + obj.subspace_id = message.subspaceId + ? message.subspaceId.toString() + : undefined; + obj.id = message.id; + obj.shorthand_code = message.shorthandCode; + obj.display_value = message.displayValue; + return obj; + }, + fromAminoMsg(object: RegisteredReactionAminoMsg): RegisteredReaction { + return RegisteredReaction.fromAmino(object.value); + }, + fromProtoMsg(message: RegisteredReactionProtoMsg): RegisteredReaction { + return RegisteredReaction.decode(message.value); + }, + toProto(message: RegisteredReaction): Uint8Array { + return RegisteredReaction.encode(message).finish(); + }, + toProtoMsg(message: RegisteredReaction): RegisteredReactionProtoMsg { + return { + typeUrl: "/desmos.reactions.v1.RegisteredReaction", + value: RegisteredReaction.encode(message).finish(), + }; + }, }; function createBaseSubspaceReactionsParams(): SubspaceReactionsParams { return { @@ -484,6 +738,51 @@ export const SubspaceReactionsParams = { : undefined; return message; }, + fromAmino(object: SubspaceReactionsParamsAmino): SubspaceReactionsParams { + return { + subspaceId: Long.fromString(object.subspace_id), + registeredReaction: object?.registered_reaction + ? RegisteredReactionValueParams.fromAmino(object.registered_reaction) + : undefined, + freeText: object?.free_text + ? FreeTextValueParams.fromAmino(object.free_text) + : undefined, + }; + }, + toAmino(message: SubspaceReactionsParams): SubspaceReactionsParamsAmino { + const obj: any = {}; + obj.subspace_id = message.subspaceId + ? message.subspaceId.toString() + : undefined; + obj.registered_reaction = message.registeredReaction + ? RegisteredReactionValueParams.toAmino(message.registeredReaction) + : undefined; + obj.free_text = message.freeText + ? FreeTextValueParams.toAmino(message.freeText) + : undefined; + return obj; + }, + fromAminoMsg( + object: SubspaceReactionsParamsAminoMsg + ): SubspaceReactionsParams { + return SubspaceReactionsParams.fromAmino(object.value); + }, + fromProtoMsg( + message: SubspaceReactionsParamsProtoMsg + ): SubspaceReactionsParams { + return SubspaceReactionsParams.decode(message.value); + }, + toProto(message: SubspaceReactionsParams): Uint8Array { + return SubspaceReactionsParams.encode(message).finish(); + }, + toProtoMsg( + message: SubspaceReactionsParams + ): SubspaceReactionsParamsProtoMsg { + return { + typeUrl: "/desmos.reactions.v1.SubspaceReactionsParams", + value: SubspaceReactionsParams.encode(message).finish(), + }; + }, }; function createBaseFreeTextValueParams(): FreeTextValueParams { return { @@ -555,6 +854,35 @@ export const FreeTextValueParams = { message.regEx = object.regEx ?? ""; return message; }, + fromAmino(object: FreeTextValueParamsAmino): FreeTextValueParams { + return { + enabled: object.enabled, + maxLength: object.max_length, + regEx: object.reg_ex, + }; + }, + toAmino(message: FreeTextValueParams): FreeTextValueParamsAmino { + const obj: any = {}; + obj.enabled = message.enabled; + obj.max_length = message.maxLength; + obj.reg_ex = message.regEx; + return obj; + }, + fromAminoMsg(object: FreeTextValueParamsAminoMsg): FreeTextValueParams { + return FreeTextValueParams.fromAmino(object.value); + }, + fromProtoMsg(message: FreeTextValueParamsProtoMsg): FreeTextValueParams { + return FreeTextValueParams.decode(message.value); + }, + toProto(message: FreeTextValueParams): Uint8Array { + return FreeTextValueParams.encode(message).finish(); + }, + toProtoMsg(message: FreeTextValueParams): FreeTextValueParamsProtoMsg { + return { + typeUrl: "/desmos.reactions.v1.FreeTextValueParams", + value: FreeTextValueParams.encode(message).finish(), + }; + }, }; function createBaseRegisteredReactionValueParams(): RegisteredReactionValueParams { return { @@ -608,4 +936,39 @@ export const RegisteredReactionValueParams = { message.enabled = object.enabled ?? false; return message; }, + fromAmino( + object: RegisteredReactionValueParamsAmino + ): RegisteredReactionValueParams { + return { + enabled: object.enabled, + }; + }, + toAmino( + message: RegisteredReactionValueParams + ): RegisteredReactionValueParamsAmino { + const obj: any = {}; + obj.enabled = message.enabled; + return obj; + }, + fromAminoMsg( + object: RegisteredReactionValueParamsAminoMsg + ): RegisteredReactionValueParams { + return RegisteredReactionValueParams.fromAmino(object.value); + }, + fromProtoMsg( + message: RegisteredReactionValueParamsProtoMsg + ): RegisteredReactionValueParams { + return RegisteredReactionValueParams.decode(message.value); + }, + toProto(message: RegisteredReactionValueParams): Uint8Array { + return RegisteredReactionValueParams.encode(message).finish(); + }, + toProtoMsg( + message: RegisteredReactionValueParams + ): RegisteredReactionValueParamsProtoMsg { + return { + typeUrl: "/desmos.reactions.v1.RegisteredReactionValueParams", + value: RegisteredReactionValueParams.encode(message).finish(), + }; + }, }; diff --git a/packages/types/src/desmos/reactions/v1/msgs.amino.ts b/packages/types/src/desmos/reactions/v1/msgs.amino.ts new file mode 100644 index 000000000..af69c676f --- /dev/null +++ b/packages/types/src/desmos/reactions/v1/msgs.amino.ts @@ -0,0 +1,41 @@ +/* eslint-disable */ +import { + MsgAddReaction, + MsgRemoveReaction, + MsgAddRegisteredReaction, + MsgEditRegisteredReaction, + MsgRemoveRegisteredReaction, + MsgSetReactionsParams, +} from "./msgs"; +export const AminoConverter = { + "/desmos.reactions.v1.MsgAddReaction": { + aminoType: "/desmos.reactions.v1.MsgAddReaction", + toAmino: MsgAddReaction.toAmino, + fromAmino: MsgAddReaction.fromAmino, + }, + "/desmos.reactions.v1.MsgRemoveReaction": { + aminoType: "/desmos.reactions.v1.MsgRemoveReaction", + toAmino: MsgRemoveReaction.toAmino, + fromAmino: MsgRemoveReaction.fromAmino, + }, + "/desmos.reactions.v1.MsgAddRegisteredReaction": { + aminoType: "/desmos.reactions.v1.MsgAddRegisteredReaction", + toAmino: MsgAddRegisteredReaction.toAmino, + fromAmino: MsgAddRegisteredReaction.fromAmino, + }, + "/desmos.reactions.v1.MsgEditRegisteredReaction": { + aminoType: "/desmos.reactions.v1.MsgEditRegisteredReaction", + toAmino: MsgEditRegisteredReaction.toAmino, + fromAmino: MsgEditRegisteredReaction.fromAmino, + }, + "/desmos.reactions.v1.MsgRemoveRegisteredReaction": { + aminoType: "/desmos.reactions.v1.MsgRemoveRegisteredReaction", + toAmino: MsgRemoveRegisteredReaction.toAmino, + fromAmino: MsgRemoveRegisteredReaction.fromAmino, + }, + "/desmos.reactions.v1.MsgSetReactionsParams": { + aminoType: "/desmos.reactions.v1.MsgSetReactionsParams", + toAmino: MsgSetReactionsParams.toAmino, + fromAmino: MsgSetReactionsParams.fromAmino, + }, +}; diff --git a/packages/types/src/desmos/reactions/v1/msgs.registry.ts b/packages/types/src/desmos/reactions/v1/msgs.registry.ts new file mode 100644 index 000000000..de861fee3 --- /dev/null +++ b/packages/types/src/desmos/reactions/v1/msgs.registry.ts @@ -0,0 +1,218 @@ +/* eslint-disable */ +import { GeneratedType, Registry } from "@cosmjs/proto-signing"; +import { + MsgAddReaction, + MsgRemoveReaction, + MsgAddRegisteredReaction, + MsgEditRegisteredReaction, + MsgRemoveRegisteredReaction, + MsgSetReactionsParams, +} from "./msgs"; +export const registry: ReadonlyArray<[string, GeneratedType]> = [ + ["/desmos.reactions.v1.MsgAddReaction", MsgAddReaction], + ["/desmos.reactions.v1.MsgRemoveReaction", MsgRemoveReaction], + ["/desmos.reactions.v1.MsgAddRegisteredReaction", MsgAddRegisteredReaction], + ["/desmos.reactions.v1.MsgEditRegisteredReaction", MsgEditRegisteredReaction], + [ + "/desmos.reactions.v1.MsgRemoveRegisteredReaction", + MsgRemoveRegisteredReaction, + ], + ["/desmos.reactions.v1.MsgSetReactionsParams", MsgSetReactionsParams], +]; +export const load = (protoRegistry: Registry) => { + registry.forEach(([typeUrl, mod]) => { + protoRegistry.register(typeUrl, mod); + }); +}; +export const MessageComposer = { + encoded: { + addReaction(value: MsgAddReaction) { + return { + typeUrl: "/desmos.reactions.v1.MsgAddReaction", + value: MsgAddReaction.encode(value).finish(), + }; + }, + removeReaction(value: MsgRemoveReaction) { + return { + typeUrl: "/desmos.reactions.v1.MsgRemoveReaction", + value: MsgRemoveReaction.encode(value).finish(), + }; + }, + addRegisteredReaction(value: MsgAddRegisteredReaction) { + return { + typeUrl: "/desmos.reactions.v1.MsgAddRegisteredReaction", + value: MsgAddRegisteredReaction.encode(value).finish(), + }; + }, + editRegisteredReaction(value: MsgEditRegisteredReaction) { + return { + typeUrl: "/desmos.reactions.v1.MsgEditRegisteredReaction", + value: MsgEditRegisteredReaction.encode(value).finish(), + }; + }, + removeRegisteredReaction(value: MsgRemoveRegisteredReaction) { + return { + typeUrl: "/desmos.reactions.v1.MsgRemoveRegisteredReaction", + value: MsgRemoveRegisteredReaction.encode(value).finish(), + }; + }, + setReactionsParams(value: MsgSetReactionsParams) { + return { + typeUrl: "/desmos.reactions.v1.MsgSetReactionsParams", + value: MsgSetReactionsParams.encode(value).finish(), + }; + }, + }, + withTypeUrl: { + addReaction(value: MsgAddReaction) { + return { + typeUrl: "/desmos.reactions.v1.MsgAddReaction", + value, + }; + }, + removeReaction(value: MsgRemoveReaction) { + return { + typeUrl: "/desmos.reactions.v1.MsgRemoveReaction", + value, + }; + }, + addRegisteredReaction(value: MsgAddRegisteredReaction) { + return { + typeUrl: "/desmos.reactions.v1.MsgAddRegisteredReaction", + value, + }; + }, + editRegisteredReaction(value: MsgEditRegisteredReaction) { + return { + typeUrl: "/desmos.reactions.v1.MsgEditRegisteredReaction", + value, + }; + }, + removeRegisteredReaction(value: MsgRemoveRegisteredReaction) { + return { + typeUrl: "/desmos.reactions.v1.MsgRemoveRegisteredReaction", + value, + }; + }, + setReactionsParams(value: MsgSetReactionsParams) { + return { + typeUrl: "/desmos.reactions.v1.MsgSetReactionsParams", + value, + }; + }, + }, + toJSON: { + addReaction(value: MsgAddReaction) { + return { + typeUrl: "/desmos.reactions.v1.MsgAddReaction", + value: MsgAddReaction.toJSON(value), + }; + }, + removeReaction(value: MsgRemoveReaction) { + return { + typeUrl: "/desmos.reactions.v1.MsgRemoveReaction", + value: MsgRemoveReaction.toJSON(value), + }; + }, + addRegisteredReaction(value: MsgAddRegisteredReaction) { + return { + typeUrl: "/desmos.reactions.v1.MsgAddRegisteredReaction", + value: MsgAddRegisteredReaction.toJSON(value), + }; + }, + editRegisteredReaction(value: MsgEditRegisteredReaction) { + return { + typeUrl: "/desmos.reactions.v1.MsgEditRegisteredReaction", + value: MsgEditRegisteredReaction.toJSON(value), + }; + }, + removeRegisteredReaction(value: MsgRemoveRegisteredReaction) { + return { + typeUrl: "/desmos.reactions.v1.MsgRemoveRegisteredReaction", + value: MsgRemoveRegisteredReaction.toJSON(value), + }; + }, + setReactionsParams(value: MsgSetReactionsParams) { + return { + typeUrl: "/desmos.reactions.v1.MsgSetReactionsParams", + value: MsgSetReactionsParams.toJSON(value), + }; + }, + }, + fromJSON: { + addReaction(value: any) { + return { + typeUrl: "/desmos.reactions.v1.MsgAddReaction", + value: MsgAddReaction.fromJSON(value), + }; + }, + removeReaction(value: any) { + return { + typeUrl: "/desmos.reactions.v1.MsgRemoveReaction", + value: MsgRemoveReaction.fromJSON(value), + }; + }, + addRegisteredReaction(value: any) { + return { + typeUrl: "/desmos.reactions.v1.MsgAddRegisteredReaction", + value: MsgAddRegisteredReaction.fromJSON(value), + }; + }, + editRegisteredReaction(value: any) { + return { + typeUrl: "/desmos.reactions.v1.MsgEditRegisteredReaction", + value: MsgEditRegisteredReaction.fromJSON(value), + }; + }, + removeRegisteredReaction(value: any) { + return { + typeUrl: "/desmos.reactions.v1.MsgRemoveRegisteredReaction", + value: MsgRemoveRegisteredReaction.fromJSON(value), + }; + }, + setReactionsParams(value: any) { + return { + typeUrl: "/desmos.reactions.v1.MsgSetReactionsParams", + value: MsgSetReactionsParams.fromJSON(value), + }; + }, + }, + fromPartial: { + addReaction(value: MsgAddReaction) { + return { + typeUrl: "/desmos.reactions.v1.MsgAddReaction", + value: MsgAddReaction.fromPartial(value), + }; + }, + removeReaction(value: MsgRemoveReaction) { + return { + typeUrl: "/desmos.reactions.v1.MsgRemoveReaction", + value: MsgRemoveReaction.fromPartial(value), + }; + }, + addRegisteredReaction(value: MsgAddRegisteredReaction) { + return { + typeUrl: "/desmos.reactions.v1.MsgAddRegisteredReaction", + value: MsgAddRegisteredReaction.fromPartial(value), + }; + }, + editRegisteredReaction(value: MsgEditRegisteredReaction) { + return { + typeUrl: "/desmos.reactions.v1.MsgEditRegisteredReaction", + value: MsgEditRegisteredReaction.fromPartial(value), + }; + }, + removeRegisteredReaction(value: MsgRemoveRegisteredReaction) { + return { + typeUrl: "/desmos.reactions.v1.MsgRemoveRegisteredReaction", + value: MsgRemoveRegisteredReaction.fromPartial(value), + }; + }, + setReactionsParams(value: MsgSetReactionsParams) { + return { + typeUrl: "/desmos.reactions.v1.MsgSetReactionsParams", + value: MsgSetReactionsParams.fromPartial(value), + }; + }, + }, +}; diff --git a/packages/types/src/desmos/reactions/v1/msgs.ts b/packages/types/src/desmos/reactions/v1/msgs.ts index 3354f64cf..ec887f042 100644 --- a/packages/types/src/desmos/reactions/v1/msgs.ts +++ b/packages/types/src/desmos/reactions/v1/msgs.ts @@ -1,6 +1,11 @@ /* eslint-disable */ -import { Any } from "../../../google/protobuf/any"; -import { RegisteredReactionValueParams, FreeTextValueParams } from "./models"; +import { Any, AnyAmino } from "../../../google/protobuf/any"; +import { + RegisteredReactionValueParams, + RegisteredReactionValueParamsAmino, + FreeTextValueParams, + FreeTextValueParamsAmino, +} from "./models"; import { Long, isSet, DeepPartial, Exact, Rpc } from "../../../helpers"; import * as _m0 from "protobufjs/minimal"; export const protobufPackage = "desmos.reactions.v1"; @@ -15,11 +20,43 @@ export interface MsgAddReaction { /** User reacting to the post */ user: string; } +export interface MsgAddReactionProtoMsg { + typeUrl: "/desmos.reactions.v1.MsgAddReaction"; + value: Uint8Array; +} +/** MsgAddReaction represents the message to be used to add a post reaction */ +export interface MsgAddReactionAmino { + /** Id of the subspace inside which the post to react to is */ + subspace_id: string; + /** Id of the post to react to */ + post_id: string; + /** Value of the reaction */ + value?: AnyAmino; + /** User reacting to the post */ + user: string; +} +export interface MsgAddReactionAminoMsg { + type: "/desmos.reactions.v1.MsgAddReaction"; + value: MsgAddReactionAmino; +} /** MsgAddReactionResponse represents the Msg/AddReaction response type */ export interface MsgAddReactionResponse { /** Id of the newly added reaction */ reactionId: number; } +export interface MsgAddReactionResponseProtoMsg { + typeUrl: "/desmos.reactions.v1.MsgAddReactionResponse"; + value: Uint8Array; +} +/** MsgAddReactionResponse represents the Msg/AddReaction response type */ +export interface MsgAddReactionResponseAmino { + /** Id of the newly added reaction */ + reaction_id: number; +} +export interface MsgAddReactionResponseAminoMsg { + type: "/desmos.reactions.v1.MsgAddReactionResponse"; + value: MsgAddReactionResponseAmino; +} /** * MsgRemoveReaction represents the message to be used to remove an * existing reaction from a post @@ -34,8 +71,40 @@ export interface MsgRemoveReaction { /** User removing the reaction */ user: string; } +export interface MsgRemoveReactionProtoMsg { + typeUrl: "/desmos.reactions.v1.MsgRemoveReaction"; + value: Uint8Array; +} +/** + * MsgRemoveReaction represents the message to be used to remove an + * existing reaction from a post + */ +export interface MsgRemoveReactionAmino { + /** Id of the subspace inside which the reaction to remove is */ + subspace_id: string; + /** Id of the post from which to remove the reaction */ + post_id: string; + /** Id of the reaction to be removed */ + reaction_id: number; + /** User removing the reaction */ + user: string; +} +export interface MsgRemoveReactionAminoMsg { + type: "/desmos.reactions.v1.MsgRemoveReaction"; + value: MsgRemoveReactionAmino; +} /** MsgRemoveReactionResponse represents the Msg/RemoveReaction response type */ export interface MsgRemoveReactionResponse {} +export interface MsgRemoveReactionResponseProtoMsg { + typeUrl: "/desmos.reactions.v1.MsgRemoveReactionResponse"; + value: Uint8Array; +} +/** MsgRemoveReactionResponse represents the Msg/RemoveReaction response type */ +export interface MsgRemoveReactionResponseAmino {} +export interface MsgRemoveReactionResponseAminoMsg { + type: "/desmos.reactions.v1.MsgRemoveReactionResponse"; + value: MsgRemoveReactionResponseAmino; +} /** * MsgAddRegisteredReaction represents the message to be used to * register a new supported reaction @@ -50,6 +119,28 @@ export interface MsgAddRegisteredReaction { /** User adding the supported reaction */ user: string; } +export interface MsgAddRegisteredReactionProtoMsg { + typeUrl: "/desmos.reactions.v1.MsgAddRegisteredReaction"; + value: Uint8Array; +} +/** + * MsgAddRegisteredReaction represents the message to be used to + * register a new supported reaction + */ +export interface MsgAddRegisteredReactionAmino { + /** Id of the subspace inside which this reaction should be registered */ + subspace_id: string; + /** Shorthand code of the reaction */ + shorthand_code: string; + /** Display value of the reaction */ + display_value: string; + /** User adding the supported reaction */ + user: string; +} +export interface MsgAddRegisteredReactionAminoMsg { + type: "/desmos.reactions.v1.MsgAddRegisteredReaction"; + value: MsgAddRegisteredReactionAmino; +} /** * MsgAddRegisteredReactionResponse represents the * Msg/AddRegisteredReaction response type @@ -58,6 +149,22 @@ export interface MsgAddRegisteredReactionResponse { /** Id of the newly registered reaction */ registeredReactionId: number; } +export interface MsgAddRegisteredReactionResponseProtoMsg { + typeUrl: "/desmos.reactions.v1.MsgAddRegisteredReactionResponse"; + value: Uint8Array; +} +/** + * MsgAddRegisteredReactionResponse represents the + * Msg/AddRegisteredReaction response type + */ +export interface MsgAddRegisteredReactionResponseAmino { + /** Id of the newly registered reaction */ + registered_reaction_id: number; +} +export interface MsgAddRegisteredReactionResponseAminoMsg { + type: "/desmos.reactions.v1.MsgAddRegisteredReactionResponse"; + value: MsgAddRegisteredReactionResponseAmino; +} /** * MsgEditRegisteredReaction represents the message to be used to edit a * registered reaction @@ -74,11 +181,48 @@ export interface MsgEditRegisteredReaction { /** User editing the registered reaction */ user: string; } +export interface MsgEditRegisteredReactionProtoMsg { + typeUrl: "/desmos.reactions.v1.MsgEditRegisteredReaction"; + value: Uint8Array; +} +/** + * MsgEditRegisteredReaction represents the message to be used to edit a + * registered reaction + */ +export interface MsgEditRegisteredReactionAmino { + /** Id of the subspace inside which the reaction to edit is */ + subspace_id: string; + /** Id of the registered reaction to edit */ + registered_reaction_id: number; + /** New shorthand code to be set */ + shorthand_code: string; + /** Display value to be set */ + display_value: string; + /** User editing the registered reaction */ + user: string; +} +export interface MsgEditRegisteredReactionAminoMsg { + type: "/desmos.reactions.v1.MsgEditRegisteredReaction"; + value: MsgEditRegisteredReactionAmino; +} /** * MsgEditRegisteredReactionResponse represents the Msg/EditRegisteredReaction * response type */ export interface MsgEditRegisteredReactionResponse {} +export interface MsgEditRegisteredReactionResponseProtoMsg { + typeUrl: "/desmos.reactions.v1.MsgEditRegisteredReactionResponse"; + value: Uint8Array; +} +/** + * MsgEditRegisteredReactionResponse represents the Msg/EditRegisteredReaction + * response type + */ +export interface MsgEditRegisteredReactionResponseAmino {} +export interface MsgEditRegisteredReactionResponseAminoMsg { + type: "/desmos.reactions.v1.MsgEditRegisteredReactionResponse"; + value: MsgEditRegisteredReactionResponseAmino; +} /** * MsgRemoveRegisteredReaction represents the message to be used to * remove an existing registered reaction @@ -91,11 +235,44 @@ export interface MsgRemoveRegisteredReaction { /** User removing the registered reaction */ user: string; } +export interface MsgRemoveRegisteredReactionProtoMsg { + typeUrl: "/desmos.reactions.v1.MsgRemoveRegisteredReaction"; + value: Uint8Array; +} +/** + * MsgRemoveRegisteredReaction represents the message to be used to + * remove an existing registered reaction + */ +export interface MsgRemoveRegisteredReactionAmino { + /** Id of the subspace from which to remove the registered reaction */ + subspace_id: string; + /** Id of the registered reaction to be removed */ + registered_reaction_id: number; + /** User removing the registered reaction */ + user: string; +} +export interface MsgRemoveRegisteredReactionAminoMsg { + type: "/desmos.reactions.v1.MsgRemoveRegisteredReaction"; + value: MsgRemoveRegisteredReactionAmino; +} /** * MsgRemoveRegisteredReactionResponse represents the * Msg/RemoveRegisteredReaction response type */ export interface MsgRemoveRegisteredReactionResponse {} +export interface MsgRemoveRegisteredReactionResponseProtoMsg { + typeUrl: "/desmos.reactions.v1.MsgRemoveRegisteredReactionResponse"; + value: Uint8Array; +} +/** + * MsgRemoveRegisteredReactionResponse represents the + * Msg/RemoveRegisteredReaction response type + */ +export interface MsgRemoveRegisteredReactionResponseAmino {} +export interface MsgRemoveRegisteredReactionResponseAminoMsg { + type: "/desmos.reactions.v1.MsgRemoveRegisteredReactionResponse"; + value: MsgRemoveRegisteredReactionResponseAmino; +} /** * MsgSetReactionsParams represents the message to be used when setting * a subspace reactions params @@ -110,11 +287,46 @@ export interface MsgSetReactionsParams { /** User setting the params */ user: string; } +export interface MsgSetReactionsParamsProtoMsg { + typeUrl: "/desmos.reactions.v1.MsgSetReactionsParams"; + value: Uint8Array; +} +/** + * MsgSetReactionsParams represents the message to be used when setting + * a subspace reactions params + */ +export interface MsgSetReactionsParamsAmino { + /** Id of the subspace for which to set the params */ + subspace_id: string; + /** Params related to RegisteredReactionValue reactions */ + registered_reaction?: RegisteredReactionValueParamsAmino; + /** Params related to FreeTextValue reactions */ + free_text?: FreeTextValueParamsAmino; + /** User setting the params */ + user: string; +} +export interface MsgSetReactionsParamsAminoMsg { + type: "/desmos.reactions.v1.MsgSetReactionsParams"; + value: MsgSetReactionsParamsAmino; +} /** * MsgSetReactionsParamsResponse represents the Msg/SetReactionsParams response * type */ export interface MsgSetReactionsParamsResponse {} +export interface MsgSetReactionsParamsResponseProtoMsg { + typeUrl: "/desmos.reactions.v1.MsgSetReactionsParamsResponse"; + value: Uint8Array; +} +/** + * MsgSetReactionsParamsResponse represents the Msg/SetReactionsParams response + * type + */ +export interface MsgSetReactionsParamsResponseAmino {} +export interface MsgSetReactionsParamsResponseAminoMsg { + type: "/desmos.reactions.v1.MsgSetReactionsParamsResponse"; + value: MsgSetReactionsParamsResponseAmino; +} function createBaseMsgAddReaction(): MsgAddReaction { return { subspaceId: Long.UZERO, @@ -208,6 +420,39 @@ export const MsgAddReaction = { message.user = object.user ?? ""; return message; }, + fromAmino(object: MsgAddReactionAmino): MsgAddReaction { + return { + subspaceId: Long.fromString(object.subspace_id), + postId: Long.fromString(object.post_id), + value: object?.value ? Any.fromAmino(object.value) : undefined, + user: object.user, + }; + }, + toAmino(message: MsgAddReaction): MsgAddReactionAmino { + const obj: any = {}; + obj.subspace_id = message.subspaceId + ? message.subspaceId.toString() + : undefined; + obj.post_id = message.postId ? message.postId.toString() : undefined; + obj.value = message.value ? Any.toAmino(message.value) : undefined; + obj.user = message.user; + return obj; + }, + fromAminoMsg(object: MsgAddReactionAminoMsg): MsgAddReaction { + return MsgAddReaction.fromAmino(object.value); + }, + fromProtoMsg(message: MsgAddReactionProtoMsg): MsgAddReaction { + return MsgAddReaction.decode(message.value); + }, + toProto(message: MsgAddReaction): Uint8Array { + return MsgAddReaction.encode(message).finish(); + }, + toProtoMsg(message: MsgAddReaction): MsgAddReactionProtoMsg { + return { + typeUrl: "/desmos.reactions.v1.MsgAddReaction", + value: MsgAddReaction.encode(message).finish(), + }; + }, }; function createBaseMsgAddReactionResponse(): MsgAddReactionResponse { return { @@ -262,6 +507,33 @@ export const MsgAddReactionResponse = { message.reactionId = object.reactionId ?? 0; return message; }, + fromAmino(object: MsgAddReactionResponseAmino): MsgAddReactionResponse { + return { + reactionId: object.reaction_id, + }; + }, + toAmino(message: MsgAddReactionResponse): MsgAddReactionResponseAmino { + const obj: any = {}; + obj.reaction_id = message.reactionId; + return obj; + }, + fromAminoMsg(object: MsgAddReactionResponseAminoMsg): MsgAddReactionResponse { + return MsgAddReactionResponse.fromAmino(object.value); + }, + fromProtoMsg( + message: MsgAddReactionResponseProtoMsg + ): MsgAddReactionResponse { + return MsgAddReactionResponse.decode(message.value); + }, + toProto(message: MsgAddReactionResponse): Uint8Array { + return MsgAddReactionResponse.encode(message).finish(); + }, + toProtoMsg(message: MsgAddReactionResponse): MsgAddReactionResponseProtoMsg { + return { + typeUrl: "/desmos.reactions.v1.MsgAddReactionResponse", + value: MsgAddReactionResponse.encode(message).finish(), + }; + }, }; function createBaseMsgRemoveReaction(): MsgRemoveReaction { return { @@ -353,6 +625,39 @@ export const MsgRemoveReaction = { message.user = object.user ?? ""; return message; }, + fromAmino(object: MsgRemoveReactionAmino): MsgRemoveReaction { + return { + subspaceId: Long.fromString(object.subspace_id), + postId: Long.fromString(object.post_id), + reactionId: object.reaction_id, + user: object.user, + }; + }, + toAmino(message: MsgRemoveReaction): MsgRemoveReactionAmino { + const obj: any = {}; + obj.subspace_id = message.subspaceId + ? message.subspaceId.toString() + : undefined; + obj.post_id = message.postId ? message.postId.toString() : undefined; + obj.reaction_id = message.reactionId; + obj.user = message.user; + return obj; + }, + fromAminoMsg(object: MsgRemoveReactionAminoMsg): MsgRemoveReaction { + return MsgRemoveReaction.fromAmino(object.value); + }, + fromProtoMsg(message: MsgRemoveReactionProtoMsg): MsgRemoveReaction { + return MsgRemoveReaction.decode(message.value); + }, + toProto(message: MsgRemoveReaction): Uint8Array { + return MsgRemoveReaction.encode(message).finish(); + }, + toProtoMsg(message: MsgRemoveReaction): MsgRemoveReactionProtoMsg { + return { + typeUrl: "/desmos.reactions.v1.MsgRemoveReaction", + value: MsgRemoveReaction.encode(message).finish(), + }; + }, }; function createBaseMsgRemoveReactionResponse(): MsgRemoveReactionResponse { return {}; @@ -394,6 +699,34 @@ export const MsgRemoveReactionResponse = { const message = createBaseMsgRemoveReactionResponse(); return message; }, + fromAmino(_: MsgRemoveReactionResponseAmino): MsgRemoveReactionResponse { + return {}; + }, + toAmino(_: MsgRemoveReactionResponse): MsgRemoveReactionResponseAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg( + object: MsgRemoveReactionResponseAminoMsg + ): MsgRemoveReactionResponse { + return MsgRemoveReactionResponse.fromAmino(object.value); + }, + fromProtoMsg( + message: MsgRemoveReactionResponseProtoMsg + ): MsgRemoveReactionResponse { + return MsgRemoveReactionResponse.decode(message.value); + }, + toProto(message: MsgRemoveReactionResponse): Uint8Array { + return MsgRemoveReactionResponse.encode(message).finish(); + }, + toProtoMsg( + message: MsgRemoveReactionResponse + ): MsgRemoveReactionResponseProtoMsg { + return { + typeUrl: "/desmos.reactions.v1.MsgRemoveReactionResponse", + value: MsgRemoveReactionResponse.encode(message).finish(), + }; + }, }; function createBaseMsgAddRegisteredReaction(): MsgAddRegisteredReaction { return { @@ -489,6 +822,45 @@ export const MsgAddRegisteredReaction = { message.user = object.user ?? ""; return message; }, + fromAmino(object: MsgAddRegisteredReactionAmino): MsgAddRegisteredReaction { + return { + subspaceId: Long.fromString(object.subspace_id), + shorthandCode: object.shorthand_code, + displayValue: object.display_value, + user: object.user, + }; + }, + toAmino(message: MsgAddRegisteredReaction): MsgAddRegisteredReactionAmino { + const obj: any = {}; + obj.subspace_id = message.subspaceId + ? message.subspaceId.toString() + : undefined; + obj.shorthand_code = message.shorthandCode; + obj.display_value = message.displayValue; + obj.user = message.user; + return obj; + }, + fromAminoMsg( + object: MsgAddRegisteredReactionAminoMsg + ): MsgAddRegisteredReaction { + return MsgAddRegisteredReaction.fromAmino(object.value); + }, + fromProtoMsg( + message: MsgAddRegisteredReactionProtoMsg + ): MsgAddRegisteredReaction { + return MsgAddRegisteredReaction.decode(message.value); + }, + toProto(message: MsgAddRegisteredReaction): Uint8Array { + return MsgAddRegisteredReaction.encode(message).finish(); + }, + toProtoMsg( + message: MsgAddRegisteredReaction + ): MsgAddRegisteredReactionProtoMsg { + return { + typeUrl: "/desmos.reactions.v1.MsgAddRegisteredReaction", + value: MsgAddRegisteredReaction.encode(message).finish(), + }; + }, }; function createBaseMsgAddRegisteredReactionResponse(): MsgAddRegisteredReactionResponse { return { @@ -545,6 +917,41 @@ export const MsgAddRegisteredReactionResponse = { message.registeredReactionId = object.registeredReactionId ?? 0; return message; }, + fromAmino( + object: MsgAddRegisteredReactionResponseAmino + ): MsgAddRegisteredReactionResponse { + return { + registeredReactionId: object.registered_reaction_id, + }; + }, + toAmino( + message: MsgAddRegisteredReactionResponse + ): MsgAddRegisteredReactionResponseAmino { + const obj: any = {}; + obj.registered_reaction_id = message.registeredReactionId; + return obj; + }, + fromAminoMsg( + object: MsgAddRegisteredReactionResponseAminoMsg + ): MsgAddRegisteredReactionResponse { + return MsgAddRegisteredReactionResponse.fromAmino(object.value); + }, + fromProtoMsg( + message: MsgAddRegisteredReactionResponseProtoMsg + ): MsgAddRegisteredReactionResponse { + return MsgAddRegisteredReactionResponse.decode(message.value); + }, + toProto(message: MsgAddRegisteredReactionResponse): Uint8Array { + return MsgAddRegisteredReactionResponse.encode(message).finish(); + }, + toProtoMsg( + message: MsgAddRegisteredReactionResponse + ): MsgAddRegisteredReactionResponseProtoMsg { + return { + typeUrl: "/desmos.reactions.v1.MsgAddRegisteredReactionResponse", + value: MsgAddRegisteredReactionResponse.encode(message).finish(), + }; + }, }; function createBaseMsgEditRegisteredReaction(): MsgEditRegisteredReaction { return { @@ -653,6 +1060,47 @@ export const MsgEditRegisteredReaction = { message.user = object.user ?? ""; return message; }, + fromAmino(object: MsgEditRegisteredReactionAmino): MsgEditRegisteredReaction { + return { + subspaceId: Long.fromString(object.subspace_id), + registeredReactionId: object.registered_reaction_id, + shorthandCode: object.shorthand_code, + displayValue: object.display_value, + user: object.user, + }; + }, + toAmino(message: MsgEditRegisteredReaction): MsgEditRegisteredReactionAmino { + const obj: any = {}; + obj.subspace_id = message.subspaceId + ? message.subspaceId.toString() + : undefined; + obj.registered_reaction_id = message.registeredReactionId; + obj.shorthand_code = message.shorthandCode; + obj.display_value = message.displayValue; + obj.user = message.user; + return obj; + }, + fromAminoMsg( + object: MsgEditRegisteredReactionAminoMsg + ): MsgEditRegisteredReaction { + return MsgEditRegisteredReaction.fromAmino(object.value); + }, + fromProtoMsg( + message: MsgEditRegisteredReactionProtoMsg + ): MsgEditRegisteredReaction { + return MsgEditRegisteredReaction.decode(message.value); + }, + toProto(message: MsgEditRegisteredReaction): Uint8Array { + return MsgEditRegisteredReaction.encode(message).finish(); + }, + toProtoMsg( + message: MsgEditRegisteredReaction + ): MsgEditRegisteredReactionProtoMsg { + return { + typeUrl: "/desmos.reactions.v1.MsgEditRegisteredReaction", + value: MsgEditRegisteredReaction.encode(message).finish(), + }; + }, }; function createBaseMsgEditRegisteredReactionResponse(): MsgEditRegisteredReactionResponse { return {}; @@ -694,6 +1142,38 @@ export const MsgEditRegisteredReactionResponse = { const message = createBaseMsgEditRegisteredReactionResponse(); return message; }, + fromAmino( + _: MsgEditRegisteredReactionResponseAmino + ): MsgEditRegisteredReactionResponse { + return {}; + }, + toAmino( + _: MsgEditRegisteredReactionResponse + ): MsgEditRegisteredReactionResponseAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg( + object: MsgEditRegisteredReactionResponseAminoMsg + ): MsgEditRegisteredReactionResponse { + return MsgEditRegisteredReactionResponse.fromAmino(object.value); + }, + fromProtoMsg( + message: MsgEditRegisteredReactionResponseProtoMsg + ): MsgEditRegisteredReactionResponse { + return MsgEditRegisteredReactionResponse.decode(message.value); + }, + toProto(message: MsgEditRegisteredReactionResponse): Uint8Array { + return MsgEditRegisteredReactionResponse.encode(message).finish(); + }, + toProtoMsg( + message: MsgEditRegisteredReactionResponse + ): MsgEditRegisteredReactionResponseProtoMsg { + return { + typeUrl: "/desmos.reactions.v1.MsgEditRegisteredReactionResponse", + value: MsgEditRegisteredReactionResponse.encode(message).finish(), + }; + }, }; function createBaseMsgRemoveRegisteredReaction(): MsgRemoveRegisteredReaction { return { @@ -776,6 +1256,47 @@ export const MsgRemoveRegisteredReaction = { message.user = object.user ?? ""; return message; }, + fromAmino( + object: MsgRemoveRegisteredReactionAmino + ): MsgRemoveRegisteredReaction { + return { + subspaceId: Long.fromString(object.subspace_id), + registeredReactionId: object.registered_reaction_id, + user: object.user, + }; + }, + toAmino( + message: MsgRemoveRegisteredReaction + ): MsgRemoveRegisteredReactionAmino { + const obj: any = {}; + obj.subspace_id = message.subspaceId + ? message.subspaceId.toString() + : undefined; + obj.registered_reaction_id = message.registeredReactionId; + obj.user = message.user; + return obj; + }, + fromAminoMsg( + object: MsgRemoveRegisteredReactionAminoMsg + ): MsgRemoveRegisteredReaction { + return MsgRemoveRegisteredReaction.fromAmino(object.value); + }, + fromProtoMsg( + message: MsgRemoveRegisteredReactionProtoMsg + ): MsgRemoveRegisteredReaction { + return MsgRemoveRegisteredReaction.decode(message.value); + }, + toProto(message: MsgRemoveRegisteredReaction): Uint8Array { + return MsgRemoveRegisteredReaction.encode(message).finish(); + }, + toProtoMsg( + message: MsgRemoveRegisteredReaction + ): MsgRemoveRegisteredReactionProtoMsg { + return { + typeUrl: "/desmos.reactions.v1.MsgRemoveRegisteredReaction", + value: MsgRemoveRegisteredReaction.encode(message).finish(), + }; + }, }; function createBaseMsgRemoveRegisteredReactionResponse(): MsgRemoveRegisteredReactionResponse { return {}; @@ -817,6 +1338,38 @@ export const MsgRemoveRegisteredReactionResponse = { const message = createBaseMsgRemoveRegisteredReactionResponse(); return message; }, + fromAmino( + _: MsgRemoveRegisteredReactionResponseAmino + ): MsgRemoveRegisteredReactionResponse { + return {}; + }, + toAmino( + _: MsgRemoveRegisteredReactionResponse + ): MsgRemoveRegisteredReactionResponseAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg( + object: MsgRemoveRegisteredReactionResponseAminoMsg + ): MsgRemoveRegisteredReactionResponse { + return MsgRemoveRegisteredReactionResponse.fromAmino(object.value); + }, + fromProtoMsg( + message: MsgRemoveRegisteredReactionResponseProtoMsg + ): MsgRemoveRegisteredReactionResponse { + return MsgRemoveRegisteredReactionResponse.decode(message.value); + }, + toProto(message: MsgRemoveRegisteredReactionResponse): Uint8Array { + return MsgRemoveRegisteredReactionResponse.encode(message).finish(); + }, + toProtoMsg( + message: MsgRemoveRegisteredReactionResponse + ): MsgRemoveRegisteredReactionResponseProtoMsg { + return { + typeUrl: "/desmos.reactions.v1.MsgRemoveRegisteredReactionResponse", + value: MsgRemoveRegisteredReactionResponse.encode(message).finish(), + }; + }, }; function createBaseMsgSetReactionsParams(): MsgSetReactionsParams { return { @@ -935,6 +1488,47 @@ export const MsgSetReactionsParams = { message.user = object.user ?? ""; return message; }, + fromAmino(object: MsgSetReactionsParamsAmino): MsgSetReactionsParams { + return { + subspaceId: Long.fromString(object.subspace_id), + registeredReaction: object?.registered_reaction + ? RegisteredReactionValueParams.fromAmino(object.registered_reaction) + : undefined, + freeText: object?.free_text + ? FreeTextValueParams.fromAmino(object.free_text) + : undefined, + user: object.user, + }; + }, + toAmino(message: MsgSetReactionsParams): MsgSetReactionsParamsAmino { + const obj: any = {}; + obj.subspace_id = message.subspaceId + ? message.subspaceId.toString() + : undefined; + obj.registered_reaction = message.registeredReaction + ? RegisteredReactionValueParams.toAmino(message.registeredReaction) + : undefined; + obj.free_text = message.freeText + ? FreeTextValueParams.toAmino(message.freeText) + : undefined; + obj.user = message.user; + return obj; + }, + fromAminoMsg(object: MsgSetReactionsParamsAminoMsg): MsgSetReactionsParams { + return MsgSetReactionsParams.fromAmino(object.value); + }, + fromProtoMsg(message: MsgSetReactionsParamsProtoMsg): MsgSetReactionsParams { + return MsgSetReactionsParams.decode(message.value); + }, + toProto(message: MsgSetReactionsParams): Uint8Array { + return MsgSetReactionsParams.encode(message).finish(); + }, + toProtoMsg(message: MsgSetReactionsParams): MsgSetReactionsParamsProtoMsg { + return { + typeUrl: "/desmos.reactions.v1.MsgSetReactionsParams", + value: MsgSetReactionsParams.encode(message).finish(), + }; + }, }; function createBaseMsgSetReactionsParamsResponse(): MsgSetReactionsParamsResponse { return {}; @@ -976,6 +1570,38 @@ export const MsgSetReactionsParamsResponse = { const message = createBaseMsgSetReactionsParamsResponse(); return message; }, + fromAmino( + _: MsgSetReactionsParamsResponseAmino + ): MsgSetReactionsParamsResponse { + return {}; + }, + toAmino( + _: MsgSetReactionsParamsResponse + ): MsgSetReactionsParamsResponseAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg( + object: MsgSetReactionsParamsResponseAminoMsg + ): MsgSetReactionsParamsResponse { + return MsgSetReactionsParamsResponse.fromAmino(object.value); + }, + fromProtoMsg( + message: MsgSetReactionsParamsResponseProtoMsg + ): MsgSetReactionsParamsResponse { + return MsgSetReactionsParamsResponse.decode(message.value); + }, + toProto(message: MsgSetReactionsParamsResponse): Uint8Array { + return MsgSetReactionsParamsResponse.encode(message).finish(); + }, + toProtoMsg( + message: MsgSetReactionsParamsResponse + ): MsgSetReactionsParamsResponseProtoMsg { + return { + typeUrl: "/desmos.reactions.v1.MsgSetReactionsParamsResponse", + value: MsgSetReactionsParamsResponse.encode(message).finish(), + }; + }, }; /** Msg defines the reactions Msg service. */ export interface Msg { diff --git a/packages/types/src/desmos/reactions/v1/query.ts b/packages/types/src/desmos/reactions/v1/query.ts index ba2ac653d..74d8ea2d5 100644 --- a/packages/types/src/desmos/reactions/v1/query.ts +++ b/packages/types/src/desmos/reactions/v1/query.ts @@ -1,12 +1,17 @@ /* eslint-disable */ import { PageRequest, + PageRequestAmino, PageResponse, + PageResponseAmino, } from "../../../cosmos/base/query/v1beta1/pagination"; import { Reaction, + ReactionAmino, RegisteredReaction, + RegisteredReactionAmino, SubspaceReactionsParams, + SubspaceReactionsParamsAmino, } from "./models"; import { Long, isSet, DeepPartial, Exact, Rpc } from "../../../helpers"; import * as _m0 from "protobufjs/minimal"; @@ -25,6 +30,28 @@ export interface QueryReactionsRequest { /** pagination defines an optional pagination for the request. */ pagination?: PageRequest; } +export interface QueryReactionsRequestProtoMsg { + typeUrl: "/desmos.reactions.v1.QueryReactionsRequest"; + value: Uint8Array; +} +/** QueryReactionsRequest is the request type for the Query/Reactions RPC method */ +export interface QueryReactionsRequestAmino { + /** Id of the subspace that contains the post to query the reactions for */ + subspace_id: string; + /** Post id to query the reactions for */ + post_id: string; + /** + * (optional) User to query the reactions for. + * This is going to be used only if a post id is specified as well. + */ + user: string; + /** pagination defines an optional pagination for the request. */ + pagination?: PageRequestAmino; +} +export interface QueryReactionsRequestAminoMsg { + type: "/desmos.reactions.v1.QueryReactionsRequest"; + value: QueryReactionsRequestAmino; +} /** * QueryReactionsResponse is the response type for the Query/Reactions RPC * method @@ -33,6 +60,22 @@ export interface QueryReactionsResponse { reactions: Reaction[]; pagination?: PageResponse; } +export interface QueryReactionsResponseProtoMsg { + typeUrl: "/desmos.reactions.v1.QueryReactionsResponse"; + value: Uint8Array; +} +/** + * QueryReactionsResponse is the response type for the Query/Reactions RPC + * method + */ +export interface QueryReactionsResponseAmino { + reactions: ReactionAmino[]; + pagination?: PageResponseAmino; +} +export interface QueryReactionsResponseAminoMsg { + type: "/desmos.reactions.v1.QueryReactionsResponse"; + value: QueryReactionsResponseAmino; +} /** * QueryReactionRequest is the request type for the Query/ReactionRequest RPC * method @@ -45,6 +88,26 @@ export interface QueryReactionRequest { /** Id of the reaction to query */ reactionId: number; } +export interface QueryReactionRequestProtoMsg { + typeUrl: "/desmos.reactions.v1.QueryReactionRequest"; + value: Uint8Array; +} +/** + * QueryReactionRequest is the request type for the Query/ReactionRequest RPC + * method + */ +export interface QueryReactionRequestAmino { + /** Id of the subspace that contains the post to query the reactions for */ + subspace_id: string; + /** Post id to query the reactions for */ + post_id: string; + /** Id of the reaction to query */ + reaction_id: number; +} +export interface QueryReactionRequestAminoMsg { + type: "/desmos.reactions.v1.QueryReactionRequest"; + value: QueryReactionRequestAmino; +} /** * QueryReactionResponse is the response type for the Query/Reaction RPC * method @@ -52,6 +115,21 @@ export interface QueryReactionRequest { export interface QueryReactionResponse { reaction?: Reaction; } +export interface QueryReactionResponseProtoMsg { + typeUrl: "/desmos.reactions.v1.QueryReactionResponse"; + value: Uint8Array; +} +/** + * QueryReactionResponse is the response type for the Query/Reaction RPC + * method + */ +export interface QueryReactionResponseAmino { + reaction?: ReactionAmino; +} +export interface QueryReactionResponseAminoMsg { + type: "/desmos.reactions.v1.QueryReactionResponse"; + value: QueryReactionResponseAmino; +} /** * QueryRegisteredReactionsRequest is the request type for the * Query/RegisteredReactions RPC method @@ -62,6 +140,24 @@ export interface QueryRegisteredReactionsRequest { /** pagination defines an optional pagination for the request. */ pagination?: PageRequest; } +export interface QueryRegisteredReactionsRequestProtoMsg { + typeUrl: "/desmos.reactions.v1.QueryRegisteredReactionsRequest"; + value: Uint8Array; +} +/** + * QueryRegisteredReactionsRequest is the request type for the + * Query/RegisteredReactions RPC method + */ +export interface QueryRegisteredReactionsRequestAmino { + /** Id of the subspace to query the registered reactions for */ + subspace_id: string; + /** pagination defines an optional pagination for the request. */ + pagination?: PageRequestAmino; +} +export interface QueryRegisteredReactionsRequestAminoMsg { + type: "/desmos.reactions.v1.QueryRegisteredReactionsRequest"; + value: QueryRegisteredReactionsRequestAmino; +} /** * QueryRegisteredReactionsResponse is the response type for the * Query/RegisteredReactions RPC method @@ -70,6 +166,22 @@ export interface QueryRegisteredReactionsResponse { registeredReactions: RegisteredReaction[]; pagination?: PageResponse; } +export interface QueryRegisteredReactionsResponseProtoMsg { + typeUrl: "/desmos.reactions.v1.QueryRegisteredReactionsResponse"; + value: Uint8Array; +} +/** + * QueryRegisteredReactionsResponse is the response type for the + * Query/RegisteredReactions RPC method + */ +export interface QueryRegisteredReactionsResponseAmino { + registered_reactions: RegisteredReactionAmino[]; + pagination?: PageResponseAmino; +} +export interface QueryRegisteredReactionsResponseAminoMsg { + type: "/desmos.reactions.v1.QueryRegisteredReactionsResponse"; + value: QueryRegisteredReactionsResponseAmino; +} /** * QueryRegisteredReactionRequest is the request type for the * Query/RegisteredReaction RPC method @@ -80,6 +192,24 @@ export interface QueryRegisteredReactionRequest { /** Id of the registered reaction to query for */ reactionId: number; } +export interface QueryRegisteredReactionRequestProtoMsg { + typeUrl: "/desmos.reactions.v1.QueryRegisteredReactionRequest"; + value: Uint8Array; +} +/** + * QueryRegisteredReactionRequest is the request type for the + * Query/RegisteredReaction RPC method + */ +export interface QueryRegisteredReactionRequestAmino { + /** Id of the subspace to query the registered reactions for */ + subspace_id: string; + /** Id of the registered reaction to query for */ + reaction_id: number; +} +export interface QueryRegisteredReactionRequestAminoMsg { + type: "/desmos.reactions.v1.QueryRegisteredReactionRequest"; + value: QueryRegisteredReactionRequestAmino; +} /** * QueryRegisteredReactionResponse is the response type for the * Query/RegisteredReaction RPC method @@ -87,6 +217,21 @@ export interface QueryRegisteredReactionRequest { export interface QueryRegisteredReactionResponse { registeredReaction?: RegisteredReaction; } +export interface QueryRegisteredReactionResponseProtoMsg { + typeUrl: "/desmos.reactions.v1.QueryRegisteredReactionResponse"; + value: Uint8Array; +} +/** + * QueryRegisteredReactionResponse is the response type for the + * Query/RegisteredReaction RPC method + */ +export interface QueryRegisteredReactionResponseAmino { + registered_reaction?: RegisteredReactionAmino; +} +export interface QueryRegisteredReactionResponseAminoMsg { + type: "/desmos.reactions.v1.QueryRegisteredReactionResponse"; + value: QueryRegisteredReactionResponseAmino; +} /** * QueryReactionsParamsRequest is the request type for the Query/ReactionsParams * RPC method @@ -95,6 +240,22 @@ export interface QueryReactionsParamsRequest { /** Id of the subspace for which to query the params */ subspaceId: Long; } +export interface QueryReactionsParamsRequestProtoMsg { + typeUrl: "/desmos.reactions.v1.QueryReactionsParamsRequest"; + value: Uint8Array; +} +/** + * QueryReactionsParamsRequest is the request type for the Query/ReactionsParams + * RPC method + */ +export interface QueryReactionsParamsRequestAmino { + /** Id of the subspace for which to query the params */ + subspace_id: string; +} +export interface QueryReactionsParamsRequestAminoMsg { + type: "/desmos.reactions.v1.QueryReactionsParamsRequest"; + value: QueryReactionsParamsRequestAmino; +} /** * QueryReactionsParamsResponse is the response type for the * Query/ReactionsParam RPC method @@ -102,6 +263,21 @@ export interface QueryReactionsParamsRequest { export interface QueryReactionsParamsResponse { params?: SubspaceReactionsParams; } +export interface QueryReactionsParamsResponseProtoMsg { + typeUrl: "/desmos.reactions.v1.QueryReactionsParamsResponse"; + value: Uint8Array; +} +/** + * QueryReactionsParamsResponse is the response type for the + * Query/ReactionsParam RPC method + */ +export interface QueryReactionsParamsResponseAmino { + params?: SubspaceReactionsParamsAmino; +} +export interface QueryReactionsParamsResponseAminoMsg { + type: "/desmos.reactions.v1.QueryReactionsParamsResponse"; + value: QueryReactionsParamsResponseAmino; +} function createBaseQueryReactionsRequest(): QueryReactionsRequest { return { subspaceId: Long.UZERO, @@ -202,6 +378,43 @@ export const QueryReactionsRequest = { : undefined; return message; }, + fromAmino(object: QueryReactionsRequestAmino): QueryReactionsRequest { + return { + subspaceId: Long.fromString(object.subspace_id), + postId: Long.fromString(object.post_id), + user: object.user, + pagination: object?.pagination + ? PageRequest.fromAmino(object.pagination) + : undefined, + }; + }, + toAmino(message: QueryReactionsRequest): QueryReactionsRequestAmino { + const obj: any = {}; + obj.subspace_id = message.subspaceId + ? message.subspaceId.toString() + : undefined; + obj.post_id = message.postId ? message.postId.toString() : undefined; + obj.user = message.user; + obj.pagination = message.pagination + ? PageRequest.toAmino(message.pagination) + : undefined; + return obj; + }, + fromAminoMsg(object: QueryReactionsRequestAminoMsg): QueryReactionsRequest { + return QueryReactionsRequest.fromAmino(object.value); + }, + fromProtoMsg(message: QueryReactionsRequestProtoMsg): QueryReactionsRequest { + return QueryReactionsRequest.decode(message.value); + }, + toProto(message: QueryReactionsRequest): Uint8Array { + return QueryReactionsRequest.encode(message).finish(); + }, + toProtoMsg(message: QueryReactionsRequest): QueryReactionsRequestProtoMsg { + return { + typeUrl: "/desmos.reactions.v1.QueryReactionsRequest", + value: QueryReactionsRequest.encode(message).finish(), + }; + }, }; function createBaseQueryReactionsResponse(): QueryReactionsResponse { return { @@ -285,6 +498,47 @@ export const QueryReactionsResponse = { : undefined; return message; }, + fromAmino(object: QueryReactionsResponseAmino): QueryReactionsResponse { + return { + reactions: Array.isArray(object?.reactions) + ? object.reactions.map((e: any) => Reaction.fromAmino(e)) + : [], + pagination: object?.pagination + ? PageResponse.fromAmino(object.pagination) + : undefined, + }; + }, + toAmino(message: QueryReactionsResponse): QueryReactionsResponseAmino { + const obj: any = {}; + if (message.reactions) { + obj.reactions = message.reactions.map((e) => + e ? Reaction.toAmino(e) : undefined + ); + } else { + obj.reactions = []; + } + obj.pagination = message.pagination + ? PageResponse.toAmino(message.pagination) + : undefined; + return obj; + }, + fromAminoMsg(object: QueryReactionsResponseAminoMsg): QueryReactionsResponse { + return QueryReactionsResponse.fromAmino(object.value); + }, + fromProtoMsg( + message: QueryReactionsResponseProtoMsg + ): QueryReactionsResponse { + return QueryReactionsResponse.decode(message.value); + }, + toProto(message: QueryReactionsResponse): Uint8Array { + return QueryReactionsResponse.encode(message).finish(); + }, + toProtoMsg(message: QueryReactionsResponse): QueryReactionsResponseProtoMsg { + return { + typeUrl: "/desmos.reactions.v1.QueryReactionsResponse", + value: QueryReactionsResponse.encode(message).finish(), + }; + }, }; function createBaseQueryReactionRequest(): QueryReactionRequest { return { @@ -369,6 +623,37 @@ export const QueryReactionRequest = { message.reactionId = object.reactionId ?? 0; return message; }, + fromAmino(object: QueryReactionRequestAmino): QueryReactionRequest { + return { + subspaceId: Long.fromString(object.subspace_id), + postId: Long.fromString(object.post_id), + reactionId: object.reaction_id, + }; + }, + toAmino(message: QueryReactionRequest): QueryReactionRequestAmino { + const obj: any = {}; + obj.subspace_id = message.subspaceId + ? message.subspaceId.toString() + : undefined; + obj.post_id = message.postId ? message.postId.toString() : undefined; + obj.reaction_id = message.reactionId; + return obj; + }, + fromAminoMsg(object: QueryReactionRequestAminoMsg): QueryReactionRequest { + return QueryReactionRequest.fromAmino(object.value); + }, + fromProtoMsg(message: QueryReactionRequestProtoMsg): QueryReactionRequest { + return QueryReactionRequest.decode(message.value); + }, + toProto(message: QueryReactionRequest): Uint8Array { + return QueryReactionRequest.encode(message).finish(); + }, + toProtoMsg(message: QueryReactionRequest): QueryReactionRequestProtoMsg { + return { + typeUrl: "/desmos.reactions.v1.QueryReactionRequest", + value: QueryReactionRequest.encode(message).finish(), + }; + }, }; function createBaseQueryReactionResponse(): QueryReactionResponse { return { @@ -430,6 +715,35 @@ export const QueryReactionResponse = { : undefined; return message; }, + fromAmino(object: QueryReactionResponseAmino): QueryReactionResponse { + return { + reaction: object?.reaction + ? Reaction.fromAmino(object.reaction) + : undefined, + }; + }, + toAmino(message: QueryReactionResponse): QueryReactionResponseAmino { + const obj: any = {}; + obj.reaction = message.reaction + ? Reaction.toAmino(message.reaction) + : undefined; + return obj; + }, + fromAminoMsg(object: QueryReactionResponseAminoMsg): QueryReactionResponse { + return QueryReactionResponse.fromAmino(object.value); + }, + fromProtoMsg(message: QueryReactionResponseProtoMsg): QueryReactionResponse { + return QueryReactionResponse.decode(message.value); + }, + toProto(message: QueryReactionResponse): Uint8Array { + return QueryReactionResponse.encode(message).finish(); + }, + toProtoMsg(message: QueryReactionResponse): QueryReactionResponseProtoMsg { + return { + typeUrl: "/desmos.reactions.v1.QueryReactionResponse", + value: QueryReactionResponse.encode(message).finish(), + }; + }, }; function createBaseQueryRegisteredReactionsRequest(): QueryRegisteredReactionsRequest { return { @@ -507,6 +821,49 @@ export const QueryRegisteredReactionsRequest = { : undefined; return message; }, + fromAmino( + object: QueryRegisteredReactionsRequestAmino + ): QueryRegisteredReactionsRequest { + return { + subspaceId: Long.fromString(object.subspace_id), + pagination: object?.pagination + ? PageRequest.fromAmino(object.pagination) + : undefined, + }; + }, + toAmino( + message: QueryRegisteredReactionsRequest + ): QueryRegisteredReactionsRequestAmino { + const obj: any = {}; + obj.subspace_id = message.subspaceId + ? message.subspaceId.toString() + : undefined; + obj.pagination = message.pagination + ? PageRequest.toAmino(message.pagination) + : undefined; + return obj; + }, + fromAminoMsg( + object: QueryRegisteredReactionsRequestAminoMsg + ): QueryRegisteredReactionsRequest { + return QueryRegisteredReactionsRequest.fromAmino(object.value); + }, + fromProtoMsg( + message: QueryRegisteredReactionsRequestProtoMsg + ): QueryRegisteredReactionsRequest { + return QueryRegisteredReactionsRequest.decode(message.value); + }, + toProto(message: QueryRegisteredReactionsRequest): Uint8Array { + return QueryRegisteredReactionsRequest.encode(message).finish(); + }, + toProtoMsg( + message: QueryRegisteredReactionsRequest + ): QueryRegisteredReactionsRequestProtoMsg { + return { + typeUrl: "/desmos.reactions.v1.QueryRegisteredReactionsRequest", + value: QueryRegisteredReactionsRequest.encode(message).finish(), + }; + }, }; function createBaseQueryRegisteredReactionsResponse(): QueryRegisteredReactionsResponse { return { @@ -596,6 +953,57 @@ export const QueryRegisteredReactionsResponse = { : undefined; return message; }, + fromAmino( + object: QueryRegisteredReactionsResponseAmino + ): QueryRegisteredReactionsResponse { + return { + registeredReactions: Array.isArray(object?.registered_reactions) + ? object.registered_reactions.map((e: any) => + RegisteredReaction.fromAmino(e) + ) + : [], + pagination: object?.pagination + ? PageResponse.fromAmino(object.pagination) + : undefined, + }; + }, + toAmino( + message: QueryRegisteredReactionsResponse + ): QueryRegisteredReactionsResponseAmino { + const obj: any = {}; + if (message.registeredReactions) { + obj.registered_reactions = message.registeredReactions.map((e) => + e ? RegisteredReaction.toAmino(e) : undefined + ); + } else { + obj.registered_reactions = []; + } + obj.pagination = message.pagination + ? PageResponse.toAmino(message.pagination) + : undefined; + return obj; + }, + fromAminoMsg( + object: QueryRegisteredReactionsResponseAminoMsg + ): QueryRegisteredReactionsResponse { + return QueryRegisteredReactionsResponse.fromAmino(object.value); + }, + fromProtoMsg( + message: QueryRegisteredReactionsResponseProtoMsg + ): QueryRegisteredReactionsResponse { + return QueryRegisteredReactionsResponse.decode(message.value); + }, + toProto(message: QueryRegisteredReactionsResponse): Uint8Array { + return QueryRegisteredReactionsResponse.encode(message).finish(); + }, + toProtoMsg( + message: QueryRegisteredReactionsResponse + ): QueryRegisteredReactionsResponseProtoMsg { + return { + typeUrl: "/desmos.reactions.v1.QueryRegisteredReactionsResponse", + value: QueryRegisteredReactionsResponse.encode(message).finish(), + }; + }, }; function createBaseQueryRegisteredReactionRequest(): QueryRegisteredReactionRequest { return { @@ -666,6 +1074,45 @@ export const QueryRegisteredReactionRequest = { message.reactionId = object.reactionId ?? 0; return message; }, + fromAmino( + object: QueryRegisteredReactionRequestAmino + ): QueryRegisteredReactionRequest { + return { + subspaceId: Long.fromString(object.subspace_id), + reactionId: object.reaction_id, + }; + }, + toAmino( + message: QueryRegisteredReactionRequest + ): QueryRegisteredReactionRequestAmino { + const obj: any = {}; + obj.subspace_id = message.subspaceId + ? message.subspaceId.toString() + : undefined; + obj.reaction_id = message.reactionId; + return obj; + }, + fromAminoMsg( + object: QueryRegisteredReactionRequestAminoMsg + ): QueryRegisteredReactionRequest { + return QueryRegisteredReactionRequest.fromAmino(object.value); + }, + fromProtoMsg( + message: QueryRegisteredReactionRequestProtoMsg + ): QueryRegisteredReactionRequest { + return QueryRegisteredReactionRequest.decode(message.value); + }, + toProto(message: QueryRegisteredReactionRequest): Uint8Array { + return QueryRegisteredReactionRequest.encode(message).finish(); + }, + toProtoMsg( + message: QueryRegisteredReactionRequest + ): QueryRegisteredReactionRequestProtoMsg { + return { + typeUrl: "/desmos.reactions.v1.QueryRegisteredReactionRequest", + value: QueryRegisteredReactionRequest.encode(message).finish(), + }; + }, }; function createBaseQueryRegisteredReactionResponse(): QueryRegisteredReactionResponse { return { @@ -734,6 +1181,45 @@ export const QueryRegisteredReactionResponse = { : undefined; return message; }, + fromAmino( + object: QueryRegisteredReactionResponseAmino + ): QueryRegisteredReactionResponse { + return { + registeredReaction: object?.registered_reaction + ? RegisteredReaction.fromAmino(object.registered_reaction) + : undefined, + }; + }, + toAmino( + message: QueryRegisteredReactionResponse + ): QueryRegisteredReactionResponseAmino { + const obj: any = {}; + obj.registered_reaction = message.registeredReaction + ? RegisteredReaction.toAmino(message.registeredReaction) + : undefined; + return obj; + }, + fromAminoMsg( + object: QueryRegisteredReactionResponseAminoMsg + ): QueryRegisteredReactionResponse { + return QueryRegisteredReactionResponse.fromAmino(object.value); + }, + fromProtoMsg( + message: QueryRegisteredReactionResponseProtoMsg + ): QueryRegisteredReactionResponse { + return QueryRegisteredReactionResponse.decode(message.value); + }, + toProto(message: QueryRegisteredReactionResponse): Uint8Array { + return QueryRegisteredReactionResponse.encode(message).finish(); + }, + toProtoMsg( + message: QueryRegisteredReactionResponse + ): QueryRegisteredReactionResponseProtoMsg { + return { + typeUrl: "/desmos.reactions.v1.QueryRegisteredReactionResponse", + value: QueryRegisteredReactionResponse.encode(message).finish(), + }; + }, }; function createBaseQueryReactionsParamsRequest(): QueryReactionsParamsRequest { return { @@ -793,6 +1279,43 @@ export const QueryReactionsParamsRequest = { : Long.UZERO; return message; }, + fromAmino( + object: QueryReactionsParamsRequestAmino + ): QueryReactionsParamsRequest { + return { + subspaceId: Long.fromString(object.subspace_id), + }; + }, + toAmino( + message: QueryReactionsParamsRequest + ): QueryReactionsParamsRequestAmino { + const obj: any = {}; + obj.subspace_id = message.subspaceId + ? message.subspaceId.toString() + : undefined; + return obj; + }, + fromAminoMsg( + object: QueryReactionsParamsRequestAminoMsg + ): QueryReactionsParamsRequest { + return QueryReactionsParamsRequest.fromAmino(object.value); + }, + fromProtoMsg( + message: QueryReactionsParamsRequestProtoMsg + ): QueryReactionsParamsRequest { + return QueryReactionsParamsRequest.decode(message.value); + }, + toProto(message: QueryReactionsParamsRequest): Uint8Array { + return QueryReactionsParamsRequest.encode(message).finish(); + }, + toProtoMsg( + message: QueryReactionsParamsRequest + ): QueryReactionsParamsRequestProtoMsg { + return { + typeUrl: "/desmos.reactions.v1.QueryReactionsParamsRequest", + value: QueryReactionsParamsRequest.encode(message).finish(), + }; + }, }; function createBaseQueryReactionsParamsResponse(): QueryReactionsParamsResponse { return { @@ -860,6 +1383,45 @@ export const QueryReactionsParamsResponse = { : undefined; return message; }, + fromAmino( + object: QueryReactionsParamsResponseAmino + ): QueryReactionsParamsResponse { + return { + params: object?.params + ? SubspaceReactionsParams.fromAmino(object.params) + : undefined, + }; + }, + toAmino( + message: QueryReactionsParamsResponse + ): QueryReactionsParamsResponseAmino { + const obj: any = {}; + obj.params = message.params + ? SubspaceReactionsParams.toAmino(message.params) + : undefined; + return obj; + }, + fromAminoMsg( + object: QueryReactionsParamsResponseAminoMsg + ): QueryReactionsParamsResponse { + return QueryReactionsParamsResponse.fromAmino(object.value); + }, + fromProtoMsg( + message: QueryReactionsParamsResponseProtoMsg + ): QueryReactionsParamsResponse { + return QueryReactionsParamsResponse.decode(message.value); + }, + toProto(message: QueryReactionsParamsResponse): Uint8Array { + return QueryReactionsParamsResponse.encode(message).finish(); + }, + toProtoMsg( + message: QueryReactionsParamsResponse + ): QueryReactionsParamsResponseProtoMsg { + return { + typeUrl: "/desmos.reactions.v1.QueryReactionsParamsResponse", + value: QueryReactionsParamsResponse.encode(message).finish(), + }; + }, }; /** Query defines the gRPC querier service. */ export interface Query { diff --git a/packages/types/src/desmos/relationships/v1/genesis.ts b/packages/types/src/desmos/relationships/v1/genesis.ts index 017423310..f13242d20 100644 --- a/packages/types/src/desmos/relationships/v1/genesis.ts +++ b/packages/types/src/desmos/relationships/v1/genesis.ts @@ -1,5 +1,10 @@ /* eslint-disable */ -import { Relationship, UserBlock } from "./models"; +import { + Relationship, + RelationshipAmino, + UserBlock, + UserBlockAmino, +} from "./models"; import * as _m0 from "protobufjs/minimal"; import { DeepPartial, Exact } from "../../../helpers"; export const protobufPackage = "desmos.relationships.v1"; @@ -8,6 +13,19 @@ export interface GenesisState { relationships: Relationship[]; blocks: UserBlock[]; } +export interface GenesisStateProtoMsg { + typeUrl: "/desmos.relationships.v1.GenesisState"; + value: Uint8Array; +} +/** GenesisState defines the profiles module's genesis state. */ +export interface GenesisStateAmino { + relationships: RelationshipAmino[]; + blocks: UserBlockAmino[]; +} +export interface GenesisStateAminoMsg { + type: "/desmos.relationships.v1.GenesisState"; + value: GenesisStateAmino; +} function createBaseGenesisState(): GenesisState { return { relationships: [], @@ -86,4 +104,47 @@ export const GenesisState = { message.blocks = object.blocks?.map((e) => UserBlock.fromPartial(e)) || []; return message; }, + fromAmino(object: GenesisStateAmino): GenesisState { + return { + relationships: Array.isArray(object?.relationships) + ? object.relationships.map((e: any) => Relationship.fromAmino(e)) + : [], + blocks: Array.isArray(object?.blocks) + ? object.blocks.map((e: any) => UserBlock.fromAmino(e)) + : [], + }; + }, + toAmino(message: GenesisState): GenesisStateAmino { + const obj: any = {}; + if (message.relationships) { + obj.relationships = message.relationships.map((e) => + e ? Relationship.toAmino(e) : undefined + ); + } else { + obj.relationships = []; + } + if (message.blocks) { + obj.blocks = message.blocks.map((e) => + e ? UserBlock.toAmino(e) : undefined + ); + } else { + obj.blocks = []; + } + return obj; + }, + fromAminoMsg(object: GenesisStateAminoMsg): GenesisState { + return GenesisState.fromAmino(object.value); + }, + fromProtoMsg(message: GenesisStateProtoMsg): GenesisState { + return GenesisState.decode(message.value); + }, + toProto(message: GenesisState): Uint8Array { + return GenesisState.encode(message).finish(); + }, + toProtoMsg(message: GenesisState): GenesisStateProtoMsg { + return { + typeUrl: "/desmos.relationships.v1.GenesisState", + value: GenesisState.encode(message).finish(), + }; + }, }; diff --git a/packages/types/src/desmos/relationships/v1/models.ts b/packages/types/src/desmos/relationships/v1/models.ts index daf7550aa..ace4f263c 100644 --- a/packages/types/src/desmos/relationships/v1/models.ts +++ b/packages/types/src/desmos/relationships/v1/models.ts @@ -17,6 +17,29 @@ export interface Relationship { */ subspaceId: Long; } +export interface RelationshipProtoMsg { + typeUrl: "/desmos.relationships.v1.Relationship"; + value: Uint8Array; +} +/** + * Relationship is the struct of a relationship. + * It represent the concept of "follow" of traditional social networks. + */ +export interface RelationshipAmino { + /** Creator represents the creator of the relationship */ + creator: string; + /** Counterparty represents the other user involved in the relationship */ + counterparty: string; + /** + * SubspaceID represents the id of the subspace for which the relationship is + * valid + */ + subspace_id: string; +} +export interface RelationshipAminoMsg { + type: "/desmos.relationships.v1.Relationship"; + value: RelationshipAmino; +} /** * UserBlock represents the fact that the Blocker has blocked the given Blocked * user. @@ -34,6 +57,31 @@ export interface UserBlock { */ subspaceId: Long; } +export interface UserBlockProtoMsg { + typeUrl: "/desmos.relationships.v1.UserBlock"; + value: Uint8Array; +} +/** + * UserBlock represents the fact that the Blocker has blocked the given Blocked + * user. + */ +export interface UserBlockAmino { + /** Blocker represents the address of the user blocking another one */ + blocker: string; + /** Blocked represents the address of the blocked user */ + blocked: string; + /** Reason represents the optional reason the user has been blocked for. */ + reason: string; + /** + * SubspaceID represents the ID of the subspace inside which the user should + * be blocked + */ + subspace_id: string; +} +export interface UserBlockAminoMsg { + type: "/desmos.relationships.v1.UserBlock"; + value: UserBlockAmino; +} function createBaseRelationship(): Relationship { return { creator: "", @@ -112,6 +160,37 @@ export const Relationship = { : Long.UZERO; return message; }, + fromAmino(object: RelationshipAmino): Relationship { + return { + creator: object.creator, + counterparty: object.counterparty, + subspaceId: Long.fromString(object.subspace_id), + }; + }, + toAmino(message: Relationship): RelationshipAmino { + const obj: any = {}; + obj.creator = message.creator; + obj.counterparty = message.counterparty; + obj.subspace_id = message.subspaceId + ? message.subspaceId.toString() + : undefined; + return obj; + }, + fromAminoMsg(object: RelationshipAminoMsg): Relationship { + return Relationship.fromAmino(object.value); + }, + fromProtoMsg(message: RelationshipProtoMsg): Relationship { + return Relationship.decode(message.value); + }, + toProto(message: Relationship): Uint8Array { + return Relationship.encode(message).finish(); + }, + toProtoMsg(message: Relationship): RelationshipProtoMsg { + return { + typeUrl: "/desmos.relationships.v1.Relationship", + value: Relationship.encode(message).finish(), + }; + }, }; function createBaseUserBlock(): UserBlock { return { @@ -198,4 +277,37 @@ export const UserBlock = { : Long.UZERO; return message; }, + fromAmino(object: UserBlockAmino): UserBlock { + return { + blocker: object.blocker, + blocked: object.blocked, + reason: object.reason, + subspaceId: Long.fromString(object.subspace_id), + }; + }, + toAmino(message: UserBlock): UserBlockAmino { + const obj: any = {}; + obj.blocker = message.blocker; + obj.blocked = message.blocked; + obj.reason = message.reason; + obj.subspace_id = message.subspaceId + ? message.subspaceId.toString() + : undefined; + return obj; + }, + fromAminoMsg(object: UserBlockAminoMsg): UserBlock { + return UserBlock.fromAmino(object.value); + }, + fromProtoMsg(message: UserBlockProtoMsg): UserBlock { + return UserBlock.decode(message.value); + }, + toProto(message: UserBlock): Uint8Array { + return UserBlock.encode(message).finish(); + }, + toProtoMsg(message: UserBlock): UserBlockProtoMsg { + return { + typeUrl: "/desmos.relationships.v1.UserBlock", + value: UserBlock.encode(message).finish(), + }; + }, }; diff --git a/packages/types/src/desmos/relationships/v1/msgs.amino.ts b/packages/types/src/desmos/relationships/v1/msgs.amino.ts new file mode 100644 index 000000000..7d197c97f --- /dev/null +++ b/packages/types/src/desmos/relationships/v1/msgs.amino.ts @@ -0,0 +1,29 @@ +/* eslint-disable */ +import { + MsgCreateRelationship, + MsgDeleteRelationship, + MsgBlockUser, + MsgUnblockUser, +} from "./msgs"; +export const AminoConverter = { + "/desmos.relationships.v1.MsgCreateRelationship": { + aminoType: "/desmos.relationships.v1.MsgCreateRelationship", + toAmino: MsgCreateRelationship.toAmino, + fromAmino: MsgCreateRelationship.fromAmino, + }, + "/desmos.relationships.v1.MsgDeleteRelationship": { + aminoType: "/desmos.relationships.v1.MsgDeleteRelationship", + toAmino: MsgDeleteRelationship.toAmino, + fromAmino: MsgDeleteRelationship.fromAmino, + }, + "/desmos.relationships.v1.MsgBlockUser": { + aminoType: "/desmos.relationships.v1.MsgBlockUser", + toAmino: MsgBlockUser.toAmino, + fromAmino: MsgBlockUser.fromAmino, + }, + "/desmos.relationships.v1.MsgUnblockUser": { + aminoType: "/desmos.relationships.v1.MsgUnblockUser", + toAmino: MsgUnblockUser.toAmino, + fromAmino: MsgUnblockUser.fromAmino, + }, +}; diff --git a/packages/types/src/desmos/relationships/v1/msgs.registry.ts b/packages/types/src/desmos/relationships/v1/msgs.registry.ts new file mode 100644 index 000000000..0ed339bd7 --- /dev/null +++ b/packages/types/src/desmos/relationships/v1/msgs.registry.ts @@ -0,0 +1,151 @@ +/* eslint-disable */ +import { GeneratedType, Registry } from "@cosmjs/proto-signing"; +import { + MsgCreateRelationship, + MsgDeleteRelationship, + MsgBlockUser, + MsgUnblockUser, +} from "./msgs"; +export const registry: ReadonlyArray<[string, GeneratedType]> = [ + ["/desmos.relationships.v1.MsgCreateRelationship", MsgCreateRelationship], + ["/desmos.relationships.v1.MsgDeleteRelationship", MsgDeleteRelationship], + ["/desmos.relationships.v1.MsgBlockUser", MsgBlockUser], + ["/desmos.relationships.v1.MsgUnblockUser", MsgUnblockUser], +]; +export const load = (protoRegistry: Registry) => { + registry.forEach(([typeUrl, mod]) => { + protoRegistry.register(typeUrl, mod); + }); +}; +export const MessageComposer = { + encoded: { + createRelationship(value: MsgCreateRelationship) { + return { + typeUrl: "/desmos.relationships.v1.MsgCreateRelationship", + value: MsgCreateRelationship.encode(value).finish(), + }; + }, + deleteRelationship(value: MsgDeleteRelationship) { + return { + typeUrl: "/desmos.relationships.v1.MsgDeleteRelationship", + value: MsgDeleteRelationship.encode(value).finish(), + }; + }, + blockUser(value: MsgBlockUser) { + return { + typeUrl: "/desmos.relationships.v1.MsgBlockUser", + value: MsgBlockUser.encode(value).finish(), + }; + }, + unblockUser(value: MsgUnblockUser) { + return { + typeUrl: "/desmos.relationships.v1.MsgUnblockUser", + value: MsgUnblockUser.encode(value).finish(), + }; + }, + }, + withTypeUrl: { + createRelationship(value: MsgCreateRelationship) { + return { + typeUrl: "/desmos.relationships.v1.MsgCreateRelationship", + value, + }; + }, + deleteRelationship(value: MsgDeleteRelationship) { + return { + typeUrl: "/desmos.relationships.v1.MsgDeleteRelationship", + value, + }; + }, + blockUser(value: MsgBlockUser) { + return { + typeUrl: "/desmos.relationships.v1.MsgBlockUser", + value, + }; + }, + unblockUser(value: MsgUnblockUser) { + return { + typeUrl: "/desmos.relationships.v1.MsgUnblockUser", + value, + }; + }, + }, + toJSON: { + createRelationship(value: MsgCreateRelationship) { + return { + typeUrl: "/desmos.relationships.v1.MsgCreateRelationship", + value: MsgCreateRelationship.toJSON(value), + }; + }, + deleteRelationship(value: MsgDeleteRelationship) { + return { + typeUrl: "/desmos.relationships.v1.MsgDeleteRelationship", + value: MsgDeleteRelationship.toJSON(value), + }; + }, + blockUser(value: MsgBlockUser) { + return { + typeUrl: "/desmos.relationships.v1.MsgBlockUser", + value: MsgBlockUser.toJSON(value), + }; + }, + unblockUser(value: MsgUnblockUser) { + return { + typeUrl: "/desmos.relationships.v1.MsgUnblockUser", + value: MsgUnblockUser.toJSON(value), + }; + }, + }, + fromJSON: { + createRelationship(value: any) { + return { + typeUrl: "/desmos.relationships.v1.MsgCreateRelationship", + value: MsgCreateRelationship.fromJSON(value), + }; + }, + deleteRelationship(value: any) { + return { + typeUrl: "/desmos.relationships.v1.MsgDeleteRelationship", + value: MsgDeleteRelationship.fromJSON(value), + }; + }, + blockUser(value: any) { + return { + typeUrl: "/desmos.relationships.v1.MsgBlockUser", + value: MsgBlockUser.fromJSON(value), + }; + }, + unblockUser(value: any) { + return { + typeUrl: "/desmos.relationships.v1.MsgUnblockUser", + value: MsgUnblockUser.fromJSON(value), + }; + }, + }, + fromPartial: { + createRelationship(value: MsgCreateRelationship) { + return { + typeUrl: "/desmos.relationships.v1.MsgCreateRelationship", + value: MsgCreateRelationship.fromPartial(value), + }; + }, + deleteRelationship(value: MsgDeleteRelationship) { + return { + typeUrl: "/desmos.relationships.v1.MsgDeleteRelationship", + value: MsgDeleteRelationship.fromPartial(value), + }; + }, + blockUser(value: MsgBlockUser) { + return { + typeUrl: "/desmos.relationships.v1.MsgBlockUser", + value: MsgBlockUser.fromPartial(value), + }; + }, + unblockUser(value: MsgUnblockUser) { + return { + typeUrl: "/desmos.relationships.v1.MsgUnblockUser", + value: MsgUnblockUser.fromPartial(value), + }; + }, + }, +}; diff --git a/packages/types/src/desmos/relationships/v1/msgs.ts b/packages/types/src/desmos/relationships/v1/msgs.ts index 35ddcd022..cf1170df2 100644 --- a/packages/types/src/desmos/relationships/v1/msgs.ts +++ b/packages/types/src/desmos/relationships/v1/msgs.ts @@ -14,11 +14,44 @@ export interface MsgCreateRelationship { /** Subspace id inside which the relationship will be valid */ subspaceId: Long; } +export interface MsgCreateRelationshipProtoMsg { + typeUrl: "/desmos.relationships.v1.MsgCreateRelationship"; + value: Uint8Array; +} +/** + * MsgCreateRelationship represents a message to create a relationship + * between two users on a specific subspace. + */ +export interface MsgCreateRelationshipAmino { + /** User creating the relationship */ + signer: string; + /** Counterparty of the relationship (i.e. user to be followed) */ + counterparty: string; + /** Subspace id inside which the relationship will be valid */ + subspace_id: string; +} +export interface MsgCreateRelationshipAminoMsg { + type: "/desmos.relationships.v1.MsgCreateRelationship"; + value: MsgCreateRelationshipAmino; +} /** * MsgCreateRelationshipResponse defines the Msg/CreateRelationship response * type. */ export interface MsgCreateRelationshipResponse {} +export interface MsgCreateRelationshipResponseProtoMsg { + typeUrl: "/desmos.relationships.v1.MsgCreateRelationshipResponse"; + value: Uint8Array; +} +/** + * MsgCreateRelationshipResponse defines the Msg/CreateRelationship response + * type. + */ +export interface MsgCreateRelationshipResponseAmino {} +export interface MsgCreateRelationshipResponseAminoMsg { + type: "/desmos.relationships.v1.MsgCreateRelationshipResponse"; + value: MsgCreateRelationshipResponseAmino; +} /** * MsgDeleteRelationship represents a message to delete the relationship * between two users. @@ -31,11 +64,44 @@ export interface MsgDeleteRelationship { /** Id of the subspace inside which the relationship to delete exists */ subspaceId: Long; } +export interface MsgDeleteRelationshipProtoMsg { + typeUrl: "/desmos.relationships.v1.MsgDeleteRelationship"; + value: Uint8Array; +} +/** + * MsgDeleteRelationship represents a message to delete the relationship + * between two users. + */ +export interface MsgDeleteRelationshipAmino { + /** User that created the relationship */ + signer: string; + /** Counterparty of the relationship that should be deleted */ + counterparty: string; + /** Id of the subspace inside which the relationship to delete exists */ + subspace_id: string; +} +export interface MsgDeleteRelationshipAminoMsg { + type: "/desmos.relationships.v1.MsgDeleteRelationship"; + value: MsgDeleteRelationshipAmino; +} /** * MsgDeleteRelationshipResponse defines the Msg/DeleteRelationship response * type. */ export interface MsgDeleteRelationshipResponse {} +export interface MsgDeleteRelationshipResponseProtoMsg { + typeUrl: "/desmos.relationships.v1.MsgDeleteRelationshipResponse"; + value: Uint8Array; +} +/** + * MsgDeleteRelationshipResponse defines the Msg/DeleteRelationship response + * type. + */ +export interface MsgDeleteRelationshipResponseAmino {} +export interface MsgDeleteRelationshipResponseAminoMsg { + type: "/desmos.relationships.v1.MsgDeleteRelationshipResponse"; + value: MsgDeleteRelationshipResponseAmino; +} /** * MsgBlockUser represents a message to block another user specifying an * optional reason. @@ -50,8 +116,40 @@ export interface MsgBlockUser { /** Id of the subspace inside which the user should be blocked */ subspaceId: Long; } +export interface MsgBlockUserProtoMsg { + typeUrl: "/desmos.relationships.v1.MsgBlockUser"; + value: Uint8Array; +} +/** + * MsgBlockUser represents a message to block another user specifying an + * optional reason. + */ +export interface MsgBlockUserAmino { + /** Address of the user blocking the other user */ + blocker: string; + /** Address of the user that should be blocked */ + blocked: string; + /** (optional) Reason why the user has been blocked */ + reason: string; + /** Id of the subspace inside which the user should be blocked */ + subspace_id: string; +} +export interface MsgBlockUserAminoMsg { + type: "/desmos.relationships.v1.MsgBlockUser"; + value: MsgBlockUserAmino; +} /** MsgBlockUserResponse defines the Msg/BlockUser response type. */ export interface MsgBlockUserResponse {} +export interface MsgBlockUserResponseProtoMsg { + typeUrl: "/desmos.relationships.v1.MsgBlockUserResponse"; + value: Uint8Array; +} +/** MsgBlockUserResponse defines the Msg/BlockUser response type. */ +export interface MsgBlockUserResponseAmino {} +export interface MsgBlockUserResponseAminoMsg { + type: "/desmos.relationships.v1.MsgBlockUserResponse"; + value: MsgBlockUserResponseAmino; +} /** MsgUnblockUser represents a message to unblock a previously blocked user. */ export interface MsgUnblockUser { /** Address of the user that blocked another user */ @@ -61,8 +159,35 @@ export interface MsgUnblockUser { /** Id of the subspace inside which the user should be unblocked */ subspaceId: Long; } +export interface MsgUnblockUserProtoMsg { + typeUrl: "/desmos.relationships.v1.MsgUnblockUser"; + value: Uint8Array; +} +/** MsgUnblockUser represents a message to unblock a previously blocked user. */ +export interface MsgUnblockUserAmino { + /** Address of the user that blocked another user */ + blocker: string; + /** Address of the user that should be unblocked */ + blocked: string; + /** Id of the subspace inside which the user should be unblocked */ + subspace_id: string; +} +export interface MsgUnblockUserAminoMsg { + type: "/desmos.relationships.v1.MsgUnblockUser"; + value: MsgUnblockUserAmino; +} /** MsgUnblockUserResponse defines the Msg/UnblockUser response type. */ export interface MsgUnblockUserResponse {} +export interface MsgUnblockUserResponseProtoMsg { + typeUrl: "/desmos.relationships.v1.MsgUnblockUserResponse"; + value: Uint8Array; +} +/** MsgUnblockUserResponse defines the Msg/UnblockUser response type. */ +export interface MsgUnblockUserResponseAmino {} +export interface MsgUnblockUserResponseAminoMsg { + type: "/desmos.relationships.v1.MsgUnblockUserResponse"; + value: MsgUnblockUserResponseAmino; +} function createBaseMsgCreateRelationship(): MsgCreateRelationship { return { signer: "", @@ -144,6 +269,37 @@ export const MsgCreateRelationship = { : Long.UZERO; return message; }, + fromAmino(object: MsgCreateRelationshipAmino): MsgCreateRelationship { + return { + signer: object.signer, + counterparty: object.counterparty, + subspaceId: Long.fromString(object.subspace_id), + }; + }, + toAmino(message: MsgCreateRelationship): MsgCreateRelationshipAmino { + const obj: any = {}; + obj.signer = message.signer; + obj.counterparty = message.counterparty; + obj.subspace_id = message.subspaceId + ? message.subspaceId.toString() + : undefined; + return obj; + }, + fromAminoMsg(object: MsgCreateRelationshipAminoMsg): MsgCreateRelationship { + return MsgCreateRelationship.fromAmino(object.value); + }, + fromProtoMsg(message: MsgCreateRelationshipProtoMsg): MsgCreateRelationship { + return MsgCreateRelationship.decode(message.value); + }, + toProto(message: MsgCreateRelationship): Uint8Array { + return MsgCreateRelationship.encode(message).finish(); + }, + toProtoMsg(message: MsgCreateRelationship): MsgCreateRelationshipProtoMsg { + return { + typeUrl: "/desmos.relationships.v1.MsgCreateRelationship", + value: MsgCreateRelationship.encode(message).finish(), + }; + }, }; function createBaseMsgCreateRelationshipResponse(): MsgCreateRelationshipResponse { return {}; @@ -185,6 +341,38 @@ export const MsgCreateRelationshipResponse = { const message = createBaseMsgCreateRelationshipResponse(); return message; }, + fromAmino( + _: MsgCreateRelationshipResponseAmino + ): MsgCreateRelationshipResponse { + return {}; + }, + toAmino( + _: MsgCreateRelationshipResponse + ): MsgCreateRelationshipResponseAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg( + object: MsgCreateRelationshipResponseAminoMsg + ): MsgCreateRelationshipResponse { + return MsgCreateRelationshipResponse.fromAmino(object.value); + }, + fromProtoMsg( + message: MsgCreateRelationshipResponseProtoMsg + ): MsgCreateRelationshipResponse { + return MsgCreateRelationshipResponse.decode(message.value); + }, + toProto(message: MsgCreateRelationshipResponse): Uint8Array { + return MsgCreateRelationshipResponse.encode(message).finish(); + }, + toProtoMsg( + message: MsgCreateRelationshipResponse + ): MsgCreateRelationshipResponseProtoMsg { + return { + typeUrl: "/desmos.relationships.v1.MsgCreateRelationshipResponse", + value: MsgCreateRelationshipResponse.encode(message).finish(), + }; + }, }; function createBaseMsgDeleteRelationship(): MsgDeleteRelationship { return { @@ -267,6 +455,37 @@ export const MsgDeleteRelationship = { : Long.UZERO; return message; }, + fromAmino(object: MsgDeleteRelationshipAmino): MsgDeleteRelationship { + return { + signer: object.signer, + counterparty: object.counterparty, + subspaceId: Long.fromString(object.subspace_id), + }; + }, + toAmino(message: MsgDeleteRelationship): MsgDeleteRelationshipAmino { + const obj: any = {}; + obj.signer = message.signer; + obj.counterparty = message.counterparty; + obj.subspace_id = message.subspaceId + ? message.subspaceId.toString() + : undefined; + return obj; + }, + fromAminoMsg(object: MsgDeleteRelationshipAminoMsg): MsgDeleteRelationship { + return MsgDeleteRelationship.fromAmino(object.value); + }, + fromProtoMsg(message: MsgDeleteRelationshipProtoMsg): MsgDeleteRelationship { + return MsgDeleteRelationship.decode(message.value); + }, + toProto(message: MsgDeleteRelationship): Uint8Array { + return MsgDeleteRelationship.encode(message).finish(); + }, + toProtoMsg(message: MsgDeleteRelationship): MsgDeleteRelationshipProtoMsg { + return { + typeUrl: "/desmos.relationships.v1.MsgDeleteRelationship", + value: MsgDeleteRelationship.encode(message).finish(), + }; + }, }; function createBaseMsgDeleteRelationshipResponse(): MsgDeleteRelationshipResponse { return {}; @@ -308,6 +527,38 @@ export const MsgDeleteRelationshipResponse = { const message = createBaseMsgDeleteRelationshipResponse(); return message; }, + fromAmino( + _: MsgDeleteRelationshipResponseAmino + ): MsgDeleteRelationshipResponse { + return {}; + }, + toAmino( + _: MsgDeleteRelationshipResponse + ): MsgDeleteRelationshipResponseAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg( + object: MsgDeleteRelationshipResponseAminoMsg + ): MsgDeleteRelationshipResponse { + return MsgDeleteRelationshipResponse.fromAmino(object.value); + }, + fromProtoMsg( + message: MsgDeleteRelationshipResponseProtoMsg + ): MsgDeleteRelationshipResponse { + return MsgDeleteRelationshipResponse.decode(message.value); + }, + toProto(message: MsgDeleteRelationshipResponse): Uint8Array { + return MsgDeleteRelationshipResponse.encode(message).finish(); + }, + toProtoMsg( + message: MsgDeleteRelationshipResponse + ): MsgDeleteRelationshipResponseProtoMsg { + return { + typeUrl: "/desmos.relationships.v1.MsgDeleteRelationshipResponse", + value: MsgDeleteRelationshipResponse.encode(message).finish(), + }; + }, }; function createBaseMsgBlockUser(): MsgBlockUser { return { @@ -394,6 +645,39 @@ export const MsgBlockUser = { : Long.UZERO; return message; }, + fromAmino(object: MsgBlockUserAmino): MsgBlockUser { + return { + blocker: object.blocker, + blocked: object.blocked, + reason: object.reason, + subspaceId: Long.fromString(object.subspace_id), + }; + }, + toAmino(message: MsgBlockUser): MsgBlockUserAmino { + const obj: any = {}; + obj.blocker = message.blocker; + obj.blocked = message.blocked; + obj.reason = message.reason; + obj.subspace_id = message.subspaceId + ? message.subspaceId.toString() + : undefined; + return obj; + }, + fromAminoMsg(object: MsgBlockUserAminoMsg): MsgBlockUser { + return MsgBlockUser.fromAmino(object.value); + }, + fromProtoMsg(message: MsgBlockUserProtoMsg): MsgBlockUser { + return MsgBlockUser.decode(message.value); + }, + toProto(message: MsgBlockUser): Uint8Array { + return MsgBlockUser.encode(message).finish(); + }, + toProtoMsg(message: MsgBlockUser): MsgBlockUserProtoMsg { + return { + typeUrl: "/desmos.relationships.v1.MsgBlockUser", + value: MsgBlockUser.encode(message).finish(), + }; + }, }; function createBaseMsgBlockUserResponse(): MsgBlockUserResponse { return {}; @@ -435,6 +719,28 @@ export const MsgBlockUserResponse = { const message = createBaseMsgBlockUserResponse(); return message; }, + fromAmino(_: MsgBlockUserResponseAmino): MsgBlockUserResponse { + return {}; + }, + toAmino(_: MsgBlockUserResponse): MsgBlockUserResponseAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg(object: MsgBlockUserResponseAminoMsg): MsgBlockUserResponse { + return MsgBlockUserResponse.fromAmino(object.value); + }, + fromProtoMsg(message: MsgBlockUserResponseProtoMsg): MsgBlockUserResponse { + return MsgBlockUserResponse.decode(message.value); + }, + toProto(message: MsgBlockUserResponse): Uint8Array { + return MsgBlockUserResponse.encode(message).finish(); + }, + toProtoMsg(message: MsgBlockUserResponse): MsgBlockUserResponseProtoMsg { + return { + typeUrl: "/desmos.relationships.v1.MsgBlockUserResponse", + value: MsgBlockUserResponse.encode(message).finish(), + }; + }, }; function createBaseMsgUnblockUser(): MsgUnblockUser { return { @@ -511,6 +817,37 @@ export const MsgUnblockUser = { : Long.UZERO; return message; }, + fromAmino(object: MsgUnblockUserAmino): MsgUnblockUser { + return { + blocker: object.blocker, + blocked: object.blocked, + subspaceId: Long.fromString(object.subspace_id), + }; + }, + toAmino(message: MsgUnblockUser): MsgUnblockUserAmino { + const obj: any = {}; + obj.blocker = message.blocker; + obj.blocked = message.blocked; + obj.subspace_id = message.subspaceId + ? message.subspaceId.toString() + : undefined; + return obj; + }, + fromAminoMsg(object: MsgUnblockUserAminoMsg): MsgUnblockUser { + return MsgUnblockUser.fromAmino(object.value); + }, + fromProtoMsg(message: MsgUnblockUserProtoMsg): MsgUnblockUser { + return MsgUnblockUser.decode(message.value); + }, + toProto(message: MsgUnblockUser): Uint8Array { + return MsgUnblockUser.encode(message).finish(); + }, + toProtoMsg(message: MsgUnblockUser): MsgUnblockUserProtoMsg { + return { + typeUrl: "/desmos.relationships.v1.MsgUnblockUser", + value: MsgUnblockUser.encode(message).finish(), + }; + }, }; function createBaseMsgUnblockUserResponse(): MsgUnblockUserResponse { return {}; @@ -552,6 +889,30 @@ export const MsgUnblockUserResponse = { const message = createBaseMsgUnblockUserResponse(); return message; }, + fromAmino(_: MsgUnblockUserResponseAmino): MsgUnblockUserResponse { + return {}; + }, + toAmino(_: MsgUnblockUserResponse): MsgUnblockUserResponseAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg(object: MsgUnblockUserResponseAminoMsg): MsgUnblockUserResponse { + return MsgUnblockUserResponse.fromAmino(object.value); + }, + fromProtoMsg( + message: MsgUnblockUserResponseProtoMsg + ): MsgUnblockUserResponse { + return MsgUnblockUserResponse.decode(message.value); + }, + toProto(message: MsgUnblockUserResponse): Uint8Array { + return MsgUnblockUserResponse.encode(message).finish(); + }, + toProtoMsg(message: MsgUnblockUserResponse): MsgUnblockUserResponseProtoMsg { + return { + typeUrl: "/desmos.relationships.v1.MsgUnblockUserResponse", + value: MsgUnblockUserResponse.encode(message).finish(), + }; + }, }; /** Msg defines the relationships Msg service. */ export interface Msg { diff --git a/packages/types/src/desmos/relationships/v1/query.ts b/packages/types/src/desmos/relationships/v1/query.ts index d7c51bae8..7755212b4 100644 --- a/packages/types/src/desmos/relationships/v1/query.ts +++ b/packages/types/src/desmos/relationships/v1/query.ts @@ -1,9 +1,16 @@ /* eslint-disable */ import { PageRequest, + PageRequestAmino, PageResponse, + PageResponseAmino, } from "../../../cosmos/base/query/v1beta1/pagination"; -import { Relationship, UserBlock } from "./models"; +import { + Relationship, + RelationshipAmino, + UserBlock, + UserBlockAmino, +} from "./models"; import { Long, isSet, DeepPartial, Exact, Rpc } from "../../../helpers"; import * as _m0 from "protobufjs/minimal"; export const protobufPackage = "desmos.relationships.v1"; @@ -24,6 +31,31 @@ export interface QueryRelationshipsRequest { /** pagination defines an optional pagination for the request. */ pagination?: PageRequest; } +export interface QueryRelationshipsRequestProtoMsg { + typeUrl: "/desmos.relationships.v1.QueryRelationshipsRequest"; + value: Uint8Array; +} +/** + * QueryRelationshipsRequest is the request type for the + * Query/Relationships RPC method. + */ +export interface QueryRelationshipsRequestAmino { + /** subspace to query the relationships for */ + subspace_id: string; + /** optional address of the user for which to query the relationships */ + user: string; + /** + * optional address of the counterparty of the relationships (used only if the + * user is provided) + */ + counterparty: string; + /** pagination defines an optional pagination for the request. */ + pagination?: PageRequestAmino; +} +export interface QueryRelationshipsRequestAminoMsg { + type: "/desmos.relationships.v1.QueryRelationshipsRequest"; + value: QueryRelationshipsRequestAmino; +} /** * QueryRelationshipsResponse is the response type for the * Query/Relationships RPC method. @@ -32,6 +64,22 @@ export interface QueryRelationshipsResponse { relationships: Relationship[]; pagination?: PageResponse; } +export interface QueryRelationshipsResponseProtoMsg { + typeUrl: "/desmos.relationships.v1.QueryRelationshipsResponse"; + value: Uint8Array; +} +/** + * QueryRelationshipsResponse is the response type for the + * Query/Relationships RPC method. + */ +export interface QueryRelationshipsResponseAmino { + relationships: RelationshipAmino[]; + pagination?: PageResponseAmino; +} +export interface QueryRelationshipsResponseAminoMsg { + type: "/desmos.relationships.v1.QueryRelationshipsResponse"; + value: QueryRelationshipsResponseAmino; +} /** * QueryBlocksRequest is the request type for the Query/Blocks RPC * endpoint @@ -49,6 +97,31 @@ export interface QueryBlocksRequest { /** pagination defines an optional pagination for the request. */ pagination?: PageRequest; } +export interface QueryBlocksRequestProtoMsg { + typeUrl: "/desmos.relationships.v1.QueryBlocksRequest"; + value: Uint8Array; +} +/** + * QueryBlocksRequest is the request type for the Query/Blocks RPC + * endpoint + */ +export interface QueryBlocksRequestAmino { + /** subspace to query the blocks for */ + subspace_id: string; + /** optional address of the blocker to query the blocks for */ + blocker: string; + /** + * optional address of the blocked user to query the block for (used only if + * the blocker is provided) + */ + blocked: string; + /** pagination defines an optional pagination for the request. */ + pagination?: PageRequestAmino; +} +export interface QueryBlocksRequestAminoMsg { + type: "/desmos.relationships.v1.QueryBlocksRequest"; + value: QueryBlocksRequestAmino; +} /** * QueryBlocksResponse is the response type for the Query/Blocks RPC * method. @@ -57,6 +130,22 @@ export interface QueryBlocksResponse { blocks: UserBlock[]; pagination?: PageResponse; } +export interface QueryBlocksResponseProtoMsg { + typeUrl: "/desmos.relationships.v1.QueryBlocksResponse"; + value: Uint8Array; +} +/** + * QueryBlocksResponse is the response type for the Query/Blocks RPC + * method. + */ +export interface QueryBlocksResponseAmino { + blocks: UserBlockAmino[]; + pagination?: PageResponseAmino; +} +export interface QueryBlocksResponseAminoMsg { + type: "/desmos.relationships.v1.QueryBlocksResponse"; + value: QueryBlocksResponseAmino; +} function createBaseQueryRelationshipsRequest(): QueryRelationshipsRequest { return { subspaceId: Long.UZERO, @@ -156,6 +245,49 @@ export const QueryRelationshipsRequest = { : undefined; return message; }, + fromAmino(object: QueryRelationshipsRequestAmino): QueryRelationshipsRequest { + return { + subspaceId: Long.fromString(object.subspace_id), + user: object.user, + counterparty: object.counterparty, + pagination: object?.pagination + ? PageRequest.fromAmino(object.pagination) + : undefined, + }; + }, + toAmino(message: QueryRelationshipsRequest): QueryRelationshipsRequestAmino { + const obj: any = {}; + obj.subspace_id = message.subspaceId + ? message.subspaceId.toString() + : undefined; + obj.user = message.user; + obj.counterparty = message.counterparty; + obj.pagination = message.pagination + ? PageRequest.toAmino(message.pagination) + : undefined; + return obj; + }, + fromAminoMsg( + object: QueryRelationshipsRequestAminoMsg + ): QueryRelationshipsRequest { + return QueryRelationshipsRequest.fromAmino(object.value); + }, + fromProtoMsg( + message: QueryRelationshipsRequestProtoMsg + ): QueryRelationshipsRequest { + return QueryRelationshipsRequest.decode(message.value); + }, + toProto(message: QueryRelationshipsRequest): Uint8Array { + return QueryRelationshipsRequest.encode(message).finish(); + }, + toProtoMsg( + message: QueryRelationshipsRequest + ): QueryRelationshipsRequestProtoMsg { + return { + typeUrl: "/desmos.relationships.v1.QueryRelationshipsRequest", + value: QueryRelationshipsRequest.encode(message).finish(), + }; + }, }; function createBaseQueryRelationshipsResponse(): QueryRelationshipsResponse { return { @@ -241,6 +373,55 @@ export const QueryRelationshipsResponse = { : undefined; return message; }, + fromAmino( + object: QueryRelationshipsResponseAmino + ): QueryRelationshipsResponse { + return { + relationships: Array.isArray(object?.relationships) + ? object.relationships.map((e: any) => Relationship.fromAmino(e)) + : [], + pagination: object?.pagination + ? PageResponse.fromAmino(object.pagination) + : undefined, + }; + }, + toAmino( + message: QueryRelationshipsResponse + ): QueryRelationshipsResponseAmino { + const obj: any = {}; + if (message.relationships) { + obj.relationships = message.relationships.map((e) => + e ? Relationship.toAmino(e) : undefined + ); + } else { + obj.relationships = []; + } + obj.pagination = message.pagination + ? PageResponse.toAmino(message.pagination) + : undefined; + return obj; + }, + fromAminoMsg( + object: QueryRelationshipsResponseAminoMsg + ): QueryRelationshipsResponse { + return QueryRelationshipsResponse.fromAmino(object.value); + }, + fromProtoMsg( + message: QueryRelationshipsResponseProtoMsg + ): QueryRelationshipsResponse { + return QueryRelationshipsResponse.decode(message.value); + }, + toProto(message: QueryRelationshipsResponse): Uint8Array { + return QueryRelationshipsResponse.encode(message).finish(); + }, + toProtoMsg( + message: QueryRelationshipsResponse + ): QueryRelationshipsResponseProtoMsg { + return { + typeUrl: "/desmos.relationships.v1.QueryRelationshipsResponse", + value: QueryRelationshipsResponse.encode(message).finish(), + }; + }, }; function createBaseQueryBlocksRequest(): QueryBlocksRequest { return { @@ -335,6 +516,43 @@ export const QueryBlocksRequest = { : undefined; return message; }, + fromAmino(object: QueryBlocksRequestAmino): QueryBlocksRequest { + return { + subspaceId: Long.fromString(object.subspace_id), + blocker: object.blocker, + blocked: object.blocked, + pagination: object?.pagination + ? PageRequest.fromAmino(object.pagination) + : undefined, + }; + }, + toAmino(message: QueryBlocksRequest): QueryBlocksRequestAmino { + const obj: any = {}; + obj.subspace_id = message.subspaceId + ? message.subspaceId.toString() + : undefined; + obj.blocker = message.blocker; + obj.blocked = message.blocked; + obj.pagination = message.pagination + ? PageRequest.toAmino(message.pagination) + : undefined; + return obj; + }, + fromAminoMsg(object: QueryBlocksRequestAminoMsg): QueryBlocksRequest { + return QueryBlocksRequest.fromAmino(object.value); + }, + fromProtoMsg(message: QueryBlocksRequestProtoMsg): QueryBlocksRequest { + return QueryBlocksRequest.decode(message.value); + }, + toProto(message: QueryBlocksRequest): Uint8Array { + return QueryBlocksRequest.encode(message).finish(); + }, + toProtoMsg(message: QueryBlocksRequest): QueryBlocksRequestProtoMsg { + return { + typeUrl: "/desmos.relationships.v1.QueryBlocksRequest", + value: QueryBlocksRequest.encode(message).finish(), + }; + }, }; function createBaseQueryBlocksResponse(): QueryBlocksResponse { return { @@ -414,6 +632,45 @@ export const QueryBlocksResponse = { : undefined; return message; }, + fromAmino(object: QueryBlocksResponseAmino): QueryBlocksResponse { + return { + blocks: Array.isArray(object?.blocks) + ? object.blocks.map((e: any) => UserBlock.fromAmino(e)) + : [], + pagination: object?.pagination + ? PageResponse.fromAmino(object.pagination) + : undefined, + }; + }, + toAmino(message: QueryBlocksResponse): QueryBlocksResponseAmino { + const obj: any = {}; + if (message.blocks) { + obj.blocks = message.blocks.map((e) => + e ? UserBlock.toAmino(e) : undefined + ); + } else { + obj.blocks = []; + } + obj.pagination = message.pagination + ? PageResponse.toAmino(message.pagination) + : undefined; + return obj; + }, + fromAminoMsg(object: QueryBlocksResponseAminoMsg): QueryBlocksResponse { + return QueryBlocksResponse.fromAmino(object.value); + }, + fromProtoMsg(message: QueryBlocksResponseProtoMsg): QueryBlocksResponse { + return QueryBlocksResponse.decode(message.value); + }, + toProto(message: QueryBlocksResponse): Uint8Array { + return QueryBlocksResponse.encode(message).finish(); + }, + toProtoMsg(message: QueryBlocksResponse): QueryBlocksResponseProtoMsg { + return { + typeUrl: "/desmos.relationships.v1.QueryBlocksResponse", + value: QueryBlocksResponse.encode(message).finish(), + }; + }, }; /** Query defines the gRPC querier service. */ export interface Query { diff --git a/packages/types/src/desmos/reports/v1/genesis.ts b/packages/types/src/desmos/reports/v1/genesis.ts index b06af2f6e..276626d9d 100644 --- a/packages/types/src/desmos/reports/v1/genesis.ts +++ b/packages/types/src/desmos/reports/v1/genesis.ts @@ -1,5 +1,12 @@ /* eslint-disable */ -import { Reason, Report, Params } from "./models"; +import { + Reason, + ReasonAmino, + Report, + ReportAmino, + Params, + ParamsAmino, +} from "./models"; import { Long, isSet, DeepPartial, Exact } from "../../../helpers"; import * as _m0 from "protobufjs/minimal"; export const protobufPackage = "desmos.reports.v1"; @@ -10,6 +17,21 @@ export interface GenesisState { reports: Report[]; params?: Params; } +export interface GenesisStateProtoMsg { + typeUrl: "/desmos.reports.v1.GenesisState"; + value: Uint8Array; +} +/** GenesisState defines the reports module's genesis state. */ +export interface GenesisStateAmino { + subspaces_data: SubspaceDataEntryAmino[]; + reasons: ReasonAmino[]; + reports: ReportAmino[]; + params?: ParamsAmino; +} +export interface GenesisStateAminoMsg { + type: "/desmos.reports.v1.GenesisState"; + value: GenesisStateAmino; +} /** SubspaceDataEntry contains the data related to a single subspace */ export interface SubspaceDataEntry { /** Id of the subspace to which the data relates */ @@ -19,6 +41,23 @@ export interface SubspaceDataEntry { /** Id of the next report inside the subspace */ reportId: Long; } +export interface SubspaceDataEntryProtoMsg { + typeUrl: "/desmos.reports.v1.SubspaceDataEntry"; + value: Uint8Array; +} +/** SubspaceDataEntry contains the data related to a single subspace */ +export interface SubspaceDataEntryAmino { + /** Id of the subspace to which the data relates */ + subspace_id: string; + /** Id of the next reason inside the subspace */ + reason_id: number; + /** Id of the next report inside the subspace */ + report_id: string; +} +export interface SubspaceDataEntryAminoMsg { + type: "/desmos.reports.v1.SubspaceDataEntry"; + value: SubspaceDataEntryAmino; +} function createBaseGenesisState(): GenesisState { return { subspacesData: [], @@ -129,6 +168,61 @@ export const GenesisState = { : undefined; return message; }, + fromAmino(object: GenesisStateAmino): GenesisState { + return { + subspacesData: Array.isArray(object?.subspaces_data) + ? object.subspaces_data.map((e: any) => SubspaceDataEntry.fromAmino(e)) + : [], + reasons: Array.isArray(object?.reasons) + ? object.reasons.map((e: any) => Reason.fromAmino(e)) + : [], + reports: Array.isArray(object?.reports) + ? object.reports.map((e: any) => Report.fromAmino(e)) + : [], + params: object?.params ? Params.fromAmino(object.params) : undefined, + }; + }, + toAmino(message: GenesisState): GenesisStateAmino { + const obj: any = {}; + if (message.subspacesData) { + obj.subspaces_data = message.subspacesData.map((e) => + e ? SubspaceDataEntry.toAmino(e) : undefined + ); + } else { + obj.subspaces_data = []; + } + if (message.reasons) { + obj.reasons = message.reasons.map((e) => + e ? Reason.toAmino(e) : undefined + ); + } else { + obj.reasons = []; + } + if (message.reports) { + obj.reports = message.reports.map((e) => + e ? Report.toAmino(e) : undefined + ); + } else { + obj.reports = []; + } + obj.params = message.params ? Params.toAmino(message.params) : undefined; + return obj; + }, + fromAminoMsg(object: GenesisStateAminoMsg): GenesisState { + return GenesisState.fromAmino(object.value); + }, + fromProtoMsg(message: GenesisStateProtoMsg): GenesisState { + return GenesisState.decode(message.value); + }, + toProto(message: GenesisState): Uint8Array { + return GenesisState.encode(message).finish(); + }, + toProtoMsg(message: GenesisState): GenesisStateProtoMsg { + return { + typeUrl: "/desmos.reports.v1.GenesisState", + value: GenesisState.encode(message).finish(), + }; + }, }; function createBaseSubspaceDataEntry(): SubspaceDataEntry { return { @@ -212,4 +306,35 @@ export const SubspaceDataEntry = { : Long.UZERO; return message; }, + fromAmino(object: SubspaceDataEntryAmino): SubspaceDataEntry { + return { + subspaceId: Long.fromString(object.subspace_id), + reasonId: object.reason_id, + reportId: Long.fromString(object.report_id), + }; + }, + toAmino(message: SubspaceDataEntry): SubspaceDataEntryAmino { + const obj: any = {}; + obj.subspace_id = message.subspaceId + ? message.subspaceId.toString() + : undefined; + obj.reason_id = message.reasonId; + obj.report_id = message.reportId ? message.reportId.toString() : undefined; + return obj; + }, + fromAminoMsg(object: SubspaceDataEntryAminoMsg): SubspaceDataEntry { + return SubspaceDataEntry.fromAmino(object.value); + }, + fromProtoMsg(message: SubspaceDataEntryProtoMsg): SubspaceDataEntry { + return SubspaceDataEntry.decode(message.value); + }, + toProto(message: SubspaceDataEntry): Uint8Array { + return SubspaceDataEntry.encode(message).finish(); + }, + toProtoMsg(message: SubspaceDataEntry): SubspaceDataEntryProtoMsg { + return { + typeUrl: "/desmos.reports.v1.SubspaceDataEntry", + value: SubspaceDataEntry.encode(message).finish(), + }; + }, }; diff --git a/packages/types/src/desmos/reports/v1/models.ts b/packages/types/src/desmos/reports/v1/models.ts index 9fba7d4ad..8f4dbaf64 100644 --- a/packages/types/src/desmos/reports/v1/models.ts +++ b/packages/types/src/desmos/reports/v1/models.ts @@ -1,6 +1,6 @@ /* eslint-disable */ -import { Any } from "../../../google/protobuf/any"; -import { Timestamp } from "../../../google/protobuf/timestamp"; +import { Any, AnyAmino } from "../../../google/protobuf/any"; +import { Timestamp, TimestampAmino } from "../../../google/protobuf/timestamp"; import { Long, isSet, @@ -28,16 +28,67 @@ export interface Report { /** Time in which the report was created */ creationDate?: Timestamp; } +export interface ReportProtoMsg { + typeUrl: "/desmos.reports.v1.Report"; + value: Uint8Array; +} +/** Report contains the data of a generic report */ +export interface ReportAmino { + /** Id of the subspace for which the report has been created */ + subspace_id: string; + /** Id of the report */ + id: string; + /** Id of the reason this report has been created for */ + reasons_ids: number[]; + /** (optional) Message attached to this report */ + message: string; + /** Address of the reporter */ + reporter: string; + /** Target of the report */ + target?: AnyAmino; + /** Time in which the report was created */ + creation_date?: TimestampAmino; +} +export interface ReportAminoMsg { + type: "/desmos.reports.v1.Report"; + value: ReportAmino; +} /** UserTarget contains the data of a report about a user */ export interface UserTarget { /** Address of the reported user */ user: string; } +export interface UserTargetProtoMsg { + typeUrl: "/desmos.reports.v1.UserTarget"; + value: Uint8Array; +} +/** UserTarget contains the data of a report about a user */ +export interface UserTargetAmino { + /** Address of the reported user */ + user: string; +} +export interface UserTargetAminoMsg { + type: "/desmos.reports.v1.UserTarget"; + value: UserTargetAmino; +} /** PostTarget contains the data of a report about a post */ export interface PostTarget { /** Id of the reported post */ postId: Long; } +export interface PostTargetProtoMsg { + typeUrl: "/desmos.reports.v1.PostTarget"; + value: Uint8Array; +} +/** PostTarget contains the data of a report about a post */ +export interface PostTargetAmino { + /** Id of the reported post */ + post_id: string; +} +export interface PostTargetAminoMsg { + type: "/desmos.reports.v1.PostTarget"; + value: PostTargetAmino; +} /** Reason contains the data about a reporting reason */ export interface Reason { /** Id of the subspace for which this reason is valid */ @@ -49,6 +100,25 @@ export interface Reason { /** (optional) Extended description of the reason and the cases it applies to */ description: string; } +export interface ReasonProtoMsg { + typeUrl: "/desmos.reports.v1.Reason"; + value: Uint8Array; +} +/** Reason contains the data about a reporting reason */ +export interface ReasonAmino { + /** Id of the subspace for which this reason is valid */ + subspace_id: string; + /** Id of the reason inside the subspace */ + id: number; + /** Title of the reason */ + title: string; + /** (optional) Extended description of the reason and the cases it applies to */ + description: string; +} +export interface ReasonAminoMsg { + type: "/desmos.reports.v1.Reason"; + value: ReasonAmino; +} /** Params contains the module parameters */ export interface Params { /** @@ -57,6 +127,22 @@ export interface Params { */ standardReasons: StandardReason[]; } +export interface ParamsProtoMsg { + typeUrl: "/desmos.reports.v1.Params"; + value: Uint8Array; +} +/** Params contains the module parameters */ +export interface ParamsAmino { + /** + * List of available reasons from which new subspaces can pick their default + * ones + */ + standard_reasons: StandardReasonAmino[]; +} +export interface ParamsAminoMsg { + type: "/desmos.reports.v1.Params"; + value: ParamsAmino; +} /** * StandardReason contains the data of a standard reason that can be picked and * used from different subspaces @@ -69,6 +155,26 @@ export interface StandardReason { /** (optional) Extended description of the reason and the cases it applies to */ description: string; } +export interface StandardReasonProtoMsg { + typeUrl: "/desmos.reports.v1.StandardReason"; + value: Uint8Array; +} +/** + * StandardReason contains the data of a standard reason that can be picked and + * used from different subspaces + */ +export interface StandardReasonAmino { + /** Id of the reason inside the subspace */ + id: number; + /** Title of the reason */ + title: string; + /** (optional) Extended description of the reason and the cases it applies to */ + description: string; +} +export interface StandardReasonAminoMsg { + type: "/desmos.reports.v1.StandardReason"; + value: StandardReasonAmino; +} function createBaseReport(): Report { return { subspaceId: Long.UZERO, @@ -211,6 +317,55 @@ export const Report = { : undefined; return message; }, + fromAmino(object: ReportAmino): Report { + return { + subspaceId: Long.fromString(object.subspace_id), + id: Long.fromString(object.id), + reasonsIds: Array.isArray(object?.reasons_ids) + ? object.reasons_ids.map((e: any) => e) + : [], + message: object.message, + reporter: object.reporter, + target: object?.target ? Any.fromAmino(object.target) : undefined, + creationDate: object?.creation_date + ? Timestamp.fromAmino(object.creation_date) + : undefined, + }; + }, + toAmino(message: Report): ReportAmino { + const obj: any = {}; + obj.subspace_id = message.subspaceId + ? message.subspaceId.toString() + : undefined; + obj.id = message.id ? message.id.toString() : undefined; + if (message.reasonsIds) { + obj.reasons_ids = message.reasonsIds.map((e) => e); + } else { + obj.reasons_ids = []; + } + obj.message = message.message; + obj.reporter = message.reporter; + obj.target = message.target ? Any.toAmino(message.target) : undefined; + obj.creation_date = message.creationDate + ? Timestamp.toAmino(message.creationDate) + : undefined; + return obj; + }, + fromAminoMsg(object: ReportAminoMsg): Report { + return Report.fromAmino(object.value); + }, + fromProtoMsg(message: ReportProtoMsg): Report { + return Report.decode(message.value); + }, + toProto(message: Report): Uint8Array { + return Report.encode(message).finish(); + }, + toProtoMsg(message: Report): ReportProtoMsg { + return { + typeUrl: "/desmos.reports.v1.Report", + value: Report.encode(message).finish(), + }; + }, }; function createBaseUserTarget(): UserTarget { return { @@ -261,6 +416,31 @@ export const UserTarget = { message.user = object.user ?? ""; return message; }, + fromAmino(object: UserTargetAmino): UserTarget { + return { + user: object.user, + }; + }, + toAmino(message: UserTarget): UserTargetAmino { + const obj: any = {}; + obj.user = message.user; + return obj; + }, + fromAminoMsg(object: UserTargetAminoMsg): UserTarget { + return UserTarget.fromAmino(object.value); + }, + fromProtoMsg(message: UserTargetProtoMsg): UserTarget { + return UserTarget.decode(message.value); + }, + toProto(message: UserTarget): Uint8Array { + return UserTarget.encode(message).finish(); + }, + toProtoMsg(message: UserTarget): UserTargetProtoMsg { + return { + typeUrl: "/desmos.reports.v1.UserTarget", + value: UserTarget.encode(message).finish(), + }; + }, }; function createBasePostTarget(): PostTarget { return { @@ -315,6 +495,31 @@ export const PostTarget = { : Long.UZERO; return message; }, + fromAmino(object: PostTargetAmino): PostTarget { + return { + postId: Long.fromString(object.post_id), + }; + }, + toAmino(message: PostTarget): PostTargetAmino { + const obj: any = {}; + obj.post_id = message.postId ? message.postId.toString() : undefined; + return obj; + }, + fromAminoMsg(object: PostTargetAminoMsg): PostTarget { + return PostTarget.fromAmino(object.value); + }, + fromProtoMsg(message: PostTargetProtoMsg): PostTarget { + return PostTarget.decode(message.value); + }, + toProto(message: PostTarget): Uint8Array { + return PostTarget.encode(message).finish(); + }, + toProtoMsg(message: PostTarget): PostTargetProtoMsg { + return { + typeUrl: "/desmos.reports.v1.PostTarget", + value: PostTarget.encode(message).finish(), + }; + }, }; function createBaseReason(): Reason { return { @@ -400,6 +605,39 @@ export const Reason = { message.description = object.description ?? ""; return message; }, + fromAmino(object: ReasonAmino): Reason { + return { + subspaceId: Long.fromString(object.subspace_id), + id: object.id, + title: object.title, + description: object.description, + }; + }, + toAmino(message: Reason): ReasonAmino { + const obj: any = {}; + obj.subspace_id = message.subspaceId + ? message.subspaceId.toString() + : undefined; + obj.id = message.id; + obj.title = message.title; + obj.description = message.description; + return obj; + }, + fromAminoMsg(object: ReasonAminoMsg): Reason { + return Reason.fromAmino(object.value); + }, + fromProtoMsg(message: ReasonProtoMsg): Reason { + return Reason.decode(message.value); + }, + toProto(message: Reason): Uint8Array { + return Reason.encode(message).finish(); + }, + toProtoMsg(message: Reason): ReasonProtoMsg { + return { + typeUrl: "/desmos.reports.v1.Reason", + value: Reason.encode(message).finish(), + }; + }, }; function createBaseParams(): Params { return { @@ -459,6 +697,39 @@ export const Params = { object.standardReasons?.map((e) => StandardReason.fromPartial(e)) || []; return message; }, + fromAmino(object: ParamsAmino): Params { + return { + standardReasons: Array.isArray(object?.standard_reasons) + ? object.standard_reasons.map((e: any) => StandardReason.fromAmino(e)) + : [], + }; + }, + toAmino(message: Params): ParamsAmino { + const obj: any = {}; + if (message.standardReasons) { + obj.standard_reasons = message.standardReasons.map((e) => + e ? StandardReason.toAmino(e) : undefined + ); + } else { + obj.standard_reasons = []; + } + return obj; + }, + fromAminoMsg(object: ParamsAminoMsg): Params { + return Params.fromAmino(object.value); + }, + fromProtoMsg(message: ParamsProtoMsg): Params { + return Params.decode(message.value); + }, + toProto(message: Params): Uint8Array { + return Params.encode(message).finish(); + }, + toProtoMsg(message: Params): ParamsProtoMsg { + return { + typeUrl: "/desmos.reports.v1.Params", + value: Params.encode(message).finish(), + }; + }, }; function createBaseStandardReason(): StandardReason { return { @@ -530,4 +801,33 @@ export const StandardReason = { message.description = object.description ?? ""; return message; }, + fromAmino(object: StandardReasonAmino): StandardReason { + return { + id: object.id, + title: object.title, + description: object.description, + }; + }, + toAmino(message: StandardReason): StandardReasonAmino { + const obj: any = {}; + obj.id = message.id; + obj.title = message.title; + obj.description = message.description; + return obj; + }, + fromAminoMsg(object: StandardReasonAminoMsg): StandardReason { + return StandardReason.fromAmino(object.value); + }, + fromProtoMsg(message: StandardReasonProtoMsg): StandardReason { + return StandardReason.decode(message.value); + }, + toProto(message: StandardReason): Uint8Array { + return StandardReason.encode(message).finish(); + }, + toProtoMsg(message: StandardReason): StandardReasonProtoMsg { + return { + typeUrl: "/desmos.reports.v1.StandardReason", + value: StandardReason.encode(message).finish(), + }; + }, }; diff --git a/packages/types/src/desmos/reports/v1/msgs.amino.ts b/packages/types/src/desmos/reports/v1/msgs.amino.ts new file mode 100644 index 000000000..57e1c2d3b --- /dev/null +++ b/packages/types/src/desmos/reports/v1/msgs.amino.ts @@ -0,0 +1,41 @@ +/* eslint-disable */ +import { + MsgCreateReport, + MsgDeleteReport, + MsgSupportStandardReason, + MsgAddReason, + MsgRemoveReason, + MsgUpdateParams, +} from "./msgs"; +export const AminoConverter = { + "/desmos.reports.v1.MsgCreateReport": { + aminoType: "/desmos.reports.v1.MsgCreateReport", + toAmino: MsgCreateReport.toAmino, + fromAmino: MsgCreateReport.fromAmino, + }, + "/desmos.reports.v1.MsgDeleteReport": { + aminoType: "/desmos.reports.v1.MsgDeleteReport", + toAmino: MsgDeleteReport.toAmino, + fromAmino: MsgDeleteReport.fromAmino, + }, + "/desmos.reports.v1.MsgSupportStandardReason": { + aminoType: "/desmos.reports.v1.MsgSupportStandardReason", + toAmino: MsgSupportStandardReason.toAmino, + fromAmino: MsgSupportStandardReason.fromAmino, + }, + "/desmos.reports.v1.MsgAddReason": { + aminoType: "/desmos.reports.v1.MsgAddReason", + toAmino: MsgAddReason.toAmino, + fromAmino: MsgAddReason.fromAmino, + }, + "/desmos.reports.v1.MsgRemoveReason": { + aminoType: "/desmos.reports.v1.MsgRemoveReason", + toAmino: MsgRemoveReason.toAmino, + fromAmino: MsgRemoveReason.fromAmino, + }, + "/desmos.reports.v1.MsgUpdateParams": { + aminoType: "/desmos.reports.v1.MsgUpdateParams", + toAmino: MsgUpdateParams.toAmino, + fromAmino: MsgUpdateParams.fromAmino, + }, +}; diff --git a/packages/types/src/desmos/reports/v1/msgs.registry.ts b/packages/types/src/desmos/reports/v1/msgs.registry.ts new file mode 100644 index 000000000..24e97bbc9 --- /dev/null +++ b/packages/types/src/desmos/reports/v1/msgs.registry.ts @@ -0,0 +1,215 @@ +/* eslint-disable */ +import { GeneratedType, Registry } from "@cosmjs/proto-signing"; +import { + MsgCreateReport, + MsgDeleteReport, + MsgSupportStandardReason, + MsgAddReason, + MsgRemoveReason, + MsgUpdateParams, +} from "./msgs"; +export const registry: ReadonlyArray<[string, GeneratedType]> = [ + ["/desmos.reports.v1.MsgCreateReport", MsgCreateReport], + ["/desmos.reports.v1.MsgDeleteReport", MsgDeleteReport], + ["/desmos.reports.v1.MsgSupportStandardReason", MsgSupportStandardReason], + ["/desmos.reports.v1.MsgAddReason", MsgAddReason], + ["/desmos.reports.v1.MsgRemoveReason", MsgRemoveReason], + ["/desmos.reports.v1.MsgUpdateParams", MsgUpdateParams], +]; +export const load = (protoRegistry: Registry) => { + registry.forEach(([typeUrl, mod]) => { + protoRegistry.register(typeUrl, mod); + }); +}; +export const MessageComposer = { + encoded: { + createReport(value: MsgCreateReport) { + return { + typeUrl: "/desmos.reports.v1.MsgCreateReport", + value: MsgCreateReport.encode(value).finish(), + }; + }, + deleteReport(value: MsgDeleteReport) { + return { + typeUrl: "/desmos.reports.v1.MsgDeleteReport", + value: MsgDeleteReport.encode(value).finish(), + }; + }, + supportStandardReason(value: MsgSupportStandardReason) { + return { + typeUrl: "/desmos.reports.v1.MsgSupportStandardReason", + value: MsgSupportStandardReason.encode(value).finish(), + }; + }, + addReason(value: MsgAddReason) { + return { + typeUrl: "/desmos.reports.v1.MsgAddReason", + value: MsgAddReason.encode(value).finish(), + }; + }, + removeReason(value: MsgRemoveReason) { + return { + typeUrl: "/desmos.reports.v1.MsgRemoveReason", + value: MsgRemoveReason.encode(value).finish(), + }; + }, + updateParams(value: MsgUpdateParams) { + return { + typeUrl: "/desmos.reports.v1.MsgUpdateParams", + value: MsgUpdateParams.encode(value).finish(), + }; + }, + }, + withTypeUrl: { + createReport(value: MsgCreateReport) { + return { + typeUrl: "/desmos.reports.v1.MsgCreateReport", + value, + }; + }, + deleteReport(value: MsgDeleteReport) { + return { + typeUrl: "/desmos.reports.v1.MsgDeleteReport", + value, + }; + }, + supportStandardReason(value: MsgSupportStandardReason) { + return { + typeUrl: "/desmos.reports.v1.MsgSupportStandardReason", + value, + }; + }, + addReason(value: MsgAddReason) { + return { + typeUrl: "/desmos.reports.v1.MsgAddReason", + value, + }; + }, + removeReason(value: MsgRemoveReason) { + return { + typeUrl: "/desmos.reports.v1.MsgRemoveReason", + value, + }; + }, + updateParams(value: MsgUpdateParams) { + return { + typeUrl: "/desmos.reports.v1.MsgUpdateParams", + value, + }; + }, + }, + toJSON: { + createReport(value: MsgCreateReport) { + return { + typeUrl: "/desmos.reports.v1.MsgCreateReport", + value: MsgCreateReport.toJSON(value), + }; + }, + deleteReport(value: MsgDeleteReport) { + return { + typeUrl: "/desmos.reports.v1.MsgDeleteReport", + value: MsgDeleteReport.toJSON(value), + }; + }, + supportStandardReason(value: MsgSupportStandardReason) { + return { + typeUrl: "/desmos.reports.v1.MsgSupportStandardReason", + value: MsgSupportStandardReason.toJSON(value), + }; + }, + addReason(value: MsgAddReason) { + return { + typeUrl: "/desmos.reports.v1.MsgAddReason", + value: MsgAddReason.toJSON(value), + }; + }, + removeReason(value: MsgRemoveReason) { + return { + typeUrl: "/desmos.reports.v1.MsgRemoveReason", + value: MsgRemoveReason.toJSON(value), + }; + }, + updateParams(value: MsgUpdateParams) { + return { + typeUrl: "/desmos.reports.v1.MsgUpdateParams", + value: MsgUpdateParams.toJSON(value), + }; + }, + }, + fromJSON: { + createReport(value: any) { + return { + typeUrl: "/desmos.reports.v1.MsgCreateReport", + value: MsgCreateReport.fromJSON(value), + }; + }, + deleteReport(value: any) { + return { + typeUrl: "/desmos.reports.v1.MsgDeleteReport", + value: MsgDeleteReport.fromJSON(value), + }; + }, + supportStandardReason(value: any) { + return { + typeUrl: "/desmos.reports.v1.MsgSupportStandardReason", + value: MsgSupportStandardReason.fromJSON(value), + }; + }, + addReason(value: any) { + return { + typeUrl: "/desmos.reports.v1.MsgAddReason", + value: MsgAddReason.fromJSON(value), + }; + }, + removeReason(value: any) { + return { + typeUrl: "/desmos.reports.v1.MsgRemoveReason", + value: MsgRemoveReason.fromJSON(value), + }; + }, + updateParams(value: any) { + return { + typeUrl: "/desmos.reports.v1.MsgUpdateParams", + value: MsgUpdateParams.fromJSON(value), + }; + }, + }, + fromPartial: { + createReport(value: MsgCreateReport) { + return { + typeUrl: "/desmos.reports.v1.MsgCreateReport", + value: MsgCreateReport.fromPartial(value), + }; + }, + deleteReport(value: MsgDeleteReport) { + return { + typeUrl: "/desmos.reports.v1.MsgDeleteReport", + value: MsgDeleteReport.fromPartial(value), + }; + }, + supportStandardReason(value: MsgSupportStandardReason) { + return { + typeUrl: "/desmos.reports.v1.MsgSupportStandardReason", + value: MsgSupportStandardReason.fromPartial(value), + }; + }, + addReason(value: MsgAddReason) { + return { + typeUrl: "/desmos.reports.v1.MsgAddReason", + value: MsgAddReason.fromPartial(value), + }; + }, + removeReason(value: MsgRemoveReason) { + return { + typeUrl: "/desmos.reports.v1.MsgRemoveReason", + value: MsgRemoveReason.fromPartial(value), + }; + }, + updateParams(value: MsgUpdateParams) { + return { + typeUrl: "/desmos.reports.v1.MsgUpdateParams", + value: MsgUpdateParams.fromPartial(value), + }; + }, + }, +}; diff --git a/packages/types/src/desmos/reports/v1/msgs.ts b/packages/types/src/desmos/reports/v1/msgs.ts index ab5b896d1..9359b3362 100644 --- a/packages/types/src/desmos/reports/v1/msgs.ts +++ b/packages/types/src/desmos/reports/v1/msgs.ts @@ -1,7 +1,7 @@ /* eslint-disable */ -import { Any } from "../../../google/protobuf/any"; -import { Params } from "./models"; -import { Timestamp } from "../../../google/protobuf/timestamp"; +import { Any, AnyAmino } from "../../../google/protobuf/any"; +import { Params, ParamsAmino } from "./models"; +import { Timestamp, TimestampAmino } from "../../../google/protobuf/timestamp"; import { Long, isSet, @@ -26,6 +26,27 @@ export interface MsgCreateReport { /** Target of the report */ target?: Any; } +export interface MsgCreateReportProtoMsg { + typeUrl: "/desmos.reports.v1.MsgCreateReport"; + value: Uint8Array; +} +/** MsgCreateReport represents the message to be used to create a report */ +export interface MsgCreateReportAmino { + /** Id of the subspace for which the report should be stored */ + subspace_id: string; + /** Id of the reason this report has been created for */ + reasons_ids: number[]; + /** (optional) Message attached to this report */ + message: string; + /** Address of the reporter */ + reporter: string; + /** Target of the report */ + target?: AnyAmino; +} +export interface MsgCreateReportAminoMsg { + type: "/desmos.reports.v1.MsgCreateReport"; + value: MsgCreateReportAmino; +} /** MsgCreateReportResponse represents the Msg/CreateReport response type */ export interface MsgCreateReportResponse { /** Id of the newly created report */ @@ -33,6 +54,21 @@ export interface MsgCreateReportResponse { /** Time in which the report was created */ creationDate?: Timestamp; } +export interface MsgCreateReportResponseProtoMsg { + typeUrl: "/desmos.reports.v1.MsgCreateReportResponse"; + value: Uint8Array; +} +/** MsgCreateReportResponse represents the Msg/CreateReport response type */ +export interface MsgCreateReportResponseAmino { + /** Id of the newly created report */ + report_id: string; + /** Time in which the report was created */ + creation_date?: TimestampAmino; +} +export interface MsgCreateReportResponseAminoMsg { + type: "/desmos.reports.v1.MsgCreateReportResponse"; + value: MsgCreateReportResponseAmino; +} /** MsgDeleteReport represents the message to be used when deleting a report */ export interface MsgDeleteReport { /** Id of the subspace that contains the report to be deleted */ @@ -42,8 +78,35 @@ export interface MsgDeleteReport { /** Address of the user deleting the report */ signer: string; } +export interface MsgDeleteReportProtoMsg { + typeUrl: "/desmos.reports.v1.MsgDeleteReport"; + value: Uint8Array; +} +/** MsgDeleteReport represents the message to be used when deleting a report */ +export interface MsgDeleteReportAmino { + /** Id of the subspace that contains the report to be deleted */ + subspace_id: string; + /** Id of the report to be deleted */ + report_id: string; + /** Address of the user deleting the report */ + signer: string; +} +export interface MsgDeleteReportAminoMsg { + type: "/desmos.reports.v1.MsgDeleteReport"; + value: MsgDeleteReportAmino; +} /** MsgDeleteReportResponse represents the Msg/DeleteReport response type */ export interface MsgDeleteReportResponse {} +export interface MsgDeleteReportResponseProtoMsg { + typeUrl: "/desmos.reports.v1.MsgDeleteReportResponse"; + value: Uint8Array; +} +/** MsgDeleteReportResponse represents the Msg/DeleteReport response type */ +export interface MsgDeleteReportResponseAmino {} +export interface MsgDeleteReportResponseAminoMsg { + type: "/desmos.reports.v1.MsgDeleteReportResponse"; + value: MsgDeleteReportResponseAmino; +} /** * MsgSupportStandardReason represents the message to be used when wanting to * support one reason from the module params @@ -56,6 +119,26 @@ export interface MsgSupportStandardReason { /** Address of the user signing the message */ signer: string; } +export interface MsgSupportStandardReasonProtoMsg { + typeUrl: "/desmos.reports.v1.MsgSupportStandardReason"; + value: Uint8Array; +} +/** + * MsgSupportStandardReason represents the message to be used when wanting to + * support one reason from the module params + */ +export interface MsgSupportStandardReasonAmino { + /** Id of the subspace for which to support the reason */ + subspace_id: string; + /** Id of the reason that should be supported */ + standard_reason_id: number; + /** Address of the user signing the message */ + signer: string; +} +export interface MsgSupportStandardReasonAminoMsg { + type: "/desmos.reports.v1.MsgSupportStandardReason"; + value: MsgSupportStandardReasonAmino; +} /** * MsgSupportStandardReasonResponse represents the Msg/SupportStandardReason * response type @@ -64,6 +147,22 @@ export interface MsgSupportStandardReasonResponse { /** Id of the newly added reason */ reasonsIds: number; } +export interface MsgSupportStandardReasonResponseProtoMsg { + typeUrl: "/desmos.reports.v1.MsgSupportStandardReasonResponse"; + value: Uint8Array; +} +/** + * MsgSupportStandardReasonResponse represents the Msg/SupportStandardReason + * response type + */ +export interface MsgSupportStandardReasonResponseAmino { + /** Id of the newly added reason */ + reasons_ids: number; +} +export interface MsgSupportStandardReasonResponseAminoMsg { + type: "/desmos.reports.v1.MsgSupportStandardReasonResponse"; + value: MsgSupportStandardReasonResponseAmino; +} /** * MsgAddReason represents the message to be used when adding a new supported * reason @@ -78,11 +177,46 @@ export interface MsgAddReason { /** Address of the user adding the supported reason */ signer: string; } +export interface MsgAddReasonProtoMsg { + typeUrl: "/desmos.reports.v1.MsgAddReason"; + value: Uint8Array; +} +/** + * MsgAddReason represents the message to be used when adding a new supported + * reason + */ +export interface MsgAddReasonAmino { + /** Id of the subspace for which to add the reason */ + subspace_id: string; + /** Title of the reason */ + title: string; + /** (optional) Extended description of the reason and the cases it applies to */ + description: string; + /** Address of the user adding the supported reason */ + signer: string; +} +export interface MsgAddReasonAminoMsg { + type: "/desmos.reports.v1.MsgAddReason"; + value: MsgAddReasonAmino; +} /** MsgAddReasonResponse represents the Msg/AddReason response type */ export interface MsgAddReasonResponse { /** Id of the newly supported reason */ reasonId: number; } +export interface MsgAddReasonResponseProtoMsg { + typeUrl: "/desmos.reports.v1.MsgAddReasonResponse"; + value: Uint8Array; +} +/** MsgAddReasonResponse represents the Msg/AddReason response type */ +export interface MsgAddReasonResponseAmino { + /** Id of the newly supported reason */ + reason_id: number; +} +export interface MsgAddReasonResponseAminoMsg { + type: "/desmos.reports.v1.MsgAddReasonResponse"; + value: MsgAddReasonResponseAmino; +} /** * MsgRemoveReason represents the message to be used when removing an exiting * reporting reason @@ -95,8 +229,38 @@ export interface MsgRemoveReason { /** Address of the user adding the supported reason */ signer: string; } +export interface MsgRemoveReasonProtoMsg { + typeUrl: "/desmos.reports.v1.MsgRemoveReason"; + value: Uint8Array; +} +/** + * MsgRemoveReason represents the message to be used when removing an exiting + * reporting reason + */ +export interface MsgRemoveReasonAmino { + /** Id of the subspace from which to remove the reason */ + subspace_id: string; + /** Id of the reason to be deleted */ + reason_id: number; + /** Address of the user adding the supported reason */ + signer: string; +} +export interface MsgRemoveReasonAminoMsg { + type: "/desmos.reports.v1.MsgRemoveReason"; + value: MsgRemoveReasonAmino; +} /** MsgRemoveReasonResponse represents the Msg/RemoveReason response type */ export interface MsgRemoveReasonResponse {} +export interface MsgRemoveReasonResponseProtoMsg { + typeUrl: "/desmos.reports.v1.MsgRemoveReasonResponse"; + value: Uint8Array; +} +/** MsgRemoveReasonResponse represents the Msg/RemoveReason response type */ +export interface MsgRemoveReasonResponseAmino {} +export interface MsgRemoveReasonResponseAminoMsg { + type: "/desmos.reports.v1.MsgRemoveReasonResponse"; + value: MsgRemoveReasonResponseAmino; +} /** * MsgUpdateParams is the Msg/UpdateParams request type. * @@ -115,6 +279,32 @@ export interface MsgUpdateParams { */ params?: Params; } +export interface MsgUpdateParamsProtoMsg { + typeUrl: "/desmos.reports.v1.MsgUpdateParams"; + value: Uint8Array; +} +/** + * MsgUpdateParams is the Msg/UpdateParams request type. + * + * Since: Desmos 5.0.0 + */ +export interface MsgUpdateParamsAmino { + /** + * authority is the address that controls the module (defaults to x/gov unless + * overwritten). + */ + authority: string; + /** + * params defines the parameters to update. + * + * NOTE: All parameters must be supplied. + */ + params?: ParamsAmino; +} +export interface MsgUpdateParamsAminoMsg { + type: "/desmos.reports.v1.MsgUpdateParams"; + value: MsgUpdateParamsAmino; +} /** * MsgUpdateParamsResponse defines the response structure for executing a * MsgUpdateParams message. @@ -122,6 +312,21 @@ export interface MsgUpdateParams { * Since: Desmos 5.0.0 */ export interface MsgUpdateParamsResponse {} +export interface MsgUpdateParamsResponseProtoMsg { + typeUrl: "/desmos.reports.v1.MsgUpdateParamsResponse"; + value: Uint8Array; +} +/** + * MsgUpdateParamsResponse defines the response structure for executing a + * MsgUpdateParams message. + * + * Since: Desmos 5.0.0 + */ +export interface MsgUpdateParamsResponseAmino {} +export interface MsgUpdateParamsResponseAminoMsg { + type: "/desmos.reports.v1.MsgUpdateParamsResponse"; + value: MsgUpdateParamsResponseAmino; +} function createBaseMsgCreateReport(): MsgCreateReport { return { subspaceId: Long.UZERO, @@ -236,6 +441,47 @@ export const MsgCreateReport = { : undefined; return message; }, + fromAmino(object: MsgCreateReportAmino): MsgCreateReport { + return { + subspaceId: Long.fromString(object.subspace_id), + reasonsIds: Array.isArray(object?.reasons_ids) + ? object.reasons_ids.map((e: any) => e) + : [], + message: object.message, + reporter: object.reporter, + target: object?.target ? Any.fromAmino(object.target) : undefined, + }; + }, + toAmino(message: MsgCreateReport): MsgCreateReportAmino { + const obj: any = {}; + obj.subspace_id = message.subspaceId + ? message.subspaceId.toString() + : undefined; + if (message.reasonsIds) { + obj.reasons_ids = message.reasonsIds.map((e) => e); + } else { + obj.reasons_ids = []; + } + obj.message = message.message; + obj.reporter = message.reporter; + obj.target = message.target ? Any.toAmino(message.target) : undefined; + return obj; + }, + fromAminoMsg(object: MsgCreateReportAminoMsg): MsgCreateReport { + return MsgCreateReport.fromAmino(object.value); + }, + fromProtoMsg(message: MsgCreateReportProtoMsg): MsgCreateReport { + return MsgCreateReport.decode(message.value); + }, + toProto(message: MsgCreateReport): Uint8Array { + return MsgCreateReport.encode(message).finish(); + }, + toProtoMsg(message: MsgCreateReport): MsgCreateReportProtoMsg { + return { + typeUrl: "/desmos.reports.v1.MsgCreateReport", + value: MsgCreateReport.encode(message).finish(), + }; + }, }; function createBaseMsgCreateReportResponse(): MsgCreateReportResponse { return { @@ -311,6 +557,43 @@ export const MsgCreateReportResponse = { : undefined; return message; }, + fromAmino(object: MsgCreateReportResponseAmino): MsgCreateReportResponse { + return { + reportId: Long.fromString(object.report_id), + creationDate: object?.creation_date + ? Timestamp.fromAmino(object.creation_date) + : undefined, + }; + }, + toAmino(message: MsgCreateReportResponse): MsgCreateReportResponseAmino { + const obj: any = {}; + obj.report_id = message.reportId ? message.reportId.toString() : undefined; + obj.creation_date = message.creationDate + ? Timestamp.toAmino(message.creationDate) + : undefined; + return obj; + }, + fromAminoMsg( + object: MsgCreateReportResponseAminoMsg + ): MsgCreateReportResponse { + return MsgCreateReportResponse.fromAmino(object.value); + }, + fromProtoMsg( + message: MsgCreateReportResponseProtoMsg + ): MsgCreateReportResponse { + return MsgCreateReportResponse.decode(message.value); + }, + toProto(message: MsgCreateReportResponse): Uint8Array { + return MsgCreateReportResponse.encode(message).finish(); + }, + toProtoMsg( + message: MsgCreateReportResponse + ): MsgCreateReportResponseProtoMsg { + return { + typeUrl: "/desmos.reports.v1.MsgCreateReportResponse", + value: MsgCreateReportResponse.encode(message).finish(), + }; + }, }; function createBaseMsgDeleteReport(): MsgDeleteReport { return { @@ -393,6 +676,37 @@ export const MsgDeleteReport = { message.signer = object.signer ?? ""; return message; }, + fromAmino(object: MsgDeleteReportAmino): MsgDeleteReport { + return { + subspaceId: Long.fromString(object.subspace_id), + reportId: Long.fromString(object.report_id), + signer: object.signer, + }; + }, + toAmino(message: MsgDeleteReport): MsgDeleteReportAmino { + const obj: any = {}; + obj.subspace_id = message.subspaceId + ? message.subspaceId.toString() + : undefined; + obj.report_id = message.reportId ? message.reportId.toString() : undefined; + obj.signer = message.signer; + return obj; + }, + fromAminoMsg(object: MsgDeleteReportAminoMsg): MsgDeleteReport { + return MsgDeleteReport.fromAmino(object.value); + }, + fromProtoMsg(message: MsgDeleteReportProtoMsg): MsgDeleteReport { + return MsgDeleteReport.decode(message.value); + }, + toProto(message: MsgDeleteReport): Uint8Array { + return MsgDeleteReport.encode(message).finish(); + }, + toProtoMsg(message: MsgDeleteReport): MsgDeleteReportProtoMsg { + return { + typeUrl: "/desmos.reports.v1.MsgDeleteReport", + value: MsgDeleteReport.encode(message).finish(), + }; + }, }; function createBaseMsgDeleteReportResponse(): MsgDeleteReportResponse { return {}; @@ -434,6 +748,34 @@ export const MsgDeleteReportResponse = { const message = createBaseMsgDeleteReportResponse(); return message; }, + fromAmino(_: MsgDeleteReportResponseAmino): MsgDeleteReportResponse { + return {}; + }, + toAmino(_: MsgDeleteReportResponse): MsgDeleteReportResponseAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg( + object: MsgDeleteReportResponseAminoMsg + ): MsgDeleteReportResponse { + return MsgDeleteReportResponse.fromAmino(object.value); + }, + fromProtoMsg( + message: MsgDeleteReportResponseProtoMsg + ): MsgDeleteReportResponse { + return MsgDeleteReportResponse.decode(message.value); + }, + toProto(message: MsgDeleteReportResponse): Uint8Array { + return MsgDeleteReportResponse.encode(message).finish(); + }, + toProtoMsg( + message: MsgDeleteReportResponse + ): MsgDeleteReportResponseProtoMsg { + return { + typeUrl: "/desmos.reports.v1.MsgDeleteReportResponse", + value: MsgDeleteReportResponse.encode(message).finish(), + }; + }, }; function createBaseMsgSupportStandardReason(): MsgSupportStandardReason { return { @@ -516,6 +858,43 @@ export const MsgSupportStandardReason = { message.signer = object.signer ?? ""; return message; }, + fromAmino(object: MsgSupportStandardReasonAmino): MsgSupportStandardReason { + return { + subspaceId: Long.fromString(object.subspace_id), + standardReasonId: object.standard_reason_id, + signer: object.signer, + }; + }, + toAmino(message: MsgSupportStandardReason): MsgSupportStandardReasonAmino { + const obj: any = {}; + obj.subspace_id = message.subspaceId + ? message.subspaceId.toString() + : undefined; + obj.standard_reason_id = message.standardReasonId; + obj.signer = message.signer; + return obj; + }, + fromAminoMsg( + object: MsgSupportStandardReasonAminoMsg + ): MsgSupportStandardReason { + return MsgSupportStandardReason.fromAmino(object.value); + }, + fromProtoMsg( + message: MsgSupportStandardReasonProtoMsg + ): MsgSupportStandardReason { + return MsgSupportStandardReason.decode(message.value); + }, + toProto(message: MsgSupportStandardReason): Uint8Array { + return MsgSupportStandardReason.encode(message).finish(); + }, + toProtoMsg( + message: MsgSupportStandardReason + ): MsgSupportStandardReasonProtoMsg { + return { + typeUrl: "/desmos.reports.v1.MsgSupportStandardReason", + value: MsgSupportStandardReason.encode(message).finish(), + }; + }, }; function createBaseMsgSupportStandardReasonResponse(): MsgSupportStandardReasonResponse { return { @@ -570,6 +949,41 @@ export const MsgSupportStandardReasonResponse = { message.reasonsIds = object.reasonsIds ?? 0; return message; }, + fromAmino( + object: MsgSupportStandardReasonResponseAmino + ): MsgSupportStandardReasonResponse { + return { + reasonsIds: object.reasons_ids, + }; + }, + toAmino( + message: MsgSupportStandardReasonResponse + ): MsgSupportStandardReasonResponseAmino { + const obj: any = {}; + obj.reasons_ids = message.reasonsIds; + return obj; + }, + fromAminoMsg( + object: MsgSupportStandardReasonResponseAminoMsg + ): MsgSupportStandardReasonResponse { + return MsgSupportStandardReasonResponse.fromAmino(object.value); + }, + fromProtoMsg( + message: MsgSupportStandardReasonResponseProtoMsg + ): MsgSupportStandardReasonResponse { + return MsgSupportStandardReasonResponse.decode(message.value); + }, + toProto(message: MsgSupportStandardReasonResponse): Uint8Array { + return MsgSupportStandardReasonResponse.encode(message).finish(); + }, + toProtoMsg( + message: MsgSupportStandardReasonResponse + ): MsgSupportStandardReasonResponseProtoMsg { + return { + typeUrl: "/desmos.reports.v1.MsgSupportStandardReasonResponse", + value: MsgSupportStandardReasonResponse.encode(message).finish(), + }; + }, }; function createBaseMsgAddReason(): MsgAddReason { return { @@ -657,6 +1071,39 @@ export const MsgAddReason = { message.signer = object.signer ?? ""; return message; }, + fromAmino(object: MsgAddReasonAmino): MsgAddReason { + return { + subspaceId: Long.fromString(object.subspace_id), + title: object.title, + description: object.description, + signer: object.signer, + }; + }, + toAmino(message: MsgAddReason): MsgAddReasonAmino { + const obj: any = {}; + obj.subspace_id = message.subspaceId + ? message.subspaceId.toString() + : undefined; + obj.title = message.title; + obj.description = message.description; + obj.signer = message.signer; + return obj; + }, + fromAminoMsg(object: MsgAddReasonAminoMsg): MsgAddReason { + return MsgAddReason.fromAmino(object.value); + }, + fromProtoMsg(message: MsgAddReasonProtoMsg): MsgAddReason { + return MsgAddReason.decode(message.value); + }, + toProto(message: MsgAddReason): Uint8Array { + return MsgAddReason.encode(message).finish(); + }, + toProtoMsg(message: MsgAddReason): MsgAddReasonProtoMsg { + return { + typeUrl: "/desmos.reports.v1.MsgAddReason", + value: MsgAddReason.encode(message).finish(), + }; + }, }; function createBaseMsgAddReasonResponse(): MsgAddReasonResponse { return { @@ -711,6 +1158,31 @@ export const MsgAddReasonResponse = { message.reasonId = object.reasonId ?? 0; return message; }, + fromAmino(object: MsgAddReasonResponseAmino): MsgAddReasonResponse { + return { + reasonId: object.reason_id, + }; + }, + toAmino(message: MsgAddReasonResponse): MsgAddReasonResponseAmino { + const obj: any = {}; + obj.reason_id = message.reasonId; + return obj; + }, + fromAminoMsg(object: MsgAddReasonResponseAminoMsg): MsgAddReasonResponse { + return MsgAddReasonResponse.fromAmino(object.value); + }, + fromProtoMsg(message: MsgAddReasonResponseProtoMsg): MsgAddReasonResponse { + return MsgAddReasonResponse.decode(message.value); + }, + toProto(message: MsgAddReasonResponse): Uint8Array { + return MsgAddReasonResponse.encode(message).finish(); + }, + toProtoMsg(message: MsgAddReasonResponse): MsgAddReasonResponseProtoMsg { + return { + typeUrl: "/desmos.reports.v1.MsgAddReasonResponse", + value: MsgAddReasonResponse.encode(message).finish(), + }; + }, }; function createBaseMsgRemoveReason(): MsgRemoveReason { return { @@ -788,6 +1260,37 @@ export const MsgRemoveReason = { message.signer = object.signer ?? ""; return message; }, + fromAmino(object: MsgRemoveReasonAmino): MsgRemoveReason { + return { + subspaceId: Long.fromString(object.subspace_id), + reasonId: object.reason_id, + signer: object.signer, + }; + }, + toAmino(message: MsgRemoveReason): MsgRemoveReasonAmino { + const obj: any = {}; + obj.subspace_id = message.subspaceId + ? message.subspaceId.toString() + : undefined; + obj.reason_id = message.reasonId; + obj.signer = message.signer; + return obj; + }, + fromAminoMsg(object: MsgRemoveReasonAminoMsg): MsgRemoveReason { + return MsgRemoveReason.fromAmino(object.value); + }, + fromProtoMsg(message: MsgRemoveReasonProtoMsg): MsgRemoveReason { + return MsgRemoveReason.decode(message.value); + }, + toProto(message: MsgRemoveReason): Uint8Array { + return MsgRemoveReason.encode(message).finish(); + }, + toProtoMsg(message: MsgRemoveReason): MsgRemoveReasonProtoMsg { + return { + typeUrl: "/desmos.reports.v1.MsgRemoveReason", + value: MsgRemoveReason.encode(message).finish(), + }; + }, }; function createBaseMsgRemoveReasonResponse(): MsgRemoveReasonResponse { return {}; @@ -829,6 +1332,34 @@ export const MsgRemoveReasonResponse = { const message = createBaseMsgRemoveReasonResponse(); return message; }, + fromAmino(_: MsgRemoveReasonResponseAmino): MsgRemoveReasonResponse { + return {}; + }, + toAmino(_: MsgRemoveReasonResponse): MsgRemoveReasonResponseAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg( + object: MsgRemoveReasonResponseAminoMsg + ): MsgRemoveReasonResponse { + return MsgRemoveReasonResponse.fromAmino(object.value); + }, + fromProtoMsg( + message: MsgRemoveReasonResponseProtoMsg + ): MsgRemoveReasonResponse { + return MsgRemoveReasonResponse.decode(message.value); + }, + toProto(message: MsgRemoveReasonResponse): Uint8Array { + return MsgRemoveReasonResponse.encode(message).finish(); + }, + toProtoMsg( + message: MsgRemoveReasonResponse + ): MsgRemoveReasonResponseProtoMsg { + return { + typeUrl: "/desmos.reports.v1.MsgRemoveReasonResponse", + value: MsgRemoveReasonResponse.encode(message).finish(), + }; + }, }; function createBaseMsgUpdateParams(): MsgUpdateParams { return { @@ -893,6 +1424,33 @@ export const MsgUpdateParams = { : undefined; return message; }, + fromAmino(object: MsgUpdateParamsAmino): MsgUpdateParams { + return { + authority: object.authority, + params: object?.params ? Params.fromAmino(object.params) : undefined, + }; + }, + toAmino(message: MsgUpdateParams): MsgUpdateParamsAmino { + const obj: any = {}; + obj.authority = message.authority; + obj.params = message.params ? Params.toAmino(message.params) : undefined; + return obj; + }, + fromAminoMsg(object: MsgUpdateParamsAminoMsg): MsgUpdateParams { + return MsgUpdateParams.fromAmino(object.value); + }, + fromProtoMsg(message: MsgUpdateParamsProtoMsg): MsgUpdateParams { + return MsgUpdateParams.decode(message.value); + }, + toProto(message: MsgUpdateParams): Uint8Array { + return MsgUpdateParams.encode(message).finish(); + }, + toProtoMsg(message: MsgUpdateParams): MsgUpdateParamsProtoMsg { + return { + typeUrl: "/desmos.reports.v1.MsgUpdateParams", + value: MsgUpdateParams.encode(message).finish(), + }; + }, }; function createBaseMsgUpdateParamsResponse(): MsgUpdateParamsResponse { return {}; @@ -934,6 +1492,34 @@ export const MsgUpdateParamsResponse = { const message = createBaseMsgUpdateParamsResponse(); return message; }, + fromAmino(_: MsgUpdateParamsResponseAmino): MsgUpdateParamsResponse { + return {}; + }, + toAmino(_: MsgUpdateParamsResponse): MsgUpdateParamsResponseAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg( + object: MsgUpdateParamsResponseAminoMsg + ): MsgUpdateParamsResponse { + return MsgUpdateParamsResponse.fromAmino(object.value); + }, + fromProtoMsg( + message: MsgUpdateParamsResponseProtoMsg + ): MsgUpdateParamsResponse { + return MsgUpdateParamsResponse.decode(message.value); + }, + toProto(message: MsgUpdateParamsResponse): Uint8Array { + return MsgUpdateParamsResponse.encode(message).finish(); + }, + toProtoMsg( + message: MsgUpdateParamsResponse + ): MsgUpdateParamsResponseProtoMsg { + return { + typeUrl: "/desmos.reports.v1.MsgUpdateParamsResponse", + value: MsgUpdateParamsResponse.encode(message).finish(), + }; + }, }; /** Msg defines the reports Msg service. */ export interface Msg { diff --git a/packages/types/src/desmos/reports/v1/query.ts b/packages/types/src/desmos/reports/v1/query.ts index fd4a5614a..11fd726ce 100644 --- a/packages/types/src/desmos/reports/v1/query.ts +++ b/packages/types/src/desmos/reports/v1/query.ts @@ -1,10 +1,19 @@ /* eslint-disable */ -import { Any } from "../../../google/protobuf/any"; +import { Any, AnyAmino } from "../../../google/protobuf/any"; import { PageRequest, + PageRequestAmino, PageResponse, + PageResponseAmino, } from "../../../cosmos/base/query/v1beta1/pagination"; -import { Report, Reason, Params } from "./models"; +import { + Report, + ReportAmino, + Reason, + ReasonAmino, + Params, + ParamsAmino, +} from "./models"; import { Long, isSet, DeepPartial, Exact, Rpc } from "../../../helpers"; import * as _m0 from "protobufjs/minimal"; export const protobufPackage = "desmos.reports.v1"; @@ -22,11 +31,46 @@ export interface QueryReportsRequest { /** pagination defines an optional pagination for the request. */ pagination?: PageRequest; } +export interface QueryReportsRequestProtoMsg { + typeUrl: "/desmos.reports.v1.QueryReportsRequest"; + value: Uint8Array; +} +/** QueryReportsResponse is the request type for Query/Reports RPC method */ +export interface QueryReportsRequestAmino { + /** Id of the subspace to query the reports for */ + subspace_id: string; + /** (optional) Target to query the reports for */ + target?: AnyAmino; + /** + * (optional) User that reported the target. + * This is going to be used only if the target is also specified + */ + reporter: string; + /** pagination defines an optional pagination for the request. */ + pagination?: PageRequestAmino; +} +export interface QueryReportsRequestAminoMsg { + type: "/desmos.reports.v1.QueryReportsRequest"; + value: QueryReportsRequestAmino; +} /** QueryReportsResponse is the response type for Query/Reports RPC method */ export interface QueryReportsResponse { reports: Report[]; pagination?: PageResponse; } +export interface QueryReportsResponseProtoMsg { + typeUrl: "/desmos.reports.v1.QueryReportsResponse"; + value: Uint8Array; +} +/** QueryReportsResponse is the response type for Query/Reports RPC method */ +export interface QueryReportsResponseAmino { + reports: ReportAmino[]; + pagination?: PageResponseAmino; +} +export interface QueryReportsResponseAminoMsg { + type: "/desmos.reports.v1.QueryReportsResponse"; + value: QueryReportsResponseAmino; +} /** QueryReportRequest is the request type for Query/Report RPC method */ export interface QueryReportRequest { /** Id of the subspace that holds the report to query for */ @@ -34,10 +78,37 @@ export interface QueryReportRequest { /** Id of the report to query for */ reportId: Long; } +export interface QueryReportRequestProtoMsg { + typeUrl: "/desmos.reports.v1.QueryReportRequest"; + value: Uint8Array; +} +/** QueryReportRequest is the request type for Query/Report RPC method */ +export interface QueryReportRequestAmino { + /** Id of the subspace that holds the report to query for */ + subspace_id: string; + /** Id of the report to query for */ + report_id: string; +} +export interface QueryReportRequestAminoMsg { + type: "/desmos.reports.v1.QueryReportRequest"; + value: QueryReportRequestAmino; +} /** QueryReportResponse is the response type for Query/Report RPC method */ export interface QueryReportResponse { report?: Report; } +export interface QueryReportResponseProtoMsg { + typeUrl: "/desmos.reports.v1.QueryReportResponse"; + value: Uint8Array; +} +/** QueryReportResponse is the response type for Query/Report RPC method */ +export interface QueryReportResponseAmino { + report?: ReportAmino; +} +export interface QueryReportResponseAminoMsg { + type: "/desmos.reports.v1.QueryReportResponse"; + value: QueryReportResponseAmino; +} /** QueryReasonsRequest is the request type for Query/Reasons RPC method */ export interface QueryReasonsRequest { /** Id of the subspace to query the supported reporting reasons for */ @@ -45,11 +116,39 @@ export interface QueryReasonsRequest { /** pagination defines an optional pagination for the request. */ pagination?: PageRequest; } +export interface QueryReasonsRequestProtoMsg { + typeUrl: "/desmos.reports.v1.QueryReasonsRequest"; + value: Uint8Array; +} +/** QueryReasonsRequest is the request type for Query/Reasons RPC method */ +export interface QueryReasonsRequestAmino { + /** Id of the subspace to query the supported reporting reasons for */ + subspace_id: string; + /** pagination defines an optional pagination for the request. */ + pagination?: PageRequestAmino; +} +export interface QueryReasonsRequestAminoMsg { + type: "/desmos.reports.v1.QueryReasonsRequest"; + value: QueryReasonsRequestAmino; +} /** QueryReasonsResponse is the response type for Query/Reasons RPC method */ export interface QueryReasonsResponse { reasons: Reason[]; pagination?: PageResponse; } +export interface QueryReasonsResponseProtoMsg { + typeUrl: "/desmos.reports.v1.QueryReasonsResponse"; + value: Uint8Array; +} +/** QueryReasonsResponse is the response type for Query/Reasons RPC method */ +export interface QueryReasonsResponseAmino { + reasons: ReasonAmino[]; + pagination?: PageResponseAmino; +} +export interface QueryReasonsResponseAminoMsg { + type: "/desmos.reports.v1.QueryReasonsResponse"; + value: QueryReasonsResponseAmino; +} /** QueryReasonRequest is the request type for Query/Reason RPC method */ export interface QueryReasonRequest { /** Id of the subspace that holds the reason to query for */ @@ -57,16 +156,65 @@ export interface QueryReasonRequest { /** Id of the reason to query for */ reasonId: number; } +export interface QueryReasonRequestProtoMsg { + typeUrl: "/desmos.reports.v1.QueryReasonRequest"; + value: Uint8Array; +} +/** QueryReasonRequest is the request type for Query/Reason RPC method */ +export interface QueryReasonRequestAmino { + /** Id of the subspace that holds the reason to query for */ + subspace_id: string; + /** Id of the reason to query for */ + reason_id: number; +} +export interface QueryReasonRequestAminoMsg { + type: "/desmos.reports.v1.QueryReasonRequest"; + value: QueryReasonRequestAmino; +} /** QueryReasonResponse is the response type for Query/Reason RPC method */ export interface QueryReasonResponse { reason?: Reason; } +export interface QueryReasonResponseProtoMsg { + typeUrl: "/desmos.reports.v1.QueryReasonResponse"; + value: Uint8Array; +} +/** QueryReasonResponse is the response type for Query/Reason RPC method */ +export interface QueryReasonResponseAmino { + reason?: ReasonAmino; +} +export interface QueryReasonResponseAminoMsg { + type: "/desmos.reports.v1.QueryReasonResponse"; + value: QueryReasonResponseAmino; +} /** QueryParamsRequest is the request type for Query/Params RPC method */ export interface QueryParamsRequest {} +export interface QueryParamsRequestProtoMsg { + typeUrl: "/desmos.reports.v1.QueryParamsRequest"; + value: Uint8Array; +} +/** QueryParamsRequest is the request type for Query/Params RPC method */ +export interface QueryParamsRequestAmino {} +export interface QueryParamsRequestAminoMsg { + type: "/desmos.reports.v1.QueryParamsRequest"; + value: QueryParamsRequestAmino; +} /** QueryParamsResponse is the response type for Query/Params RPC method */ export interface QueryParamsResponse { params?: Params; } +export interface QueryParamsResponseProtoMsg { + typeUrl: "/desmos.reports.v1.QueryParamsResponse"; + value: Uint8Array; +} +/** QueryParamsResponse is the response type for Query/Params RPC method */ +export interface QueryParamsResponseAmino { + params?: ParamsAmino; +} +export interface QueryParamsResponseAminoMsg { + type: "/desmos.reports.v1.QueryParamsResponse"; + value: QueryParamsResponseAmino; +} function createBaseQueryReportsRequest(): QueryReportsRequest { return { subspaceId: Long.UZERO, @@ -164,6 +312,43 @@ export const QueryReportsRequest = { : undefined; return message; }, + fromAmino(object: QueryReportsRequestAmino): QueryReportsRequest { + return { + subspaceId: Long.fromString(object.subspace_id), + target: object?.target ? Any.fromAmino(object.target) : undefined, + reporter: object.reporter, + pagination: object?.pagination + ? PageRequest.fromAmino(object.pagination) + : undefined, + }; + }, + toAmino(message: QueryReportsRequest): QueryReportsRequestAmino { + const obj: any = {}; + obj.subspace_id = message.subspaceId + ? message.subspaceId.toString() + : undefined; + obj.target = message.target ? Any.toAmino(message.target) : undefined; + obj.reporter = message.reporter; + obj.pagination = message.pagination + ? PageRequest.toAmino(message.pagination) + : undefined; + return obj; + }, + fromAminoMsg(object: QueryReportsRequestAminoMsg): QueryReportsRequest { + return QueryReportsRequest.fromAmino(object.value); + }, + fromProtoMsg(message: QueryReportsRequestProtoMsg): QueryReportsRequest { + return QueryReportsRequest.decode(message.value); + }, + toProto(message: QueryReportsRequest): Uint8Array { + return QueryReportsRequest.encode(message).finish(); + }, + toProtoMsg(message: QueryReportsRequest): QueryReportsRequestProtoMsg { + return { + typeUrl: "/desmos.reports.v1.QueryReportsRequest", + value: QueryReportsRequest.encode(message).finish(), + }; + }, }; function createBaseQueryReportsResponse(): QueryReportsResponse { return { @@ -246,6 +431,45 @@ export const QueryReportsResponse = { : undefined; return message; }, + fromAmino(object: QueryReportsResponseAmino): QueryReportsResponse { + return { + reports: Array.isArray(object?.reports) + ? object.reports.map((e: any) => Report.fromAmino(e)) + : [], + pagination: object?.pagination + ? PageResponse.fromAmino(object.pagination) + : undefined, + }; + }, + toAmino(message: QueryReportsResponse): QueryReportsResponseAmino { + const obj: any = {}; + if (message.reports) { + obj.reports = message.reports.map((e) => + e ? Report.toAmino(e) : undefined + ); + } else { + obj.reports = []; + } + obj.pagination = message.pagination + ? PageResponse.toAmino(message.pagination) + : undefined; + return obj; + }, + fromAminoMsg(object: QueryReportsResponseAminoMsg): QueryReportsResponse { + return QueryReportsResponse.fromAmino(object.value); + }, + fromProtoMsg(message: QueryReportsResponseProtoMsg): QueryReportsResponse { + return QueryReportsResponse.decode(message.value); + }, + toProto(message: QueryReportsResponse): Uint8Array { + return QueryReportsResponse.encode(message).finish(); + }, + toProtoMsg(message: QueryReportsResponse): QueryReportsResponseProtoMsg { + return { + typeUrl: "/desmos.reports.v1.QueryReportsResponse", + value: QueryReportsResponse.encode(message).finish(), + }; + }, }; function createBaseQueryReportRequest(): QueryReportRequest { return { @@ -318,6 +542,35 @@ export const QueryReportRequest = { : Long.UZERO; return message; }, + fromAmino(object: QueryReportRequestAmino): QueryReportRequest { + return { + subspaceId: Long.fromString(object.subspace_id), + reportId: Long.fromString(object.report_id), + }; + }, + toAmino(message: QueryReportRequest): QueryReportRequestAmino { + const obj: any = {}; + obj.subspace_id = message.subspaceId + ? message.subspaceId.toString() + : undefined; + obj.report_id = message.reportId ? message.reportId.toString() : undefined; + return obj; + }, + fromAminoMsg(object: QueryReportRequestAminoMsg): QueryReportRequest { + return QueryReportRequest.fromAmino(object.value); + }, + fromProtoMsg(message: QueryReportRequestProtoMsg): QueryReportRequest { + return QueryReportRequest.decode(message.value); + }, + toProto(message: QueryReportRequest): Uint8Array { + return QueryReportRequest.encode(message).finish(); + }, + toProtoMsg(message: QueryReportRequest): QueryReportRequestProtoMsg { + return { + typeUrl: "/desmos.reports.v1.QueryReportRequest", + value: QueryReportRequest.encode(message).finish(), + }; + }, }; function createBaseQueryReportResponse(): QueryReportResponse { return { @@ -372,6 +625,31 @@ export const QueryReportResponse = { : undefined; return message; }, + fromAmino(object: QueryReportResponseAmino): QueryReportResponse { + return { + report: object?.report ? Report.fromAmino(object.report) : undefined, + }; + }, + toAmino(message: QueryReportResponse): QueryReportResponseAmino { + const obj: any = {}; + obj.report = message.report ? Report.toAmino(message.report) : undefined; + return obj; + }, + fromAminoMsg(object: QueryReportResponseAminoMsg): QueryReportResponse { + return QueryReportResponse.fromAmino(object.value); + }, + fromProtoMsg(message: QueryReportResponseProtoMsg): QueryReportResponse { + return QueryReportResponse.decode(message.value); + }, + toProto(message: QueryReportResponse): Uint8Array { + return QueryReportResponse.encode(message).finish(); + }, + toProtoMsg(message: QueryReportResponse): QueryReportResponseProtoMsg { + return { + typeUrl: "/desmos.reports.v1.QueryReportResponse", + value: QueryReportResponse.encode(message).finish(), + }; + }, }; function createBaseQueryReasonsRequest(): QueryReasonsRequest { return { @@ -446,6 +724,39 @@ export const QueryReasonsRequest = { : undefined; return message; }, + fromAmino(object: QueryReasonsRequestAmino): QueryReasonsRequest { + return { + subspaceId: Long.fromString(object.subspace_id), + pagination: object?.pagination + ? PageRequest.fromAmino(object.pagination) + : undefined, + }; + }, + toAmino(message: QueryReasonsRequest): QueryReasonsRequestAmino { + const obj: any = {}; + obj.subspace_id = message.subspaceId + ? message.subspaceId.toString() + : undefined; + obj.pagination = message.pagination + ? PageRequest.toAmino(message.pagination) + : undefined; + return obj; + }, + fromAminoMsg(object: QueryReasonsRequestAminoMsg): QueryReasonsRequest { + return QueryReasonsRequest.fromAmino(object.value); + }, + fromProtoMsg(message: QueryReasonsRequestProtoMsg): QueryReasonsRequest { + return QueryReasonsRequest.decode(message.value); + }, + toProto(message: QueryReasonsRequest): Uint8Array { + return QueryReasonsRequest.encode(message).finish(); + }, + toProtoMsg(message: QueryReasonsRequest): QueryReasonsRequestProtoMsg { + return { + typeUrl: "/desmos.reports.v1.QueryReasonsRequest", + value: QueryReasonsRequest.encode(message).finish(), + }; + }, }; function createBaseQueryReasonsResponse(): QueryReasonsResponse { return { @@ -528,6 +839,45 @@ export const QueryReasonsResponse = { : undefined; return message; }, + fromAmino(object: QueryReasonsResponseAmino): QueryReasonsResponse { + return { + reasons: Array.isArray(object?.reasons) + ? object.reasons.map((e: any) => Reason.fromAmino(e)) + : [], + pagination: object?.pagination + ? PageResponse.fromAmino(object.pagination) + : undefined, + }; + }, + toAmino(message: QueryReasonsResponse): QueryReasonsResponseAmino { + const obj: any = {}; + if (message.reasons) { + obj.reasons = message.reasons.map((e) => + e ? Reason.toAmino(e) : undefined + ); + } else { + obj.reasons = []; + } + obj.pagination = message.pagination + ? PageResponse.toAmino(message.pagination) + : undefined; + return obj; + }, + fromAminoMsg(object: QueryReasonsResponseAminoMsg): QueryReasonsResponse { + return QueryReasonsResponse.fromAmino(object.value); + }, + fromProtoMsg(message: QueryReasonsResponseProtoMsg): QueryReasonsResponse { + return QueryReasonsResponse.decode(message.value); + }, + toProto(message: QueryReasonsResponse): Uint8Array { + return QueryReasonsResponse.encode(message).finish(); + }, + toProtoMsg(message: QueryReasonsResponse): QueryReasonsResponseProtoMsg { + return { + typeUrl: "/desmos.reports.v1.QueryReasonsResponse", + value: QueryReasonsResponse.encode(message).finish(), + }; + }, }; function createBaseQueryReasonRequest(): QueryReasonRequest { return { @@ -595,6 +945,35 @@ export const QueryReasonRequest = { message.reasonId = object.reasonId ?? 0; return message; }, + fromAmino(object: QueryReasonRequestAmino): QueryReasonRequest { + return { + subspaceId: Long.fromString(object.subspace_id), + reasonId: object.reason_id, + }; + }, + toAmino(message: QueryReasonRequest): QueryReasonRequestAmino { + const obj: any = {}; + obj.subspace_id = message.subspaceId + ? message.subspaceId.toString() + : undefined; + obj.reason_id = message.reasonId; + return obj; + }, + fromAminoMsg(object: QueryReasonRequestAminoMsg): QueryReasonRequest { + return QueryReasonRequest.fromAmino(object.value); + }, + fromProtoMsg(message: QueryReasonRequestProtoMsg): QueryReasonRequest { + return QueryReasonRequest.decode(message.value); + }, + toProto(message: QueryReasonRequest): Uint8Array { + return QueryReasonRequest.encode(message).finish(); + }, + toProtoMsg(message: QueryReasonRequest): QueryReasonRequestProtoMsg { + return { + typeUrl: "/desmos.reports.v1.QueryReasonRequest", + value: QueryReasonRequest.encode(message).finish(), + }; + }, }; function createBaseQueryReasonResponse(): QueryReasonResponse { return { @@ -649,6 +1028,31 @@ export const QueryReasonResponse = { : undefined; return message; }, + fromAmino(object: QueryReasonResponseAmino): QueryReasonResponse { + return { + reason: object?.reason ? Reason.fromAmino(object.reason) : undefined, + }; + }, + toAmino(message: QueryReasonResponse): QueryReasonResponseAmino { + const obj: any = {}; + obj.reason = message.reason ? Reason.toAmino(message.reason) : undefined; + return obj; + }, + fromAminoMsg(object: QueryReasonResponseAminoMsg): QueryReasonResponse { + return QueryReasonResponse.fromAmino(object.value); + }, + fromProtoMsg(message: QueryReasonResponseProtoMsg): QueryReasonResponse { + return QueryReasonResponse.decode(message.value); + }, + toProto(message: QueryReasonResponse): Uint8Array { + return QueryReasonResponse.encode(message).finish(); + }, + toProtoMsg(message: QueryReasonResponse): QueryReasonResponseProtoMsg { + return { + typeUrl: "/desmos.reports.v1.QueryReasonResponse", + value: QueryReasonResponse.encode(message).finish(), + }; + }, }; function createBaseQueryParamsRequest(): QueryParamsRequest { return {}; @@ -687,6 +1091,28 @@ export const QueryParamsRequest = { const message = createBaseQueryParamsRequest(); return message; }, + fromAmino(_: QueryParamsRequestAmino): QueryParamsRequest { + return {}; + }, + toAmino(_: QueryParamsRequest): QueryParamsRequestAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg(object: QueryParamsRequestAminoMsg): QueryParamsRequest { + return QueryParamsRequest.fromAmino(object.value); + }, + fromProtoMsg(message: QueryParamsRequestProtoMsg): QueryParamsRequest { + return QueryParamsRequest.decode(message.value); + }, + toProto(message: QueryParamsRequest): Uint8Array { + return QueryParamsRequest.encode(message).finish(); + }, + toProtoMsg(message: QueryParamsRequest): QueryParamsRequestProtoMsg { + return { + typeUrl: "/desmos.reports.v1.QueryParamsRequest", + value: QueryParamsRequest.encode(message).finish(), + }; + }, }; function createBaseQueryParamsResponse(): QueryParamsResponse { return { @@ -741,6 +1167,31 @@ export const QueryParamsResponse = { : undefined; return message; }, + fromAmino(object: QueryParamsResponseAmino): QueryParamsResponse { + return { + params: object?.params ? Params.fromAmino(object.params) : undefined, + }; + }, + toAmino(message: QueryParamsResponse): QueryParamsResponseAmino { + const obj: any = {}; + obj.params = message.params ? Params.toAmino(message.params) : undefined; + return obj; + }, + fromAminoMsg(object: QueryParamsResponseAminoMsg): QueryParamsResponse { + return QueryParamsResponse.fromAmino(object.value); + }, + fromProtoMsg(message: QueryParamsResponseProtoMsg): QueryParamsResponse { + return QueryParamsResponse.decode(message.value); + }, + toProto(message: QueryParamsResponse): Uint8Array { + return QueryParamsResponse.encode(message).finish(); + }, + toProtoMsg(message: QueryParamsResponse): QueryParamsResponseProtoMsg { + return { + typeUrl: "/desmos.reports.v1.QueryParamsResponse", + value: QueryParamsResponse.encode(message).finish(), + }; + }, }; /** Query defines the gRPC querier service. */ export interface Query { diff --git a/packages/types/src/desmos/subspaces/v3/authz/authz.ts b/packages/types/src/desmos/subspaces/v3/authz/authz.ts index 45b4783e6..f2cad9360 100644 --- a/packages/types/src/desmos/subspaces/v3/authz/authz.ts +++ b/packages/types/src/desmos/subspaces/v3/authz/authz.ts @@ -15,6 +15,27 @@ export interface GenericSubspaceAuthorization { */ msg: string; } +export interface GenericSubspaceAuthorizationProtoMsg { + typeUrl: "/desmos.subspaces.v3.authz.GenericSubspaceAuthorization"; + value: Uint8Array; +} +/** + * GenericSubspaceAuthorization defines an authorization to perform any + * operation only inside a specific subspace. + */ +export interface GenericSubspaceAuthorizationAmino { + /** Ids of the subspaces inside which to grant the permission */ + subspaces_ids: string[]; + /** + * Msg, identified by it's type URL, to grant unrestricted permissions to + * execute within the subspace + */ + msg: string; +} +export interface GenericSubspaceAuthorizationAminoMsg { + type: "/desmos.subspaces.v3.authz.GenericSubspaceAuthorization"; + value: GenericSubspaceAuthorizationAmino; +} function createBaseGenericSubspaceAuthorization(): GenericSubspaceAuthorization { return { subspacesIds: [], @@ -95,4 +116,47 @@ export const GenericSubspaceAuthorization = { message.msg = object.msg ?? ""; return message; }, + fromAmino( + object: GenericSubspaceAuthorizationAmino + ): GenericSubspaceAuthorization { + return { + subspacesIds: Array.isArray(object?.subspaces_ids) + ? object.subspaces_ids.map((e: any) => e) + : [], + msg: object.msg, + }; + }, + toAmino( + message: GenericSubspaceAuthorization + ): GenericSubspaceAuthorizationAmino { + const obj: any = {}; + if (message.subspacesIds) { + obj.subspaces_ids = message.subspacesIds.map((e) => e); + } else { + obj.subspaces_ids = []; + } + obj.msg = message.msg; + return obj; + }, + fromAminoMsg( + object: GenericSubspaceAuthorizationAminoMsg + ): GenericSubspaceAuthorization { + return GenericSubspaceAuthorization.fromAmino(object.value); + }, + fromProtoMsg( + message: GenericSubspaceAuthorizationProtoMsg + ): GenericSubspaceAuthorization { + return GenericSubspaceAuthorization.decode(message.value); + }, + toProto(message: GenericSubspaceAuthorization): Uint8Array { + return GenericSubspaceAuthorization.encode(message).finish(); + }, + toProtoMsg( + message: GenericSubspaceAuthorization + ): GenericSubspaceAuthorizationProtoMsg { + return { + typeUrl: "/desmos.subspaces.v3.authz.GenericSubspaceAuthorization", + value: GenericSubspaceAuthorization.encode(message).finish(), + }; + }, }; diff --git a/packages/types/src/desmos/subspaces/v3/genesis.ts b/packages/types/src/desmos/subspaces/v3/genesis.ts index 03052158c..1a85644c0 100644 --- a/packages/types/src/desmos/subspaces/v3/genesis.ts +++ b/packages/types/src/desmos/subspaces/v3/genesis.ts @@ -1,6 +1,15 @@ /* eslint-disable */ -import { Subspace, Section, UserPermission, UserGroup } from "./models"; -import { Grant } from "./models_feegrant"; +import { + Subspace, + SubspaceAmino, + Section, + SectionAmino, + UserPermission, + UserPermissionAmino, + UserGroup, + UserGroupAmino, +} from "./models"; +import { Grant, GrantAmino } from "./models_feegrant"; import { Long, isSet, DeepPartial, Exact } from "../../../helpers"; import * as _m0 from "protobufjs/minimal"; export const protobufPackage = "desmos.subspaces.v3"; @@ -15,18 +24,65 @@ export interface GenesisState { userGroupsMembers: UserGroupMemberEntry[]; grants: Grant[]; } +export interface GenesisStateProtoMsg { + typeUrl: "/desmos.subspaces.v3.GenesisState"; + value: Uint8Array; +} +/** GenesisState contains the data of the genesis state for the subspaces module */ +export interface GenesisStateAmino { + initial_subspace_id: string; + subspaces_data: SubspaceDataAmino[]; + subspaces: SubspaceAmino[]; + sections: SectionAmino[]; + user_permissions: UserPermissionAmino[]; + user_groups: UserGroupAmino[]; + user_groups_members: UserGroupMemberEntryAmino[]; + grants: GrantAmino[]; +} +export interface GenesisStateAminoMsg { + type: "/desmos.subspaces.v3.GenesisState"; + value: GenesisStateAmino; +} /** SubspaceData contains the genesis data for a single subspace */ export interface SubspaceData { subspaceId: Long; nextGroupId: number; nextSectionId: number; } +export interface SubspaceDataProtoMsg { + typeUrl: "/desmos.subspaces.v3.SubspaceData"; + value: Uint8Array; +} +/** SubspaceData contains the genesis data for a single subspace */ +export interface SubspaceDataAmino { + subspace_id: string; + next_group_id: number; + next_section_id: number; +} +export interface SubspaceDataAminoMsg { + type: "/desmos.subspaces.v3.SubspaceData"; + value: SubspaceDataAmino; +} /** UserGroupMemberEntry contains the details of a user group member */ export interface UserGroupMemberEntry { subspaceId: Long; groupId: number; user: string; } +export interface UserGroupMemberEntryProtoMsg { + typeUrl: "/desmos.subspaces.v3.UserGroupMemberEntry"; + value: Uint8Array; +} +/** UserGroupMemberEntry contains the details of a user group member */ +export interface UserGroupMemberEntryAmino { + subspace_id: string; + group_id: number; + user: string; +} +export interface UserGroupMemberEntryAminoMsg { + type: "/desmos.subspaces.v3.UserGroupMemberEntry"; + value: UserGroupMemberEntryAmino; +} function createBaseGenesisState(): GenesisState { return { initialSubspaceId: Long.UZERO, @@ -225,6 +281,105 @@ export const GenesisState = { message.grants = object.grants?.map((e) => Grant.fromPartial(e)) || []; return message; }, + fromAmino(object: GenesisStateAmino): GenesisState { + return { + initialSubspaceId: Long.fromString(object.initial_subspace_id), + subspacesData: Array.isArray(object?.subspaces_data) + ? object.subspaces_data.map((e: any) => SubspaceData.fromAmino(e)) + : [], + subspaces: Array.isArray(object?.subspaces) + ? object.subspaces.map((e: any) => Subspace.fromAmino(e)) + : [], + sections: Array.isArray(object?.sections) + ? object.sections.map((e: any) => Section.fromAmino(e)) + : [], + userPermissions: Array.isArray(object?.user_permissions) + ? object.user_permissions.map((e: any) => UserPermission.fromAmino(e)) + : [], + userGroups: Array.isArray(object?.user_groups) + ? object.user_groups.map((e: any) => UserGroup.fromAmino(e)) + : [], + userGroupsMembers: Array.isArray(object?.user_groups_members) + ? object.user_groups_members.map((e: any) => + UserGroupMemberEntry.fromAmino(e) + ) + : [], + grants: Array.isArray(object?.grants) + ? object.grants.map((e: any) => Grant.fromAmino(e)) + : [], + }; + }, + toAmino(message: GenesisState): GenesisStateAmino { + const obj: any = {}; + obj.initial_subspace_id = message.initialSubspaceId + ? message.initialSubspaceId.toString() + : undefined; + if (message.subspacesData) { + obj.subspaces_data = message.subspacesData.map((e) => + e ? SubspaceData.toAmino(e) : undefined + ); + } else { + obj.subspaces_data = []; + } + if (message.subspaces) { + obj.subspaces = message.subspaces.map((e) => + e ? Subspace.toAmino(e) : undefined + ); + } else { + obj.subspaces = []; + } + if (message.sections) { + obj.sections = message.sections.map((e) => + e ? Section.toAmino(e) : undefined + ); + } else { + obj.sections = []; + } + if (message.userPermissions) { + obj.user_permissions = message.userPermissions.map((e) => + e ? UserPermission.toAmino(e) : undefined + ); + } else { + obj.user_permissions = []; + } + if (message.userGroups) { + obj.user_groups = message.userGroups.map((e) => + e ? UserGroup.toAmino(e) : undefined + ); + } else { + obj.user_groups = []; + } + if (message.userGroupsMembers) { + obj.user_groups_members = message.userGroupsMembers.map((e) => + e ? UserGroupMemberEntry.toAmino(e) : undefined + ); + } else { + obj.user_groups_members = []; + } + if (message.grants) { + obj.grants = message.grants.map((e) => + e ? Grant.toAmino(e) : undefined + ); + } else { + obj.grants = []; + } + return obj; + }, + fromAminoMsg(object: GenesisStateAminoMsg): GenesisState { + return GenesisState.fromAmino(object.value); + }, + fromProtoMsg(message: GenesisStateProtoMsg): GenesisState { + return GenesisState.decode(message.value); + }, + toProto(message: GenesisState): Uint8Array { + return GenesisState.encode(message).finish(); + }, + toProtoMsg(message: GenesisState): GenesisStateProtoMsg { + return { + typeUrl: "/desmos.subspaces.v3.GenesisState", + value: GenesisState.encode(message).finish(), + }; + }, }; function createBaseSubspaceData(): SubspaceData { return { @@ -305,6 +460,37 @@ export const SubspaceData = { message.nextSectionId = object.nextSectionId ?? 0; return message; }, + fromAmino(object: SubspaceDataAmino): SubspaceData { + return { + subspaceId: Long.fromString(object.subspace_id), + nextGroupId: object.next_group_id, + nextSectionId: object.next_section_id, + }; + }, + toAmino(message: SubspaceData): SubspaceDataAmino { + const obj: any = {}; + obj.subspace_id = message.subspaceId + ? message.subspaceId.toString() + : undefined; + obj.next_group_id = message.nextGroupId; + obj.next_section_id = message.nextSectionId; + return obj; + }, + fromAminoMsg(object: SubspaceDataAminoMsg): SubspaceData { + return SubspaceData.fromAmino(object.value); + }, + fromProtoMsg(message: SubspaceDataProtoMsg): SubspaceData { + return SubspaceData.decode(message.value); + }, + toProto(message: SubspaceData): Uint8Array { + return SubspaceData.encode(message).finish(); + }, + toProtoMsg(message: SubspaceData): SubspaceDataProtoMsg { + return { + typeUrl: "/desmos.subspaces.v3.SubspaceData", + value: SubspaceData.encode(message).finish(), + }; + }, }; function createBaseUserGroupMemberEntry(): UserGroupMemberEntry { return { @@ -385,4 +571,35 @@ export const UserGroupMemberEntry = { message.user = object.user ?? ""; return message; }, + fromAmino(object: UserGroupMemberEntryAmino): UserGroupMemberEntry { + return { + subspaceId: Long.fromString(object.subspace_id), + groupId: object.group_id, + user: object.user, + }; + }, + toAmino(message: UserGroupMemberEntry): UserGroupMemberEntryAmino { + const obj: any = {}; + obj.subspace_id = message.subspaceId + ? message.subspaceId.toString() + : undefined; + obj.group_id = message.groupId; + obj.user = message.user; + return obj; + }, + fromAminoMsg(object: UserGroupMemberEntryAminoMsg): UserGroupMemberEntry { + return UserGroupMemberEntry.fromAmino(object.value); + }, + fromProtoMsg(message: UserGroupMemberEntryProtoMsg): UserGroupMemberEntry { + return UserGroupMemberEntry.decode(message.value); + }, + toProto(message: UserGroupMemberEntry): Uint8Array { + return UserGroupMemberEntry.encode(message).finish(); + }, + toProtoMsg(message: UserGroupMemberEntry): UserGroupMemberEntryProtoMsg { + return { + typeUrl: "/desmos.subspaces.v3.UserGroupMemberEntry", + value: UserGroupMemberEntry.encode(message).finish(), + }; + }, }; diff --git a/packages/types/src/desmos/subspaces/v3/models.ts b/packages/types/src/desmos/subspaces/v3/models.ts index 597fd6d6b..fb4d5d0c1 100644 --- a/packages/types/src/desmos/subspaces/v3/models.ts +++ b/packages/types/src/desmos/subspaces/v3/models.ts @@ -1,5 +1,5 @@ /* eslint-disable */ -import { Timestamp } from "../../../google/protobuf/timestamp"; +import { Timestamp, TimestampAmino } from "../../../google/protobuf/timestamp"; import { Long, isSet, @@ -30,6 +30,34 @@ export interface Subspace { /** the creation time of the subspace */ creationTime?: Timestamp; } +export interface SubspaceProtoMsg { + typeUrl: "/desmos.subspaces.v3.Subspace"; + value: Uint8Array; +} +/** Subspace contains all the data of a Desmos subspace */ +export interface SubspaceAmino { + /** Unique id that identifies the subspace */ + id: string; + /** Human-readable name of the subspace */ + name: string; + /** Optional description of this subspace */ + description: string; + /** + * Represents the account that is associated with the subspace and + * should be used to connect external applications to verify this subspace + */ + treasury: string; + /** Address of the user that owns the subspace */ + owner: string; + /** Address of the subspace creator */ + creator: string; + /** the creation time of the subspace */ + creation_time?: TimestampAmino; +} +export interface SubspaceAminoMsg { + type: "/desmos.subspaces.v3.Subspace"; + value: SubspaceAmino; +} /** Section contains the data of a single subspace section */ export interface Section { /** Id of the subspace inside which the section exists */ @@ -43,6 +71,27 @@ export interface Section { /** (optional) Description of the section */ description: string; } +export interface SectionProtoMsg { + typeUrl: "/desmos.subspaces.v3.Section"; + value: Uint8Array; +} +/** Section contains the data of a single subspace section */ +export interface SectionAmino { + /** Id of the subspace inside which the section exists */ + subspace_id: string; + /** Unique id of the section within the subspace */ + id: number; + /** (optional) Id of the parent section */ + parent_id: number; + /** Name of the section within the subspace */ + name: string; + /** (optional) Description of the section */ + description: string; +} +export interface SectionAminoMsg { + type: "/desmos.subspaces.v3.Section"; + value: SectionAmino; +} /** UserGroup represents a group of users */ export interface UserGroup { /** ID of the subspace inside which this group exists */ @@ -58,6 +107,29 @@ export interface UserGroup { /** Permissions that will be granted to all the users part of this group */ permissions: string[]; } +export interface UserGroupProtoMsg { + typeUrl: "/desmos.subspaces.v3.UserGroup"; + value: Uint8Array; +} +/** UserGroup represents a group of users */ +export interface UserGroupAmino { + /** ID of the subspace inside which this group exists */ + subspace_id: string; + /** (optional) Id of the section inside which this group is valid */ + section_id: number; + /** Unique id that identifies the group */ + id: number; + /** Human-readable name of the user group */ + name: string; + /** Optional description of this group */ + description: string; + /** Permissions that will be granted to all the users part of this group */ + permissions: string[]; +} +export interface UserGroupAminoMsg { + type: "/desmos.subspaces.v3.UserGroup"; + value: UserGroupAmino; +} /** UserPermission represents a single Access Control List entry */ export interface UserPermission { subspaceId: Long; @@ -65,6 +137,21 @@ export interface UserPermission { user: string; permissions: string[]; } +export interface UserPermissionProtoMsg { + typeUrl: "/desmos.subspaces.v3.UserPermission"; + value: Uint8Array; +} +/** UserPermission represents a single Access Control List entry */ +export interface UserPermissionAmino { + subspace_id: string; + section_id: number; + user: string; + permissions: string[]; +} +export interface UserPermissionAminoMsg { + type: "/desmos.subspaces.v3.UserPermission"; + value: UserPermissionAmino; +} function createBaseSubspace(): Subspace { return { id: Long.UZERO, @@ -183,6 +270,47 @@ export const Subspace = { : undefined; return message; }, + fromAmino(object: SubspaceAmino): Subspace { + return { + id: Long.fromString(object.id), + name: object.name, + description: object.description, + treasury: object.treasury, + owner: object.owner, + creator: object.creator, + creationTime: object?.creation_time + ? Timestamp.fromAmino(object.creation_time) + : undefined, + }; + }, + toAmino(message: Subspace): SubspaceAmino { + const obj: any = {}; + obj.id = message.id ? message.id.toString() : undefined; + obj.name = message.name; + obj.description = message.description; + obj.treasury = message.treasury; + obj.owner = message.owner; + obj.creator = message.creator; + obj.creation_time = message.creationTime + ? Timestamp.toAmino(message.creationTime) + : undefined; + return obj; + }, + fromAminoMsg(object: SubspaceAminoMsg): Subspace { + return Subspace.fromAmino(object.value); + }, + fromProtoMsg(message: SubspaceProtoMsg): Subspace { + return Subspace.decode(message.value); + }, + toProto(message: Subspace): Uint8Array { + return Subspace.encode(message).finish(); + }, + toProtoMsg(message: Subspace): SubspaceProtoMsg { + return { + typeUrl: "/desmos.subspaces.v3.Subspace", + value: Subspace.encode(message).finish(), + }; + }, }; function createBaseSection(): Section { return { @@ -279,6 +407,41 @@ export const Section = { message.description = object.description ?? ""; return message; }, + fromAmino(object: SectionAmino): Section { + return { + subspaceId: Long.fromString(object.subspace_id), + id: object.id, + parentId: object.parent_id, + name: object.name, + description: object.description, + }; + }, + toAmino(message: Section): SectionAmino { + const obj: any = {}; + obj.subspace_id = message.subspaceId + ? message.subspaceId.toString() + : undefined; + obj.id = message.id; + obj.parent_id = message.parentId; + obj.name = message.name; + obj.description = message.description; + return obj; + }, + fromAminoMsg(object: SectionAminoMsg): Section { + return Section.fromAmino(object.value); + }, + fromProtoMsg(message: SectionProtoMsg): Section { + return Section.decode(message.value); + }, + toProto(message: Section): Uint8Array { + return Section.encode(message).finish(); + }, + toProtoMsg(message: Section): SectionProtoMsg { + return { + typeUrl: "/desmos.subspaces.v3.Section", + value: Section.encode(message).finish(), + }; + }, }; function createBaseUserGroup(): UserGroup { return { @@ -393,6 +556,49 @@ export const UserGroup = { message.permissions = object.permissions?.map((e) => e) || []; return message; }, + fromAmino(object: UserGroupAmino): UserGroup { + return { + subspaceId: Long.fromString(object.subspace_id), + sectionId: object.section_id, + id: object.id, + name: object.name, + description: object.description, + permissions: Array.isArray(object?.permissions) + ? object.permissions.map((e: any) => e) + : [], + }; + }, + toAmino(message: UserGroup): UserGroupAmino { + const obj: any = {}; + obj.subspace_id = message.subspaceId + ? message.subspaceId.toString() + : undefined; + obj.section_id = message.sectionId; + obj.id = message.id; + obj.name = message.name; + obj.description = message.description; + if (message.permissions) { + obj.permissions = message.permissions.map((e) => e); + } else { + obj.permissions = []; + } + return obj; + }, + fromAminoMsg(object: UserGroupAminoMsg): UserGroup { + return UserGroup.fromAmino(object.value); + }, + fromProtoMsg(message: UserGroupProtoMsg): UserGroup { + return UserGroup.decode(message.value); + }, + toProto(message: UserGroup): Uint8Array { + return UserGroup.encode(message).finish(); + }, + toProtoMsg(message: UserGroup): UserGroupProtoMsg { + return { + typeUrl: "/desmos.subspaces.v3.UserGroup", + value: UserGroup.encode(message).finish(), + }; + }, }; function createBaseUserPermission(): UserPermission { return { @@ -486,4 +692,43 @@ export const UserPermission = { message.permissions = object.permissions?.map((e) => e) || []; return message; }, + fromAmino(object: UserPermissionAmino): UserPermission { + return { + subspaceId: Long.fromString(object.subspace_id), + sectionId: object.section_id, + user: object.user, + permissions: Array.isArray(object?.permissions) + ? object.permissions.map((e: any) => e) + : [], + }; + }, + toAmino(message: UserPermission): UserPermissionAmino { + const obj: any = {}; + obj.subspace_id = message.subspaceId + ? message.subspaceId.toString() + : undefined; + obj.section_id = message.sectionId; + obj.user = message.user; + if (message.permissions) { + obj.permissions = message.permissions.map((e) => e); + } else { + obj.permissions = []; + } + return obj; + }, + fromAminoMsg(object: UserPermissionAminoMsg): UserPermission { + return UserPermission.fromAmino(object.value); + }, + fromProtoMsg(message: UserPermissionProtoMsg): UserPermission { + return UserPermission.decode(message.value); + }, + toProto(message: UserPermission): Uint8Array { + return UserPermission.encode(message).finish(); + }, + toProtoMsg(message: UserPermission): UserPermissionProtoMsg { + return { + typeUrl: "/desmos.subspaces.v3.UserPermission", + value: UserPermission.encode(message).finish(), + }; + }, }; diff --git a/packages/types/src/desmos/subspaces/v3/models_feegrant.ts b/packages/types/src/desmos/subspaces/v3/models_feegrant.ts index e5ea578af..9e5709af7 100644 --- a/packages/types/src/desmos/subspaces/v3/models_feegrant.ts +++ b/packages/types/src/desmos/subspaces/v3/models_feegrant.ts @@ -1,5 +1,5 @@ /* eslint-disable */ -import { Any } from "../../../google/protobuf/any"; +import { Any, AnyAmino } from "../../../google/protobuf/any"; import { Long, isSet, DeepPartial, Exact } from "../../../helpers"; import * as _m0 from "protobufjs/minimal"; export const protobufPackage = "desmos.subspaces.v3"; @@ -17,14 +17,60 @@ export interface Grant { */ allowance?: Any; } +export interface GrantProtoMsg { + typeUrl: "/desmos.subspaces.v3.Grant"; + value: Uint8Array; +} +/** Grant represents a grant to a user or a group */ +export interface GrantAmino { + /** Id of the subspace inside which the user was granted the allowance */ + subspace_id: string; + /** Address of the user that granted the allowance */ + granter: string; + /** Target to which the allowance has been granted */ + grantee?: AnyAmino; + /** + * Allowance can be any allowance type implementing the FeeAllowanceI + * interface + */ + allowance?: AnyAmino; +} +export interface GrantAminoMsg { + type: "/desmos.subspaces.v3.Grant"; + value: GrantAmino; +} /** UserGrantee contains the target of a grant about a user */ export interface UserGrantee { user: string; } +export interface UserGranteeProtoMsg { + typeUrl: "/desmos.subspaces.v3.UserGrantee"; + value: Uint8Array; +} +/** UserGrantee contains the target of a grant about a user */ +export interface UserGranteeAmino { + user: string; +} +export interface UserGranteeAminoMsg { + type: "/desmos.subspaces.v3.UserGrantee"; + value: UserGranteeAmino; +} /** GroupGrantee contains the target of a grant about a group */ export interface GroupGrantee { groupId: number; } +export interface GroupGranteeProtoMsg { + typeUrl: "/desmos.subspaces.v3.GroupGrantee"; + value: Uint8Array; +} +/** GroupGrantee contains the target of a grant about a group */ +export interface GroupGranteeAmino { + group_id: number; +} +export interface GroupGranteeAminoMsg { + type: "/desmos.subspaces.v3.GroupGrantee"; + value: GroupGranteeAmino; +} function createBaseGrant(): Grant { return { subspaceId: Long.UZERO, @@ -117,6 +163,43 @@ export const Grant = { : undefined; return message; }, + fromAmino(object: GrantAmino): Grant { + return { + subspaceId: Long.fromString(object.subspace_id), + granter: object.granter, + grantee: object?.grantee ? Any.fromAmino(object.grantee) : undefined, + allowance: object?.allowance + ? Any.fromAmino(object.allowance) + : undefined, + }; + }, + toAmino(message: Grant): GrantAmino { + const obj: any = {}; + obj.subspace_id = message.subspaceId + ? message.subspaceId.toString() + : undefined; + obj.granter = message.granter; + obj.grantee = message.grantee ? Any.toAmino(message.grantee) : undefined; + obj.allowance = message.allowance + ? Any.toAmino(message.allowance) + : undefined; + return obj; + }, + fromAminoMsg(object: GrantAminoMsg): Grant { + return Grant.fromAmino(object.value); + }, + fromProtoMsg(message: GrantProtoMsg): Grant { + return Grant.decode(message.value); + }, + toProto(message: Grant): Uint8Array { + return Grant.encode(message).finish(); + }, + toProtoMsg(message: Grant): GrantProtoMsg { + return { + typeUrl: "/desmos.subspaces.v3.Grant", + value: Grant.encode(message).finish(), + }; + }, }; function createBaseUserGrantee(): UserGrantee { return { @@ -167,6 +250,31 @@ export const UserGrantee = { message.user = object.user ?? ""; return message; }, + fromAmino(object: UserGranteeAmino): UserGrantee { + return { + user: object.user, + }; + }, + toAmino(message: UserGrantee): UserGranteeAmino { + const obj: any = {}; + obj.user = message.user; + return obj; + }, + fromAminoMsg(object: UserGranteeAminoMsg): UserGrantee { + return UserGrantee.fromAmino(object.value); + }, + fromProtoMsg(message: UserGranteeProtoMsg): UserGrantee { + return UserGrantee.decode(message.value); + }, + toProto(message: UserGrantee): Uint8Array { + return UserGrantee.encode(message).finish(); + }, + toProtoMsg(message: UserGrantee): UserGranteeProtoMsg { + return { + typeUrl: "/desmos.subspaces.v3.UserGrantee", + value: UserGrantee.encode(message).finish(), + }; + }, }; function createBaseGroupGrantee(): GroupGrantee { return { @@ -218,4 +326,29 @@ export const GroupGrantee = { message.groupId = object.groupId ?? 0; return message; }, + fromAmino(object: GroupGranteeAmino): GroupGrantee { + return { + groupId: object.group_id, + }; + }, + toAmino(message: GroupGrantee): GroupGranteeAmino { + const obj: any = {}; + obj.group_id = message.groupId; + return obj; + }, + fromAminoMsg(object: GroupGranteeAminoMsg): GroupGrantee { + return GroupGrantee.fromAmino(object.value); + }, + fromProtoMsg(message: GroupGranteeProtoMsg): GroupGrantee { + return GroupGrantee.decode(message.value); + }, + toProto(message: GroupGrantee): Uint8Array { + return GroupGrantee.encode(message).finish(); + }, + toProtoMsg(message: GroupGrantee): GroupGranteeProtoMsg { + return { + typeUrl: "/desmos.subspaces.v3.GroupGrantee", + value: GroupGrantee.encode(message).finish(), + }; + }, }; diff --git a/packages/types/src/desmos/subspaces/v3/msgs.amino.ts b/packages/types/src/desmos/subspaces/v3/msgs.amino.ts new file mode 100644 index 000000000..13f5e696a --- /dev/null +++ b/packages/types/src/desmos/subspaces/v3/msgs.amino.ts @@ -0,0 +1,120 @@ +/* eslint-disable */ +import { + MsgCreateSubspace, + MsgEditSubspace, + MsgDeleteSubspace, + MsgCreateSection, + MsgEditSection, + MsgMoveSection, + MsgDeleteSection, + MsgCreateUserGroup, + MsgEditUserGroup, + MsgMoveUserGroup, + MsgSetUserGroupPermissions, + MsgDeleteUserGroup, + MsgAddUserToUserGroup, + MsgRemoveUserFromUserGroup, + MsgSetUserPermissions, +} from "./msgs"; +import { + MsgGrantTreasuryAuthorization, + MsgRevokeTreasuryAuthorization, +} from "./msgs_treasury"; +import { MsgGrantAllowance, MsgRevokeAllowance } from "./msgs_feegrant"; +export const AminoConverter = { + "/desmos.subspaces.v3.MsgCreateSubspace": { + aminoType: "/desmos.subspaces.v3.MsgCreateSubspace", + toAmino: MsgCreateSubspace.toAmino, + fromAmino: MsgCreateSubspace.fromAmino, + }, + "/desmos.subspaces.v3.MsgEditSubspace": { + aminoType: "/desmos.subspaces.v3.MsgEditSubspace", + toAmino: MsgEditSubspace.toAmino, + fromAmino: MsgEditSubspace.fromAmino, + }, + "/desmos.subspaces.v3.MsgDeleteSubspace": { + aminoType: "/desmos.subspaces.v3.MsgDeleteSubspace", + toAmino: MsgDeleteSubspace.toAmino, + fromAmino: MsgDeleteSubspace.fromAmino, + }, + "/desmos.subspaces.v3.MsgCreateSection": { + aminoType: "/desmos.subspaces.v3.MsgCreateSection", + toAmino: MsgCreateSection.toAmino, + fromAmino: MsgCreateSection.fromAmino, + }, + "/desmos.subspaces.v3.MsgEditSection": { + aminoType: "/desmos.subspaces.v3.MsgEditSection", + toAmino: MsgEditSection.toAmino, + fromAmino: MsgEditSection.fromAmino, + }, + "/desmos.subspaces.v3.MsgMoveSection": { + aminoType: "/desmos.subspaces.v3.MsgMoveSection", + toAmino: MsgMoveSection.toAmino, + fromAmino: MsgMoveSection.fromAmino, + }, + "/desmos.subspaces.v3.MsgDeleteSection": { + aminoType: "/desmos.subspaces.v3.MsgDeleteSection", + toAmino: MsgDeleteSection.toAmino, + fromAmino: MsgDeleteSection.fromAmino, + }, + "/desmos.subspaces.v3.MsgCreateUserGroup": { + aminoType: "/desmos.subspaces.v3.MsgCreateUserGroup", + toAmino: MsgCreateUserGroup.toAmino, + fromAmino: MsgCreateUserGroup.fromAmino, + }, + "/desmos.subspaces.v3.MsgEditUserGroup": { + aminoType: "/desmos.subspaces.v3.MsgEditUserGroup", + toAmino: MsgEditUserGroup.toAmino, + fromAmino: MsgEditUserGroup.fromAmino, + }, + "/desmos.subspaces.v3.MsgMoveUserGroup": { + aminoType: "/desmos.subspaces.v3.MsgMoveUserGroup", + toAmino: MsgMoveUserGroup.toAmino, + fromAmino: MsgMoveUserGroup.fromAmino, + }, + "/desmos.subspaces.v3.MsgSetUserGroupPermissions": { + aminoType: "/desmos.subspaces.v3.MsgSetUserGroupPermissions", + toAmino: MsgSetUserGroupPermissions.toAmino, + fromAmino: MsgSetUserGroupPermissions.fromAmino, + }, + "/desmos.subspaces.v3.MsgDeleteUserGroup": { + aminoType: "/desmos.subspaces.v3.MsgDeleteUserGroup", + toAmino: MsgDeleteUserGroup.toAmino, + fromAmino: MsgDeleteUserGroup.fromAmino, + }, + "/desmos.subspaces.v3.MsgAddUserToUserGroup": { + aminoType: "/desmos.subspaces.v3.MsgAddUserToUserGroup", + toAmino: MsgAddUserToUserGroup.toAmino, + fromAmino: MsgAddUserToUserGroup.fromAmino, + }, + "/desmos.subspaces.v3.MsgRemoveUserFromUserGroup": { + aminoType: "/desmos.subspaces.v3.MsgRemoveUserFromUserGroup", + toAmino: MsgRemoveUserFromUserGroup.toAmino, + fromAmino: MsgRemoveUserFromUserGroup.fromAmino, + }, + "/desmos.subspaces.v3.MsgSetUserPermissions": { + aminoType: "/desmos.subspaces.v3.MsgSetUserPermissions", + toAmino: MsgSetUserPermissions.toAmino, + fromAmino: MsgSetUserPermissions.fromAmino, + }, + "/desmos.subspaces.v3.MsgGrantTreasuryAuthorization": { + aminoType: "/desmos.subspaces.v3.MsgGrantTreasuryAuthorization", + toAmino: MsgGrantTreasuryAuthorization.toAmino, + fromAmino: MsgGrantTreasuryAuthorization.fromAmino, + }, + "/desmos.subspaces.v3.MsgRevokeTreasuryAuthorization": { + aminoType: "/desmos.subspaces.v3.MsgRevokeTreasuryAuthorization", + toAmino: MsgRevokeTreasuryAuthorization.toAmino, + fromAmino: MsgRevokeTreasuryAuthorization.fromAmino, + }, + "/desmos.subspaces.v3.MsgGrantAllowance": { + aminoType: "/desmos.subspaces.v3.MsgGrantAllowance", + toAmino: MsgGrantAllowance.toAmino, + fromAmino: MsgGrantAllowance.fromAmino, + }, + "/desmos.subspaces.v3.MsgRevokeAllowance": { + aminoType: "/desmos.subspaces.v3.MsgRevokeAllowance", + toAmino: MsgRevokeAllowance.toAmino, + fromAmino: MsgRevokeAllowance.fromAmino, + }, +}; diff --git a/packages/types/src/desmos/subspaces/v3/msgs.registry.ts b/packages/types/src/desmos/subspaces/v3/msgs.registry.ts new file mode 100644 index 000000000..05273b9c0 --- /dev/null +++ b/packages/types/src/desmos/subspaces/v3/msgs.registry.ts @@ -0,0 +1,644 @@ +/* eslint-disable */ +import { GeneratedType, Registry } from "@cosmjs/proto-signing"; +import { + MsgCreateSubspace, + MsgEditSubspace, + MsgDeleteSubspace, + MsgCreateSection, + MsgEditSection, + MsgMoveSection, + MsgDeleteSection, + MsgCreateUserGroup, + MsgEditUserGroup, + MsgMoveUserGroup, + MsgSetUserGroupPermissions, + MsgDeleteUserGroup, + MsgAddUserToUserGroup, + MsgRemoveUserFromUserGroup, + MsgSetUserPermissions, +} from "./msgs"; +import { + MsgGrantTreasuryAuthorization, + MsgRevokeTreasuryAuthorization, +} from "./msgs_treasury"; +import { MsgGrantAllowance, MsgRevokeAllowance } from "./msgs_feegrant"; +export const registry: ReadonlyArray<[string, GeneratedType]> = [ + ["/desmos.subspaces.v3.MsgCreateSubspace", MsgCreateSubspace], + ["/desmos.subspaces.v3.MsgEditSubspace", MsgEditSubspace], + ["/desmos.subspaces.v3.MsgDeleteSubspace", MsgDeleteSubspace], + ["/desmos.subspaces.v3.MsgCreateSection", MsgCreateSection], + ["/desmos.subspaces.v3.MsgEditSection", MsgEditSection], + ["/desmos.subspaces.v3.MsgMoveSection", MsgMoveSection], + ["/desmos.subspaces.v3.MsgDeleteSection", MsgDeleteSection], + ["/desmos.subspaces.v3.MsgCreateUserGroup", MsgCreateUserGroup], + ["/desmos.subspaces.v3.MsgEditUserGroup", MsgEditUserGroup], + ["/desmos.subspaces.v3.MsgMoveUserGroup", MsgMoveUserGroup], + [ + "/desmos.subspaces.v3.MsgSetUserGroupPermissions", + MsgSetUserGroupPermissions, + ], + ["/desmos.subspaces.v3.MsgDeleteUserGroup", MsgDeleteUserGroup], + ["/desmos.subspaces.v3.MsgAddUserToUserGroup", MsgAddUserToUserGroup], + [ + "/desmos.subspaces.v3.MsgRemoveUserFromUserGroup", + MsgRemoveUserFromUserGroup, + ], + ["/desmos.subspaces.v3.MsgSetUserPermissions", MsgSetUserPermissions], + [ + "/desmos.subspaces.v3.MsgGrantTreasuryAuthorization", + MsgGrantTreasuryAuthorization, + ], + [ + "/desmos.subspaces.v3.MsgRevokeTreasuryAuthorization", + MsgRevokeTreasuryAuthorization, + ], + ["/desmos.subspaces.v3.MsgGrantAllowance", MsgGrantAllowance], + ["/desmos.subspaces.v3.MsgRevokeAllowance", MsgRevokeAllowance], +]; +export const load = (protoRegistry: Registry) => { + registry.forEach(([typeUrl, mod]) => { + protoRegistry.register(typeUrl, mod); + }); +}; +export const MessageComposer = { + encoded: { + createSubspace(value: MsgCreateSubspace) { + return { + typeUrl: "/desmos.subspaces.v3.MsgCreateSubspace", + value: MsgCreateSubspace.encode(value).finish(), + }; + }, + editSubspace(value: MsgEditSubspace) { + return { + typeUrl: "/desmos.subspaces.v3.MsgEditSubspace", + value: MsgEditSubspace.encode(value).finish(), + }; + }, + deleteSubspace(value: MsgDeleteSubspace) { + return { + typeUrl: "/desmos.subspaces.v3.MsgDeleteSubspace", + value: MsgDeleteSubspace.encode(value).finish(), + }; + }, + createSection(value: MsgCreateSection) { + return { + typeUrl: "/desmos.subspaces.v3.MsgCreateSection", + value: MsgCreateSection.encode(value).finish(), + }; + }, + editSection(value: MsgEditSection) { + return { + typeUrl: "/desmos.subspaces.v3.MsgEditSection", + value: MsgEditSection.encode(value).finish(), + }; + }, + moveSection(value: MsgMoveSection) { + return { + typeUrl: "/desmos.subspaces.v3.MsgMoveSection", + value: MsgMoveSection.encode(value).finish(), + }; + }, + deleteSection(value: MsgDeleteSection) { + return { + typeUrl: "/desmos.subspaces.v3.MsgDeleteSection", + value: MsgDeleteSection.encode(value).finish(), + }; + }, + createUserGroup(value: MsgCreateUserGroup) { + return { + typeUrl: "/desmos.subspaces.v3.MsgCreateUserGroup", + value: MsgCreateUserGroup.encode(value).finish(), + }; + }, + editUserGroup(value: MsgEditUserGroup) { + return { + typeUrl: "/desmos.subspaces.v3.MsgEditUserGroup", + value: MsgEditUserGroup.encode(value).finish(), + }; + }, + moveUserGroup(value: MsgMoveUserGroup) { + return { + typeUrl: "/desmos.subspaces.v3.MsgMoveUserGroup", + value: MsgMoveUserGroup.encode(value).finish(), + }; + }, + setUserGroupPermissions(value: MsgSetUserGroupPermissions) { + return { + typeUrl: "/desmos.subspaces.v3.MsgSetUserGroupPermissions", + value: MsgSetUserGroupPermissions.encode(value).finish(), + }; + }, + deleteUserGroup(value: MsgDeleteUserGroup) { + return { + typeUrl: "/desmos.subspaces.v3.MsgDeleteUserGroup", + value: MsgDeleteUserGroup.encode(value).finish(), + }; + }, + addUserToUserGroup(value: MsgAddUserToUserGroup) { + return { + typeUrl: "/desmos.subspaces.v3.MsgAddUserToUserGroup", + value: MsgAddUserToUserGroup.encode(value).finish(), + }; + }, + removeUserFromUserGroup(value: MsgRemoveUserFromUserGroup) { + return { + typeUrl: "/desmos.subspaces.v3.MsgRemoveUserFromUserGroup", + value: MsgRemoveUserFromUserGroup.encode(value).finish(), + }; + }, + setUserPermissions(value: MsgSetUserPermissions) { + return { + typeUrl: "/desmos.subspaces.v3.MsgSetUserPermissions", + value: MsgSetUserPermissions.encode(value).finish(), + }; + }, + grantTreasuryAuthorization(value: MsgGrantTreasuryAuthorization) { + return { + typeUrl: "/desmos.subspaces.v3.MsgGrantTreasuryAuthorization", + value: MsgGrantTreasuryAuthorization.encode(value).finish(), + }; + }, + revokeTreasuryAuthorization(value: MsgRevokeTreasuryAuthorization) { + return { + typeUrl: "/desmos.subspaces.v3.MsgRevokeTreasuryAuthorization", + value: MsgRevokeTreasuryAuthorization.encode(value).finish(), + }; + }, + grantAllowance(value: MsgGrantAllowance) { + return { + typeUrl: "/desmos.subspaces.v3.MsgGrantAllowance", + value: MsgGrantAllowance.encode(value).finish(), + }; + }, + revokeAllowance(value: MsgRevokeAllowance) { + return { + typeUrl: "/desmos.subspaces.v3.MsgRevokeAllowance", + value: MsgRevokeAllowance.encode(value).finish(), + }; + }, + }, + withTypeUrl: { + createSubspace(value: MsgCreateSubspace) { + return { + typeUrl: "/desmos.subspaces.v3.MsgCreateSubspace", + value, + }; + }, + editSubspace(value: MsgEditSubspace) { + return { + typeUrl: "/desmos.subspaces.v3.MsgEditSubspace", + value, + }; + }, + deleteSubspace(value: MsgDeleteSubspace) { + return { + typeUrl: "/desmos.subspaces.v3.MsgDeleteSubspace", + value, + }; + }, + createSection(value: MsgCreateSection) { + return { + typeUrl: "/desmos.subspaces.v3.MsgCreateSection", + value, + }; + }, + editSection(value: MsgEditSection) { + return { + typeUrl: "/desmos.subspaces.v3.MsgEditSection", + value, + }; + }, + moveSection(value: MsgMoveSection) { + return { + typeUrl: "/desmos.subspaces.v3.MsgMoveSection", + value, + }; + }, + deleteSection(value: MsgDeleteSection) { + return { + typeUrl: "/desmos.subspaces.v3.MsgDeleteSection", + value, + }; + }, + createUserGroup(value: MsgCreateUserGroup) { + return { + typeUrl: "/desmos.subspaces.v3.MsgCreateUserGroup", + value, + }; + }, + editUserGroup(value: MsgEditUserGroup) { + return { + typeUrl: "/desmos.subspaces.v3.MsgEditUserGroup", + value, + }; + }, + moveUserGroup(value: MsgMoveUserGroup) { + return { + typeUrl: "/desmos.subspaces.v3.MsgMoveUserGroup", + value, + }; + }, + setUserGroupPermissions(value: MsgSetUserGroupPermissions) { + return { + typeUrl: "/desmos.subspaces.v3.MsgSetUserGroupPermissions", + value, + }; + }, + deleteUserGroup(value: MsgDeleteUserGroup) { + return { + typeUrl: "/desmos.subspaces.v3.MsgDeleteUserGroup", + value, + }; + }, + addUserToUserGroup(value: MsgAddUserToUserGroup) { + return { + typeUrl: "/desmos.subspaces.v3.MsgAddUserToUserGroup", + value, + }; + }, + removeUserFromUserGroup(value: MsgRemoveUserFromUserGroup) { + return { + typeUrl: "/desmos.subspaces.v3.MsgRemoveUserFromUserGroup", + value, + }; + }, + setUserPermissions(value: MsgSetUserPermissions) { + return { + typeUrl: "/desmos.subspaces.v3.MsgSetUserPermissions", + value, + }; + }, + grantTreasuryAuthorization(value: MsgGrantTreasuryAuthorization) { + return { + typeUrl: "/desmos.subspaces.v3.MsgGrantTreasuryAuthorization", + value, + }; + }, + revokeTreasuryAuthorization(value: MsgRevokeTreasuryAuthorization) { + return { + typeUrl: "/desmos.subspaces.v3.MsgRevokeTreasuryAuthorization", + value, + }; + }, + grantAllowance(value: MsgGrantAllowance) { + return { + typeUrl: "/desmos.subspaces.v3.MsgGrantAllowance", + value, + }; + }, + revokeAllowance(value: MsgRevokeAllowance) { + return { + typeUrl: "/desmos.subspaces.v3.MsgRevokeAllowance", + value, + }; + }, + }, + toJSON: { + createSubspace(value: MsgCreateSubspace) { + return { + typeUrl: "/desmos.subspaces.v3.MsgCreateSubspace", + value: MsgCreateSubspace.toJSON(value), + }; + }, + editSubspace(value: MsgEditSubspace) { + return { + typeUrl: "/desmos.subspaces.v3.MsgEditSubspace", + value: MsgEditSubspace.toJSON(value), + }; + }, + deleteSubspace(value: MsgDeleteSubspace) { + return { + typeUrl: "/desmos.subspaces.v3.MsgDeleteSubspace", + value: MsgDeleteSubspace.toJSON(value), + }; + }, + createSection(value: MsgCreateSection) { + return { + typeUrl: "/desmos.subspaces.v3.MsgCreateSection", + value: MsgCreateSection.toJSON(value), + }; + }, + editSection(value: MsgEditSection) { + return { + typeUrl: "/desmos.subspaces.v3.MsgEditSection", + value: MsgEditSection.toJSON(value), + }; + }, + moveSection(value: MsgMoveSection) { + return { + typeUrl: "/desmos.subspaces.v3.MsgMoveSection", + value: MsgMoveSection.toJSON(value), + }; + }, + deleteSection(value: MsgDeleteSection) { + return { + typeUrl: "/desmos.subspaces.v3.MsgDeleteSection", + value: MsgDeleteSection.toJSON(value), + }; + }, + createUserGroup(value: MsgCreateUserGroup) { + return { + typeUrl: "/desmos.subspaces.v3.MsgCreateUserGroup", + value: MsgCreateUserGroup.toJSON(value), + }; + }, + editUserGroup(value: MsgEditUserGroup) { + return { + typeUrl: "/desmos.subspaces.v3.MsgEditUserGroup", + value: MsgEditUserGroup.toJSON(value), + }; + }, + moveUserGroup(value: MsgMoveUserGroup) { + return { + typeUrl: "/desmos.subspaces.v3.MsgMoveUserGroup", + value: MsgMoveUserGroup.toJSON(value), + }; + }, + setUserGroupPermissions(value: MsgSetUserGroupPermissions) { + return { + typeUrl: "/desmos.subspaces.v3.MsgSetUserGroupPermissions", + value: MsgSetUserGroupPermissions.toJSON(value), + }; + }, + deleteUserGroup(value: MsgDeleteUserGroup) { + return { + typeUrl: "/desmos.subspaces.v3.MsgDeleteUserGroup", + value: MsgDeleteUserGroup.toJSON(value), + }; + }, + addUserToUserGroup(value: MsgAddUserToUserGroup) { + return { + typeUrl: "/desmos.subspaces.v3.MsgAddUserToUserGroup", + value: MsgAddUserToUserGroup.toJSON(value), + }; + }, + removeUserFromUserGroup(value: MsgRemoveUserFromUserGroup) { + return { + typeUrl: "/desmos.subspaces.v3.MsgRemoveUserFromUserGroup", + value: MsgRemoveUserFromUserGroup.toJSON(value), + }; + }, + setUserPermissions(value: MsgSetUserPermissions) { + return { + typeUrl: "/desmos.subspaces.v3.MsgSetUserPermissions", + value: MsgSetUserPermissions.toJSON(value), + }; + }, + grantTreasuryAuthorization(value: MsgGrantTreasuryAuthorization) { + return { + typeUrl: "/desmos.subspaces.v3.MsgGrantTreasuryAuthorization", + value: MsgGrantTreasuryAuthorization.toJSON(value), + }; + }, + revokeTreasuryAuthorization(value: MsgRevokeTreasuryAuthorization) { + return { + typeUrl: "/desmos.subspaces.v3.MsgRevokeTreasuryAuthorization", + value: MsgRevokeTreasuryAuthorization.toJSON(value), + }; + }, + grantAllowance(value: MsgGrantAllowance) { + return { + typeUrl: "/desmos.subspaces.v3.MsgGrantAllowance", + value: MsgGrantAllowance.toJSON(value), + }; + }, + revokeAllowance(value: MsgRevokeAllowance) { + return { + typeUrl: "/desmos.subspaces.v3.MsgRevokeAllowance", + value: MsgRevokeAllowance.toJSON(value), + }; + }, + }, + fromJSON: { + createSubspace(value: any) { + return { + typeUrl: "/desmos.subspaces.v3.MsgCreateSubspace", + value: MsgCreateSubspace.fromJSON(value), + }; + }, + editSubspace(value: any) { + return { + typeUrl: "/desmos.subspaces.v3.MsgEditSubspace", + value: MsgEditSubspace.fromJSON(value), + }; + }, + deleteSubspace(value: any) { + return { + typeUrl: "/desmos.subspaces.v3.MsgDeleteSubspace", + value: MsgDeleteSubspace.fromJSON(value), + }; + }, + createSection(value: any) { + return { + typeUrl: "/desmos.subspaces.v3.MsgCreateSection", + value: MsgCreateSection.fromJSON(value), + }; + }, + editSection(value: any) { + return { + typeUrl: "/desmos.subspaces.v3.MsgEditSection", + value: MsgEditSection.fromJSON(value), + }; + }, + moveSection(value: any) { + return { + typeUrl: "/desmos.subspaces.v3.MsgMoveSection", + value: MsgMoveSection.fromJSON(value), + }; + }, + deleteSection(value: any) { + return { + typeUrl: "/desmos.subspaces.v3.MsgDeleteSection", + value: MsgDeleteSection.fromJSON(value), + }; + }, + createUserGroup(value: any) { + return { + typeUrl: "/desmos.subspaces.v3.MsgCreateUserGroup", + value: MsgCreateUserGroup.fromJSON(value), + }; + }, + editUserGroup(value: any) { + return { + typeUrl: "/desmos.subspaces.v3.MsgEditUserGroup", + value: MsgEditUserGroup.fromJSON(value), + }; + }, + moveUserGroup(value: any) { + return { + typeUrl: "/desmos.subspaces.v3.MsgMoveUserGroup", + value: MsgMoveUserGroup.fromJSON(value), + }; + }, + setUserGroupPermissions(value: any) { + return { + typeUrl: "/desmos.subspaces.v3.MsgSetUserGroupPermissions", + value: MsgSetUserGroupPermissions.fromJSON(value), + }; + }, + deleteUserGroup(value: any) { + return { + typeUrl: "/desmos.subspaces.v3.MsgDeleteUserGroup", + value: MsgDeleteUserGroup.fromJSON(value), + }; + }, + addUserToUserGroup(value: any) { + return { + typeUrl: "/desmos.subspaces.v3.MsgAddUserToUserGroup", + value: MsgAddUserToUserGroup.fromJSON(value), + }; + }, + removeUserFromUserGroup(value: any) { + return { + typeUrl: "/desmos.subspaces.v3.MsgRemoveUserFromUserGroup", + value: MsgRemoveUserFromUserGroup.fromJSON(value), + }; + }, + setUserPermissions(value: any) { + return { + typeUrl: "/desmos.subspaces.v3.MsgSetUserPermissions", + value: MsgSetUserPermissions.fromJSON(value), + }; + }, + grantTreasuryAuthorization(value: any) { + return { + typeUrl: "/desmos.subspaces.v3.MsgGrantTreasuryAuthorization", + value: MsgGrantTreasuryAuthorization.fromJSON(value), + }; + }, + revokeTreasuryAuthorization(value: any) { + return { + typeUrl: "/desmos.subspaces.v3.MsgRevokeTreasuryAuthorization", + value: MsgRevokeTreasuryAuthorization.fromJSON(value), + }; + }, + grantAllowance(value: any) { + return { + typeUrl: "/desmos.subspaces.v3.MsgGrantAllowance", + value: MsgGrantAllowance.fromJSON(value), + }; + }, + revokeAllowance(value: any) { + return { + typeUrl: "/desmos.subspaces.v3.MsgRevokeAllowance", + value: MsgRevokeAllowance.fromJSON(value), + }; + }, + }, + fromPartial: { + createSubspace(value: MsgCreateSubspace) { + return { + typeUrl: "/desmos.subspaces.v3.MsgCreateSubspace", + value: MsgCreateSubspace.fromPartial(value), + }; + }, + editSubspace(value: MsgEditSubspace) { + return { + typeUrl: "/desmos.subspaces.v3.MsgEditSubspace", + value: MsgEditSubspace.fromPartial(value), + }; + }, + deleteSubspace(value: MsgDeleteSubspace) { + return { + typeUrl: "/desmos.subspaces.v3.MsgDeleteSubspace", + value: MsgDeleteSubspace.fromPartial(value), + }; + }, + createSection(value: MsgCreateSection) { + return { + typeUrl: "/desmos.subspaces.v3.MsgCreateSection", + value: MsgCreateSection.fromPartial(value), + }; + }, + editSection(value: MsgEditSection) { + return { + typeUrl: "/desmos.subspaces.v3.MsgEditSection", + value: MsgEditSection.fromPartial(value), + }; + }, + moveSection(value: MsgMoveSection) { + return { + typeUrl: "/desmos.subspaces.v3.MsgMoveSection", + value: MsgMoveSection.fromPartial(value), + }; + }, + deleteSection(value: MsgDeleteSection) { + return { + typeUrl: "/desmos.subspaces.v3.MsgDeleteSection", + value: MsgDeleteSection.fromPartial(value), + }; + }, + createUserGroup(value: MsgCreateUserGroup) { + return { + typeUrl: "/desmos.subspaces.v3.MsgCreateUserGroup", + value: MsgCreateUserGroup.fromPartial(value), + }; + }, + editUserGroup(value: MsgEditUserGroup) { + return { + typeUrl: "/desmos.subspaces.v3.MsgEditUserGroup", + value: MsgEditUserGroup.fromPartial(value), + }; + }, + moveUserGroup(value: MsgMoveUserGroup) { + return { + typeUrl: "/desmos.subspaces.v3.MsgMoveUserGroup", + value: MsgMoveUserGroup.fromPartial(value), + }; + }, + setUserGroupPermissions(value: MsgSetUserGroupPermissions) { + return { + typeUrl: "/desmos.subspaces.v3.MsgSetUserGroupPermissions", + value: MsgSetUserGroupPermissions.fromPartial(value), + }; + }, + deleteUserGroup(value: MsgDeleteUserGroup) { + return { + typeUrl: "/desmos.subspaces.v3.MsgDeleteUserGroup", + value: MsgDeleteUserGroup.fromPartial(value), + }; + }, + addUserToUserGroup(value: MsgAddUserToUserGroup) { + return { + typeUrl: "/desmos.subspaces.v3.MsgAddUserToUserGroup", + value: MsgAddUserToUserGroup.fromPartial(value), + }; + }, + removeUserFromUserGroup(value: MsgRemoveUserFromUserGroup) { + return { + typeUrl: "/desmos.subspaces.v3.MsgRemoveUserFromUserGroup", + value: MsgRemoveUserFromUserGroup.fromPartial(value), + }; + }, + setUserPermissions(value: MsgSetUserPermissions) { + return { + typeUrl: "/desmos.subspaces.v3.MsgSetUserPermissions", + value: MsgSetUserPermissions.fromPartial(value), + }; + }, + grantTreasuryAuthorization(value: MsgGrantTreasuryAuthorization) { + return { + typeUrl: "/desmos.subspaces.v3.MsgGrantTreasuryAuthorization", + value: MsgGrantTreasuryAuthorization.fromPartial(value), + }; + }, + revokeTreasuryAuthorization(value: MsgRevokeTreasuryAuthorization) { + return { + typeUrl: "/desmos.subspaces.v3.MsgRevokeTreasuryAuthorization", + value: MsgRevokeTreasuryAuthorization.fromPartial(value), + }; + }, + grantAllowance(value: MsgGrantAllowance) { + return { + typeUrl: "/desmos.subspaces.v3.MsgGrantAllowance", + value: MsgGrantAllowance.fromPartial(value), + }; + }, + revokeAllowance(value: MsgRevokeAllowance) { + return { + typeUrl: "/desmos.subspaces.v3.MsgRevokeAllowance", + value: MsgRevokeAllowance.fromPartial(value), + }; + }, + }, +}; diff --git a/packages/types/src/desmos/subspaces/v3/msgs.ts b/packages/types/src/desmos/subspaces/v3/msgs.ts index f62846044..7861f863a 100644 --- a/packages/types/src/desmos/subspaces/v3/msgs.ts +++ b/packages/types/src/desmos/subspaces/v3/msgs.ts @@ -13,6 +13,7 @@ import { MsgRevokeTreasuryAuthorization, MsgRevokeTreasuryAuthorizationResponse, } from "./msgs_treasury"; + export const protobufPackage = "desmos.subspaces.v3"; /** MsgCreateSubspace represents the message used to create a subspace */ export interface MsgCreateSubspace { @@ -28,11 +29,46 @@ export interface MsgCreateSubspace { /** Address creating the subspace */ creator: string; } +export interface MsgCreateSubspaceProtoMsg { + typeUrl: "/desmos.subspaces.v3.MsgCreateSubspace"; + value: Uint8Array; +} +/** MsgCreateSubspace represents the message used to create a subspace */ +export interface MsgCreateSubspaceAmino { + /** Name of the subspace */ + name: string; + /** (optional) Description of the subspace */ + description: string; + /** + * (optional) Owner of this subspace. If not specified, the creator will be + * the default owner. + */ + owner: string; + /** Address creating the subspace */ + creator: string; +} +export interface MsgCreateSubspaceAminoMsg { + type: "/desmos.subspaces.v3.MsgCreateSubspace"; + value: MsgCreateSubspaceAmino; +} /** MsgCreateSubspaceResponse defines the Msg/CreateSubspace response type */ export interface MsgCreateSubspaceResponse { /** Id of the newly created subspace id */ subspaceId: Long; } +export interface MsgCreateSubspaceResponseProtoMsg { + typeUrl: "/desmos.subspaces.v3.MsgCreateSubspaceResponse"; + value: Uint8Array; +} +/** MsgCreateSubspaceResponse defines the Msg/CreateSubspace response type */ +export interface MsgCreateSubspaceResponseAmino { + /** Id of the newly created subspace id */ + subspace_id: string; +} +export interface MsgCreateSubspaceResponseAminoMsg { + type: "/desmos.subspaces.v3.MsgCreateSubspaceResponse"; + value: MsgCreateSubspaceResponseAmino; +} /** MsgEditSubspace represents the message used to edit a subspace fields */ export interface MsgEditSubspace { /** Id of the subspace to edit */ @@ -55,8 +91,48 @@ export interface MsgEditSubspace { /** Address of the user editing the subspace */ signer: string; } +export interface MsgEditSubspaceProtoMsg { + typeUrl: "/desmos.subspaces.v3.MsgEditSubspace"; + value: Uint8Array; +} +/** MsgEditSubspace represents the message used to edit a subspace fields */ +export interface MsgEditSubspaceAmino { + /** Id of the subspace to edit */ + subspace_id: string; + /** + * New name of the subspace. If it shouldn't be changed, use [do-not-modify] + * instead. + */ + name: string; + /** + * New description of the subspace. If it shouldn't be changed, use + * [do-not-modify] instead. + */ + description: string; + /** + * New owner of the subspace. If it shouldn't be changed, use [do-not-modify] + * instead. + */ + owner: string; + /** Address of the user editing the subspace */ + signer: string; +} +export interface MsgEditSubspaceAminoMsg { + type: "/desmos.subspaces.v3.MsgEditSubspace"; + value: MsgEditSubspaceAmino; +} /** MsgEditSubspaceResponse defines the Msg/EditSubspace response type */ export interface MsgEditSubspaceResponse {} +export interface MsgEditSubspaceResponseProtoMsg { + typeUrl: "/desmos.subspaces.v3.MsgEditSubspaceResponse"; + value: Uint8Array; +} +/** MsgEditSubspaceResponse defines the Msg/EditSubspace response type */ +export interface MsgEditSubspaceResponseAmino {} +export interface MsgEditSubspaceResponseAminoMsg { + type: "/desmos.subspaces.v3.MsgEditSubspaceResponse"; + value: MsgEditSubspaceResponseAmino; +} /** MsgDeleteSubspace represents the message used to delete a subspace */ export interface MsgDeleteSubspace { /** Id of the subspace to delete */ @@ -64,8 +140,33 @@ export interface MsgDeleteSubspace { /** Address of the user deleting the subspace */ signer: string; } +export interface MsgDeleteSubspaceProtoMsg { + typeUrl: "/desmos.subspaces.v3.MsgDeleteSubspace"; + value: Uint8Array; +} +/** MsgDeleteSubspace represents the message used to delete a subspace */ +export interface MsgDeleteSubspaceAmino { + /** Id of the subspace to delete */ + subspace_id: string; + /** Address of the user deleting the subspace */ + signer: string; +} +export interface MsgDeleteSubspaceAminoMsg { + type: "/desmos.subspaces.v3.MsgDeleteSubspace"; + value: MsgDeleteSubspaceAmino; +} /** MsgDeleteSubspaceResponse defines the Msg/DeleteSubspace response type */ export interface MsgDeleteSubspaceResponse {} +export interface MsgDeleteSubspaceResponseProtoMsg { + typeUrl: "/desmos.subspaces.v3.MsgDeleteSubspaceResponse"; + value: Uint8Array; +} +/** MsgDeleteSubspaceResponse defines the Msg/DeleteSubspace response type */ +export interface MsgDeleteSubspaceResponseAmino {} +export interface MsgDeleteSubspaceResponseAminoMsg { + type: "/desmos.subspaces.v3.MsgDeleteSubspaceResponse"; + value: MsgDeleteSubspaceResponseAmino; +} /** * MsgCreateSection represents the message to be used when creating a subspace * section @@ -82,11 +183,48 @@ export interface MsgCreateSection { /** User creating the section */ creator: string; } +export interface MsgCreateSectionProtoMsg { + typeUrl: "/desmos.subspaces.v3.MsgCreateSection"; + value: Uint8Array; +} +/** + * MsgCreateSection represents the message to be used when creating a subspace + * section + */ +export interface MsgCreateSectionAmino { + /** Id of the subspace inside which the section will be placed */ + subspace_id: string; + /** Name of the section to be created */ + name: string; + /** (optional) Description of the section */ + description: string; + /** (optional) Id of the parent section */ + parent_id: number; + /** User creating the section */ + creator: string; +} +export interface MsgCreateSectionAminoMsg { + type: "/desmos.subspaces.v3.MsgCreateSection"; + value: MsgCreateSectionAmino; +} /** MsgCreateSectionResponse represents the Msg/CreateSection response type */ export interface MsgCreateSectionResponse { /** Id of the newly created section */ sectionId: number; } +export interface MsgCreateSectionResponseProtoMsg { + typeUrl: "/desmos.subspaces.v3.MsgCreateSectionResponse"; + value: Uint8Array; +} +/** MsgCreateSectionResponse represents the Msg/CreateSection response type */ +export interface MsgCreateSectionResponseAmino { + /** Id of the newly created section */ + section_id: number; +} +export interface MsgCreateSectionResponseAminoMsg { + type: "/desmos.subspaces.v3.MsgCreateSectionResponse"; + value: MsgCreateSectionResponseAmino; +} /** * MsgEditSection represents the message to be used when editing a subspace * section @@ -103,8 +241,42 @@ export interface MsgEditSection { /** User editing the section */ editor: string; } +export interface MsgEditSectionProtoMsg { + typeUrl: "/desmos.subspaces.v3.MsgEditSection"; + value: Uint8Array; +} +/** + * MsgEditSection represents the message to be used when editing a subspace + * section + */ +export interface MsgEditSectionAmino { + /** Id of the subspace inside which the section to be edited is */ + subspace_id: string; + /** Id of the section to be edited */ + section_id: number; + /** (optional) New name of the section */ + name: string; + /** (optional) New description of the section */ + description: string; + /** User editing the section */ + editor: string; +} +export interface MsgEditSectionAminoMsg { + type: "/desmos.subspaces.v3.MsgEditSection"; + value: MsgEditSectionAmino; +} /** MsgEditSectionResponse represents the Msg/EditSection response type */ export interface MsgEditSectionResponse {} +export interface MsgEditSectionResponseProtoMsg { + typeUrl: "/desmos.subspaces.v3.MsgEditSectionResponse"; + value: Uint8Array; +} +/** MsgEditSectionResponse represents the Msg/EditSection response type */ +export interface MsgEditSectionResponseAmino {} +export interface MsgEditSectionResponseAminoMsg { + type: "/desmos.subspaces.v3.MsgEditSectionResponse"; + value: MsgEditSectionResponseAmino; +} /** * MsgMoveSection represents the message to be used when moving a section to * another parent @@ -119,8 +291,40 @@ export interface MsgMoveSection { /** Signer of the message */ signer: string; } +export interface MsgMoveSectionProtoMsg { + typeUrl: "/desmos.subspaces.v3.MsgMoveSection"; + value: Uint8Array; +} +/** + * MsgMoveSection represents the message to be used when moving a section to + * another parent + */ +export interface MsgMoveSectionAmino { + /** Id of the subspace inside which the section lies */ + subspace_id: string; + /** Id of the section to be moved */ + section_id: number; + /** Id of the new parent */ + new_parent_id: number; + /** Signer of the message */ + signer: string; +} +export interface MsgMoveSectionAminoMsg { + type: "/desmos.subspaces.v3.MsgMoveSection"; + value: MsgMoveSectionAmino; +} /** MsgMoveSectionResponse */ export interface MsgMoveSectionResponse {} +export interface MsgMoveSectionResponseProtoMsg { + typeUrl: "/desmos.subspaces.v3.MsgMoveSectionResponse"; + value: Uint8Array; +} +/** MsgMoveSectionResponse */ +export interface MsgMoveSectionResponseAmino {} +export interface MsgMoveSectionResponseAminoMsg { + type: "/desmos.subspaces.v3.MsgMoveSectionResponse"; + value: MsgMoveSectionResponseAmino; +} /** MsgDeleteSection represents the message to be used when deleting a section */ export interface MsgDeleteSection { /** Id of the subspace inside which the section to be deleted is */ @@ -130,8 +334,35 @@ export interface MsgDeleteSection { /** User deleting the section */ signer: string; } +export interface MsgDeleteSectionProtoMsg { + typeUrl: "/desmos.subspaces.v3.MsgDeleteSection"; + value: Uint8Array; +} +/** MsgDeleteSection represents the message to be used when deleting a section */ +export interface MsgDeleteSectionAmino { + /** Id of the subspace inside which the section to be deleted is */ + subspace_id: string; + /** Id of the section to delete */ + section_id: number; + /** User deleting the section */ + signer: string; +} +export interface MsgDeleteSectionAminoMsg { + type: "/desmos.subspaces.v3.MsgDeleteSection"; + value: MsgDeleteSectionAmino; +} /** MsgDeleteSectionResponse represents the Msg/DeleteSection response type */ export interface MsgDeleteSectionResponse {} +export interface MsgDeleteSectionResponseProtoMsg { + typeUrl: "/desmos.subspaces.v3.MsgDeleteSectionResponse"; + value: Uint8Array; +} +/** MsgDeleteSectionResponse represents the Msg/DeleteSection response type */ +export interface MsgDeleteSectionResponseAmino {} +export interface MsgDeleteSectionResponseAminoMsg { + type: "/desmos.subspaces.v3.MsgDeleteSectionResponse"; + value: MsgDeleteSectionResponseAmino; +} /** MsgCreateUserGroup represents the message used to create a user group */ export interface MsgCreateUserGroup { /** Id of the subspace inside which the group will be created */ @@ -149,10 +380,47 @@ export interface MsgCreateUserGroup { /** Creator of the group */ creator: string; } +export interface MsgCreateUserGroupProtoMsg { + typeUrl: "/desmos.subspaces.v3.MsgCreateUserGroup"; + value: Uint8Array; +} +/** MsgCreateUserGroup represents the message used to create a user group */ +export interface MsgCreateUserGroupAmino { + /** Id of the subspace inside which the group will be created */ + subspace_id: string; + /** (optional) Id of the section inside which the group will be created */ + section_id: number; + /** Name of the group */ + name: string; + /** (optional) Description of the group */ + description: string; + /** Default permissions to be applied to the group */ + default_permissions: string[]; + /** Initial members to be put inside the group */ + initial_members: string[]; + /** Creator of the group */ + creator: string; +} +export interface MsgCreateUserGroupAminoMsg { + type: "/desmos.subspaces.v3.MsgCreateUserGroup"; + value: MsgCreateUserGroupAmino; +} /** MsgCreateUserGroupResponse defines the Msg/CreateUserGroup response type */ export interface MsgCreateUserGroupResponse { groupId: number; } +export interface MsgCreateUserGroupResponseProtoMsg { + typeUrl: "/desmos.subspaces.v3.MsgCreateUserGroupResponse"; + value: Uint8Array; +} +/** MsgCreateUserGroupResponse defines the Msg/CreateUserGroup response type */ +export interface MsgCreateUserGroupResponseAmino { + group_id: number; +} +export interface MsgCreateUserGroupResponseAminoMsg { + type: "/desmos.subspaces.v3.MsgCreateUserGroupResponse"; + value: MsgCreateUserGroupResponseAmino; +} /** MsgEditUserGroup represents the message used to edit a user group */ export interface MsgEditUserGroup { /** Id of the subspace inside which the group to be edited is */ @@ -166,8 +434,39 @@ export interface MsgEditUserGroup { /** User editing the group */ signer: string; } +export interface MsgEditUserGroupProtoMsg { + typeUrl: "/desmos.subspaces.v3.MsgEditUserGroup"; + value: Uint8Array; +} +/** MsgEditUserGroup represents the message used to edit a user group */ +export interface MsgEditUserGroupAmino { + /** Id of the subspace inside which the group to be edited is */ + subspace_id: string; + /** Id of the group to be edited */ + group_id: number; + /** (optional) New name of the group */ + name: string; + /** (optional) New description of the group */ + description: string; + /** User editing the group */ + signer: string; +} +export interface MsgEditUserGroupAminoMsg { + type: "/desmos.subspaces.v3.MsgEditUserGroup"; + value: MsgEditUserGroupAmino; +} /** MsgEditUserGroupResponse defines the Msg/EditUserGroup response type */ export interface MsgEditUserGroupResponse {} +export interface MsgEditUserGroupResponseProtoMsg { + typeUrl: "/desmos.subspaces.v3.MsgEditUserGroupResponse"; + value: Uint8Array; +} +/** MsgEditUserGroupResponse defines the Msg/EditUserGroup response type */ +export interface MsgEditUserGroupResponseAmino {} +export interface MsgEditUserGroupResponseAminoMsg { + type: "/desmos.subspaces.v3.MsgEditUserGroupResponse"; + value: MsgEditUserGroupResponseAmino; +} /** * MsgMoveUserGroup represents the message used to move one user group from a * section to anoter @@ -182,8 +481,40 @@ export interface MsgMoveUserGroup { /** User signing the message */ signer: string; } +export interface MsgMoveUserGroupProtoMsg { + typeUrl: "/desmos.subspaces.v3.MsgMoveUserGroup"; + value: Uint8Array; +} +/** + * MsgMoveUserGroup represents the message used to move one user group from a + * section to anoter + */ +export interface MsgMoveUserGroupAmino { + /** Id of the subspace inside which the group to move is */ + subspace_id: string; + /** Id of the group to be moved */ + group_id: number; + /** Id of the new section where to move the group */ + new_section_id: number; + /** User signing the message */ + signer: string; +} +export interface MsgMoveUserGroupAminoMsg { + type: "/desmos.subspaces.v3.MsgMoveUserGroup"; + value: MsgMoveUserGroupAmino; +} /** MsgMoveUserGroupResponse defines the Msg/MoveUserGroup response type */ export interface MsgMoveUserGroupResponse {} +export interface MsgMoveUserGroupResponseProtoMsg { + typeUrl: "/desmos.subspaces.v3.MsgMoveUserGroupResponse"; + value: Uint8Array; +} +/** MsgMoveUserGroupResponse defines the Msg/MoveUserGroup response type */ +export interface MsgMoveUserGroupResponseAmino {} +export interface MsgMoveUserGroupResponseAminoMsg { + type: "/desmos.subspaces.v3.MsgMoveUserGroupResponse"; + value: MsgMoveUserGroupResponseAmino; +} /** * MsgSetUserGroupPermissions represents the message used to set the permissions * of a user group @@ -198,11 +529,46 @@ export interface MsgSetUserGroupPermissions { /** User setting the new permissions */ signer: string; } +export interface MsgSetUserGroupPermissionsProtoMsg { + typeUrl: "/desmos.subspaces.v3.MsgSetUserGroupPermissions"; + value: Uint8Array; +} +/** + * MsgSetUserGroupPermissions represents the message used to set the permissions + * of a user group + */ +export interface MsgSetUserGroupPermissionsAmino { + /** Id of the subspace inside which the group is */ + subspace_id: string; + /** Id of the group for which to set the new permissions */ + group_id: number; + /** New permissions to be set to the group */ + permissions: string[]; + /** User setting the new permissions */ + signer: string; +} +export interface MsgSetUserGroupPermissionsAminoMsg { + type: "/desmos.subspaces.v3.MsgSetUserGroupPermissions"; + value: MsgSetUserGroupPermissionsAmino; +} /** * MsgSetUserGroupPermissionsResponse defines the * Msg/SetUserGroupPermissionsResponse response type */ export interface MsgSetUserGroupPermissionsResponse {} +export interface MsgSetUserGroupPermissionsResponseProtoMsg { + typeUrl: "/desmos.subspaces.v3.MsgSetUserGroupPermissionsResponse"; + value: Uint8Array; +} +/** + * MsgSetUserGroupPermissionsResponse defines the + * Msg/SetUserGroupPermissionsResponse response type + */ +export interface MsgSetUserGroupPermissionsResponseAmino {} +export interface MsgSetUserGroupPermissionsResponseAminoMsg { + type: "/desmos.subspaces.v3.MsgSetUserGroupPermissionsResponse"; + value: MsgSetUserGroupPermissionsResponseAmino; +} /** MsgDeleteUserGroup represents the message used to delete a user group */ export interface MsgDeleteUserGroup { /** Id of the subspace inside which the group to delete is */ @@ -212,8 +578,35 @@ export interface MsgDeleteUserGroup { /** User deleting the group */ signer: string; } +export interface MsgDeleteUserGroupProtoMsg { + typeUrl: "/desmos.subspaces.v3.MsgDeleteUserGroup"; + value: Uint8Array; +} +/** MsgDeleteUserGroup represents the message used to delete a user group */ +export interface MsgDeleteUserGroupAmino { + /** Id of the subspace inside which the group to delete is */ + subspace_id: string; + /** Id of the group to be deleted */ + group_id: number; + /** User deleting the group */ + signer: string; +} +export interface MsgDeleteUserGroupAminoMsg { + type: "/desmos.subspaces.v3.MsgDeleteUserGroup"; + value: MsgDeleteUserGroupAmino; +} /** MsgDeleteUserGroupResponse defines the Msg/DeleteUserGroup response type */ export interface MsgDeleteUserGroupResponse {} +export interface MsgDeleteUserGroupResponseProtoMsg { + typeUrl: "/desmos.subspaces.v3.MsgDeleteUserGroupResponse"; + value: Uint8Array; +} +/** MsgDeleteUserGroupResponse defines the Msg/DeleteUserGroup response type */ +export interface MsgDeleteUserGroupResponseAmino {} +export interface MsgDeleteUserGroupResponseAminoMsg { + type: "/desmos.subspaces.v3.MsgDeleteUserGroupResponse"; + value: MsgDeleteUserGroupResponseAmino; +} /** * MsgAddUserToUserGroup represents the message used to add a user to a user * group @@ -228,11 +621,46 @@ export interface MsgAddUserToUserGroup { /** User signing the message */ signer: string; } +export interface MsgAddUserToUserGroupProtoMsg { + typeUrl: "/desmos.subspaces.v3.MsgAddUserToUserGroup"; + value: Uint8Array; +} +/** + * MsgAddUserToUserGroup represents the message used to add a user to a user + * group + */ +export interface MsgAddUserToUserGroupAmino { + /** Id of the subspace inside which the group is */ + subspace_id: string; + /** Id of the group to which to add the user */ + group_id: number; + /** User to be added to the group */ + user: string; + /** User signing the message */ + signer: string; +} +export interface MsgAddUserToUserGroupAminoMsg { + type: "/desmos.subspaces.v3.MsgAddUserToUserGroup"; + value: MsgAddUserToUserGroupAmino; +} /** * MsgAddUserToUserGroupResponse defines the Msg/AddUserToUserGroupResponse * response type */ export interface MsgAddUserToUserGroupResponse {} +export interface MsgAddUserToUserGroupResponseProtoMsg { + typeUrl: "/desmos.subspaces.v3.MsgAddUserToUserGroupResponse"; + value: Uint8Array; +} +/** + * MsgAddUserToUserGroupResponse defines the Msg/AddUserToUserGroupResponse + * response type + */ +export interface MsgAddUserToUserGroupResponseAmino {} +export interface MsgAddUserToUserGroupResponseAminoMsg { + type: "/desmos.subspaces.v3.MsgAddUserToUserGroupResponse"; + value: MsgAddUserToUserGroupResponseAmino; +} /** * MsgRemoveUserFromUserGroup represents the message used to remove a user from * a user group @@ -247,11 +675,46 @@ export interface MsgRemoveUserFromUserGroup { /** User signing the message */ signer: string; } +export interface MsgRemoveUserFromUserGroupProtoMsg { + typeUrl: "/desmos.subspaces.v3.MsgRemoveUserFromUserGroup"; + value: Uint8Array; +} +/** + * MsgRemoveUserFromUserGroup represents the message used to remove a user from + * a user group + */ +export interface MsgRemoveUserFromUserGroupAmino { + /** Id of the subspace inside which the group to remove the user from is */ + subspace_id: string; + /** Id of the group from which to remove the user */ + group_id: number; + /** User to be removed from the group */ + user: string; + /** User signing the message */ + signer: string; +} +export interface MsgRemoveUserFromUserGroupAminoMsg { + type: "/desmos.subspaces.v3.MsgRemoveUserFromUserGroup"; + value: MsgRemoveUserFromUserGroupAmino; +} /** * MsgRemoveUserFromUserGroupResponse defines the * Msg/RemoveUserFromUserGroupResponse response type */ export interface MsgRemoveUserFromUserGroupResponse {} +export interface MsgRemoveUserFromUserGroupResponseProtoMsg { + typeUrl: "/desmos.subspaces.v3.MsgRemoveUserFromUserGroupResponse"; + value: Uint8Array; +} +/** + * MsgRemoveUserFromUserGroupResponse defines the + * Msg/RemoveUserFromUserGroupResponse response type + */ +export interface MsgRemoveUserFromUserGroupResponseAmino {} +export interface MsgRemoveUserFromUserGroupResponseAminoMsg { + type: "/desmos.subspaces.v3.MsgRemoveUserFromUserGroupResponse"; + value: MsgRemoveUserFromUserGroupResponseAmino; +} /** * MsgSetUserPermissions represents the message used to set the permissions of a * specific user @@ -268,11 +731,48 @@ export interface MsgSetUserPermissions { /** User signing the message */ signer: string; } +export interface MsgSetUserPermissionsProtoMsg { + typeUrl: "/desmos.subspaces.v3.MsgSetUserPermissions"; + value: Uint8Array; +} +/** + * MsgSetUserPermissions represents the message used to set the permissions of a + * specific user + */ +export interface MsgSetUserPermissionsAmino { + /** Id of the subspace inside which to set the permissions */ + subspace_id: string; + /** Id of the section for which to set the permissions */ + section_id: number; + /** User for which to set the permissions */ + user: string; + /** Permissions to be set to the user */ + permissions: string[]; + /** User signing the message */ + signer: string; +} +export interface MsgSetUserPermissionsAminoMsg { + type: "/desmos.subspaces.v3.MsgSetUserPermissions"; + value: MsgSetUserPermissionsAmino; +} /** * MsgSetUserPermissionsResponse defines the Msg/SetPermissionsResponse * response type */ export interface MsgSetUserPermissionsResponse {} +export interface MsgSetUserPermissionsResponseProtoMsg { + typeUrl: "/desmos.subspaces.v3.MsgSetUserPermissionsResponse"; + value: Uint8Array; +} +/** + * MsgSetUserPermissionsResponse defines the Msg/SetPermissionsResponse + * response type + */ +export interface MsgSetUserPermissionsResponseAmino {} +export interface MsgSetUserPermissionsResponseAminoMsg { + type: "/desmos.subspaces.v3.MsgSetUserPermissionsResponse"; + value: MsgSetUserPermissionsResponseAmino; +} function createBaseMsgCreateSubspace(): MsgCreateSubspace { return { name: "", @@ -353,6 +853,37 @@ export const MsgCreateSubspace = { message.creator = object.creator ?? ""; return message; }, + fromAmino(object: MsgCreateSubspaceAmino): MsgCreateSubspace { + return { + name: object.name, + description: object.description, + owner: object.owner, + creator: object.creator, + }; + }, + toAmino(message: MsgCreateSubspace): MsgCreateSubspaceAmino { + const obj: any = {}; + obj.name = message.name; + obj.description = message.description; + obj.owner = message.owner; + obj.creator = message.creator; + return obj; + }, + fromAminoMsg(object: MsgCreateSubspaceAminoMsg): MsgCreateSubspace { + return MsgCreateSubspace.fromAmino(object.value); + }, + fromProtoMsg(message: MsgCreateSubspaceProtoMsg): MsgCreateSubspace { + return MsgCreateSubspace.decode(message.value); + }, + toProto(message: MsgCreateSubspace): Uint8Array { + return MsgCreateSubspace.encode(message).finish(); + }, + toProtoMsg(message: MsgCreateSubspace): MsgCreateSubspaceProtoMsg { + return { + typeUrl: "/desmos.subspaces.v3.MsgCreateSubspace", + value: MsgCreateSubspace.encode(message).finish(), + }; + }, }; function createBaseMsgCreateSubspaceResponse(): MsgCreateSubspaceResponse { return { @@ -412,6 +943,39 @@ export const MsgCreateSubspaceResponse = { : Long.UZERO; return message; }, + fromAmino(object: MsgCreateSubspaceResponseAmino): MsgCreateSubspaceResponse { + return { + subspaceId: Long.fromString(object.subspace_id), + }; + }, + toAmino(message: MsgCreateSubspaceResponse): MsgCreateSubspaceResponseAmino { + const obj: any = {}; + obj.subspace_id = message.subspaceId + ? message.subspaceId.toString() + : undefined; + return obj; + }, + fromAminoMsg( + object: MsgCreateSubspaceResponseAminoMsg + ): MsgCreateSubspaceResponse { + return MsgCreateSubspaceResponse.fromAmino(object.value); + }, + fromProtoMsg( + message: MsgCreateSubspaceResponseProtoMsg + ): MsgCreateSubspaceResponse { + return MsgCreateSubspaceResponse.decode(message.value); + }, + toProto(message: MsgCreateSubspaceResponse): Uint8Array { + return MsgCreateSubspaceResponse.encode(message).finish(); + }, + toProtoMsg( + message: MsgCreateSubspaceResponse + ): MsgCreateSubspaceResponseProtoMsg { + return { + typeUrl: "/desmos.subspaces.v3.MsgCreateSubspaceResponse", + value: MsgCreateSubspaceResponse.encode(message).finish(), + }; + }, }; function createBaseMsgEditSubspace(): MsgEditSubspace { return { @@ -509,6 +1073,41 @@ export const MsgEditSubspace = { message.signer = object.signer ?? ""; return message; }, + fromAmino(object: MsgEditSubspaceAmino): MsgEditSubspace { + return { + subspaceId: Long.fromString(object.subspace_id), + name: object.name, + description: object.description, + owner: object.owner, + signer: object.signer, + }; + }, + toAmino(message: MsgEditSubspace): MsgEditSubspaceAmino { + const obj: any = {}; + obj.subspace_id = message.subspaceId + ? message.subspaceId.toString() + : undefined; + obj.name = message.name; + obj.description = message.description; + obj.owner = message.owner; + obj.signer = message.signer; + return obj; + }, + fromAminoMsg(object: MsgEditSubspaceAminoMsg): MsgEditSubspace { + return MsgEditSubspace.fromAmino(object.value); + }, + fromProtoMsg(message: MsgEditSubspaceProtoMsg): MsgEditSubspace { + return MsgEditSubspace.decode(message.value); + }, + toProto(message: MsgEditSubspace): Uint8Array { + return MsgEditSubspace.encode(message).finish(); + }, + toProtoMsg(message: MsgEditSubspace): MsgEditSubspaceProtoMsg { + return { + typeUrl: "/desmos.subspaces.v3.MsgEditSubspace", + value: MsgEditSubspace.encode(message).finish(), + }; + }, }; function createBaseMsgEditSubspaceResponse(): MsgEditSubspaceResponse { return {}; @@ -550,6 +1149,34 @@ export const MsgEditSubspaceResponse = { const message = createBaseMsgEditSubspaceResponse(); return message; }, + fromAmino(_: MsgEditSubspaceResponseAmino): MsgEditSubspaceResponse { + return {}; + }, + toAmino(_: MsgEditSubspaceResponse): MsgEditSubspaceResponseAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg( + object: MsgEditSubspaceResponseAminoMsg + ): MsgEditSubspaceResponse { + return MsgEditSubspaceResponse.fromAmino(object.value); + }, + fromProtoMsg( + message: MsgEditSubspaceResponseProtoMsg + ): MsgEditSubspaceResponse { + return MsgEditSubspaceResponse.decode(message.value); + }, + toProto(message: MsgEditSubspaceResponse): Uint8Array { + return MsgEditSubspaceResponse.encode(message).finish(); + }, + toProtoMsg( + message: MsgEditSubspaceResponse + ): MsgEditSubspaceResponseProtoMsg { + return { + typeUrl: "/desmos.subspaces.v3.MsgEditSubspaceResponse", + value: MsgEditSubspaceResponse.encode(message).finish(), + }; + }, }; function createBaseMsgDeleteSubspace(): MsgDeleteSubspace { return { @@ -616,6 +1243,35 @@ export const MsgDeleteSubspace = { message.signer = object.signer ?? ""; return message; }, + fromAmino(object: MsgDeleteSubspaceAmino): MsgDeleteSubspace { + return { + subspaceId: Long.fromString(object.subspace_id), + signer: object.signer, + }; + }, + toAmino(message: MsgDeleteSubspace): MsgDeleteSubspaceAmino { + const obj: any = {}; + obj.subspace_id = message.subspaceId + ? message.subspaceId.toString() + : undefined; + obj.signer = message.signer; + return obj; + }, + fromAminoMsg(object: MsgDeleteSubspaceAminoMsg): MsgDeleteSubspace { + return MsgDeleteSubspace.fromAmino(object.value); + }, + fromProtoMsg(message: MsgDeleteSubspaceProtoMsg): MsgDeleteSubspace { + return MsgDeleteSubspace.decode(message.value); + }, + toProto(message: MsgDeleteSubspace): Uint8Array { + return MsgDeleteSubspace.encode(message).finish(); + }, + toProtoMsg(message: MsgDeleteSubspace): MsgDeleteSubspaceProtoMsg { + return { + typeUrl: "/desmos.subspaces.v3.MsgDeleteSubspace", + value: MsgDeleteSubspace.encode(message).finish(), + }; + }, }; function createBaseMsgDeleteSubspaceResponse(): MsgDeleteSubspaceResponse { return {}; @@ -657,6 +1313,34 @@ export const MsgDeleteSubspaceResponse = { const message = createBaseMsgDeleteSubspaceResponse(); return message; }, + fromAmino(_: MsgDeleteSubspaceResponseAmino): MsgDeleteSubspaceResponse { + return {}; + }, + toAmino(_: MsgDeleteSubspaceResponse): MsgDeleteSubspaceResponseAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg( + object: MsgDeleteSubspaceResponseAminoMsg + ): MsgDeleteSubspaceResponse { + return MsgDeleteSubspaceResponse.fromAmino(object.value); + }, + fromProtoMsg( + message: MsgDeleteSubspaceResponseProtoMsg + ): MsgDeleteSubspaceResponse { + return MsgDeleteSubspaceResponse.decode(message.value); + }, + toProto(message: MsgDeleteSubspaceResponse): Uint8Array { + return MsgDeleteSubspaceResponse.encode(message).finish(); + }, + toProtoMsg( + message: MsgDeleteSubspaceResponse + ): MsgDeleteSubspaceResponseProtoMsg { + return { + typeUrl: "/desmos.subspaces.v3.MsgDeleteSubspaceResponse", + value: MsgDeleteSubspaceResponse.encode(message).finish(), + }; + }, }; function createBaseMsgCreateSection(): MsgCreateSection { return { @@ -755,6 +1439,41 @@ export const MsgCreateSection = { message.creator = object.creator ?? ""; return message; }, + fromAmino(object: MsgCreateSectionAmino): MsgCreateSection { + return { + subspaceId: Long.fromString(object.subspace_id), + name: object.name, + description: object.description, + parentId: object.parent_id, + creator: object.creator, + }; + }, + toAmino(message: MsgCreateSection): MsgCreateSectionAmino { + const obj: any = {}; + obj.subspace_id = message.subspaceId + ? message.subspaceId.toString() + : undefined; + obj.name = message.name; + obj.description = message.description; + obj.parent_id = message.parentId; + obj.creator = message.creator; + return obj; + }, + fromAminoMsg(object: MsgCreateSectionAminoMsg): MsgCreateSection { + return MsgCreateSection.fromAmino(object.value); + }, + fromProtoMsg(message: MsgCreateSectionProtoMsg): MsgCreateSection { + return MsgCreateSection.decode(message.value); + }, + toProto(message: MsgCreateSection): Uint8Array { + return MsgCreateSection.encode(message).finish(); + }, + toProtoMsg(message: MsgCreateSection): MsgCreateSectionProtoMsg { + return { + typeUrl: "/desmos.subspaces.v3.MsgCreateSection", + value: MsgCreateSection.encode(message).finish(), + }; + }, }; function createBaseMsgCreateSectionResponse(): MsgCreateSectionResponse { return { @@ -809,6 +1528,37 @@ export const MsgCreateSectionResponse = { message.sectionId = object.sectionId ?? 0; return message; }, + fromAmino(object: MsgCreateSectionResponseAmino): MsgCreateSectionResponse { + return { + sectionId: object.section_id, + }; + }, + toAmino(message: MsgCreateSectionResponse): MsgCreateSectionResponseAmino { + const obj: any = {}; + obj.section_id = message.sectionId; + return obj; + }, + fromAminoMsg( + object: MsgCreateSectionResponseAminoMsg + ): MsgCreateSectionResponse { + return MsgCreateSectionResponse.fromAmino(object.value); + }, + fromProtoMsg( + message: MsgCreateSectionResponseProtoMsg + ): MsgCreateSectionResponse { + return MsgCreateSectionResponse.decode(message.value); + }, + toProto(message: MsgCreateSectionResponse): Uint8Array { + return MsgCreateSectionResponse.encode(message).finish(); + }, + toProtoMsg( + message: MsgCreateSectionResponse + ): MsgCreateSectionResponseProtoMsg { + return { + typeUrl: "/desmos.subspaces.v3.MsgCreateSectionResponse", + value: MsgCreateSectionResponse.encode(message).finish(), + }; + }, }; function createBaseMsgEditSection(): MsgEditSection { return { @@ -907,6 +1657,41 @@ export const MsgEditSection = { message.editor = object.editor ?? ""; return message; }, + fromAmino(object: MsgEditSectionAmino): MsgEditSection { + return { + subspaceId: Long.fromString(object.subspace_id), + sectionId: object.section_id, + name: object.name, + description: object.description, + editor: object.editor, + }; + }, + toAmino(message: MsgEditSection): MsgEditSectionAmino { + const obj: any = {}; + obj.subspace_id = message.subspaceId + ? message.subspaceId.toString() + : undefined; + obj.section_id = message.sectionId; + obj.name = message.name; + obj.description = message.description; + obj.editor = message.editor; + return obj; + }, + fromAminoMsg(object: MsgEditSectionAminoMsg): MsgEditSection { + return MsgEditSection.fromAmino(object.value); + }, + fromProtoMsg(message: MsgEditSectionProtoMsg): MsgEditSection { + return MsgEditSection.decode(message.value); + }, + toProto(message: MsgEditSection): Uint8Array { + return MsgEditSection.encode(message).finish(); + }, + toProtoMsg(message: MsgEditSection): MsgEditSectionProtoMsg { + return { + typeUrl: "/desmos.subspaces.v3.MsgEditSection", + value: MsgEditSection.encode(message).finish(), + }; + }, }; function createBaseMsgEditSectionResponse(): MsgEditSectionResponse { return {}; @@ -948,6 +1733,30 @@ export const MsgEditSectionResponse = { const message = createBaseMsgEditSectionResponse(); return message; }, + fromAmino(_: MsgEditSectionResponseAmino): MsgEditSectionResponse { + return {}; + }, + toAmino(_: MsgEditSectionResponse): MsgEditSectionResponseAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg(object: MsgEditSectionResponseAminoMsg): MsgEditSectionResponse { + return MsgEditSectionResponse.fromAmino(object.value); + }, + fromProtoMsg( + message: MsgEditSectionResponseProtoMsg + ): MsgEditSectionResponse { + return MsgEditSectionResponse.decode(message.value); + }, + toProto(message: MsgEditSectionResponse): Uint8Array { + return MsgEditSectionResponse.encode(message).finish(); + }, + toProtoMsg(message: MsgEditSectionResponse): MsgEditSectionResponseProtoMsg { + return { + typeUrl: "/desmos.subspaces.v3.MsgEditSectionResponse", + value: MsgEditSectionResponse.encode(message).finish(), + }; + }, }; function createBaseMsgMoveSection(): MsgMoveSection { return { @@ -1036,6 +1845,39 @@ export const MsgMoveSection = { message.signer = object.signer ?? ""; return message; }, + fromAmino(object: MsgMoveSectionAmino): MsgMoveSection { + return { + subspaceId: Long.fromString(object.subspace_id), + sectionId: object.section_id, + newParentId: object.new_parent_id, + signer: object.signer, + }; + }, + toAmino(message: MsgMoveSection): MsgMoveSectionAmino { + const obj: any = {}; + obj.subspace_id = message.subspaceId + ? message.subspaceId.toString() + : undefined; + obj.section_id = message.sectionId; + obj.new_parent_id = message.newParentId; + obj.signer = message.signer; + return obj; + }, + fromAminoMsg(object: MsgMoveSectionAminoMsg): MsgMoveSection { + return MsgMoveSection.fromAmino(object.value); + }, + fromProtoMsg(message: MsgMoveSectionProtoMsg): MsgMoveSection { + return MsgMoveSection.decode(message.value); + }, + toProto(message: MsgMoveSection): Uint8Array { + return MsgMoveSection.encode(message).finish(); + }, + toProtoMsg(message: MsgMoveSection): MsgMoveSectionProtoMsg { + return { + typeUrl: "/desmos.subspaces.v3.MsgMoveSection", + value: MsgMoveSection.encode(message).finish(), + }; + }, }; function createBaseMsgMoveSectionResponse(): MsgMoveSectionResponse { return {}; @@ -1077,6 +1919,30 @@ export const MsgMoveSectionResponse = { const message = createBaseMsgMoveSectionResponse(); return message; }, + fromAmino(_: MsgMoveSectionResponseAmino): MsgMoveSectionResponse { + return {}; + }, + toAmino(_: MsgMoveSectionResponse): MsgMoveSectionResponseAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg(object: MsgMoveSectionResponseAminoMsg): MsgMoveSectionResponse { + return MsgMoveSectionResponse.fromAmino(object.value); + }, + fromProtoMsg( + message: MsgMoveSectionResponseProtoMsg + ): MsgMoveSectionResponse { + return MsgMoveSectionResponse.decode(message.value); + }, + toProto(message: MsgMoveSectionResponse): Uint8Array { + return MsgMoveSectionResponse.encode(message).finish(); + }, + toProtoMsg(message: MsgMoveSectionResponse): MsgMoveSectionResponseProtoMsg { + return { + typeUrl: "/desmos.subspaces.v3.MsgMoveSectionResponse", + value: MsgMoveSectionResponse.encode(message).finish(), + }; + }, }; function createBaseMsgDeleteSection(): MsgDeleteSection { return { @@ -1154,6 +2020,37 @@ export const MsgDeleteSection = { message.signer = object.signer ?? ""; return message; }, + fromAmino(object: MsgDeleteSectionAmino): MsgDeleteSection { + return { + subspaceId: Long.fromString(object.subspace_id), + sectionId: object.section_id, + signer: object.signer, + }; + }, + toAmino(message: MsgDeleteSection): MsgDeleteSectionAmino { + const obj: any = {}; + obj.subspace_id = message.subspaceId + ? message.subspaceId.toString() + : undefined; + obj.section_id = message.sectionId; + obj.signer = message.signer; + return obj; + }, + fromAminoMsg(object: MsgDeleteSectionAminoMsg): MsgDeleteSection { + return MsgDeleteSection.fromAmino(object.value); + }, + fromProtoMsg(message: MsgDeleteSectionProtoMsg): MsgDeleteSection { + return MsgDeleteSection.decode(message.value); + }, + toProto(message: MsgDeleteSection): Uint8Array { + return MsgDeleteSection.encode(message).finish(); + }, + toProtoMsg(message: MsgDeleteSection): MsgDeleteSectionProtoMsg { + return { + typeUrl: "/desmos.subspaces.v3.MsgDeleteSection", + value: MsgDeleteSection.encode(message).finish(), + }; + }, }; function createBaseMsgDeleteSectionResponse(): MsgDeleteSectionResponse { return {}; @@ -1195,6 +2092,34 @@ export const MsgDeleteSectionResponse = { const message = createBaseMsgDeleteSectionResponse(); return message; }, + fromAmino(_: MsgDeleteSectionResponseAmino): MsgDeleteSectionResponse { + return {}; + }, + toAmino(_: MsgDeleteSectionResponse): MsgDeleteSectionResponseAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg( + object: MsgDeleteSectionResponseAminoMsg + ): MsgDeleteSectionResponse { + return MsgDeleteSectionResponse.fromAmino(object.value); + }, + fromProtoMsg( + message: MsgDeleteSectionResponseProtoMsg + ): MsgDeleteSectionResponse { + return MsgDeleteSectionResponse.decode(message.value); + }, + toProto(message: MsgDeleteSectionResponse): Uint8Array { + return MsgDeleteSectionResponse.encode(message).finish(); + }, + toProtoMsg( + message: MsgDeleteSectionResponse + ): MsgDeleteSectionResponseProtoMsg { + return { + typeUrl: "/desmos.subspaces.v3.MsgDeleteSectionResponse", + value: MsgDeleteSectionResponse.encode(message).finish(), + }; + }, }; function createBaseMsgCreateUserGroup(): MsgCreateUserGroup { return { @@ -1325,6 +2250,57 @@ export const MsgCreateUserGroup = { message.creator = object.creator ?? ""; return message; }, + fromAmino(object: MsgCreateUserGroupAmino): MsgCreateUserGroup { + return { + subspaceId: Long.fromString(object.subspace_id), + sectionId: object.section_id, + name: object.name, + description: object.description, + defaultPermissions: Array.isArray(object?.default_permissions) + ? object.default_permissions.map((e: any) => e) + : [], + initialMembers: Array.isArray(object?.initial_members) + ? object.initial_members.map((e: any) => e) + : [], + creator: object.creator, + }; + }, + toAmino(message: MsgCreateUserGroup): MsgCreateUserGroupAmino { + const obj: any = {}; + obj.subspace_id = message.subspaceId + ? message.subspaceId.toString() + : undefined; + obj.section_id = message.sectionId; + obj.name = message.name; + obj.description = message.description; + if (message.defaultPermissions) { + obj.default_permissions = message.defaultPermissions.map((e) => e); + } else { + obj.default_permissions = []; + } + if (message.initialMembers) { + obj.initial_members = message.initialMembers.map((e) => e); + } else { + obj.initial_members = []; + } + obj.creator = message.creator; + return obj; + }, + fromAminoMsg(object: MsgCreateUserGroupAminoMsg): MsgCreateUserGroup { + return MsgCreateUserGroup.fromAmino(object.value); + }, + fromProtoMsg(message: MsgCreateUserGroupProtoMsg): MsgCreateUserGroup { + return MsgCreateUserGroup.decode(message.value); + }, + toProto(message: MsgCreateUserGroup): Uint8Array { + return MsgCreateUserGroup.encode(message).finish(); + }, + toProtoMsg(message: MsgCreateUserGroup): MsgCreateUserGroupProtoMsg { + return { + typeUrl: "/desmos.subspaces.v3.MsgCreateUserGroup", + value: MsgCreateUserGroup.encode(message).finish(), + }; + }, }; function createBaseMsgCreateUserGroupResponse(): MsgCreateUserGroupResponse { return { @@ -1379,6 +2355,41 @@ export const MsgCreateUserGroupResponse = { message.groupId = object.groupId ?? 0; return message; }, + fromAmino( + object: MsgCreateUserGroupResponseAmino + ): MsgCreateUserGroupResponse { + return { + groupId: object.group_id, + }; + }, + toAmino( + message: MsgCreateUserGroupResponse + ): MsgCreateUserGroupResponseAmino { + const obj: any = {}; + obj.group_id = message.groupId; + return obj; + }, + fromAminoMsg( + object: MsgCreateUserGroupResponseAminoMsg + ): MsgCreateUserGroupResponse { + return MsgCreateUserGroupResponse.fromAmino(object.value); + }, + fromProtoMsg( + message: MsgCreateUserGroupResponseProtoMsg + ): MsgCreateUserGroupResponse { + return MsgCreateUserGroupResponse.decode(message.value); + }, + toProto(message: MsgCreateUserGroupResponse): Uint8Array { + return MsgCreateUserGroupResponse.encode(message).finish(); + }, + toProtoMsg( + message: MsgCreateUserGroupResponse + ): MsgCreateUserGroupResponseProtoMsg { + return { + typeUrl: "/desmos.subspaces.v3.MsgCreateUserGroupResponse", + value: MsgCreateUserGroupResponse.encode(message).finish(), + }; + }, }; function createBaseMsgEditUserGroup(): MsgEditUserGroup { return { @@ -1477,6 +2488,41 @@ export const MsgEditUserGroup = { message.signer = object.signer ?? ""; return message; }, + fromAmino(object: MsgEditUserGroupAmino): MsgEditUserGroup { + return { + subspaceId: Long.fromString(object.subspace_id), + groupId: object.group_id, + name: object.name, + description: object.description, + signer: object.signer, + }; + }, + toAmino(message: MsgEditUserGroup): MsgEditUserGroupAmino { + const obj: any = {}; + obj.subspace_id = message.subspaceId + ? message.subspaceId.toString() + : undefined; + obj.group_id = message.groupId; + obj.name = message.name; + obj.description = message.description; + obj.signer = message.signer; + return obj; + }, + fromAminoMsg(object: MsgEditUserGroupAminoMsg): MsgEditUserGroup { + return MsgEditUserGroup.fromAmino(object.value); + }, + fromProtoMsg(message: MsgEditUserGroupProtoMsg): MsgEditUserGroup { + return MsgEditUserGroup.decode(message.value); + }, + toProto(message: MsgEditUserGroup): Uint8Array { + return MsgEditUserGroup.encode(message).finish(); + }, + toProtoMsg(message: MsgEditUserGroup): MsgEditUserGroupProtoMsg { + return { + typeUrl: "/desmos.subspaces.v3.MsgEditUserGroup", + value: MsgEditUserGroup.encode(message).finish(), + }; + }, }; function createBaseMsgEditUserGroupResponse(): MsgEditUserGroupResponse { return {}; @@ -1518,6 +2564,34 @@ export const MsgEditUserGroupResponse = { const message = createBaseMsgEditUserGroupResponse(); return message; }, + fromAmino(_: MsgEditUserGroupResponseAmino): MsgEditUserGroupResponse { + return {}; + }, + toAmino(_: MsgEditUserGroupResponse): MsgEditUserGroupResponseAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg( + object: MsgEditUserGroupResponseAminoMsg + ): MsgEditUserGroupResponse { + return MsgEditUserGroupResponse.fromAmino(object.value); + }, + fromProtoMsg( + message: MsgEditUserGroupResponseProtoMsg + ): MsgEditUserGroupResponse { + return MsgEditUserGroupResponse.decode(message.value); + }, + toProto(message: MsgEditUserGroupResponse): Uint8Array { + return MsgEditUserGroupResponse.encode(message).finish(); + }, + toProtoMsg( + message: MsgEditUserGroupResponse + ): MsgEditUserGroupResponseProtoMsg { + return { + typeUrl: "/desmos.subspaces.v3.MsgEditUserGroupResponse", + value: MsgEditUserGroupResponse.encode(message).finish(), + }; + }, }; function createBaseMsgMoveUserGroup(): MsgMoveUserGroup { return { @@ -1608,6 +2682,39 @@ export const MsgMoveUserGroup = { message.signer = object.signer ?? ""; return message; }, + fromAmino(object: MsgMoveUserGroupAmino): MsgMoveUserGroup { + return { + subspaceId: Long.fromString(object.subspace_id), + groupId: object.group_id, + newSectionId: object.new_section_id, + signer: object.signer, + }; + }, + toAmino(message: MsgMoveUserGroup): MsgMoveUserGroupAmino { + const obj: any = {}; + obj.subspace_id = message.subspaceId + ? message.subspaceId.toString() + : undefined; + obj.group_id = message.groupId; + obj.new_section_id = message.newSectionId; + obj.signer = message.signer; + return obj; + }, + fromAminoMsg(object: MsgMoveUserGroupAminoMsg): MsgMoveUserGroup { + return MsgMoveUserGroup.fromAmino(object.value); + }, + fromProtoMsg(message: MsgMoveUserGroupProtoMsg): MsgMoveUserGroup { + return MsgMoveUserGroup.decode(message.value); + }, + toProto(message: MsgMoveUserGroup): Uint8Array { + return MsgMoveUserGroup.encode(message).finish(); + }, + toProtoMsg(message: MsgMoveUserGroup): MsgMoveUserGroupProtoMsg { + return { + typeUrl: "/desmos.subspaces.v3.MsgMoveUserGroup", + value: MsgMoveUserGroup.encode(message).finish(), + }; + }, }; function createBaseMsgMoveUserGroupResponse(): MsgMoveUserGroupResponse { return {}; @@ -1649,6 +2756,34 @@ export const MsgMoveUserGroupResponse = { const message = createBaseMsgMoveUserGroupResponse(); return message; }, + fromAmino(_: MsgMoveUserGroupResponseAmino): MsgMoveUserGroupResponse { + return {}; + }, + toAmino(_: MsgMoveUserGroupResponse): MsgMoveUserGroupResponseAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg( + object: MsgMoveUserGroupResponseAminoMsg + ): MsgMoveUserGroupResponse { + return MsgMoveUserGroupResponse.fromAmino(object.value); + }, + fromProtoMsg( + message: MsgMoveUserGroupResponseProtoMsg + ): MsgMoveUserGroupResponse { + return MsgMoveUserGroupResponse.decode(message.value); + }, + toProto(message: MsgMoveUserGroupResponse): Uint8Array { + return MsgMoveUserGroupResponse.encode(message).finish(); + }, + toProtoMsg( + message: MsgMoveUserGroupResponse + ): MsgMoveUserGroupResponseProtoMsg { + return { + typeUrl: "/desmos.subspaces.v3.MsgMoveUserGroupResponse", + value: MsgMoveUserGroupResponse.encode(message).finish(), + }; + }, }; function createBaseMsgSetUserGroupPermissions(): MsgSetUserGroupPermissions { return { @@ -1745,6 +2880,55 @@ export const MsgSetUserGroupPermissions = { message.signer = object.signer ?? ""; return message; }, + fromAmino( + object: MsgSetUserGroupPermissionsAmino + ): MsgSetUserGroupPermissions { + return { + subspaceId: Long.fromString(object.subspace_id), + groupId: object.group_id, + permissions: Array.isArray(object?.permissions) + ? object.permissions.map((e: any) => e) + : [], + signer: object.signer, + }; + }, + toAmino( + message: MsgSetUserGroupPermissions + ): MsgSetUserGroupPermissionsAmino { + const obj: any = {}; + obj.subspace_id = message.subspaceId + ? message.subspaceId.toString() + : undefined; + obj.group_id = message.groupId; + if (message.permissions) { + obj.permissions = message.permissions.map((e) => e); + } else { + obj.permissions = []; + } + obj.signer = message.signer; + return obj; + }, + fromAminoMsg( + object: MsgSetUserGroupPermissionsAminoMsg + ): MsgSetUserGroupPermissions { + return MsgSetUserGroupPermissions.fromAmino(object.value); + }, + fromProtoMsg( + message: MsgSetUserGroupPermissionsProtoMsg + ): MsgSetUserGroupPermissions { + return MsgSetUserGroupPermissions.decode(message.value); + }, + toProto(message: MsgSetUserGroupPermissions): Uint8Array { + return MsgSetUserGroupPermissions.encode(message).finish(); + }, + toProtoMsg( + message: MsgSetUserGroupPermissions + ): MsgSetUserGroupPermissionsProtoMsg { + return { + typeUrl: "/desmos.subspaces.v3.MsgSetUserGroupPermissions", + value: MsgSetUserGroupPermissions.encode(message).finish(), + }; + }, }; function createBaseMsgSetUserGroupPermissionsResponse(): MsgSetUserGroupPermissionsResponse { return {}; @@ -1786,6 +2970,38 @@ export const MsgSetUserGroupPermissionsResponse = { const message = createBaseMsgSetUserGroupPermissionsResponse(); return message; }, + fromAmino( + _: MsgSetUserGroupPermissionsResponseAmino + ): MsgSetUserGroupPermissionsResponse { + return {}; + }, + toAmino( + _: MsgSetUserGroupPermissionsResponse + ): MsgSetUserGroupPermissionsResponseAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg( + object: MsgSetUserGroupPermissionsResponseAminoMsg + ): MsgSetUserGroupPermissionsResponse { + return MsgSetUserGroupPermissionsResponse.fromAmino(object.value); + }, + fromProtoMsg( + message: MsgSetUserGroupPermissionsResponseProtoMsg + ): MsgSetUserGroupPermissionsResponse { + return MsgSetUserGroupPermissionsResponse.decode(message.value); + }, + toProto(message: MsgSetUserGroupPermissionsResponse): Uint8Array { + return MsgSetUserGroupPermissionsResponse.encode(message).finish(); + }, + toProtoMsg( + message: MsgSetUserGroupPermissionsResponse + ): MsgSetUserGroupPermissionsResponseProtoMsg { + return { + typeUrl: "/desmos.subspaces.v3.MsgSetUserGroupPermissionsResponse", + value: MsgSetUserGroupPermissionsResponse.encode(message).finish(), + }; + }, }; function createBaseMsgDeleteUserGroup(): MsgDeleteUserGroup { return { @@ -1863,6 +3079,37 @@ export const MsgDeleteUserGroup = { message.signer = object.signer ?? ""; return message; }, + fromAmino(object: MsgDeleteUserGroupAmino): MsgDeleteUserGroup { + return { + subspaceId: Long.fromString(object.subspace_id), + groupId: object.group_id, + signer: object.signer, + }; + }, + toAmino(message: MsgDeleteUserGroup): MsgDeleteUserGroupAmino { + const obj: any = {}; + obj.subspace_id = message.subspaceId + ? message.subspaceId.toString() + : undefined; + obj.group_id = message.groupId; + obj.signer = message.signer; + return obj; + }, + fromAminoMsg(object: MsgDeleteUserGroupAminoMsg): MsgDeleteUserGroup { + return MsgDeleteUserGroup.fromAmino(object.value); + }, + fromProtoMsg(message: MsgDeleteUserGroupProtoMsg): MsgDeleteUserGroup { + return MsgDeleteUserGroup.decode(message.value); + }, + toProto(message: MsgDeleteUserGroup): Uint8Array { + return MsgDeleteUserGroup.encode(message).finish(); + }, + toProtoMsg(message: MsgDeleteUserGroup): MsgDeleteUserGroupProtoMsg { + return { + typeUrl: "/desmos.subspaces.v3.MsgDeleteUserGroup", + value: MsgDeleteUserGroup.encode(message).finish(), + }; + }, }; function createBaseMsgDeleteUserGroupResponse(): MsgDeleteUserGroupResponse { return {}; @@ -1904,6 +3151,34 @@ export const MsgDeleteUserGroupResponse = { const message = createBaseMsgDeleteUserGroupResponse(); return message; }, + fromAmino(_: MsgDeleteUserGroupResponseAmino): MsgDeleteUserGroupResponse { + return {}; + }, + toAmino(_: MsgDeleteUserGroupResponse): MsgDeleteUserGroupResponseAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg( + object: MsgDeleteUserGroupResponseAminoMsg + ): MsgDeleteUserGroupResponse { + return MsgDeleteUserGroupResponse.fromAmino(object.value); + }, + fromProtoMsg( + message: MsgDeleteUserGroupResponseProtoMsg + ): MsgDeleteUserGroupResponse { + return MsgDeleteUserGroupResponse.decode(message.value); + }, + toProto(message: MsgDeleteUserGroupResponse): Uint8Array { + return MsgDeleteUserGroupResponse.encode(message).finish(); + }, + toProtoMsg( + message: MsgDeleteUserGroupResponse + ): MsgDeleteUserGroupResponseProtoMsg { + return { + typeUrl: "/desmos.subspaces.v3.MsgDeleteUserGroupResponse", + value: MsgDeleteUserGroupResponse.encode(message).finish(), + }; + }, }; function createBaseMsgAddUserToUserGroup(): MsgAddUserToUserGroup { return { @@ -1994,6 +3269,39 @@ export const MsgAddUserToUserGroup = { message.signer = object.signer ?? ""; return message; }, + fromAmino(object: MsgAddUserToUserGroupAmino): MsgAddUserToUserGroup { + return { + subspaceId: Long.fromString(object.subspace_id), + groupId: object.group_id, + user: object.user, + signer: object.signer, + }; + }, + toAmino(message: MsgAddUserToUserGroup): MsgAddUserToUserGroupAmino { + const obj: any = {}; + obj.subspace_id = message.subspaceId + ? message.subspaceId.toString() + : undefined; + obj.group_id = message.groupId; + obj.user = message.user; + obj.signer = message.signer; + return obj; + }, + fromAminoMsg(object: MsgAddUserToUserGroupAminoMsg): MsgAddUserToUserGroup { + return MsgAddUserToUserGroup.fromAmino(object.value); + }, + fromProtoMsg(message: MsgAddUserToUserGroupProtoMsg): MsgAddUserToUserGroup { + return MsgAddUserToUserGroup.decode(message.value); + }, + toProto(message: MsgAddUserToUserGroup): Uint8Array { + return MsgAddUserToUserGroup.encode(message).finish(); + }, + toProtoMsg(message: MsgAddUserToUserGroup): MsgAddUserToUserGroupProtoMsg { + return { + typeUrl: "/desmos.subspaces.v3.MsgAddUserToUserGroup", + value: MsgAddUserToUserGroup.encode(message).finish(), + }; + }, }; function createBaseMsgAddUserToUserGroupResponse(): MsgAddUserToUserGroupResponse { return {}; @@ -2035,6 +3343,38 @@ export const MsgAddUserToUserGroupResponse = { const message = createBaseMsgAddUserToUserGroupResponse(); return message; }, + fromAmino( + _: MsgAddUserToUserGroupResponseAmino + ): MsgAddUserToUserGroupResponse { + return {}; + }, + toAmino( + _: MsgAddUserToUserGroupResponse + ): MsgAddUserToUserGroupResponseAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg( + object: MsgAddUserToUserGroupResponseAminoMsg + ): MsgAddUserToUserGroupResponse { + return MsgAddUserToUserGroupResponse.fromAmino(object.value); + }, + fromProtoMsg( + message: MsgAddUserToUserGroupResponseProtoMsg + ): MsgAddUserToUserGroupResponse { + return MsgAddUserToUserGroupResponse.decode(message.value); + }, + toProto(message: MsgAddUserToUserGroupResponse): Uint8Array { + return MsgAddUserToUserGroupResponse.encode(message).finish(); + }, + toProtoMsg( + message: MsgAddUserToUserGroupResponse + ): MsgAddUserToUserGroupResponseProtoMsg { + return { + typeUrl: "/desmos.subspaces.v3.MsgAddUserToUserGroupResponse", + value: MsgAddUserToUserGroupResponse.encode(message).finish(), + }; + }, }; function createBaseMsgRemoveUserFromUserGroup(): MsgRemoveUserFromUserGroup { return { @@ -2125,6 +3465,49 @@ export const MsgRemoveUserFromUserGroup = { message.signer = object.signer ?? ""; return message; }, + fromAmino( + object: MsgRemoveUserFromUserGroupAmino + ): MsgRemoveUserFromUserGroup { + return { + subspaceId: Long.fromString(object.subspace_id), + groupId: object.group_id, + user: object.user, + signer: object.signer, + }; + }, + toAmino( + message: MsgRemoveUserFromUserGroup + ): MsgRemoveUserFromUserGroupAmino { + const obj: any = {}; + obj.subspace_id = message.subspaceId + ? message.subspaceId.toString() + : undefined; + obj.group_id = message.groupId; + obj.user = message.user; + obj.signer = message.signer; + return obj; + }, + fromAminoMsg( + object: MsgRemoveUserFromUserGroupAminoMsg + ): MsgRemoveUserFromUserGroup { + return MsgRemoveUserFromUserGroup.fromAmino(object.value); + }, + fromProtoMsg( + message: MsgRemoveUserFromUserGroupProtoMsg + ): MsgRemoveUserFromUserGroup { + return MsgRemoveUserFromUserGroup.decode(message.value); + }, + toProto(message: MsgRemoveUserFromUserGroup): Uint8Array { + return MsgRemoveUserFromUserGroup.encode(message).finish(); + }, + toProtoMsg( + message: MsgRemoveUserFromUserGroup + ): MsgRemoveUserFromUserGroupProtoMsg { + return { + typeUrl: "/desmos.subspaces.v3.MsgRemoveUserFromUserGroup", + value: MsgRemoveUserFromUserGroup.encode(message).finish(), + }; + }, }; function createBaseMsgRemoveUserFromUserGroupResponse(): MsgRemoveUserFromUserGroupResponse { return {}; @@ -2166,6 +3549,38 @@ export const MsgRemoveUserFromUserGroupResponse = { const message = createBaseMsgRemoveUserFromUserGroupResponse(); return message; }, + fromAmino( + _: MsgRemoveUserFromUserGroupResponseAmino + ): MsgRemoveUserFromUserGroupResponse { + return {}; + }, + toAmino( + _: MsgRemoveUserFromUserGroupResponse + ): MsgRemoveUserFromUserGroupResponseAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg( + object: MsgRemoveUserFromUserGroupResponseAminoMsg + ): MsgRemoveUserFromUserGroupResponse { + return MsgRemoveUserFromUserGroupResponse.fromAmino(object.value); + }, + fromProtoMsg( + message: MsgRemoveUserFromUserGroupResponseProtoMsg + ): MsgRemoveUserFromUserGroupResponse { + return MsgRemoveUserFromUserGroupResponse.decode(message.value); + }, + toProto(message: MsgRemoveUserFromUserGroupResponse): Uint8Array { + return MsgRemoveUserFromUserGroupResponse.encode(message).finish(); + }, + toProtoMsg( + message: MsgRemoveUserFromUserGroupResponse + ): MsgRemoveUserFromUserGroupResponseProtoMsg { + return { + typeUrl: "/desmos.subspaces.v3.MsgRemoveUserFromUserGroupResponse", + value: MsgRemoveUserFromUserGroupResponse.encode(message).finish(), + }; + }, }; function createBaseMsgSetUserPermissions(): MsgSetUserPermissions { return { @@ -2272,6 +3687,47 @@ export const MsgSetUserPermissions = { message.signer = object.signer ?? ""; return message; }, + fromAmino(object: MsgSetUserPermissionsAmino): MsgSetUserPermissions { + return { + subspaceId: Long.fromString(object.subspace_id), + sectionId: object.section_id, + user: object.user, + permissions: Array.isArray(object?.permissions) + ? object.permissions.map((e: any) => e) + : [], + signer: object.signer, + }; + }, + toAmino(message: MsgSetUserPermissions): MsgSetUserPermissionsAmino { + const obj: any = {}; + obj.subspace_id = message.subspaceId + ? message.subspaceId.toString() + : undefined; + obj.section_id = message.sectionId; + obj.user = message.user; + if (message.permissions) { + obj.permissions = message.permissions.map((e) => e); + } else { + obj.permissions = []; + } + obj.signer = message.signer; + return obj; + }, + fromAminoMsg(object: MsgSetUserPermissionsAminoMsg): MsgSetUserPermissions { + return MsgSetUserPermissions.fromAmino(object.value); + }, + fromProtoMsg(message: MsgSetUserPermissionsProtoMsg): MsgSetUserPermissions { + return MsgSetUserPermissions.decode(message.value); + }, + toProto(message: MsgSetUserPermissions): Uint8Array { + return MsgSetUserPermissions.encode(message).finish(); + }, + toProtoMsg(message: MsgSetUserPermissions): MsgSetUserPermissionsProtoMsg { + return { + typeUrl: "/desmos.subspaces.v3.MsgSetUserPermissions", + value: MsgSetUserPermissions.encode(message).finish(), + }; + }, }; function createBaseMsgSetUserPermissionsResponse(): MsgSetUserPermissionsResponse { return {}; @@ -2313,6 +3769,38 @@ export const MsgSetUserPermissionsResponse = { const message = createBaseMsgSetUserPermissionsResponse(); return message; }, + fromAmino( + _: MsgSetUserPermissionsResponseAmino + ): MsgSetUserPermissionsResponse { + return {}; + }, + toAmino( + _: MsgSetUserPermissionsResponse + ): MsgSetUserPermissionsResponseAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg( + object: MsgSetUserPermissionsResponseAminoMsg + ): MsgSetUserPermissionsResponse { + return MsgSetUserPermissionsResponse.fromAmino(object.value); + }, + fromProtoMsg( + message: MsgSetUserPermissionsResponseProtoMsg + ): MsgSetUserPermissionsResponse { + return MsgSetUserPermissionsResponse.decode(message.value); + }, + toProto(message: MsgSetUserPermissionsResponse): Uint8Array { + return MsgSetUserPermissionsResponse.encode(message).finish(); + }, + toProtoMsg( + message: MsgSetUserPermissionsResponse + ): MsgSetUserPermissionsResponseProtoMsg { + return { + typeUrl: "/desmos.subspaces.v3.MsgSetUserPermissionsResponse", + value: MsgSetUserPermissionsResponse.encode(message).finish(), + }; + }, }; /** Msg defines subspaces Msg service. */ export interface Msg { diff --git a/packages/types/src/desmos/subspaces/v3/msgs_feegrant.ts b/packages/types/src/desmos/subspaces/v3/msgs_feegrant.ts index f8a46e3a1..224fb75e4 100644 --- a/packages/types/src/desmos/subspaces/v3/msgs_feegrant.ts +++ b/packages/types/src/desmos/subspaces/v3/msgs_feegrant.ts @@ -1,5 +1,5 @@ /* eslint-disable */ -import { Any } from "../../../google/protobuf/any"; +import { Any, AnyAmino } from "../../../google/protobuf/any"; import { Long, isSet, DeepPartial, Exact } from "../../../helpers"; import * as _m0 from "protobufjs/minimal"; export const protobufPackage = "desmos.subspaces.v3"; @@ -17,11 +17,46 @@ export interface MsgGrantAllowance { /** Allowance can be any allowance type that implements AllowanceI */ allowance?: Any; } +export interface MsgGrantAllowanceProtoMsg { + typeUrl: "/desmos.subspaces.v3.MsgGrantAllowance"; + value: Uint8Array; +} +/** + * MsgGrantAllowance adds grants for the grantee to spend up allowance of fees + * from the treasury inside the given subspace + */ +export interface MsgGrantAllowanceAmino { + /** Id of the subspace inside which where the allowance should be granted */ + subspace_id: string; + /** Address of the user granting the allowance */ + granter: string; + /** Target being granted the allowance */ + grantee?: AnyAmino; + /** Allowance can be any allowance type that implements AllowanceI */ + allowance?: AnyAmino; +} +export interface MsgGrantAllowanceAminoMsg { + type: "/desmos.subspaces.v3.MsgGrantAllowance"; + value: MsgGrantAllowanceAmino; +} /** * MsgGrantAllowanceResponse defines the Msg/GrantAllowanceResponse response * type. */ export interface MsgGrantAllowanceResponse {} +export interface MsgGrantAllowanceResponseProtoMsg { + typeUrl: "/desmos.subspaces.v3.MsgGrantAllowanceResponse"; + value: Uint8Array; +} +/** + * MsgGrantAllowanceResponse defines the Msg/GrantAllowanceResponse response + * type. + */ +export interface MsgGrantAllowanceResponseAmino {} +export interface MsgGrantAllowanceResponseAminoMsg { + type: "/desmos.subspaces.v3.MsgGrantAllowanceResponse"; + value: MsgGrantAllowanceResponseAmino; +} /** * MsgRevokeAllowance removes any existing allowance to the grantee inside the * subspace @@ -34,11 +69,44 @@ export interface MsgRevokeAllowance { /** Target being revoked the allowance */ grantee?: Any; } +export interface MsgRevokeAllowanceProtoMsg { + typeUrl: "/desmos.subspaces.v3.MsgRevokeAllowance"; + value: Uint8Array; +} +/** + * MsgRevokeAllowance removes any existing allowance to the grantee inside the + * subspace + */ +export interface MsgRevokeAllowanceAmino { + /** If of the subspace inside which the allowance to be deleted is */ + subspace_id: string; + /** Address of the user that created the allowance */ + granter: string; + /** Target being revoked the allowance */ + grantee?: AnyAmino; +} +export interface MsgRevokeAllowanceAminoMsg { + type: "/desmos.subspaces.v3.MsgRevokeAllowance"; + value: MsgRevokeAllowanceAmino; +} /** * MsgRevokeAllowanceResponse defines the Msg/RevokeAllowanceResponse * response type. */ export interface MsgRevokeAllowanceResponse {} +export interface MsgRevokeAllowanceResponseProtoMsg { + typeUrl: "/desmos.subspaces.v3.MsgRevokeAllowanceResponse"; + value: Uint8Array; +} +/** + * MsgRevokeAllowanceResponse defines the Msg/RevokeAllowanceResponse + * response type. + */ +export interface MsgRevokeAllowanceResponseAmino {} +export interface MsgRevokeAllowanceResponseAminoMsg { + type: "/desmos.subspaces.v3.MsgRevokeAllowanceResponse"; + value: MsgRevokeAllowanceResponseAmino; +} function createBaseMsgGrantAllowance(): MsgGrantAllowance { return { subspaceId: Long.UZERO, @@ -136,6 +204,43 @@ export const MsgGrantAllowance = { : undefined; return message; }, + fromAmino(object: MsgGrantAllowanceAmino): MsgGrantAllowance { + return { + subspaceId: Long.fromString(object.subspace_id), + granter: object.granter, + grantee: object?.grantee ? Any.fromAmino(object.grantee) : undefined, + allowance: object?.allowance + ? Any.fromAmino(object.allowance) + : undefined, + }; + }, + toAmino(message: MsgGrantAllowance): MsgGrantAllowanceAmino { + const obj: any = {}; + obj.subspace_id = message.subspaceId + ? message.subspaceId.toString() + : undefined; + obj.granter = message.granter; + obj.grantee = message.grantee ? Any.toAmino(message.grantee) : undefined; + obj.allowance = message.allowance + ? Any.toAmino(message.allowance) + : undefined; + return obj; + }, + fromAminoMsg(object: MsgGrantAllowanceAminoMsg): MsgGrantAllowance { + return MsgGrantAllowance.fromAmino(object.value); + }, + fromProtoMsg(message: MsgGrantAllowanceProtoMsg): MsgGrantAllowance { + return MsgGrantAllowance.decode(message.value); + }, + toProto(message: MsgGrantAllowance): Uint8Array { + return MsgGrantAllowance.encode(message).finish(); + }, + toProtoMsg(message: MsgGrantAllowance): MsgGrantAllowanceProtoMsg { + return { + typeUrl: "/desmos.subspaces.v3.MsgGrantAllowance", + value: MsgGrantAllowance.encode(message).finish(), + }; + }, }; function createBaseMsgGrantAllowanceResponse(): MsgGrantAllowanceResponse { return {}; @@ -177,6 +282,34 @@ export const MsgGrantAllowanceResponse = { const message = createBaseMsgGrantAllowanceResponse(); return message; }, + fromAmino(_: MsgGrantAllowanceResponseAmino): MsgGrantAllowanceResponse { + return {}; + }, + toAmino(_: MsgGrantAllowanceResponse): MsgGrantAllowanceResponseAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg( + object: MsgGrantAllowanceResponseAminoMsg + ): MsgGrantAllowanceResponse { + return MsgGrantAllowanceResponse.fromAmino(object.value); + }, + fromProtoMsg( + message: MsgGrantAllowanceResponseProtoMsg + ): MsgGrantAllowanceResponse { + return MsgGrantAllowanceResponse.decode(message.value); + }, + toProto(message: MsgGrantAllowanceResponse): Uint8Array { + return MsgGrantAllowanceResponse.encode(message).finish(); + }, + toProtoMsg( + message: MsgGrantAllowanceResponse + ): MsgGrantAllowanceResponseProtoMsg { + return { + typeUrl: "/desmos.subspaces.v3.MsgGrantAllowanceResponse", + value: MsgGrantAllowanceResponse.encode(message).finish(), + }; + }, }; function createBaseMsgRevokeAllowance(): MsgRevokeAllowance { return { @@ -257,6 +390,37 @@ export const MsgRevokeAllowance = { : undefined; return message; }, + fromAmino(object: MsgRevokeAllowanceAmino): MsgRevokeAllowance { + return { + subspaceId: Long.fromString(object.subspace_id), + granter: object.granter, + grantee: object?.grantee ? Any.fromAmino(object.grantee) : undefined, + }; + }, + toAmino(message: MsgRevokeAllowance): MsgRevokeAllowanceAmino { + const obj: any = {}; + obj.subspace_id = message.subspaceId + ? message.subspaceId.toString() + : undefined; + obj.granter = message.granter; + obj.grantee = message.grantee ? Any.toAmino(message.grantee) : undefined; + return obj; + }, + fromAminoMsg(object: MsgRevokeAllowanceAminoMsg): MsgRevokeAllowance { + return MsgRevokeAllowance.fromAmino(object.value); + }, + fromProtoMsg(message: MsgRevokeAllowanceProtoMsg): MsgRevokeAllowance { + return MsgRevokeAllowance.decode(message.value); + }, + toProto(message: MsgRevokeAllowance): Uint8Array { + return MsgRevokeAllowance.encode(message).finish(); + }, + toProtoMsg(message: MsgRevokeAllowance): MsgRevokeAllowanceProtoMsg { + return { + typeUrl: "/desmos.subspaces.v3.MsgRevokeAllowance", + value: MsgRevokeAllowance.encode(message).finish(), + }; + }, }; function createBaseMsgRevokeAllowanceResponse(): MsgRevokeAllowanceResponse { return {}; @@ -298,4 +462,32 @@ export const MsgRevokeAllowanceResponse = { const message = createBaseMsgRevokeAllowanceResponse(); return message; }, + fromAmino(_: MsgRevokeAllowanceResponseAmino): MsgRevokeAllowanceResponse { + return {}; + }, + toAmino(_: MsgRevokeAllowanceResponse): MsgRevokeAllowanceResponseAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg( + object: MsgRevokeAllowanceResponseAminoMsg + ): MsgRevokeAllowanceResponse { + return MsgRevokeAllowanceResponse.fromAmino(object.value); + }, + fromProtoMsg( + message: MsgRevokeAllowanceResponseProtoMsg + ): MsgRevokeAllowanceResponse { + return MsgRevokeAllowanceResponse.decode(message.value); + }, + toProto(message: MsgRevokeAllowanceResponse): Uint8Array { + return MsgRevokeAllowanceResponse.encode(message).finish(); + }, + toProtoMsg( + message: MsgRevokeAllowanceResponse + ): MsgRevokeAllowanceResponseProtoMsg { + return { + typeUrl: "/desmos.subspaces.v3.MsgRevokeAllowanceResponse", + value: MsgRevokeAllowanceResponse.encode(message).finish(), + }; + }, }; diff --git a/packages/types/src/desmos/subspaces/v3/msgs_treasury.ts b/packages/types/src/desmos/subspaces/v3/msgs_treasury.ts index 538321b9d..e3e369582 100644 --- a/packages/types/src/desmos/subspaces/v3/msgs_treasury.ts +++ b/packages/types/src/desmos/subspaces/v3/msgs_treasury.ts @@ -1,5 +1,5 @@ /* eslint-disable */ -import { Grant } from "../../../cosmos/authz/v1beta1/authz"; +import { Grant, GrantAmino } from "../../../cosmos/authz/v1beta1/authz"; import { Long, isSet, DeepPartial, Exact } from "../../../helpers"; import * as _m0 from "protobufjs/minimal"; export const protobufPackage = "desmos.subspaces.v3"; @@ -17,11 +17,46 @@ export interface MsgGrantTreasuryAuthorization { /** Grant represents the authorization to execute the provided methods */ grant?: Grant; } +export interface MsgGrantTreasuryAuthorizationProtoMsg { + typeUrl: "/desmos.subspaces.v3.MsgGrantTreasuryAuthorization"; + value: Uint8Array; +} +/** + * MsgGrantTreasuryAuthorization grants an authorization on behalf of the + * treasury to a user + */ +export interface MsgGrantTreasuryAuthorizationAmino { + /** Id of the subspace where the authorization should be granted */ + subspace_id: string; + /** Address of the user granting a treasury authorization */ + granter: string; + /** Address of the user who is being granted a treasury authorization */ + grantee: string; + /** Grant represents the authorization to execute the provided methods */ + grant?: GrantAmino; +} +export interface MsgGrantTreasuryAuthorizationAminoMsg { + type: "/desmos.subspaces.v3.MsgGrantTreasuryAuthorization"; + value: MsgGrantTreasuryAuthorizationAmino; +} /** * MsgGrantTreasuryAuthorizationResponse defines the * Msg/MsgGrantTreasuryAuthorization response type */ export interface MsgGrantTreasuryAuthorizationResponse {} +export interface MsgGrantTreasuryAuthorizationResponseProtoMsg { + typeUrl: "/desmos.subspaces.v3.MsgGrantTreasuryAuthorizationResponse"; + value: Uint8Array; +} +/** + * MsgGrantTreasuryAuthorizationResponse defines the + * Msg/MsgGrantTreasuryAuthorization response type + */ +export interface MsgGrantTreasuryAuthorizationResponseAmino {} +export interface MsgGrantTreasuryAuthorizationResponseAminoMsg { + type: "/desmos.subspaces.v3.MsgGrantTreasuryAuthorizationResponse"; + value: MsgGrantTreasuryAuthorizationResponseAmino; +} /** * MsgRevokeTreasuryAuthorization revokes an existing treasury authorization * from a user @@ -36,11 +71,46 @@ export interface MsgRevokeTreasuryAuthorization { /** Type url of the authorized message which is being revoked */ msgTypeUrl: string; } +export interface MsgRevokeTreasuryAuthorizationProtoMsg { + typeUrl: "/desmos.subspaces.v3.MsgRevokeTreasuryAuthorization"; + value: Uint8Array; +} +/** + * MsgRevokeTreasuryAuthorization revokes an existing treasury authorization + * from a user + */ +export interface MsgRevokeTreasuryAuthorizationAmino { + /** Id of the subspace from which the authorization should be revoked */ + subspace_id: string; + /** Address of the user revoking the treasury authorization */ + granter: string; + /** Address of the user who is being revoked the treasury authorization */ + grantee: string; + /** Type url of the authorized message which is being revoked */ + msg_type_url: string; +} +export interface MsgRevokeTreasuryAuthorizationAminoMsg { + type: "/desmos.subspaces.v3.MsgRevokeTreasuryAuthorization"; + value: MsgRevokeTreasuryAuthorizationAmino; +} /** * MsgRevokeTreasuryAuthorizationResponse defines the * Msg/MsgRevokeTreasuryAuthorization response type */ export interface MsgRevokeTreasuryAuthorizationResponse {} +export interface MsgRevokeTreasuryAuthorizationResponseProtoMsg { + typeUrl: "/desmos.subspaces.v3.MsgRevokeTreasuryAuthorizationResponse"; + value: Uint8Array; +} +/** + * MsgRevokeTreasuryAuthorizationResponse defines the + * Msg/MsgRevokeTreasuryAuthorization response type + */ +export interface MsgRevokeTreasuryAuthorizationResponseAmino {} +export interface MsgRevokeTreasuryAuthorizationResponseAminoMsg { + type: "/desmos.subspaces.v3.MsgRevokeTreasuryAuthorizationResponse"; + value: MsgRevokeTreasuryAuthorizationResponseAmino; +} function createBaseMsgGrantTreasuryAuthorization(): MsgGrantTreasuryAuthorization { return { subspaceId: Long.UZERO, @@ -133,6 +203,49 @@ export const MsgGrantTreasuryAuthorization = { : undefined; return message; }, + fromAmino( + object: MsgGrantTreasuryAuthorizationAmino + ): MsgGrantTreasuryAuthorization { + return { + subspaceId: Long.fromString(object.subspace_id), + granter: object.granter, + grantee: object.grantee, + grant: object?.grant ? Grant.fromAmino(object.grant) : undefined, + }; + }, + toAmino( + message: MsgGrantTreasuryAuthorization + ): MsgGrantTreasuryAuthorizationAmino { + const obj: any = {}; + obj.subspace_id = message.subspaceId + ? message.subspaceId.toString() + : undefined; + obj.granter = message.granter; + obj.grantee = message.grantee; + obj.grant = message.grant ? Grant.toAmino(message.grant) : undefined; + return obj; + }, + fromAminoMsg( + object: MsgGrantTreasuryAuthorizationAminoMsg + ): MsgGrantTreasuryAuthorization { + return MsgGrantTreasuryAuthorization.fromAmino(object.value); + }, + fromProtoMsg( + message: MsgGrantTreasuryAuthorizationProtoMsg + ): MsgGrantTreasuryAuthorization { + return MsgGrantTreasuryAuthorization.decode(message.value); + }, + toProto(message: MsgGrantTreasuryAuthorization): Uint8Array { + return MsgGrantTreasuryAuthorization.encode(message).finish(); + }, + toProtoMsg( + message: MsgGrantTreasuryAuthorization + ): MsgGrantTreasuryAuthorizationProtoMsg { + return { + typeUrl: "/desmos.subspaces.v3.MsgGrantTreasuryAuthorization", + value: MsgGrantTreasuryAuthorization.encode(message).finish(), + }; + }, }; function createBaseMsgGrantTreasuryAuthorizationResponse(): MsgGrantTreasuryAuthorizationResponse { return {}; @@ -174,6 +287,38 @@ export const MsgGrantTreasuryAuthorizationResponse = { const message = createBaseMsgGrantTreasuryAuthorizationResponse(); return message; }, + fromAmino( + _: MsgGrantTreasuryAuthorizationResponseAmino + ): MsgGrantTreasuryAuthorizationResponse { + return {}; + }, + toAmino( + _: MsgGrantTreasuryAuthorizationResponse + ): MsgGrantTreasuryAuthorizationResponseAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg( + object: MsgGrantTreasuryAuthorizationResponseAminoMsg + ): MsgGrantTreasuryAuthorizationResponse { + return MsgGrantTreasuryAuthorizationResponse.fromAmino(object.value); + }, + fromProtoMsg( + message: MsgGrantTreasuryAuthorizationResponseProtoMsg + ): MsgGrantTreasuryAuthorizationResponse { + return MsgGrantTreasuryAuthorizationResponse.decode(message.value); + }, + toProto(message: MsgGrantTreasuryAuthorizationResponse): Uint8Array { + return MsgGrantTreasuryAuthorizationResponse.encode(message).finish(); + }, + toProtoMsg( + message: MsgGrantTreasuryAuthorizationResponse + ): MsgGrantTreasuryAuthorizationResponseProtoMsg { + return { + typeUrl: "/desmos.subspaces.v3.MsgGrantTreasuryAuthorizationResponse", + value: MsgGrantTreasuryAuthorizationResponse.encode(message).finish(), + }; + }, }; function createBaseMsgRevokeTreasuryAuthorization(): MsgRevokeTreasuryAuthorization { return { @@ -263,6 +408,49 @@ export const MsgRevokeTreasuryAuthorization = { message.msgTypeUrl = object.msgTypeUrl ?? ""; return message; }, + fromAmino( + object: MsgRevokeTreasuryAuthorizationAmino + ): MsgRevokeTreasuryAuthorization { + return { + subspaceId: Long.fromString(object.subspace_id), + granter: object.granter, + grantee: object.grantee, + msgTypeUrl: object.msg_type_url, + }; + }, + toAmino( + message: MsgRevokeTreasuryAuthorization + ): MsgRevokeTreasuryAuthorizationAmino { + const obj: any = {}; + obj.subspace_id = message.subspaceId + ? message.subspaceId.toString() + : undefined; + obj.granter = message.granter; + obj.grantee = message.grantee; + obj.msg_type_url = message.msgTypeUrl; + return obj; + }, + fromAminoMsg( + object: MsgRevokeTreasuryAuthorizationAminoMsg + ): MsgRevokeTreasuryAuthorization { + return MsgRevokeTreasuryAuthorization.fromAmino(object.value); + }, + fromProtoMsg( + message: MsgRevokeTreasuryAuthorizationProtoMsg + ): MsgRevokeTreasuryAuthorization { + return MsgRevokeTreasuryAuthorization.decode(message.value); + }, + toProto(message: MsgRevokeTreasuryAuthorization): Uint8Array { + return MsgRevokeTreasuryAuthorization.encode(message).finish(); + }, + toProtoMsg( + message: MsgRevokeTreasuryAuthorization + ): MsgRevokeTreasuryAuthorizationProtoMsg { + return { + typeUrl: "/desmos.subspaces.v3.MsgRevokeTreasuryAuthorization", + value: MsgRevokeTreasuryAuthorization.encode(message).finish(), + }; + }, }; function createBaseMsgRevokeTreasuryAuthorizationResponse(): MsgRevokeTreasuryAuthorizationResponse { return {}; @@ -304,4 +492,36 @@ export const MsgRevokeTreasuryAuthorizationResponse = { const message = createBaseMsgRevokeTreasuryAuthorizationResponse(); return message; }, + fromAmino( + _: MsgRevokeTreasuryAuthorizationResponseAmino + ): MsgRevokeTreasuryAuthorizationResponse { + return {}; + }, + toAmino( + _: MsgRevokeTreasuryAuthorizationResponse + ): MsgRevokeTreasuryAuthorizationResponseAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg( + object: MsgRevokeTreasuryAuthorizationResponseAminoMsg + ): MsgRevokeTreasuryAuthorizationResponse { + return MsgRevokeTreasuryAuthorizationResponse.fromAmino(object.value); + }, + fromProtoMsg( + message: MsgRevokeTreasuryAuthorizationResponseProtoMsg + ): MsgRevokeTreasuryAuthorizationResponse { + return MsgRevokeTreasuryAuthorizationResponse.decode(message.value); + }, + toProto(message: MsgRevokeTreasuryAuthorizationResponse): Uint8Array { + return MsgRevokeTreasuryAuthorizationResponse.encode(message).finish(); + }, + toProtoMsg( + message: MsgRevokeTreasuryAuthorizationResponse + ): MsgRevokeTreasuryAuthorizationResponseProtoMsg { + return { + typeUrl: "/desmos.subspaces.v3.MsgRevokeTreasuryAuthorizationResponse", + value: MsgRevokeTreasuryAuthorizationResponse.encode(message).finish(), + }; + }, }; diff --git a/packages/types/src/desmos/subspaces/v3/query.ts b/packages/types/src/desmos/subspaces/v3/query.ts index cdadeb296..ce15dbdbe 100644 --- a/packages/types/src/desmos/subspaces/v3/query.ts +++ b/packages/types/src/desmos/subspaces/v3/query.ts @@ -1,10 +1,19 @@ /* eslint-disable */ import { PageRequest, + PageRequestAmino, PageResponse, + PageResponseAmino, } from "../../../cosmos/base/query/v1beta1/pagination"; -import { Subspace, Section, UserGroup } from "./models"; -import { Grant } from "./models_feegrant"; +import { + Subspace, + SubspaceAmino, + Section, + SectionAmino, + UserGroup, + UserGroupAmino, +} from "./models"; +import { Grant, GrantAmino } from "./models_feegrant"; import { Long, isSet, DeepPartial, Exact, Rpc } from "../../../helpers"; import * as _m0 from "protobufjs/minimal"; export const protobufPackage = "desmos.subspaces.v3"; @@ -13,6 +22,19 @@ export interface QuerySubspacesRequest { /** pagination defines an optional pagination for the request. */ pagination?: PageRequest; } +export interface QuerySubspacesRequestProtoMsg { + typeUrl: "/desmos.subspaces.v3.QuerySubspacesRequest"; + value: Uint8Array; +} +/** QuerySubspacesRequest is the request type for the Query/Subspaces RPC method */ +export interface QuerySubspacesRequestAmino { + /** pagination defines an optional pagination for the request. */ + pagination?: PageRequestAmino; +} +export interface QuerySubspacesRequestAminoMsg { + type: "/desmos.subspaces.v3.QuerySubspacesRequest"; + value: QuerySubspacesRequestAmino; +} /** * QuerySubspacesResponse is the response type for the Query/Subspaces RPC * method @@ -21,15 +43,56 @@ export interface QuerySubspacesResponse { subspaces: Subspace[]; pagination?: PageResponse; } +export interface QuerySubspacesResponseProtoMsg { + typeUrl: "/desmos.subspaces.v3.QuerySubspacesResponse"; + value: Uint8Array; +} +/** + * QuerySubspacesResponse is the response type for the Query/Subspaces RPC + * method + */ +export interface QuerySubspacesResponseAmino { + subspaces: SubspaceAmino[]; + pagination?: PageResponseAmino; +} +export interface QuerySubspacesResponseAminoMsg { + type: "/desmos.subspaces.v3.QuerySubspacesResponse"; + value: QuerySubspacesResponseAmino; +} /** QuerySubspace is the request type for the Query/Subspace RPC method */ export interface QuerySubspaceRequest { /** Id of the subspace to query */ subspaceId: Long; } +export interface QuerySubspaceRequestProtoMsg { + typeUrl: "/desmos.subspaces.v3.QuerySubspaceRequest"; + value: Uint8Array; +} +/** QuerySubspace is the request type for the Query/Subspace RPC method */ +export interface QuerySubspaceRequestAmino { + /** Id of the subspace to query */ + subspace_id: string; +} +export interface QuerySubspaceRequestAminoMsg { + type: "/desmos.subspaces.v3.QuerySubspaceRequest"; + value: QuerySubspaceRequestAmino; +} /** QuerySubspaceResponse is the response type for the Query/Subspace method */ export interface QuerySubspaceResponse { subspace?: Subspace; } +export interface QuerySubspaceResponseProtoMsg { + typeUrl: "/desmos.subspaces.v3.QuerySubspaceResponse"; + value: Uint8Array; +} +/** QuerySubspaceResponse is the response type for the Query/Subspace method */ +export interface QuerySubspaceResponseAmino { + subspace?: SubspaceAmino; +} +export interface QuerySubspaceResponseAminoMsg { + type: "/desmos.subspaces.v3.QuerySubspaceResponse"; + value: QuerySubspaceResponseAmino; +} /** QuerySectionsRequest is the request type for Query/Sections RPC method */ export interface QuerySectionsRequest { /** Id of the subspace to query the sections for */ @@ -37,11 +100,39 @@ export interface QuerySectionsRequest { /** pagination defines an optional pagination for the request. */ pagination?: PageRequest; } +export interface QuerySectionsRequestProtoMsg { + typeUrl: "/desmos.subspaces.v3.QuerySectionsRequest"; + value: Uint8Array; +} +/** QuerySectionsRequest is the request type for Query/Sections RPC method */ +export interface QuerySectionsRequestAmino { + /** Id of the subspace to query the sections for */ + subspace_id: string; + /** pagination defines an optional pagination for the request. */ + pagination?: PageRequestAmino; +} +export interface QuerySectionsRequestAminoMsg { + type: "/desmos.subspaces.v3.QuerySectionsRequest"; + value: QuerySectionsRequestAmino; +} /** QuerySectionsResponse is the response type for Query/Sections RPC method */ export interface QuerySectionsResponse { sections: Section[]; pagination?: PageResponse; } +export interface QuerySectionsResponseProtoMsg { + typeUrl: "/desmos.subspaces.v3.QuerySectionsResponse"; + value: Uint8Array; +} +/** QuerySectionsResponse is the response type for Query/Sections RPC method */ +export interface QuerySectionsResponseAmino { + sections: SectionAmino[]; + pagination?: PageResponseAmino; +} +export interface QuerySectionsResponseAminoMsg { + type: "/desmos.subspaces.v3.QuerySectionsResponse"; + value: QuerySectionsResponseAmino; +} /** QuerySectionRequest is the request type for Query/Section RPC method */ export interface QuerySectionRequest { /** Id of the subspace inside which to search for */ @@ -49,10 +140,37 @@ export interface QuerySectionRequest { /** Id of the searched section */ sectionId: number; } +export interface QuerySectionRequestProtoMsg { + typeUrl: "/desmos.subspaces.v3.QuerySectionRequest"; + value: Uint8Array; +} +/** QuerySectionRequest is the request type for Query/Section RPC method */ +export interface QuerySectionRequestAmino { + /** Id of the subspace inside which to search for */ + subspace_id: string; + /** Id of the searched section */ + section_id: number; +} +export interface QuerySectionRequestAminoMsg { + type: "/desmos.subspaces.v3.QuerySectionRequest"; + value: QuerySectionRequestAmino; +} /** QuerySectionResponse is the response type for Query/Section RPC method */ export interface QuerySectionResponse { section?: Section; } +export interface QuerySectionResponseProtoMsg { + typeUrl: "/desmos.subspaces.v3.QuerySectionResponse"; + value: Uint8Array; +} +/** QuerySectionResponse is the response type for Query/Section RPC method */ +export interface QuerySectionResponseAmino { + section?: SectionAmino; +} +export interface QuerySectionResponseAminoMsg { + type: "/desmos.subspaces.v3.QuerySectionResponse"; + value: QuerySectionResponseAmino; +} /** * QueryUserGroupsRequest is the request type for the Query/UserGroups RPC * method @@ -65,6 +183,26 @@ export interface QueryUserGroupsRequest { /** pagination defines an optional pagination for the request. */ pagination?: PageRequest; } +export interface QueryUserGroupsRequestProtoMsg { + typeUrl: "/desmos.subspaces.v3.QueryUserGroupsRequest"; + value: Uint8Array; +} +/** + * QueryUserGroupsRequest is the request type for the Query/UserGroups RPC + * method + */ +export interface QueryUserGroupsRequestAmino { + /** Id of the subspace to query the groups for */ + subspace_id: string; + /** (optional) Section id to query the groups for */ + section_id: number; + /** pagination defines an optional pagination for the request. */ + pagination?: PageRequestAmino; +} +export interface QueryUserGroupsRequestAminoMsg { + type: "/desmos.subspaces.v3.QueryUserGroupsRequest"; + value: QueryUserGroupsRequestAmino; +} /** * QueryUserGroupsResponse is the response type for the Query/UserGroups RPC * method @@ -73,6 +211,22 @@ export interface QueryUserGroupsResponse { groups: UserGroup[]; pagination?: PageResponse; } +export interface QueryUserGroupsResponseProtoMsg { + typeUrl: "/desmos.subspaces.v3.QueryUserGroupsResponse"; + value: Uint8Array; +} +/** + * QueryUserGroupsResponse is the response type for the Query/UserGroups RPC + * method + */ +export interface QueryUserGroupsResponseAmino { + groups: UserGroupAmino[]; + pagination?: PageResponseAmino; +} +export interface QueryUserGroupsResponseAminoMsg { + type: "/desmos.subspaces.v3.QueryUserGroupsResponse"; + value: QueryUserGroupsResponseAmino; +} /** QueryUserGroupRequest is the request type for the Query/UserGroup RPC method */ export interface QueryUserGroupRequest { /** Id of the subspace that contains the group */ @@ -80,6 +234,21 @@ export interface QueryUserGroupRequest { /** Id of the group to query */ groupId: number; } +export interface QueryUserGroupRequestProtoMsg { + typeUrl: "/desmos.subspaces.v3.QueryUserGroupRequest"; + value: Uint8Array; +} +/** QueryUserGroupRequest is the request type for the Query/UserGroup RPC method */ +export interface QueryUserGroupRequestAmino { + /** Id of the subspace that contains the group */ + subspace_id: string; + /** Id of the group to query */ + group_id: number; +} +export interface QueryUserGroupRequestAminoMsg { + type: "/desmos.subspaces.v3.QueryUserGroupRequest"; + value: QueryUserGroupRequestAmino; +} /** * QueryUserGroupResponse is the response type for the Query/UserGroup RPC * method @@ -87,6 +256,21 @@ export interface QueryUserGroupRequest { export interface QueryUserGroupResponse { group?: UserGroup; } +export interface QueryUserGroupResponseProtoMsg { + typeUrl: "/desmos.subspaces.v3.QueryUserGroupResponse"; + value: Uint8Array; +} +/** + * QueryUserGroupResponse is the response type for the Query/UserGroup RPC + * method + */ +export interface QueryUserGroupResponseAmino { + group?: UserGroupAmino; +} +export interface QueryUserGroupResponseAminoMsg { + type: "/desmos.subspaces.v3.QueryUserGroupResponse"; + value: QueryUserGroupResponseAmino; +} /** * QueryUserGroupMembersRequest is the request type for the * Query/UserGroupMembers RPC method @@ -99,6 +283,26 @@ export interface QueryUserGroupMembersRequest { /** pagination defines an optional pagination for the request. */ pagination?: PageRequest; } +export interface QueryUserGroupMembersRequestProtoMsg { + typeUrl: "/desmos.subspaces.v3.QueryUserGroupMembersRequest"; + value: Uint8Array; +} +/** + * QueryUserGroupMembersRequest is the request type for the + * Query/UserGroupMembers RPC method + */ +export interface QueryUserGroupMembersRequestAmino { + /** Id of the subspace that contains the group */ + subspace_id: string; + /** Id of the user group to query the members for */ + group_id: number; + /** pagination defines an optional pagination for the request. */ + pagination?: PageRequestAmino; +} +export interface QueryUserGroupMembersRequestAminoMsg { + type: "/desmos.subspaces.v3.QueryUserGroupMembersRequest"; + value: QueryUserGroupMembersRequestAmino; +} /** * QueryUserGroupMembersResponse is the response type for the * Query/UserGroupMembers RPC method @@ -107,6 +311,22 @@ export interface QueryUserGroupMembersResponse { members: string[]; pagination?: PageResponse; } +export interface QueryUserGroupMembersResponseProtoMsg { + typeUrl: "/desmos.subspaces.v3.QueryUserGroupMembersResponse"; + value: Uint8Array; +} +/** + * QueryUserGroupMembersResponse is the response type for the + * Query/UserGroupMembers RPC method + */ +export interface QueryUserGroupMembersResponseAmino { + members: string[]; + pagination?: PageResponseAmino; +} +export interface QueryUserGroupMembersResponseAminoMsg { + type: "/desmos.subspaces.v3.QueryUserGroupMembersResponse"; + value: QueryUserGroupMembersResponseAmino; +} /** * QueryUserPermissionsRequest is the request type for the Query/UserPermissions * RPC method @@ -119,6 +339,26 @@ export interface QueryUserPermissionsRequest { /** Address of the user to query the permissions for */ user: string; } +export interface QueryUserPermissionsRequestProtoMsg { + typeUrl: "/desmos.subspaces.v3.QueryUserPermissionsRequest"; + value: Uint8Array; +} +/** + * QueryUserPermissionsRequest is the request type for the Query/UserPermissions + * RPC method + */ +export interface QueryUserPermissionsRequestAmino { + /** Id of the subspace to query the permissions for */ + subspace_id: string; + /** Id of the section to query the permissions for */ + section_id: number; + /** Address of the user to query the permissions for */ + user: string; +} +export interface QueryUserPermissionsRequestAminoMsg { + type: "/desmos.subspaces.v3.QueryUserPermissionsRequest"; + value: QueryUserPermissionsRequestAmino; +} /** * QueryUserPermissionsRequest is the response type for the * Query/UserPermissions method @@ -127,6 +367,22 @@ export interface QueryUserPermissionsResponse { permissions: string[]; details: PermissionDetail[]; } +export interface QueryUserPermissionsResponseProtoMsg { + typeUrl: "/desmos.subspaces.v3.QueryUserPermissionsResponse"; + value: Uint8Array; +} +/** + * QueryUserPermissionsRequest is the response type for the + * Query/UserPermissions method + */ +export interface QueryUserPermissionsResponseAmino { + permissions: string[]; + details: PermissionDetailAmino[]; +} +export interface QueryUserPermissionsResponseAminoMsg { + type: "/desmos.subspaces.v3.QueryUserPermissionsResponse"; + value: QueryUserPermissionsResponseAmino; +} /** PermissionDetail contains the details data of a permission */ export interface PermissionDetail { /** Id of the subspace for which this permission is valid */ @@ -138,6 +394,25 @@ export interface PermissionDetail { /** Group represents a group permission */ group?: PermissionDetail_Group; } +export interface PermissionDetailProtoMsg { + typeUrl: "/desmos.subspaces.v3.PermissionDetail"; + value: Uint8Array; +} +/** PermissionDetail contains the details data of a permission */ +export interface PermissionDetailAmino { + /** Id of the subspace for which this permission is valid */ + subspace_id: string; + /** Id of the section for which this permission is valid */ + section_id: number; + /** User represents a user permission */ + user?: PermissionDetail_UserAmino; + /** Group represents a group permission */ + group?: PermissionDetail_GroupAmino; +} +export interface PermissionDetailAminoMsg { + type: "/desmos.subspaces.v3.PermissionDetail"; + value: PermissionDetailAmino; +} /** User is a permission that has been set to a specific user */ export interface PermissionDetail_User { /** User for which the permission was set */ @@ -145,6 +420,21 @@ export interface PermissionDetail_User { /** Permissions set to the user */ permission: string[]; } +export interface PermissionDetail_UserProtoMsg { + typeUrl: "/desmos.subspaces.v3.User"; + value: Uint8Array; +} +/** User is a permission that has been set to a specific user */ +export interface PermissionDetail_UserAmino { + /** User for which the permission was set */ + user: string; + /** Permissions set to the user */ + permission: string[]; +} +export interface PermissionDetail_UserAminoMsg { + type: "/desmos.subspaces.v3.User"; + value: PermissionDetail_UserAmino; +} /** Group is a permission that has been set to a user group */ export interface PermissionDetail_Group { /** Unique id of the group */ @@ -152,6 +442,21 @@ export interface PermissionDetail_Group { /** Permissions set to the group */ permission: string[]; } +export interface PermissionDetail_GroupProtoMsg { + typeUrl: "/desmos.subspaces.v3.Group"; + value: Uint8Array; +} +/** Group is a permission that has been set to a user group */ +export interface PermissionDetail_GroupAmino { + /** Unique id of the group */ + group_id: number; + /** Permissions set to the group */ + permission: string[]; +} +export interface PermissionDetail_GroupAminoMsg { + type: "/desmos.subspaces.v3.Group"; + value: PermissionDetail_GroupAmino; +} /** * QueryUserAllowancesRequest is the request type for the Query/UserAllowances * RPC method @@ -164,6 +469,26 @@ export interface QueryUserAllowancesRequest { /** pagination defines an pagination for the request */ pagination?: PageRequest; } +export interface QueryUserAllowancesRequestProtoMsg { + typeUrl: "/desmos.subspaces.v3.QueryUserAllowancesRequest"; + value: Uint8Array; +} +/** + * QueryUserAllowancesRequest is the request type for the Query/UserAllowances + * RPC method + */ +export interface QueryUserAllowancesRequestAmino { + /** Id of the subspace for which to get the grant(s) */ + subspace_id: string; + /** (Optional) Address of the user that was granted an allowance */ + grantee: string; + /** pagination defines an pagination for the request */ + pagination?: PageRequestAmino; +} +export interface QueryUserAllowancesRequestAminoMsg { + type: "/desmos.subspaces.v3.QueryUserAllowancesRequest"; + value: QueryUserAllowancesRequestAmino; +} /** * QueryUserAllowancesResponse is the response type for the Query/UserAllowances * RPC method @@ -173,6 +498,23 @@ export interface QueryUserAllowancesResponse { /** pagination defines an pagination for the response */ pagination?: PageResponse; } +export interface QueryUserAllowancesResponseProtoMsg { + typeUrl: "/desmos.subspaces.v3.QueryUserAllowancesResponse"; + value: Uint8Array; +} +/** + * QueryUserAllowancesResponse is the response type for the Query/UserAllowances + * RPC method + */ +export interface QueryUserAllowancesResponseAmino { + grants: GrantAmino[]; + /** pagination defines an pagination for the response */ + pagination?: PageResponseAmino; +} +export interface QueryUserAllowancesResponseAminoMsg { + type: "/desmos.subspaces.v3.QueryUserAllowancesResponse"; + value: QueryUserAllowancesResponseAmino; +} /** * QueryGroupAllowancesRequest is the request type for the Query/GroupAllowances * RPC method @@ -185,6 +527,26 @@ export interface QueryGroupAllowancesRequest { /** pagination defines an pagination for the request */ pagination?: PageRequest; } +export interface QueryGroupAllowancesRequestProtoMsg { + typeUrl: "/desmos.subspaces.v3.QueryGroupAllowancesRequest"; + value: Uint8Array; +} +/** + * QueryGroupAllowancesRequest is the request type for the Query/GroupAllowances + * RPC method + */ +export interface QueryGroupAllowancesRequestAmino { + /** Id of the subspace for which to get the grant(s) */ + subspace_id: string; + /** (optional) Address of the user group that was granted the allowance(s) */ + group_id: number; + /** pagination defines an pagination for the request */ + pagination?: PageRequestAmino; +} +export interface QueryGroupAllowancesRequestAminoMsg { + type: "/desmos.subspaces.v3.QueryGroupAllowancesRequest"; + value: QueryGroupAllowancesRequestAmino; +} /** * QueryGroupAllowancesResponse is the response type for the * Query/GroupAllowances RPC method @@ -194,6 +556,23 @@ export interface QueryGroupAllowancesResponse { /** pagination defines an pagination for the response */ pagination?: PageResponse; } +export interface QueryGroupAllowancesResponseProtoMsg { + typeUrl: "/desmos.subspaces.v3.QueryGroupAllowancesResponse"; + value: Uint8Array; +} +/** + * QueryGroupAllowancesResponse is the response type for the + * Query/GroupAllowances RPC method + */ +export interface QueryGroupAllowancesResponseAmino { + grants: GrantAmino[]; + /** pagination defines an pagination for the response */ + pagination?: PageResponseAmino; +} +export interface QueryGroupAllowancesResponseAminoMsg { + type: "/desmos.subspaces.v3.QueryGroupAllowancesResponse"; + value: QueryGroupAllowancesResponseAmino; +} function createBaseQuerySubspacesRequest(): QuerySubspacesRequest { return { pagination: undefined, @@ -254,6 +633,35 @@ export const QuerySubspacesRequest = { : undefined; return message; }, + fromAmino(object: QuerySubspacesRequestAmino): QuerySubspacesRequest { + return { + pagination: object?.pagination + ? PageRequest.fromAmino(object.pagination) + : undefined, + }; + }, + toAmino(message: QuerySubspacesRequest): QuerySubspacesRequestAmino { + const obj: any = {}; + obj.pagination = message.pagination + ? PageRequest.toAmino(message.pagination) + : undefined; + return obj; + }, + fromAminoMsg(object: QuerySubspacesRequestAminoMsg): QuerySubspacesRequest { + return QuerySubspacesRequest.fromAmino(object.value); + }, + fromProtoMsg(message: QuerySubspacesRequestProtoMsg): QuerySubspacesRequest { + return QuerySubspacesRequest.decode(message.value); + }, + toProto(message: QuerySubspacesRequest): Uint8Array { + return QuerySubspacesRequest.encode(message).finish(); + }, + toProtoMsg(message: QuerySubspacesRequest): QuerySubspacesRequestProtoMsg { + return { + typeUrl: "/desmos.subspaces.v3.QuerySubspacesRequest", + value: QuerySubspacesRequest.encode(message).finish(), + }; + }, }; function createBaseQuerySubspacesResponse(): QuerySubspacesResponse { return { @@ -337,6 +745,47 @@ export const QuerySubspacesResponse = { : undefined; return message; }, + fromAmino(object: QuerySubspacesResponseAmino): QuerySubspacesResponse { + return { + subspaces: Array.isArray(object?.subspaces) + ? object.subspaces.map((e: any) => Subspace.fromAmino(e)) + : [], + pagination: object?.pagination + ? PageResponse.fromAmino(object.pagination) + : undefined, + }; + }, + toAmino(message: QuerySubspacesResponse): QuerySubspacesResponseAmino { + const obj: any = {}; + if (message.subspaces) { + obj.subspaces = message.subspaces.map((e) => + e ? Subspace.toAmino(e) : undefined + ); + } else { + obj.subspaces = []; + } + obj.pagination = message.pagination + ? PageResponse.toAmino(message.pagination) + : undefined; + return obj; + }, + fromAminoMsg(object: QuerySubspacesResponseAminoMsg): QuerySubspacesResponse { + return QuerySubspacesResponse.fromAmino(object.value); + }, + fromProtoMsg( + message: QuerySubspacesResponseProtoMsg + ): QuerySubspacesResponse { + return QuerySubspacesResponse.decode(message.value); + }, + toProto(message: QuerySubspacesResponse): Uint8Array { + return QuerySubspacesResponse.encode(message).finish(); + }, + toProtoMsg(message: QuerySubspacesResponse): QuerySubspacesResponseProtoMsg { + return { + typeUrl: "/desmos.subspaces.v3.QuerySubspacesResponse", + value: QuerySubspacesResponse.encode(message).finish(), + }; + }, }; function createBaseQuerySubspaceRequest(): QuerySubspaceRequest { return { @@ -396,6 +845,33 @@ export const QuerySubspaceRequest = { : Long.UZERO; return message; }, + fromAmino(object: QuerySubspaceRequestAmino): QuerySubspaceRequest { + return { + subspaceId: Long.fromString(object.subspace_id), + }; + }, + toAmino(message: QuerySubspaceRequest): QuerySubspaceRequestAmino { + const obj: any = {}; + obj.subspace_id = message.subspaceId + ? message.subspaceId.toString() + : undefined; + return obj; + }, + fromAminoMsg(object: QuerySubspaceRequestAminoMsg): QuerySubspaceRequest { + return QuerySubspaceRequest.fromAmino(object.value); + }, + fromProtoMsg(message: QuerySubspaceRequestProtoMsg): QuerySubspaceRequest { + return QuerySubspaceRequest.decode(message.value); + }, + toProto(message: QuerySubspaceRequest): Uint8Array { + return QuerySubspaceRequest.encode(message).finish(); + }, + toProtoMsg(message: QuerySubspaceRequest): QuerySubspaceRequestProtoMsg { + return { + typeUrl: "/desmos.subspaces.v3.QuerySubspaceRequest", + value: QuerySubspaceRequest.encode(message).finish(), + }; + }, }; function createBaseQuerySubspaceResponse(): QuerySubspaceResponse { return { @@ -457,6 +933,35 @@ export const QuerySubspaceResponse = { : undefined; return message; }, + fromAmino(object: QuerySubspaceResponseAmino): QuerySubspaceResponse { + return { + subspace: object?.subspace + ? Subspace.fromAmino(object.subspace) + : undefined, + }; + }, + toAmino(message: QuerySubspaceResponse): QuerySubspaceResponseAmino { + const obj: any = {}; + obj.subspace = message.subspace + ? Subspace.toAmino(message.subspace) + : undefined; + return obj; + }, + fromAminoMsg(object: QuerySubspaceResponseAminoMsg): QuerySubspaceResponse { + return QuerySubspaceResponse.fromAmino(object.value); + }, + fromProtoMsg(message: QuerySubspaceResponseProtoMsg): QuerySubspaceResponse { + return QuerySubspaceResponse.decode(message.value); + }, + toProto(message: QuerySubspaceResponse): Uint8Array { + return QuerySubspaceResponse.encode(message).finish(); + }, + toProtoMsg(message: QuerySubspaceResponse): QuerySubspaceResponseProtoMsg { + return { + typeUrl: "/desmos.subspaces.v3.QuerySubspaceResponse", + value: QuerySubspaceResponse.encode(message).finish(), + }; + }, }; function createBaseQuerySectionsRequest(): QuerySectionsRequest { return { @@ -534,6 +1039,39 @@ export const QuerySectionsRequest = { : undefined; return message; }, + fromAmino(object: QuerySectionsRequestAmino): QuerySectionsRequest { + return { + subspaceId: Long.fromString(object.subspace_id), + pagination: object?.pagination + ? PageRequest.fromAmino(object.pagination) + : undefined, + }; + }, + toAmino(message: QuerySectionsRequest): QuerySectionsRequestAmino { + const obj: any = {}; + obj.subspace_id = message.subspaceId + ? message.subspaceId.toString() + : undefined; + obj.pagination = message.pagination + ? PageRequest.toAmino(message.pagination) + : undefined; + return obj; + }, + fromAminoMsg(object: QuerySectionsRequestAminoMsg): QuerySectionsRequest { + return QuerySectionsRequest.fromAmino(object.value); + }, + fromProtoMsg(message: QuerySectionsRequestProtoMsg): QuerySectionsRequest { + return QuerySectionsRequest.decode(message.value); + }, + toProto(message: QuerySectionsRequest): Uint8Array { + return QuerySectionsRequest.encode(message).finish(); + }, + toProtoMsg(message: QuerySectionsRequest): QuerySectionsRequestProtoMsg { + return { + typeUrl: "/desmos.subspaces.v3.QuerySectionsRequest", + value: QuerySectionsRequest.encode(message).finish(), + }; + }, }; function createBaseQuerySectionsResponse(): QuerySectionsResponse { return { @@ -617,6 +1155,45 @@ export const QuerySectionsResponse = { : undefined; return message; }, + fromAmino(object: QuerySectionsResponseAmino): QuerySectionsResponse { + return { + sections: Array.isArray(object?.sections) + ? object.sections.map((e: any) => Section.fromAmino(e)) + : [], + pagination: object?.pagination + ? PageResponse.fromAmino(object.pagination) + : undefined, + }; + }, + toAmino(message: QuerySectionsResponse): QuerySectionsResponseAmino { + const obj: any = {}; + if (message.sections) { + obj.sections = message.sections.map((e) => + e ? Section.toAmino(e) : undefined + ); + } else { + obj.sections = []; + } + obj.pagination = message.pagination + ? PageResponse.toAmino(message.pagination) + : undefined; + return obj; + }, + fromAminoMsg(object: QuerySectionsResponseAminoMsg): QuerySectionsResponse { + return QuerySectionsResponse.fromAmino(object.value); + }, + fromProtoMsg(message: QuerySectionsResponseProtoMsg): QuerySectionsResponse { + return QuerySectionsResponse.decode(message.value); + }, + toProto(message: QuerySectionsResponse): Uint8Array { + return QuerySectionsResponse.encode(message).finish(); + }, + toProtoMsg(message: QuerySectionsResponse): QuerySectionsResponseProtoMsg { + return { + typeUrl: "/desmos.subspaces.v3.QuerySectionsResponse", + value: QuerySectionsResponse.encode(message).finish(), + }; + }, }; function createBaseQuerySectionRequest(): QuerySectionRequest { return { @@ -684,6 +1261,35 @@ export const QuerySectionRequest = { message.sectionId = object.sectionId ?? 0; return message; }, + fromAmino(object: QuerySectionRequestAmino): QuerySectionRequest { + return { + subspaceId: Long.fromString(object.subspace_id), + sectionId: object.section_id, + }; + }, + toAmino(message: QuerySectionRequest): QuerySectionRequestAmino { + const obj: any = {}; + obj.subspace_id = message.subspaceId + ? message.subspaceId.toString() + : undefined; + obj.section_id = message.sectionId; + return obj; + }, + fromAminoMsg(object: QuerySectionRequestAminoMsg): QuerySectionRequest { + return QuerySectionRequest.fromAmino(object.value); + }, + fromProtoMsg(message: QuerySectionRequestProtoMsg): QuerySectionRequest { + return QuerySectionRequest.decode(message.value); + }, + toProto(message: QuerySectionRequest): Uint8Array { + return QuerySectionRequest.encode(message).finish(); + }, + toProtoMsg(message: QuerySectionRequest): QuerySectionRequestProtoMsg { + return { + typeUrl: "/desmos.subspaces.v3.QuerySectionRequest", + value: QuerySectionRequest.encode(message).finish(), + }; + }, }; function createBaseQuerySectionResponse(): QuerySectionResponse { return { @@ -745,6 +1351,33 @@ export const QuerySectionResponse = { : undefined; return message; }, + fromAmino(object: QuerySectionResponseAmino): QuerySectionResponse { + return { + section: object?.section ? Section.fromAmino(object.section) : undefined, + }; + }, + toAmino(message: QuerySectionResponse): QuerySectionResponseAmino { + const obj: any = {}; + obj.section = message.section + ? Section.toAmino(message.section) + : undefined; + return obj; + }, + fromAminoMsg(object: QuerySectionResponseAminoMsg): QuerySectionResponse { + return QuerySectionResponse.fromAmino(object.value); + }, + fromProtoMsg(message: QuerySectionResponseProtoMsg): QuerySectionResponse { + return QuerySectionResponse.decode(message.value); + }, + toProto(message: QuerySectionResponse): Uint8Array { + return QuerySectionResponse.encode(message).finish(); + }, + toProtoMsg(message: QuerySectionResponse): QuerySectionResponseProtoMsg { + return { + typeUrl: "/desmos.subspaces.v3.QuerySectionResponse", + value: QuerySectionResponse.encode(message).finish(), + }; + }, }; function createBaseQueryUserGroupsRequest(): QueryUserGroupsRequest { return { @@ -833,6 +1466,43 @@ export const QueryUserGroupsRequest = { : undefined; return message; }, + fromAmino(object: QueryUserGroupsRequestAmino): QueryUserGroupsRequest { + return { + subspaceId: Long.fromString(object.subspace_id), + sectionId: object.section_id, + pagination: object?.pagination + ? PageRequest.fromAmino(object.pagination) + : undefined, + }; + }, + toAmino(message: QueryUserGroupsRequest): QueryUserGroupsRequestAmino { + const obj: any = {}; + obj.subspace_id = message.subspaceId + ? message.subspaceId.toString() + : undefined; + obj.section_id = message.sectionId; + obj.pagination = message.pagination + ? PageRequest.toAmino(message.pagination) + : undefined; + return obj; + }, + fromAminoMsg(object: QueryUserGroupsRequestAminoMsg): QueryUserGroupsRequest { + return QueryUserGroupsRequest.fromAmino(object.value); + }, + fromProtoMsg( + message: QueryUserGroupsRequestProtoMsg + ): QueryUserGroupsRequest { + return QueryUserGroupsRequest.decode(message.value); + }, + toProto(message: QueryUserGroupsRequest): Uint8Array { + return QueryUserGroupsRequest.encode(message).finish(); + }, + toProtoMsg(message: QueryUserGroupsRequest): QueryUserGroupsRequestProtoMsg { + return { + typeUrl: "/desmos.subspaces.v3.QueryUserGroupsRequest", + value: QueryUserGroupsRequest.encode(message).finish(), + }; + }, }; function createBaseQueryUserGroupsResponse(): QueryUserGroupsResponse { return { @@ -904,16 +1574,61 @@ export const QueryUserGroupsResponse = { : undefined); return obj; }, - fromPartial, I>>( - object: I + fromPartial, I>>( + object: I + ): QueryUserGroupsResponse { + const message = createBaseQueryUserGroupsResponse(); + message.groups = object.groups?.map((e) => UserGroup.fromPartial(e)) || []; + message.pagination = + object.pagination !== undefined && object.pagination !== null + ? PageResponse.fromPartial(object.pagination) + : undefined; + return message; + }, + fromAmino(object: QueryUserGroupsResponseAmino): QueryUserGroupsResponse { + return { + groups: Array.isArray(object?.groups) + ? object.groups.map((e: any) => UserGroup.fromAmino(e)) + : [], + pagination: object?.pagination + ? PageResponse.fromAmino(object.pagination) + : undefined, + }; + }, + toAmino(message: QueryUserGroupsResponse): QueryUserGroupsResponseAmino { + const obj: any = {}; + if (message.groups) { + obj.groups = message.groups.map((e) => + e ? UserGroup.toAmino(e) : undefined + ); + } else { + obj.groups = []; + } + obj.pagination = message.pagination + ? PageResponse.toAmino(message.pagination) + : undefined; + return obj; + }, + fromAminoMsg( + object: QueryUserGroupsResponseAminoMsg ): QueryUserGroupsResponse { - const message = createBaseQueryUserGroupsResponse(); - message.groups = object.groups?.map((e) => UserGroup.fromPartial(e)) || []; - message.pagination = - object.pagination !== undefined && object.pagination !== null - ? PageResponse.fromPartial(object.pagination) - : undefined; - return message; + return QueryUserGroupsResponse.fromAmino(object.value); + }, + fromProtoMsg( + message: QueryUserGroupsResponseProtoMsg + ): QueryUserGroupsResponse { + return QueryUserGroupsResponse.decode(message.value); + }, + toProto(message: QueryUserGroupsResponse): Uint8Array { + return QueryUserGroupsResponse.encode(message).finish(); + }, + toProtoMsg( + message: QueryUserGroupsResponse + ): QueryUserGroupsResponseProtoMsg { + return { + typeUrl: "/desmos.subspaces.v3.QueryUserGroupsResponse", + value: QueryUserGroupsResponse.encode(message).finish(), + }; }, }; function createBaseQueryUserGroupRequest(): QueryUserGroupRequest { @@ -985,6 +1700,35 @@ export const QueryUserGroupRequest = { message.groupId = object.groupId ?? 0; return message; }, + fromAmino(object: QueryUserGroupRequestAmino): QueryUserGroupRequest { + return { + subspaceId: Long.fromString(object.subspace_id), + groupId: object.group_id, + }; + }, + toAmino(message: QueryUserGroupRequest): QueryUserGroupRequestAmino { + const obj: any = {}; + obj.subspace_id = message.subspaceId + ? message.subspaceId.toString() + : undefined; + obj.group_id = message.groupId; + return obj; + }, + fromAminoMsg(object: QueryUserGroupRequestAminoMsg): QueryUserGroupRequest { + return QueryUserGroupRequest.fromAmino(object.value); + }, + fromProtoMsg(message: QueryUserGroupRequestProtoMsg): QueryUserGroupRequest { + return QueryUserGroupRequest.decode(message.value); + }, + toProto(message: QueryUserGroupRequest): Uint8Array { + return QueryUserGroupRequest.encode(message).finish(); + }, + toProtoMsg(message: QueryUserGroupRequest): QueryUserGroupRequestProtoMsg { + return { + typeUrl: "/desmos.subspaces.v3.QueryUserGroupRequest", + value: QueryUserGroupRequest.encode(message).finish(), + }; + }, }; function createBaseQueryUserGroupResponse(): QueryUserGroupResponse { return { @@ -1042,6 +1786,33 @@ export const QueryUserGroupResponse = { : undefined; return message; }, + fromAmino(object: QueryUserGroupResponseAmino): QueryUserGroupResponse { + return { + group: object?.group ? UserGroup.fromAmino(object.group) : undefined, + }; + }, + toAmino(message: QueryUserGroupResponse): QueryUserGroupResponseAmino { + const obj: any = {}; + obj.group = message.group ? UserGroup.toAmino(message.group) : undefined; + return obj; + }, + fromAminoMsg(object: QueryUserGroupResponseAminoMsg): QueryUserGroupResponse { + return QueryUserGroupResponse.fromAmino(object.value); + }, + fromProtoMsg( + message: QueryUserGroupResponseProtoMsg + ): QueryUserGroupResponse { + return QueryUserGroupResponse.decode(message.value); + }, + toProto(message: QueryUserGroupResponse): Uint8Array { + return QueryUserGroupResponse.encode(message).finish(); + }, + toProtoMsg(message: QueryUserGroupResponse): QueryUserGroupResponseProtoMsg { + return { + typeUrl: "/desmos.subspaces.v3.QueryUserGroupResponse", + value: QueryUserGroupResponse.encode(message).finish(), + }; + }, }; function createBaseQueryUserGroupMembersRequest(): QueryUserGroupMembersRequest { return { @@ -1130,6 +1901,51 @@ export const QueryUserGroupMembersRequest = { : undefined; return message; }, + fromAmino( + object: QueryUserGroupMembersRequestAmino + ): QueryUserGroupMembersRequest { + return { + subspaceId: Long.fromString(object.subspace_id), + groupId: object.group_id, + pagination: object?.pagination + ? PageRequest.fromAmino(object.pagination) + : undefined, + }; + }, + toAmino( + message: QueryUserGroupMembersRequest + ): QueryUserGroupMembersRequestAmino { + const obj: any = {}; + obj.subspace_id = message.subspaceId + ? message.subspaceId.toString() + : undefined; + obj.group_id = message.groupId; + obj.pagination = message.pagination + ? PageRequest.toAmino(message.pagination) + : undefined; + return obj; + }, + fromAminoMsg( + object: QueryUserGroupMembersRequestAminoMsg + ): QueryUserGroupMembersRequest { + return QueryUserGroupMembersRequest.fromAmino(object.value); + }, + fromProtoMsg( + message: QueryUserGroupMembersRequestProtoMsg + ): QueryUserGroupMembersRequest { + return QueryUserGroupMembersRequest.decode(message.value); + }, + toProto(message: QueryUserGroupMembersRequest): Uint8Array { + return QueryUserGroupMembersRequest.encode(message).finish(); + }, + toProtoMsg( + message: QueryUserGroupMembersRequest + ): QueryUserGroupMembersRequestProtoMsg { + return { + typeUrl: "/desmos.subspaces.v3.QueryUserGroupMembersRequest", + value: QueryUserGroupMembersRequest.encode(message).finish(), + }; + }, }; function createBaseQueryUserGroupMembersResponse(): QueryUserGroupMembersResponse { return { @@ -1210,6 +2026,53 @@ export const QueryUserGroupMembersResponse = { : undefined; return message; }, + fromAmino( + object: QueryUserGroupMembersResponseAmino + ): QueryUserGroupMembersResponse { + return { + members: Array.isArray(object?.members) + ? object.members.map((e: any) => e) + : [], + pagination: object?.pagination + ? PageResponse.fromAmino(object.pagination) + : undefined, + }; + }, + toAmino( + message: QueryUserGroupMembersResponse + ): QueryUserGroupMembersResponseAmino { + const obj: any = {}; + if (message.members) { + obj.members = message.members.map((e) => e); + } else { + obj.members = []; + } + obj.pagination = message.pagination + ? PageResponse.toAmino(message.pagination) + : undefined; + return obj; + }, + fromAminoMsg( + object: QueryUserGroupMembersResponseAminoMsg + ): QueryUserGroupMembersResponse { + return QueryUserGroupMembersResponse.fromAmino(object.value); + }, + fromProtoMsg( + message: QueryUserGroupMembersResponseProtoMsg + ): QueryUserGroupMembersResponse { + return QueryUserGroupMembersResponse.decode(message.value); + }, + toProto(message: QueryUserGroupMembersResponse): Uint8Array { + return QueryUserGroupMembersResponse.encode(message).finish(); + }, + toProtoMsg( + message: QueryUserGroupMembersResponse + ): QueryUserGroupMembersResponseProtoMsg { + return { + typeUrl: "/desmos.subspaces.v3.QueryUserGroupMembersResponse", + value: QueryUserGroupMembersResponse.encode(message).finish(), + }; + }, }; function createBaseQueryUserPermissionsRequest(): QueryUserPermissionsRequest { return { @@ -1290,6 +2153,47 @@ export const QueryUserPermissionsRequest = { message.user = object.user ?? ""; return message; }, + fromAmino( + object: QueryUserPermissionsRequestAmino + ): QueryUserPermissionsRequest { + return { + subspaceId: Long.fromString(object.subspace_id), + sectionId: object.section_id, + user: object.user, + }; + }, + toAmino( + message: QueryUserPermissionsRequest + ): QueryUserPermissionsRequestAmino { + const obj: any = {}; + obj.subspace_id = message.subspaceId + ? message.subspaceId.toString() + : undefined; + obj.section_id = message.sectionId; + obj.user = message.user; + return obj; + }, + fromAminoMsg( + object: QueryUserPermissionsRequestAminoMsg + ): QueryUserPermissionsRequest { + return QueryUserPermissionsRequest.fromAmino(object.value); + }, + fromProtoMsg( + message: QueryUserPermissionsRequestProtoMsg + ): QueryUserPermissionsRequest { + return QueryUserPermissionsRequest.decode(message.value); + }, + toProto(message: QueryUserPermissionsRequest): Uint8Array { + return QueryUserPermissionsRequest.encode(message).finish(); + }, + toProtoMsg( + message: QueryUserPermissionsRequest + ): QueryUserPermissionsRequestProtoMsg { + return { + typeUrl: "/desmos.subspaces.v3.QueryUserPermissionsRequest", + value: QueryUserPermissionsRequest.encode(message).finish(), + }; + }, }; function createBaseQueryUserPermissionsResponse(): QueryUserPermissionsResponse { return { @@ -1370,6 +2274,57 @@ export const QueryUserPermissionsResponse = { object.details?.map((e) => PermissionDetail.fromPartial(e)) || []; return message; }, + fromAmino( + object: QueryUserPermissionsResponseAmino + ): QueryUserPermissionsResponse { + return { + permissions: Array.isArray(object?.permissions) + ? object.permissions.map((e: any) => e) + : [], + details: Array.isArray(object?.details) + ? object.details.map((e: any) => PermissionDetail.fromAmino(e)) + : [], + }; + }, + toAmino( + message: QueryUserPermissionsResponse + ): QueryUserPermissionsResponseAmino { + const obj: any = {}; + if (message.permissions) { + obj.permissions = message.permissions.map((e) => e); + } else { + obj.permissions = []; + } + if (message.details) { + obj.details = message.details.map((e) => + e ? PermissionDetail.toAmino(e) : undefined + ); + } else { + obj.details = []; + } + return obj; + }, + fromAminoMsg( + object: QueryUserPermissionsResponseAminoMsg + ): QueryUserPermissionsResponse { + return QueryUserPermissionsResponse.fromAmino(object.value); + }, + fromProtoMsg( + message: QueryUserPermissionsResponseProtoMsg + ): QueryUserPermissionsResponse { + return QueryUserPermissionsResponse.decode(message.value); + }, + toProto(message: QueryUserPermissionsResponse): Uint8Array { + return QueryUserPermissionsResponse.encode(message).finish(); + }, + toProtoMsg( + message: QueryUserPermissionsResponse + ): QueryUserPermissionsResponseProtoMsg { + return { + typeUrl: "/desmos.subspaces.v3.QueryUserPermissionsResponse", + value: QueryUserPermissionsResponse.encode(message).finish(), + }; + }, }; function createBasePermissionDetail(): PermissionDetail { return { @@ -1482,6 +2437,47 @@ export const PermissionDetail = { : undefined; return message; }, + fromAmino(object: PermissionDetailAmino): PermissionDetail { + return { + subspaceId: Long.fromString(object.subspace_id), + sectionId: object.section_id, + user: object?.user + ? PermissionDetail_User.fromAmino(object.user) + : undefined, + group: object?.group + ? PermissionDetail_Group.fromAmino(object.group) + : undefined, + }; + }, + toAmino(message: PermissionDetail): PermissionDetailAmino { + const obj: any = {}; + obj.subspace_id = message.subspaceId + ? message.subspaceId.toString() + : undefined; + obj.section_id = message.sectionId; + obj.user = message.user + ? PermissionDetail_User.toAmino(message.user) + : undefined; + obj.group = message.group + ? PermissionDetail_Group.toAmino(message.group) + : undefined; + return obj; + }, + fromAminoMsg(object: PermissionDetailAminoMsg): PermissionDetail { + return PermissionDetail.fromAmino(object.value); + }, + fromProtoMsg(message: PermissionDetailProtoMsg): PermissionDetail { + return PermissionDetail.decode(message.value); + }, + toProto(message: PermissionDetail): Uint8Array { + return PermissionDetail.encode(message).finish(); + }, + toProtoMsg(message: PermissionDetail): PermissionDetailProtoMsg { + return { + typeUrl: "/desmos.subspaces.v3.PermissionDetail", + value: PermissionDetail.encode(message).finish(), + }; + }, }; function createBasePermissionDetail_User(): PermissionDetail_User { return { @@ -1551,6 +2547,39 @@ export const PermissionDetail_User = { message.permission = object.permission?.map((e) => e) || []; return message; }, + fromAmino(object: PermissionDetail_UserAmino): PermissionDetail_User { + return { + user: object.user, + permission: Array.isArray(object?.permission) + ? object.permission.map((e: any) => e) + : [], + }; + }, + toAmino(message: PermissionDetail_User): PermissionDetail_UserAmino { + const obj: any = {}; + obj.user = message.user; + if (message.permission) { + obj.permission = message.permission.map((e) => e); + } else { + obj.permission = []; + } + return obj; + }, + fromAminoMsg(object: PermissionDetail_UserAminoMsg): PermissionDetail_User { + return PermissionDetail_User.fromAmino(object.value); + }, + fromProtoMsg(message: PermissionDetail_UserProtoMsg): PermissionDetail_User { + return PermissionDetail_User.decode(message.value); + }, + toProto(message: PermissionDetail_User): Uint8Array { + return PermissionDetail_User.encode(message).finish(); + }, + toProtoMsg(message: PermissionDetail_User): PermissionDetail_UserProtoMsg { + return { + typeUrl: "/desmos.subspaces.v3.User", + value: PermissionDetail_User.encode(message).finish(), + }; + }, }; function createBasePermissionDetail_Group(): PermissionDetail_Group { return { @@ -1621,6 +2650,41 @@ export const PermissionDetail_Group = { message.permission = object.permission?.map((e) => e) || []; return message; }, + fromAmino(object: PermissionDetail_GroupAmino): PermissionDetail_Group { + return { + groupId: object.group_id, + permission: Array.isArray(object?.permission) + ? object.permission.map((e: any) => e) + : [], + }; + }, + toAmino(message: PermissionDetail_Group): PermissionDetail_GroupAmino { + const obj: any = {}; + obj.group_id = message.groupId; + if (message.permission) { + obj.permission = message.permission.map((e) => e); + } else { + obj.permission = []; + } + return obj; + }, + fromAminoMsg(object: PermissionDetail_GroupAminoMsg): PermissionDetail_Group { + return PermissionDetail_Group.fromAmino(object.value); + }, + fromProtoMsg( + message: PermissionDetail_GroupProtoMsg + ): PermissionDetail_Group { + return PermissionDetail_Group.decode(message.value); + }, + toProto(message: PermissionDetail_Group): Uint8Array { + return PermissionDetail_Group.encode(message).finish(); + }, + toProtoMsg(message: PermissionDetail_Group): PermissionDetail_GroupProtoMsg { + return { + typeUrl: "/desmos.subspaces.v3.Group", + value: PermissionDetail_Group.encode(message).finish(), + }; + }, }; function createBaseQueryUserAllowancesRequest(): QueryUserAllowancesRequest { return { @@ -1708,6 +2772,51 @@ export const QueryUserAllowancesRequest = { : undefined; return message; }, + fromAmino( + object: QueryUserAllowancesRequestAmino + ): QueryUserAllowancesRequest { + return { + subspaceId: Long.fromString(object.subspace_id), + grantee: object.grantee, + pagination: object?.pagination + ? PageRequest.fromAmino(object.pagination) + : undefined, + }; + }, + toAmino( + message: QueryUserAllowancesRequest + ): QueryUserAllowancesRequestAmino { + const obj: any = {}; + obj.subspace_id = message.subspaceId + ? message.subspaceId.toString() + : undefined; + obj.grantee = message.grantee; + obj.pagination = message.pagination + ? PageRequest.toAmino(message.pagination) + : undefined; + return obj; + }, + fromAminoMsg( + object: QueryUserAllowancesRequestAminoMsg + ): QueryUserAllowancesRequest { + return QueryUserAllowancesRequest.fromAmino(object.value); + }, + fromProtoMsg( + message: QueryUserAllowancesRequestProtoMsg + ): QueryUserAllowancesRequest { + return QueryUserAllowancesRequest.decode(message.value); + }, + toProto(message: QueryUserAllowancesRequest): Uint8Array { + return QueryUserAllowancesRequest.encode(message).finish(); + }, + toProtoMsg( + message: QueryUserAllowancesRequest + ): QueryUserAllowancesRequestProtoMsg { + return { + typeUrl: "/desmos.subspaces.v3.QueryUserAllowancesRequest", + value: QueryUserAllowancesRequest.encode(message).finish(), + }; + }, }; function createBaseQueryUserAllowancesResponse(): QueryUserAllowancesResponse { return { @@ -1788,6 +2897,55 @@ export const QueryUserAllowancesResponse = { : undefined; return message; }, + fromAmino( + object: QueryUserAllowancesResponseAmino + ): QueryUserAllowancesResponse { + return { + grants: Array.isArray(object?.grants) + ? object.grants.map((e: any) => Grant.fromAmino(e)) + : [], + pagination: object?.pagination + ? PageResponse.fromAmino(object.pagination) + : undefined, + }; + }, + toAmino( + message: QueryUserAllowancesResponse + ): QueryUserAllowancesResponseAmino { + const obj: any = {}; + if (message.grants) { + obj.grants = message.grants.map((e) => + e ? Grant.toAmino(e) : undefined + ); + } else { + obj.grants = []; + } + obj.pagination = message.pagination + ? PageResponse.toAmino(message.pagination) + : undefined; + return obj; + }, + fromAminoMsg( + object: QueryUserAllowancesResponseAminoMsg + ): QueryUserAllowancesResponse { + return QueryUserAllowancesResponse.fromAmino(object.value); + }, + fromProtoMsg( + message: QueryUserAllowancesResponseProtoMsg + ): QueryUserAllowancesResponse { + return QueryUserAllowancesResponse.decode(message.value); + }, + toProto(message: QueryUserAllowancesResponse): Uint8Array { + return QueryUserAllowancesResponse.encode(message).finish(); + }, + toProtoMsg( + message: QueryUserAllowancesResponse + ): QueryUserAllowancesResponseProtoMsg { + return { + typeUrl: "/desmos.subspaces.v3.QueryUserAllowancesResponse", + value: QueryUserAllowancesResponse.encode(message).finish(), + }; + }, }; function createBaseQueryGroupAllowancesRequest(): QueryGroupAllowancesRequest { return { @@ -1876,6 +3034,51 @@ export const QueryGroupAllowancesRequest = { : undefined; return message; }, + fromAmino( + object: QueryGroupAllowancesRequestAmino + ): QueryGroupAllowancesRequest { + return { + subspaceId: Long.fromString(object.subspace_id), + groupId: object.group_id, + pagination: object?.pagination + ? PageRequest.fromAmino(object.pagination) + : undefined, + }; + }, + toAmino( + message: QueryGroupAllowancesRequest + ): QueryGroupAllowancesRequestAmino { + const obj: any = {}; + obj.subspace_id = message.subspaceId + ? message.subspaceId.toString() + : undefined; + obj.group_id = message.groupId; + obj.pagination = message.pagination + ? PageRequest.toAmino(message.pagination) + : undefined; + return obj; + }, + fromAminoMsg( + object: QueryGroupAllowancesRequestAminoMsg + ): QueryGroupAllowancesRequest { + return QueryGroupAllowancesRequest.fromAmino(object.value); + }, + fromProtoMsg( + message: QueryGroupAllowancesRequestProtoMsg + ): QueryGroupAllowancesRequest { + return QueryGroupAllowancesRequest.decode(message.value); + }, + toProto(message: QueryGroupAllowancesRequest): Uint8Array { + return QueryGroupAllowancesRequest.encode(message).finish(); + }, + toProtoMsg( + message: QueryGroupAllowancesRequest + ): QueryGroupAllowancesRequestProtoMsg { + return { + typeUrl: "/desmos.subspaces.v3.QueryGroupAllowancesRequest", + value: QueryGroupAllowancesRequest.encode(message).finish(), + }; + }, }; function createBaseQueryGroupAllowancesResponse(): QueryGroupAllowancesResponse { return { @@ -1956,6 +3159,55 @@ export const QueryGroupAllowancesResponse = { : undefined; return message; }, + fromAmino( + object: QueryGroupAllowancesResponseAmino + ): QueryGroupAllowancesResponse { + return { + grants: Array.isArray(object?.grants) + ? object.grants.map((e: any) => Grant.fromAmino(e)) + : [], + pagination: object?.pagination + ? PageResponse.fromAmino(object.pagination) + : undefined, + }; + }, + toAmino( + message: QueryGroupAllowancesResponse + ): QueryGroupAllowancesResponseAmino { + const obj: any = {}; + if (message.grants) { + obj.grants = message.grants.map((e) => + e ? Grant.toAmino(e) : undefined + ); + } else { + obj.grants = []; + } + obj.pagination = message.pagination + ? PageResponse.toAmino(message.pagination) + : undefined; + return obj; + }, + fromAminoMsg( + object: QueryGroupAllowancesResponseAminoMsg + ): QueryGroupAllowancesResponse { + return QueryGroupAllowancesResponse.fromAmino(object.value); + }, + fromProtoMsg( + message: QueryGroupAllowancesResponseProtoMsg + ): QueryGroupAllowancesResponse { + return QueryGroupAllowancesResponse.decode(message.value); + }, + toProto(message: QueryGroupAllowancesResponse): Uint8Array { + return QueryGroupAllowancesResponse.encode(message).finish(); + }, + toProtoMsg( + message: QueryGroupAllowancesResponse + ): QueryGroupAllowancesResponseProtoMsg { + return { + typeUrl: "/desmos.subspaces.v3.QueryGroupAllowancesResponse", + value: QueryGroupAllowancesResponse.encode(message).finish(), + }; + }, }; /** Query defines the gRPC querier service */ export interface Query { diff --git a/packages/types/src/desmos/supply/v1/query.ts b/packages/types/src/desmos/supply/v1/query.ts index 8f245cf8b..e1c3eb0a7 100644 --- a/packages/types/src/desmos/supply/v1/query.ts +++ b/packages/types/src/desmos/supply/v1/query.ts @@ -12,10 +12,40 @@ export interface QueryTotalRequest { */ dividerExponent: Long; } +export interface QueryTotalRequestProtoMsg { + typeUrl: "/desmos.supply.v1.QueryTotalRequest"; + value: Uint8Array; +} +/** QueryTotalRequest is the request type for Query/Total RPC method */ +export interface QueryTotalRequestAmino { + /** coin denom to query the circulating supply for */ + denom: string; + /** + * divider_exponent is a factor used to power the divider used to convert the + * supply to the desired representation + */ + divider_exponent: string; +} +export interface QueryTotalRequestAminoMsg { + type: "/desmos.supply.v1.QueryTotalRequest"; + value: QueryTotalRequestAmino; +} /** QueryTotalResponse is the response type for the Query/Total RPC method */ export interface QueryTotalResponse { totalSupply: string; } +export interface QueryTotalResponseProtoMsg { + typeUrl: "/desmos.supply.v1.QueryTotalResponse"; + value: Uint8Array; +} +/** QueryTotalResponse is the response type for the Query/Total RPC method */ +export interface QueryTotalResponseAmino { + total_supply: string; +} +export interface QueryTotalResponseAminoMsg { + type: "/desmos.supply.v1.QueryTotalResponse"; + value: QueryTotalResponseAmino; +} /** * QueryCirculatingRequest is the request type for the Query/Circulating RPC * method @@ -29,6 +59,27 @@ export interface QueryCirculatingRequest { */ dividerExponent: Long; } +export interface QueryCirculatingRequestProtoMsg { + typeUrl: "/desmos.supply.v1.QueryCirculatingRequest"; + value: Uint8Array; +} +/** + * QueryCirculatingRequest is the request type for the Query/Circulating RPC + * method + */ +export interface QueryCirculatingRequestAmino { + /** coin denom to query the circulating supply for */ + denom: string; + /** + * divider_exponent is a factor used to power the divider used to convert the + * supply to the desired representation + */ + divider_exponent: string; +} +export interface QueryCirculatingRequestAminoMsg { + type: "/desmos.supply.v1.QueryCirculatingRequest"; + value: QueryCirculatingRequestAmino; +} /** * QueryCirculatingResponse is the response type for the Query/Circulating RPC * method @@ -36,6 +87,21 @@ export interface QueryCirculatingRequest { export interface QueryCirculatingResponse { circulatingSupply: string; } +export interface QueryCirculatingResponseProtoMsg { + typeUrl: "/desmos.supply.v1.QueryCirculatingResponse"; + value: Uint8Array; +} +/** + * QueryCirculatingResponse is the response type for the Query/Circulating RPC + * method + */ +export interface QueryCirculatingResponseAmino { + circulating_supply: string; +} +export interface QueryCirculatingResponseAminoMsg { + type: "/desmos.supply.v1.QueryCirculatingResponse"; + value: QueryCirculatingResponseAmino; +} function createBaseQueryTotalRequest(): QueryTotalRequest { return { denom: "", @@ -103,6 +169,35 @@ export const QueryTotalRequest = { : Long.UZERO; return message; }, + fromAmino(object: QueryTotalRequestAmino): QueryTotalRequest { + return { + denom: object.denom, + dividerExponent: Long.fromString(object.divider_exponent), + }; + }, + toAmino(message: QueryTotalRequest): QueryTotalRequestAmino { + const obj: any = {}; + obj.denom = message.denom; + obj.divider_exponent = message.dividerExponent + ? message.dividerExponent.toString() + : undefined; + return obj; + }, + fromAminoMsg(object: QueryTotalRequestAminoMsg): QueryTotalRequest { + return QueryTotalRequest.fromAmino(object.value); + }, + fromProtoMsg(message: QueryTotalRequestProtoMsg): QueryTotalRequest { + return QueryTotalRequest.decode(message.value); + }, + toProto(message: QueryTotalRequest): Uint8Array { + return QueryTotalRequest.encode(message).finish(); + }, + toProtoMsg(message: QueryTotalRequest): QueryTotalRequestProtoMsg { + return { + typeUrl: "/desmos.supply.v1.QueryTotalRequest", + value: QueryTotalRequest.encode(message).finish(), + }; + }, }; function createBaseQueryTotalResponse(): QueryTotalResponse { return { @@ -154,6 +249,31 @@ export const QueryTotalResponse = { message.totalSupply = object.totalSupply ?? ""; return message; }, + fromAmino(object: QueryTotalResponseAmino): QueryTotalResponse { + return { + totalSupply: object.total_supply, + }; + }, + toAmino(message: QueryTotalResponse): QueryTotalResponseAmino { + const obj: any = {}; + obj.total_supply = message.totalSupply; + return obj; + }, + fromAminoMsg(object: QueryTotalResponseAminoMsg): QueryTotalResponse { + return QueryTotalResponse.fromAmino(object.value); + }, + fromProtoMsg(message: QueryTotalResponseProtoMsg): QueryTotalResponse { + return QueryTotalResponse.decode(message.value); + }, + toProto(message: QueryTotalResponse): Uint8Array { + return QueryTotalResponse.encode(message).finish(); + }, + toProtoMsg(message: QueryTotalResponse): QueryTotalResponseProtoMsg { + return { + typeUrl: "/desmos.supply.v1.QueryTotalResponse", + value: QueryTotalResponse.encode(message).finish(), + }; + }, }; function createBaseQueryCirculatingRequest(): QueryCirculatingRequest { return { @@ -225,6 +345,41 @@ export const QueryCirculatingRequest = { : Long.UZERO; return message; }, + fromAmino(object: QueryCirculatingRequestAmino): QueryCirculatingRequest { + return { + denom: object.denom, + dividerExponent: Long.fromString(object.divider_exponent), + }; + }, + toAmino(message: QueryCirculatingRequest): QueryCirculatingRequestAmino { + const obj: any = {}; + obj.denom = message.denom; + obj.divider_exponent = message.dividerExponent + ? message.dividerExponent.toString() + : undefined; + return obj; + }, + fromAminoMsg( + object: QueryCirculatingRequestAminoMsg + ): QueryCirculatingRequest { + return QueryCirculatingRequest.fromAmino(object.value); + }, + fromProtoMsg( + message: QueryCirculatingRequestProtoMsg + ): QueryCirculatingRequest { + return QueryCirculatingRequest.decode(message.value); + }, + toProto(message: QueryCirculatingRequest): Uint8Array { + return QueryCirculatingRequest.encode(message).finish(); + }, + toProtoMsg( + message: QueryCirculatingRequest + ): QueryCirculatingRequestProtoMsg { + return { + typeUrl: "/desmos.supply.v1.QueryCirculatingRequest", + value: QueryCirculatingRequest.encode(message).finish(), + }; + }, }; function createBaseQueryCirculatingResponse(): QueryCirculatingResponse { return { @@ -281,6 +436,37 @@ export const QueryCirculatingResponse = { message.circulatingSupply = object.circulatingSupply ?? ""; return message; }, + fromAmino(object: QueryCirculatingResponseAmino): QueryCirculatingResponse { + return { + circulatingSupply: object.circulating_supply, + }; + }, + toAmino(message: QueryCirculatingResponse): QueryCirculatingResponseAmino { + const obj: any = {}; + obj.circulating_supply = message.circulatingSupply; + return obj; + }, + fromAminoMsg( + object: QueryCirculatingResponseAminoMsg + ): QueryCirculatingResponse { + return QueryCirculatingResponse.fromAmino(object.value); + }, + fromProtoMsg( + message: QueryCirculatingResponseProtoMsg + ): QueryCirculatingResponse { + return QueryCirculatingResponse.decode(message.value); + }, + toProto(message: QueryCirculatingResponse): Uint8Array { + return QueryCirculatingResponse.encode(message).finish(); + }, + toProtoMsg( + message: QueryCirculatingResponse + ): QueryCirculatingResponseProtoMsg { + return { + typeUrl: "/desmos.supply.v1.QueryCirculatingResponse", + value: QueryCirculatingResponse.encode(message).finish(), + }; + }, }; /** Query defines the gRPC querier service. */ export interface Query { diff --git a/packages/types/src/gogoproto/gogo.ts b/packages/types/src/gogoproto/gogo.ts deleted file mode 100644 index cb0ff5c3b..000000000 --- a/packages/types/src/gogoproto/gogo.ts +++ /dev/null @@ -1 +0,0 @@ -export {}; diff --git a/packages/types/src/google/api/annotations.ts b/packages/types/src/google/api/annotations.ts deleted file mode 100644 index cb0ff5c3b..000000000 --- a/packages/types/src/google/api/annotations.ts +++ /dev/null @@ -1 +0,0 @@ -export {}; diff --git a/packages/types/src/google/api/http.ts b/packages/types/src/google/api/http.ts deleted file mode 100644 index fc5922b2c..000000000 --- a/packages/types/src/google/api/http.ts +++ /dev/null @@ -1,646 +0,0 @@ -/* eslint-disable */ -import * as _m0 from "protobufjs/minimal"; -import { isSet, DeepPartial, Exact } from "../../helpers"; -export const protobufPackage = "google.api"; -/** - * Defines the HTTP configuration for an API service. It contains a list of - * [HttpRule][google.api.HttpRule], each specifying the mapping of an RPC method - * to one or more HTTP REST API methods. - */ -export interface Http { - /** - * A list of HTTP configuration rules that apply to individual API methods. - * - * **NOTE:** All service configuration rules follow "last one wins" order. - */ - rules: HttpRule[]; - /** - * When set to true, URL path parameters will be fully URI-decoded except in - * cases of single segment matches in reserved expansion, where "%2F" will be - * left encoded. - * - * The default behavior is to not decode RFC 6570 reserved characters in multi - * segment matches. - */ - fullyDecodeReservedExpansion: boolean; -} -/** - * # gRPC Transcoding - * - * gRPC Transcoding is a feature for mapping between a gRPC method and one or - * more HTTP REST endpoints. It allows developers to build a single API service - * that supports both gRPC APIs and REST APIs. Many systems, including [Google - * APIs](https://github.com/googleapis/googleapis), - * [Cloud Endpoints](https://cloud.google.com/endpoints), [gRPC - * Gateway](https://github.com/grpc-ecosystem/grpc-gateway), - * and [Envoy](https://github.com/envoyproxy/envoy) proxy support this feature - * and use it for large scale production services. - * - * `HttpRule` defines the schema of the gRPC/REST mapping. The mapping specifies - * how different portions of the gRPC request message are mapped to the URL - * path, URL query parameters, and HTTP request body. It also controls how the - * gRPC response message is mapped to the HTTP response body. `HttpRule` is - * typically specified as an `google.api.http` annotation on the gRPC method. - * - * Each mapping specifies a URL path template and an HTTP method. The path - * template may refer to one or more fields in the gRPC request message, as long - * as each field is a non-repeated field with a primitive (non-message) type. - * The path template controls how fields of the request message are mapped to - * the URL path. - * - * Example: - * - * service Messaging { - * rpc GetMessage(GetMessageRequest) returns (Message) { - * option (google.api.http) = { - * get: "/v1/{name=messages/*}" - * }; - * } - * } - * message GetMessageRequest { - * string name = 1; // Mapped to URL path. - * } - * message Message { - * string text = 1; // The resource content. - * } - * - * This enables an HTTP REST to gRPC mapping as below: - * - * HTTP | gRPC - * -----|----- - * `GET /v1/messages/123456` | `GetMessage(name: "messages/123456")` - * - * Any fields in the request message which are not bound by the path template - * automatically become HTTP query parameters if there is no HTTP request body. - * For example: - * - * service Messaging { - * rpc GetMessage(GetMessageRequest) returns (Message) { - * option (google.api.http) = { - * get:"/v1/messages/{message_id}" - * }; - * } - * } - * message GetMessageRequest { - * message SubMessage { - * string subfield = 1; - * } - * string message_id = 1; // Mapped to URL path. - * int64 revision = 2; // Mapped to URL query parameter `revision`. - * SubMessage sub = 3; // Mapped to URL query parameter `sub.subfield`. - * } - * - * This enables a HTTP JSON to RPC mapping as below: - * - * HTTP | gRPC - * -----|----- - * `GET /v1/messages/123456?revision=2&sub.subfield=foo` | - * `GetMessage(message_id: "123456" revision: 2 sub: SubMessage(subfield: - * "foo"))` - * - * Note that fields which are mapped to URL query parameters must have a - * primitive type or a repeated primitive type or a non-repeated message type. - * In the case of a repeated type, the parameter can be repeated in the URL - * as `...?param=A¶m=B`. In the case of a message type, each field of the - * message is mapped to a separate parameter, such as - * `...?foo.a=A&foo.b=B&foo.c=C`. - * - * For HTTP methods that allow a request body, the `body` field - * specifies the mapping. Consider a REST update method on the - * message resource collection: - * - * service Messaging { - * rpc UpdateMessage(UpdateMessageRequest) returns (Message) { - * option (google.api.http) = { - * patch: "/v1/messages/{message_id}" - * body: "message" - * }; - * } - * } - * message UpdateMessageRequest { - * string message_id = 1; // mapped to the URL - * Message message = 2; // mapped to the body - * } - * - * The following HTTP JSON to RPC mapping is enabled, where the - * representation of the JSON in the request body is determined by - * protos JSON encoding: - * - * HTTP | gRPC - * -----|----- - * `PATCH /v1/messages/123456 { "text": "Hi!" }` | `UpdateMessage(message_id: - * "123456" message { text: "Hi!" })` - * - * The special name `*` can be used in the body mapping to define that - * every field not bound by the path template should be mapped to the - * request body. This enables the following alternative definition of - * the update method: - * - * service Messaging { - * rpc UpdateMessage(Message) returns (Message) { - * option (google.api.http) = { - * patch: "/v1/messages/{message_id}" - * body: "*" - * }; - * } - * } - * message Message { - * string message_id = 1; - * string text = 2; - * } - * - * - * The following HTTP JSON to RPC mapping is enabled: - * - * HTTP | gRPC - * -----|----- - * `PATCH /v1/messages/123456 { "text": "Hi!" }` | `UpdateMessage(message_id: - * "123456" text: "Hi!")` - * - * Note that when using `*` in the body mapping, it is not possible to - * have HTTP parameters, as all fields not bound by the path end in - * the body. This makes this option more rarely used in practice when - * defining REST APIs. The common usage of `*` is in custom methods - * which don't use the URL at all for transferring data. - * - * It is possible to define multiple HTTP methods for one RPC by using - * the `additional_bindings` option. Example: - * - * service Messaging { - * rpc GetMessage(GetMessageRequest) returns (Message) { - * option (google.api.http) = { - * get: "/v1/messages/{message_id}" - * additional_bindings { - * get: "/v1/users/{user_id}/messages/{message_id}" - * } - * }; - * } - * } - * message GetMessageRequest { - * string message_id = 1; - * string user_id = 2; - * } - * - * This enables the following two alternative HTTP JSON to RPC mappings: - * - * HTTP | gRPC - * -----|----- - * `GET /v1/messages/123456` | `GetMessage(message_id: "123456")` - * `GET /v1/users/me/messages/123456` | `GetMessage(user_id: "me" message_id: - * "123456")` - * - * ## Rules for HTTP mapping - * - * 1. Leaf request fields (recursive expansion nested messages in the request - * message) are classified into three categories: - * - Fields referred by the path template. They are passed via the URL path. - * - Fields referred by the [HttpRule.body][google.api.HttpRule.body]. They are passed via the HTTP - * request body. - * - All other fields are passed via the URL query parameters, and the - * parameter name is the field path in the request message. A repeated - * field can be represented as multiple query parameters under the same - * name. - * 2. If [HttpRule.body][google.api.HttpRule.body] is "*", there is no URL query parameter, all fields - * are passed via URL path and HTTP request body. - * 3. If [HttpRule.body][google.api.HttpRule.body] is omitted, there is no HTTP request body, all - * fields are passed via URL path and URL query parameters. - * - * ### Path template syntax - * - * Template = "/" Segments [ Verb ] ; - * Segments = Segment { "/" Segment } ; - * Segment = "*" | "**" | LITERAL | Variable ; - * Variable = "{" FieldPath [ "=" Segments ] "}" ; - * FieldPath = IDENT { "." IDENT } ; - * Verb = ":" LITERAL ; - * - * The syntax `*` matches a single URL path segment. The syntax `**` matches - * zero or more URL path segments, which must be the last part of the URL path - * except the `Verb`. - * - * The syntax `Variable` matches part of the URL path as specified by its - * template. A variable template must not contain other variables. If a variable - * matches a single path segment, its template may be omitted, e.g. `{var}` - * is equivalent to `{var=*}`. - * - * The syntax `LITERAL` matches literal text in the URL path. If the `LITERAL` - * contains any reserved character, such characters should be percent-encoded - * before the matching. - * - * If a variable contains exactly one path segment, such as `"{var}"` or - * `"{var=*}"`, when such a variable is expanded into a URL path on the client - * side, all characters except `[-_.~0-9a-zA-Z]` are percent-encoded. The - * server side does the reverse decoding. Such variables show up in the - * [Discovery - * Document](https://developers.google.com/discovery/v1/reference/apis) as - * `{var}`. - * - * If a variable contains multiple path segments, such as `"{var=foo/*}"` - * or `"{var=**}"`, when such a variable is expanded into a URL path on the - * client side, all characters except `[-_.~/0-9a-zA-Z]` are percent-encoded. - * The server side does the reverse decoding, except "%2F" and "%2f" are left - * unchanged. Such variables show up in the - * [Discovery - * Document](https://developers.google.com/discovery/v1/reference/apis) as - * `{+var}`. - * - * ## Using gRPC API Service Configuration - * - * gRPC API Service Configuration (service config) is a configuration language - * for configuring a gRPC service to become a user-facing product. The - * service config is simply the YAML representation of the `google.api.Service` - * proto message. - * - * As an alternative to annotating your proto file, you can configure gRPC - * transcoding in your service config YAML files. You do this by specifying a - * `HttpRule` that maps the gRPC method to a REST endpoint, achieving the same - * effect as the proto annotation. This can be particularly useful if you - * have a proto that is reused in multiple services. Note that any transcoding - * specified in the service config will override any matching transcoding - * configuration in the proto. - * - * Example: - * - * http: - * rules: - * # Selects a gRPC method and applies HttpRule to it. - * - selector: example.v1.Messaging.GetMessage - * get: /v1/messages/{message_id}/{sub.subfield} - * - * ## Special notes - * - * When gRPC Transcoding is used to map a gRPC to JSON REST endpoints, the - * proto to JSON conversion must follow the [proto3 - * specification](https://developers.google.com/protocol-buffers/docs/proto3#json). - * - * While the single segment variable follows the semantics of - * [RFC 6570](https://tools.ietf.org/html/rfc6570) Section 3.2.2 Simple String - * Expansion, the multi segment variable **does not** follow RFC 6570 Section - * 3.2.3 Reserved Expansion. The reason is that the Reserved Expansion - * does not expand special characters like `?` and `#`, which would lead - * to invalid URLs. As the result, gRPC Transcoding uses a custom encoding - * for multi segment variables. - * - * The path variables **must not** refer to any repeated or mapped field, - * because client libraries are not capable of handling such variable expansion. - * - * The path variables **must not** capture the leading "/" character. The reason - * is that the most common use case "{var}" does not capture the leading "/" - * character. For consistency, all path variables must share the same behavior. - * - * Repeated message fields must not be mapped to URL query parameters, because - * no client library can support such complicated mapping. - * - * If an API needs to use a JSON array for request or response body, it can map - * the request or response body to a repeated field. However, some gRPC - * Transcoding implementations may not support this feature. - */ -export interface HttpRule { - /** - * Selects a method to which this rule applies. - * - * Refer to [selector][google.api.DocumentationRule.selector] for syntax details. - */ - selector: string; - /** - * Maps to HTTP GET. Used for listing and getting information about - * resources. - */ - get?: string; - /** Maps to HTTP PUT. Used for replacing a resource. */ - put?: string; - /** Maps to HTTP POST. Used for creating a resource or performing an action. */ - post?: string; - /** Maps to HTTP DELETE. Used for deleting a resource. */ - delete?: string; - /** Maps to HTTP PATCH. Used for updating a resource. */ - patch?: string; - /** - * The custom pattern is used for specifying an HTTP method that is not - * included in the `pattern` field, such as HEAD, or "*" to leave the - * HTTP method unspecified for this rule. The wild-card rule is useful - * for services that provide content to Web (HTML) clients. - */ - custom?: CustomHttpPattern; - /** - * The name of the request field whose value is mapped to the HTTP request - * body, or `*` for mapping all request fields not captured by the path - * pattern to the HTTP body, or omitted for not having any HTTP request body. - * - * NOTE: the referred field must be present at the top-level of the request - * message type. - */ - body: string; - /** - * Optional. The name of the response field whose value is mapped to the HTTP - * response body. When omitted, the entire response message will be used - * as the HTTP response body. - * - * NOTE: The referred field must be present at the top-level of the response - * message type. - */ - responseBody: string; - /** - * Additional HTTP bindings for the selector. Nested bindings must - * not contain an `additional_bindings` field themselves (that is, - * the nesting may only be one level deep). - */ - additionalBindings: HttpRule[]; -} -/** A custom pattern is used for defining custom HTTP verb. */ -export interface CustomHttpPattern { - /** The name of this custom HTTP verb. */ - kind: string; - /** The path matched by this custom verb. */ - path: string; -} -function createBaseHttp(): Http { - return { - rules: [], - fullyDecodeReservedExpansion: false, - }; -} -export const Http = { - encode(message: Http, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { - for (const v of message.rules) { - HttpRule.encode(v!, writer.uint32(10).fork()).ldelim(); - } - if (message.fullyDecodeReservedExpansion === true) { - writer.uint32(16).bool(message.fullyDecodeReservedExpansion); - } - return writer; - }, - decode(input: _m0.Reader | Uint8Array, length?: number): Http { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseHttp(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.rules.push(HttpRule.decode(reader, reader.uint32())); - break; - case 2: - message.fullyDecodeReservedExpansion = reader.bool(); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }, - fromJSON(object: any): Http { - return { - rules: Array.isArray(object?.rules) - ? object.rules.map((e: any) => HttpRule.fromJSON(e)) - : [], - fullyDecodeReservedExpansion: isSet(object.fullyDecodeReservedExpansion) - ? Boolean(object.fullyDecodeReservedExpansion) - : false, - }; - }, - toJSON(message: Http): unknown { - const obj: any = {}; - if (message.rules) { - obj.rules = message.rules.map((e) => - e ? HttpRule.toJSON(e) : undefined - ); - } else { - obj.rules = []; - } - message.fullyDecodeReservedExpansion !== undefined && - (obj.fullyDecodeReservedExpansion = message.fullyDecodeReservedExpansion); - return obj; - }, - fromPartial, I>>(object: I): Http { - const message = createBaseHttp(); - message.rules = object.rules?.map((e) => HttpRule.fromPartial(e)) || []; - message.fullyDecodeReservedExpansion = - object.fullyDecodeReservedExpansion ?? false; - return message; - }, -}; -function createBaseHttpRule(): HttpRule { - return { - selector: "", - get: undefined, - put: undefined, - post: undefined, - delete: undefined, - patch: undefined, - custom: undefined, - body: "", - responseBody: "", - additionalBindings: [], - }; -} -export const HttpRule = { - encode( - message: HttpRule, - writer: _m0.Writer = _m0.Writer.create() - ): _m0.Writer { - if (message.selector !== "") { - writer.uint32(10).string(message.selector); - } - if (message.get !== undefined) { - writer.uint32(18).string(message.get); - } - if (message.put !== undefined) { - writer.uint32(26).string(message.put); - } - if (message.post !== undefined) { - writer.uint32(34).string(message.post); - } - if (message.delete !== undefined) { - writer.uint32(42).string(message.delete); - } - if (message.patch !== undefined) { - writer.uint32(50).string(message.patch); - } - if (message.custom !== undefined) { - CustomHttpPattern.encode( - message.custom, - writer.uint32(66).fork() - ).ldelim(); - } - if (message.body !== "") { - writer.uint32(58).string(message.body); - } - if (message.responseBody !== "") { - writer.uint32(98).string(message.responseBody); - } - for (const v of message.additionalBindings) { - HttpRule.encode(v!, writer.uint32(90).fork()).ldelim(); - } - return writer; - }, - decode(input: _m0.Reader | Uint8Array, length?: number): HttpRule { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseHttpRule(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.selector = reader.string(); - break; - case 2: - message.get = reader.string(); - break; - case 3: - message.put = reader.string(); - break; - case 4: - message.post = reader.string(); - break; - case 5: - message.delete = reader.string(); - break; - case 6: - message.patch = reader.string(); - break; - case 8: - message.custom = CustomHttpPattern.decode(reader, reader.uint32()); - break; - case 7: - message.body = reader.string(); - break; - case 12: - message.responseBody = reader.string(); - break; - case 11: - message.additionalBindings.push( - HttpRule.decode(reader, reader.uint32()) - ); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }, - fromJSON(object: any): HttpRule { - return { - selector: isSet(object.selector) ? String(object.selector) : "", - get: isSet(object.get) ? String(object.get) : undefined, - put: isSet(object.put) ? String(object.put) : undefined, - post: isSet(object.post) ? String(object.post) : undefined, - delete: isSet(object.delete) ? String(object.delete) : undefined, - patch: isSet(object.patch) ? String(object.patch) : undefined, - custom: isSet(object.custom) - ? CustomHttpPattern.fromJSON(object.custom) - : undefined, - body: isSet(object.body) ? String(object.body) : "", - responseBody: isSet(object.responseBody) - ? String(object.responseBody) - : "", - additionalBindings: Array.isArray(object?.additionalBindings) - ? object.additionalBindings.map((e: any) => HttpRule.fromJSON(e)) - : [], - }; - }, - toJSON(message: HttpRule): unknown { - const obj: any = {}; - message.selector !== undefined && (obj.selector = message.selector); - message.get !== undefined && (obj.get = message.get); - message.put !== undefined && (obj.put = message.put); - message.post !== undefined && (obj.post = message.post); - message.delete !== undefined && (obj.delete = message.delete); - message.patch !== undefined && (obj.patch = message.patch); - message.custom !== undefined && - (obj.custom = message.custom - ? CustomHttpPattern.toJSON(message.custom) - : undefined); - message.body !== undefined && (obj.body = message.body); - message.responseBody !== undefined && - (obj.responseBody = message.responseBody); - if (message.additionalBindings) { - obj.additionalBindings = message.additionalBindings.map((e) => - e ? HttpRule.toJSON(e) : undefined - ); - } else { - obj.additionalBindings = []; - } - return obj; - }, - fromPartial, I>>(object: I): HttpRule { - const message = createBaseHttpRule(); - message.selector = object.selector ?? ""; - message.get = object.get ?? undefined; - message.put = object.put ?? undefined; - message.post = object.post ?? undefined; - message.delete = object.delete ?? undefined; - message.patch = object.patch ?? undefined; - message.custom = - object.custom !== undefined && object.custom !== null - ? CustomHttpPattern.fromPartial(object.custom) - : undefined; - message.body = object.body ?? ""; - message.responseBody = object.responseBody ?? ""; - message.additionalBindings = - object.additionalBindings?.map((e) => HttpRule.fromPartial(e)) || []; - return message; - }, -}; -function createBaseCustomHttpPattern(): CustomHttpPattern { - return { - kind: "", - path: "", - }; -} -export const CustomHttpPattern = { - encode( - message: CustomHttpPattern, - writer: _m0.Writer = _m0.Writer.create() - ): _m0.Writer { - if (message.kind !== "") { - writer.uint32(10).string(message.kind); - } - if (message.path !== "") { - writer.uint32(18).string(message.path); - } - return writer; - }, - decode(input: _m0.Reader | Uint8Array, length?: number): CustomHttpPattern { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseCustomHttpPattern(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.kind = reader.string(); - break; - case 2: - message.path = reader.string(); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }, - fromJSON(object: any): CustomHttpPattern { - return { - kind: isSet(object.kind) ? String(object.kind) : "", - path: isSet(object.path) ? String(object.path) : "", - }; - }, - toJSON(message: CustomHttpPattern): unknown { - const obj: any = {}; - message.kind !== undefined && (obj.kind = message.kind); - message.path !== undefined && (obj.path = message.path); - return obj; - }, - fromPartial, I>>( - object: I - ): CustomHttpPattern { - const message = createBaseCustomHttpPattern(); - message.kind = object.kind ?? ""; - message.path = object.path ?? ""; - return message; - }, -}; diff --git a/packages/types/src/google/protobuf/any.ts b/packages/types/src/google/protobuf/any.ts index 0a869ce63..b794a12d7 100644 --- a/packages/types/src/google/protobuf/any.ts +++ b/packages/types/src/google/protobuf/any.ts @@ -123,6 +123,129 @@ export interface Any { /** Must be a valid serialized protocol buffer of the above specified type. */ value: Uint8Array; } +export interface AnyProtoMsg { + typeUrl: "/google.protobuf.Any"; + value: Uint8Array; +} +/** + * `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" + * } + */ +export interface AnyAmino { + /** + * A URL/resource name that uniquely identifies the type of the serialized + * protocol buffer message. This string must contain at least + * one "/" character. The last segment of the URL's path must represent + * the fully qualified name of the type (as in + * `path/google.protobuf.Duration`). The name should be in a canonical form + * (e.g., leading "." is not accepted). + * + * In practice, teams usually precompile into the binary all types that they + * expect it to use in the context of Any. However, for URLs which use the + * scheme `http`, `https`, or no scheme, one can optionally set up a type + * server that maps type URLs to message definitions as follows: + * + * * If no scheme is provided, `https` is assumed. + * * An HTTP GET on the URL must yield a [google.protobuf.Type][] + * value in binary format, or produce an error. + * * Applications are allowed to cache lookup results based on the + * URL, or have them precompiled into a binary to avoid any + * lookup. Therefore, binary compatibility needs to be preserved + * on changes to types. (Use versioned type names to manage + * breaking changes.) + * + * Note: this functionality is not currently available in the official + * protobuf release, and it is not used for type URLs beginning with + * type.googleapis.com. + * + * Schemes other than `http`, `https` (or the empty scheme) might be + * used with implementation specific semantics. + */ + type: string; + /** Must be a valid serialized protocol buffer of the above specified type. */ + value: any; +} +export interface AnyAminoMsg { + type: string; + value: AnyAmino; +} function createBaseAny(): Any { return { typeUrl: "", @@ -182,4 +305,31 @@ export const Any = { message.value = object.value ?? new Uint8Array(); return message; }, + fromAmino(object: AnyAmino): Any { + return { + typeUrl: object.type, + value: object.value, + }; + }, + toAmino(message: Any): AnyAmino { + return { + type: message.typeUrl, + value: message.value, + }; + }, + fromAminoMsg(object: AnyAminoMsg): Any { + return Any.fromAmino(object.value); + }, + fromProtoMsg(message: AnyProtoMsg): Any { + return Any.decode(message.value); + }, + toProto(message: Any): Uint8Array { + return Any.encode(message).finish(); + }, + toProtoMsg(message: Any): AnyProtoMsg { + return { + typeUrl: "/google.protobuf.Any", + value: Any.encode(message).finish(), + }; + }, }; diff --git a/packages/types/src/google/protobuf/descriptor.ts b/packages/types/src/google/protobuf/descriptor.ts index a8ba110a3..6d1c7ad78 100644 --- a/packages/types/src/google/protobuf/descriptor.ts +++ b/packages/types/src/google/protobuf/descriptor.ts @@ -51,6 +51,7 @@ export enum FieldDescriptorProto_Type { TYPE_SINT64 = 18, UNRECOGNIZED = -1, } +export const FieldDescriptorProto_TypeAmino = FieldDescriptorProto_Type; export function fieldDescriptorProto_TypeFromJSON( object: any ): FieldDescriptorProto_Type { @@ -167,6 +168,7 @@ export enum FieldDescriptorProto_Label { LABEL_REPEATED = 3, UNRECOGNIZED = -1, } +export const FieldDescriptorProto_LabelAmino = FieldDescriptorProto_Label; export function fieldDescriptorProto_LabelFromJSON( object: any ): FieldDescriptorProto_Label { @@ -214,6 +216,7 @@ export enum FileOptions_OptimizeMode { LITE_RUNTIME = 3, UNRECOGNIZED = -1, } +export const FileOptions_OptimizeModeAmino = FileOptions_OptimizeMode; export function fileOptions_OptimizeModeFromJSON( object: any ): FileOptions_OptimizeMode { @@ -255,6 +258,7 @@ export enum FieldOptions_CType { STRING_PIECE = 2, UNRECOGNIZED = -1, } +export const FieldOptions_CTypeAmino = FieldOptions_CType; export function fieldOptions_CTypeFromJSON(object: any): FieldOptions_CType { switch (object) { case 0: @@ -294,6 +298,7 @@ export enum FieldOptions_JSType { JS_NUMBER = 2, UNRECOGNIZED = -1, } +export const FieldOptions_JSTypeAmino = FieldOptions_JSType; export function fieldOptions_JSTypeFromJSON(object: any): FieldOptions_JSType { switch (object) { case 0: @@ -337,6 +342,8 @@ export enum MethodOptions_IdempotencyLevel { IDEMPOTENT = 2, UNRECOGNIZED = -1, } +export const MethodOptions_IdempotencyLevelAmino = + MethodOptions_IdempotencyLevel; export function methodOptions_IdempotencyLevelFromJSON( object: any ): MethodOptions_IdempotencyLevel { @@ -378,6 +385,21 @@ export function methodOptions_IdempotencyLevelToJSON( export interface FileDescriptorSet { file: FileDescriptorProto[]; } +export interface FileDescriptorSetProtoMsg { + typeUrl: "/google.protobuf.FileDescriptorSet"; + value: Uint8Array; +} +/** + * The protocol compiler can output a FileDescriptorSet containing the .proto + * files it parses. + */ +export interface FileDescriptorSetAmino { + file: FileDescriptorProtoAmino[]; +} +export interface FileDescriptorSetAminoMsg { + type: "/google.protobuf.FileDescriptorSet"; + value: FileDescriptorSetAmino; +} /** Describes a complete .proto file. */ export interface FileDescriptorProto { /** file name, relative to root of source tree */ @@ -411,6 +433,47 @@ export interface FileDescriptorProto { */ syntax: string; } +export interface FileDescriptorProtoProtoMsg { + typeUrl: "/google.protobuf.FileDescriptorProto"; + value: Uint8Array; +} +/** Describes a complete .proto file. */ +export interface FileDescriptorProtoAmino { + /** file name, relative to root of source tree */ + name: string; + package: string; + /** Names of files imported by this file. */ + dependency: string[]; + /** Indexes of the public imported files in the dependency list above. */ + public_dependency: number[]; + /** + * Indexes of the weak imported files in the dependency list. + * For Google-internal migration only. Do not use. + */ + weak_dependency: number[]; + /** All top-level definitions in this file. */ + message_type: DescriptorProtoAmino[]; + enum_type: EnumDescriptorProtoAmino[]; + service: ServiceDescriptorProtoAmino[]; + extension: FieldDescriptorProtoAmino[]; + options?: FileOptionsAmino; + /** + * This field contains optional information about the original source code. + * You may safely remove this entire field without harming runtime + * functionality of the descriptors -- the information is needed only by + * development tools. + */ + source_code_info?: SourceCodeInfoAmino; + /** + * The syntax of the proto file. + * The supported values are "proto2" and "proto3". + */ + syntax: string; +} +export interface FileDescriptorProtoAminoMsg { + type: "/google.protobuf.FileDescriptorProto"; + value: FileDescriptorProtoAmino; +} /** Describes a message type. */ export interface DescriptorProto { name: string; @@ -428,6 +491,31 @@ export interface DescriptorProto { */ reservedName: string[]; } +export interface DescriptorProtoProtoMsg { + typeUrl: "/google.protobuf.DescriptorProto"; + value: Uint8Array; +} +/** Describes a message type. */ +export interface DescriptorProtoAmino { + name: string; + field: FieldDescriptorProtoAmino[]; + extension: FieldDescriptorProtoAmino[]; + nested_type: DescriptorProtoAmino[]; + enum_type: EnumDescriptorProtoAmino[]; + extension_range: DescriptorProto_ExtensionRangeAmino[]; + oneof_decl: OneofDescriptorProtoAmino[]; + options?: MessageOptionsAmino; + reserved_range: DescriptorProto_ReservedRangeAmino[]; + /** + * Reserved field names, which may not be used by fields in the same message. + * A given name may only be reserved once. + */ + reserved_name: string[]; +} +export interface DescriptorProtoAminoMsg { + type: "/google.protobuf.DescriptorProto"; + value: DescriptorProtoAmino; +} export interface DescriptorProto_ExtensionRange { /** Inclusive. */ start: number; @@ -435,6 +523,21 @@ export interface DescriptorProto_ExtensionRange { end: number; options?: ExtensionRangeOptions; } +export interface DescriptorProto_ExtensionRangeProtoMsg { + typeUrl: "/google.protobuf.ExtensionRange"; + value: Uint8Array; +} +export interface DescriptorProto_ExtensionRangeAmino { + /** Inclusive. */ + start: number; + /** Exclusive. */ + end: number; + options?: ExtensionRangeOptionsAmino; +} +export interface DescriptorProto_ExtensionRangeAminoMsg { + type: "/google.protobuf.ExtensionRange"; + value: DescriptorProto_ExtensionRangeAmino; +} /** * Range of reserved tag numbers. Reserved tag numbers may not be used by * fields or extension ranges in the same message. Reserved ranges may @@ -446,10 +549,41 @@ export interface DescriptorProto_ReservedRange { /** Exclusive. */ end: number; } +export interface DescriptorProto_ReservedRangeProtoMsg { + typeUrl: "/google.protobuf.ReservedRange"; + value: Uint8Array; +} +/** + * Range of reserved tag numbers. Reserved tag numbers may not be used by + * fields or extension ranges in the same message. Reserved ranges may + * not overlap. + */ +export interface DescriptorProto_ReservedRangeAmino { + /** Inclusive. */ + start: number; + /** Exclusive. */ + end: number; +} +export interface DescriptorProto_ReservedRangeAminoMsg { + type: "/google.protobuf.ReservedRange"; + value: DescriptorProto_ReservedRangeAmino; +} export interface ExtensionRangeOptions { /** The parser stores options it doesn't recognize here. See above. */ uninterpretedOption: UninterpretedOption[]; } +export interface ExtensionRangeOptionsProtoMsg { + typeUrl: "/google.protobuf.ExtensionRangeOptions"; + value: Uint8Array; +} +export interface ExtensionRangeOptionsAmino { + /** The parser stores options it doesn't recognize here. See above. */ + uninterpreted_option: UninterpretedOptionAmino[]; +} +export interface ExtensionRangeOptionsAminoMsg { + type: "/google.protobuf.ExtensionRangeOptions"; + value: ExtensionRangeOptionsAmino; +} /** Describes a field within a message. */ export interface FieldDescriptorProto { name: string; @@ -495,11 +629,77 @@ export interface FieldDescriptorProto { jsonName: string; options?: FieldOptions; } +export interface FieldDescriptorProtoProtoMsg { + typeUrl: "/google.protobuf.FieldDescriptorProto"; + value: Uint8Array; +} +/** Describes a field within a message. */ +export interface FieldDescriptorProtoAmino { + name: string; + number: number; + label: FieldDescriptorProto_Label; + /** + * If type_name is set, this need not be set. If both this and type_name + * are set, this must be one of TYPE_ENUM, TYPE_MESSAGE or TYPE_GROUP. + */ + type: FieldDescriptorProto_Type; + /** + * For message and enum types, this is the name of the type. If the name + * starts with a '.', it is fully-qualified. Otherwise, C++-like scoping + * rules are used to find the type (i.e. first the nested types within this + * message are searched, then within the parent, on up to the root + * namespace). + */ + type_name: string; + /** + * For extensions, this is the name of the type being extended. It is + * resolved in the same manner as type_name. + */ + extendee: string; + /** + * For numeric types, contains the original text representation of the value. + * For booleans, "true" or "false". + * For strings, contains the default text contents (not escaped in any way). + * For bytes, contains the C escaped value. All bytes >= 128 are escaped. + * TODO(kenton): Base-64 encode? + */ + default_value: string; + /** + * If set, gives the index of a oneof in the containing type's oneof_decl + * list. This field is a member of that oneof. + */ + oneof_index: number; + /** + * JSON name of this field. The value is set by protocol compiler. If the + * user has set a "json_name" option on this field, that option's value + * will be used. Otherwise, it's deduced from the field's name by converting + * it to camelCase. + */ + json_name: string; + options?: FieldOptionsAmino; +} +export interface FieldDescriptorProtoAminoMsg { + type: "/google.protobuf.FieldDescriptorProto"; + value: FieldDescriptorProtoAmino; +} /** Describes a oneof. */ export interface OneofDescriptorProto { name: string; options?: OneofOptions; } +export interface OneofDescriptorProtoProtoMsg { + typeUrl: "/google.protobuf.OneofDescriptorProto"; + value: Uint8Array; +} +/** Describes a oneof. */ +export interface OneofDescriptorProtoAmino { + name: string; + options?: OneofOptionsAmino; +} +export interface OneofDescriptorProtoAminoMsg { + type: "/google.protobuf.OneofDescriptorProto"; + value: OneofDescriptorProtoAmino; +} /** Describes an enum type. */ export interface EnumDescriptorProto { name: string; @@ -517,6 +717,31 @@ export interface EnumDescriptorProto { */ reservedName: string[]; } +export interface EnumDescriptorProtoProtoMsg { + typeUrl: "/google.protobuf.EnumDescriptorProto"; + value: Uint8Array; +} +/** Describes an enum type. */ +export interface EnumDescriptorProtoAmino { + name: string; + value: EnumValueDescriptorProtoAmino[]; + options?: EnumOptionsAmino; + /** + * Range of reserved numeric values. Reserved numeric values may not be used + * by enum values in the same enum declaration. Reserved ranges may not + * overlap. + */ + reserved_range: EnumDescriptorProto_EnumReservedRangeAmino[]; + /** + * Reserved enum value names, which may not be reused. A given name may only + * be reserved once. + */ + reserved_name: string[]; +} +export interface EnumDescriptorProtoAminoMsg { + type: "/google.protobuf.EnumDescriptorProto"; + value: EnumDescriptorProtoAmino; +} /** * Range of reserved numeric values. Reserved values may not be used by * entries in the same enum. Reserved ranges may not overlap. @@ -531,18 +756,68 @@ export interface EnumDescriptorProto_EnumReservedRange { /** Inclusive. */ end: number; } +export interface EnumDescriptorProto_EnumReservedRangeProtoMsg { + typeUrl: "/google.protobuf.EnumReservedRange"; + value: Uint8Array; +} +/** + * Range of reserved numeric values. Reserved values may not be used by + * entries in the same enum. Reserved ranges may not overlap. + * + * Note that this is distinct from DescriptorProto.ReservedRange in that it + * is inclusive such that it can appropriately represent the entire int32 + * domain. + */ +export interface EnumDescriptorProto_EnumReservedRangeAmino { + /** Inclusive. */ + start: number; + /** Inclusive. */ + end: number; +} +export interface EnumDescriptorProto_EnumReservedRangeAminoMsg { + type: "/google.protobuf.EnumReservedRange"; + value: EnumDescriptorProto_EnumReservedRangeAmino; +} /** Describes a value within an enum. */ export interface EnumValueDescriptorProto { name: string; number: number; options?: EnumValueOptions; } +export interface EnumValueDescriptorProtoProtoMsg { + typeUrl: "/google.protobuf.EnumValueDescriptorProto"; + value: Uint8Array; +} +/** Describes a value within an enum. */ +export interface EnumValueDescriptorProtoAmino { + name: string; + number: number; + options?: EnumValueOptionsAmino; +} +export interface EnumValueDescriptorProtoAminoMsg { + type: "/google.protobuf.EnumValueDescriptorProto"; + value: EnumValueDescriptorProtoAmino; +} /** Describes a service. */ export interface ServiceDescriptorProto { name: string; method: MethodDescriptorProto[]; options?: ServiceOptions; } +export interface ServiceDescriptorProtoProtoMsg { + typeUrl: "/google.protobuf.ServiceDescriptorProto"; + value: Uint8Array; +} +/** Describes a service. */ +export interface ServiceDescriptorProtoAmino { + name: string; + method: MethodDescriptorProtoAmino[]; + options?: ServiceOptionsAmino; +} +export interface ServiceDescriptorProtoAminoMsg { + type: "/google.protobuf.ServiceDescriptorProto"; + value: ServiceDescriptorProtoAmino; +} /** Describes a method of a service. */ export interface MethodDescriptorProto { name: string; @@ -558,6 +833,29 @@ export interface MethodDescriptorProto { /** Identifies if server streams multiple server messages */ serverStreaming: boolean; } +export interface MethodDescriptorProtoProtoMsg { + typeUrl: "/google.protobuf.MethodDescriptorProto"; + value: Uint8Array; +} +/** Describes a method of a service. */ +export interface MethodDescriptorProtoAmino { + name: string; + /** + * Input and output type names. These are resolved in the same way as + * FieldDescriptorProto.type_name, but must refer to a message type. + */ + input_type: string; + output_type: string; + options?: MethodOptionsAmino; + /** Identifies if client streams multiple client messages */ + client_streaming: boolean; + /** Identifies if server streams multiple server messages */ + server_streaming: boolean; +} +export interface MethodDescriptorProtoAminoMsg { + type: "/google.protobuf.MethodDescriptorProto"; + value: MethodDescriptorProtoAmino; +} export interface FileOptions { /** * Sets the Java package where classes generated from this .proto will be @@ -675,6 +973,131 @@ export interface FileOptions { */ uninterpretedOption: UninterpretedOption[]; } +export interface FileOptionsProtoMsg { + typeUrl: "/google.protobuf.FileOptions"; + value: Uint8Array; +} +export interface FileOptionsAmino { + /** + * Sets the Java package where classes generated from this .proto will be + * placed. By default, the proto package is used, but this is often + * inappropriate because proto packages do not normally start with backwards + * domain names. + */ + java_package: string; + /** + * If set, all the classes from the .proto file are wrapped in a single + * outer class with the given name. This applies to both Proto1 + * (equivalent to the old "--one_java_file" option) and Proto2 (where + * a .proto always translates to a single class, but you may want to + * explicitly choose the class name). + */ + java_outer_classname: string; + /** + * If set true, then the Java code generator will generate a separate .java + * file for each top-level message, enum, and service defined in the .proto + * file. Thus, these types will *not* be nested inside the outer class + * named by java_outer_classname. However, the outer class will still be + * generated to contain the file's getDescriptor() method as well as any + * top-level extensions defined in the file. + */ + java_multiple_files: boolean; + /** This option does nothing. */ + /** @deprecated */ + java_generate_equals_and_hash: boolean; + /** + * If set true, then the Java2 code generator will generate code that + * throws an exception whenever an attempt is made to assign a non-UTF-8 + * byte sequence to a string field. + * Message reflection will do the same. + * However, an extension field still accepts non-UTF-8 byte sequences. + * This option has no effect on when used with the lite runtime. + */ + java_string_check_utf8: boolean; + optimize_for: FileOptions_OptimizeMode; + /** + * Sets the Go package where structs generated from this .proto will be + * placed. If omitted, the Go package will be derived from the following: + * - The basename of the package import path, if provided. + * - Otherwise, the package statement in the .proto file, if present. + * - Otherwise, the basename of the .proto file, without extension. + */ + go_package: string; + /** + * Should generic services be generated in each language? "Generic" services + * are not specific to any particular RPC system. They are generated by the + * main code generators in each language (without additional plugins). + * Generic services were the only kind of service generation supported by + * early versions of google.protobuf. + * + * Generic services are now considered deprecated in favor of using plugins + * that generate code specific to your particular RPC system. Therefore, + * these default to false. Old code which depends on generic services should + * explicitly set them to true. + */ + cc_generic_services: boolean; + java_generic_services: boolean; + py_generic_services: boolean; + php_generic_services: boolean; + /** + * Is this file deprecated? + * Depending on the target platform, this can emit Deprecated annotations + * for everything in the file, or it will be completely ignored; in the very + * least, this is a formalization for deprecating files. + */ + deprecated: boolean; + /** + * Enables the use of arenas for the proto messages in this file. This applies + * only to generated classes for C++. + */ + cc_enable_arenas: boolean; + /** + * Sets the objective c class prefix which is prepended to all objective c + * generated classes from this .proto. There is no default. + */ + objc_class_prefix: string; + /** Namespace for generated classes; defaults to the package. */ + csharp_namespace: string; + /** + * By default Swift generators will take the proto package and CamelCase it + * replacing '.' with underscore and use that to prefix the types/symbols + * defined. When this options is provided, they will use this value instead + * to prefix the types/symbols defined. + */ + swift_prefix: string; + /** + * Sets the php class prefix which is prepended to all php generated classes + * from this .proto. Default is empty. + */ + php_class_prefix: string; + /** + * Use this option to change the namespace of php generated classes. Default + * is empty. When this option is empty, the package name will be used for + * determining the namespace. + */ + php_namespace: string; + /** + * Use this option to change the namespace of php generated metadata classes. + * Default is empty. When this option is empty, the proto file name will be + * used for determining the namespace. + */ + php_metadata_namespace: string; + /** + * Use this option to change the package of ruby generated classes. Default + * is empty. When this option is not set, the package name will be used for + * determining the ruby package. + */ + ruby_package: string; + /** + * The parser stores options it doesn't recognize here. + * See the documentation for the "Options" section above. + */ + uninterpreted_option: UninterpretedOptionAmino[]; +} +export interface FileOptionsAminoMsg { + type: "/google.protobuf.FileOptions"; + value: FileOptionsAmino; +} export interface MessageOptions { /** * Set true to use the old proto1 MessageSet wire format for extensions. @@ -737,6 +1160,76 @@ export interface MessageOptions { /** The parser stores options it doesn't recognize here. See above. */ uninterpretedOption: UninterpretedOption[]; } +export interface MessageOptionsProtoMsg { + typeUrl: "/google.protobuf.MessageOptions"; + value: Uint8Array; +} +export interface MessageOptionsAmino { + /** + * Set true to use the old proto1 MessageSet wire format for extensions. + * This is provided for backwards-compatibility with the MessageSet wire + * format. You should not use this for any other reason: It's less + * efficient, has fewer features, and is more complicated. + * + * The message must be defined exactly as follows: + * message Foo { + * option message_set_wire_format = true; + * extensions 4 to max; + * } + * Note that the message cannot have any defined fields; MessageSets only + * have extensions. + * + * All extensions of your type must be singular messages; e.g. they cannot + * be int32s, enums, or repeated messages. + * + * Because this is an option, the above two restrictions are not enforced by + * the protocol compiler. + */ + message_set_wire_format: boolean; + /** + * Disables the generation of the standard "descriptor()" accessor, which can + * conflict with a field of the same name. This is meant to make migration + * from proto1 easier; new code should avoid fields named "descriptor". + */ + no_standard_descriptor_accessor: boolean; + /** + * Is this message deprecated? + * Depending on the target platform, this can emit Deprecated annotations + * for the message, or it will be completely ignored; in the very least, + * this is a formalization for deprecating messages. + */ + deprecated: boolean; + /** + * Whether the message is an automatically generated map entry type for the + * maps field. + * + * For maps fields: + * map map_field = 1; + * The parsed descriptor looks like: + * message MapFieldEntry { + * option map_entry = true; + * optional KeyType key = 1; + * optional ValueType value = 2; + * } + * repeated MapFieldEntry map_field = 1; + * + * Implementations may choose not to generate the map_entry=true message, but + * use a native map in the target language to hold the keys and values. + * The reflection APIs in such implementations still need to work as + * if the field is a repeated message field. + * + * NOTE: Do not set the option in .proto files. Always use the maps syntax + * instead. The option should only be implicitly set by the proto compiler + * parser. + */ + map_entry: boolean; + /** The parser stores options it doesn't recognize here. See above. */ + uninterpreted_option: UninterpretedOptionAmino[]; +} +export interface MessageOptionsAminoMsg { + type: "/google.protobuf.MessageOptions"; + value: MessageOptionsAmino; +} export interface FieldOptions { /** * The ctype option instructs the C++ code generator to use a different @@ -810,10 +1303,103 @@ export interface FieldOptions { /** The parser stores options it doesn't recognize here. See above. */ uninterpretedOption: UninterpretedOption[]; } +export interface FieldOptionsProtoMsg { + typeUrl: "/google.protobuf.FieldOptions"; + value: Uint8Array; +} +export interface FieldOptionsAmino { + /** + * The ctype option instructs the C++ code generator to use a different + * representation of the field than it normally would. See the specific + * options below. This option is not yet implemented in the open source + * release -- sorry, we'll try to include it in a future version! + */ + ctype: FieldOptions_CType; + /** + * The packed option can be enabled for repeated primitive fields to enable + * a more efficient representation on the wire. Rather than repeatedly + * writing the tag and type for each element, the entire array is encoded as + * a single length-delimited blob. In proto3, only explicit setting it to + * false will avoid using packed encoding. + */ + packed: boolean; + /** + * The jstype option determines the JavaScript type used for values of the + * field. The option is permitted only for 64 bit integral and fixed types + * (int64, uint64, sint64, fixed64, sfixed64). A field with jstype JS_STRING + * is represented as JavaScript string, which avoids loss of precision that + * can happen when a large value is converted to a floating point JavaScript. + * Specifying JS_NUMBER for the jstype causes the generated JavaScript code to + * use the JavaScript "number" type. The behavior of the default option + * JS_NORMAL is implementation dependent. + * + * This option is an enum to permit additional types to be added, e.g. + * goog.math.Integer. + */ + jstype: FieldOptions_JSType; + /** + * Should this field be parsed lazily? Lazy applies only to message-type + * fields. It means that when the outer message is initially parsed, the + * inner message's contents will not be parsed but instead stored in encoded + * form. The inner message will actually be parsed when it is first accessed. + * + * This is only a hint. Implementations are free to choose whether to use + * eager or lazy parsing regardless of the value of this option. However, + * setting this option true suggests that the protocol author believes that + * using lazy parsing on this field is worth the additional bookkeeping + * overhead typically needed to implement it. + * + * This option does not affect the public interface of any generated code; + * all method signatures remain the same. Furthermore, thread-safety of the + * interface is not affected by this option; const methods remain safe to + * call from multiple threads concurrently, while non-const methods continue + * to require exclusive access. + * + * + * Note that implementations may choose not to check required fields within + * a lazy sub-message. That is, calling IsInitialized() on the outer message + * may return true even if the inner message has missing required fields. + * This is necessary because otherwise the inner message would have to be + * parsed in order to perform the check, defeating the purpose of lazy + * parsing. An implementation which chooses not to check required fields + * must be consistent about it. That is, for any particular sub-message, the + * implementation must either *always* check its required fields, or *never* + * check its required fields, regardless of whether or not the message has + * been parsed. + */ + lazy: boolean; + /** + * Is this field deprecated? + * Depending on the target platform, this can emit Deprecated annotations + * for accessors, or it will be completely ignored; in the very least, this + * is a formalization for deprecating fields. + */ + deprecated: boolean; + /** For Google-internal migration only. Do not use. */ + weak: boolean; + /** The parser stores options it doesn't recognize here. See above. */ + uninterpreted_option: UninterpretedOptionAmino[]; +} +export interface FieldOptionsAminoMsg { + type: "/google.protobuf.FieldOptions"; + value: FieldOptionsAmino; +} export interface OneofOptions { /** The parser stores options it doesn't recognize here. See above. */ uninterpretedOption: UninterpretedOption[]; } +export interface OneofOptionsProtoMsg { + typeUrl: "/google.protobuf.OneofOptions"; + value: Uint8Array; +} +export interface OneofOptionsAmino { + /** The parser stores options it doesn't recognize here. See above. */ + uninterpreted_option: UninterpretedOptionAmino[]; +} +export interface OneofOptionsAminoMsg { + type: "/google.protobuf.OneofOptions"; + value: OneofOptionsAmino; +} export interface EnumOptions { /** * Set this option to true to allow mapping different tag names to the same @@ -830,6 +1416,30 @@ export interface EnumOptions { /** The parser stores options it doesn't recognize here. See above. */ uninterpretedOption: UninterpretedOption[]; } +export interface EnumOptionsProtoMsg { + typeUrl: "/google.protobuf.EnumOptions"; + value: Uint8Array; +} +export interface EnumOptionsAmino { + /** + * Set this option to true to allow mapping different tag names to the same + * value. + */ + allow_alias: boolean; + /** + * Is this enum deprecated? + * Depending on the target platform, this can emit Deprecated annotations + * for the enum, or it will be completely ignored; in the very least, this + * is a formalization for deprecating enums. + */ + deprecated: boolean; + /** The parser stores options it doesn't recognize here. See above. */ + uninterpreted_option: UninterpretedOptionAmino[]; +} +export interface EnumOptionsAminoMsg { + type: "/google.protobuf.EnumOptions"; + value: EnumOptionsAmino; +} export interface EnumValueOptions { /** * Is this enum value deprecated? @@ -841,6 +1451,25 @@ export interface EnumValueOptions { /** The parser stores options it doesn't recognize here. See above. */ uninterpretedOption: UninterpretedOption[]; } +export interface EnumValueOptionsProtoMsg { + typeUrl: "/google.protobuf.EnumValueOptions"; + value: Uint8Array; +} +export interface EnumValueOptionsAmino { + /** + * Is this enum value deprecated? + * Depending on the target platform, this can emit Deprecated annotations + * for the enum value, or it will be completely ignored; in the very least, + * this is a formalization for deprecating enum values. + */ + deprecated: boolean; + /** The parser stores options it doesn't recognize here. See above. */ + uninterpreted_option: UninterpretedOptionAmino[]; +} +export interface EnumValueOptionsAminoMsg { + type: "/google.protobuf.EnumValueOptions"; + value: EnumValueOptionsAmino; +} export interface ServiceOptions { /** * Is this service deprecated? @@ -852,6 +1481,25 @@ export interface ServiceOptions { /** The parser stores options it doesn't recognize here. See above. */ uninterpretedOption: UninterpretedOption[]; } +export interface ServiceOptionsProtoMsg { + typeUrl: "/google.protobuf.ServiceOptions"; + value: Uint8Array; +} +export interface ServiceOptionsAmino { + /** + * Is this service deprecated? + * Depending on the target platform, this can emit Deprecated annotations + * for the service, or it will be completely ignored; in the very least, + * this is a formalization for deprecating services. + */ + deprecated: boolean; + /** The parser stores options it doesn't recognize here. See above. */ + uninterpreted_option: UninterpretedOptionAmino[]; +} +export interface ServiceOptionsAminoMsg { + type: "/google.protobuf.ServiceOptions"; + value: ServiceOptionsAmino; +} export interface MethodOptions { /** * Is this method deprecated? @@ -864,6 +1512,26 @@ export interface MethodOptions { /** The parser stores options it doesn't recognize here. See above. */ uninterpretedOption: UninterpretedOption[]; } +export interface MethodOptionsProtoMsg { + typeUrl: "/google.protobuf.MethodOptions"; + value: Uint8Array; +} +export interface MethodOptionsAmino { + /** + * Is this method deprecated? + * Depending on the target platform, this can emit Deprecated annotations + * for the method, or it will be completely ignored; in the very least, + * this is a formalization for deprecating methods. + */ + deprecated: boolean; + idempotency_level: MethodOptions_IdempotencyLevel; + /** The parser stores options it doesn't recognize here. See above. */ + uninterpreted_option: UninterpretedOptionAmino[]; +} +export interface MethodOptionsAminoMsg { + type: "/google.protobuf.MethodOptions"; + value: MethodOptionsAmino; +} /** * A message representing a option the parser does not recognize. This only * appears in options protos created by the compiler::Parser class. @@ -885,6 +1553,35 @@ export interface UninterpretedOption { stringValue: Uint8Array; aggregateValue: string; } +export interface UninterpretedOptionProtoMsg { + typeUrl: "/google.protobuf.UninterpretedOption"; + value: Uint8Array; +} +/** + * A message representing a option the parser does not recognize. This only + * appears in options protos created by the compiler::Parser class. + * DescriptorPool resolves these when building Descriptor objects. Therefore, + * options protos in descriptor objects (e.g. returned by Descriptor::options(), + * or produced by Descriptor::CopyTo()) will never have UninterpretedOptions + * in them. + */ +export interface UninterpretedOptionAmino { + name: UninterpretedOption_NamePartAmino[]; + /** + * The value of the uninterpreted option, in whatever type the tokenizer + * identified it as during parsing. Exactly one of these should be set. + */ + identifier_value: string; + positive_int_value: string; + negative_int_value: string; + double_value: number; + string_value: Uint8Array; + aggregate_value: string; +} +export interface UninterpretedOptionAminoMsg { + type: "/google.protobuf.UninterpretedOption"; + value: UninterpretedOptionAmino; +} /** * The name of the uninterpreted option. Each string represents a segment in * a dot-separated name. is_extension is true iff a segment represents an @@ -896,6 +1593,25 @@ export interface UninterpretedOption_NamePart { namePart: string; isExtension: boolean; } +export interface UninterpretedOption_NamePartProtoMsg { + typeUrl: "/google.protobuf.NamePart"; + value: Uint8Array; +} +/** + * The name of the uninterpreted option. Each string represents a segment in + * a dot-separated name. is_extension is true iff a segment represents an + * extension (denoted with parentheses in options specs in .proto files). + * E.g.,{ ["foo", false], ["bar.baz", true], ["qux", false] } represents + * "foo.(bar.baz).qux". + */ +export interface UninterpretedOption_NamePartAmino { + name_part: string; + is_extension: boolean; +} +export interface UninterpretedOption_NamePartAminoMsg { + type: "/google.protobuf.NamePart"; + value: UninterpretedOption_NamePartAmino; +} /** * Encapsulates information about the original source file from which a * FileDescriptorProto was generated. @@ -948,6 +1664,66 @@ export interface SourceCodeInfo { */ location: SourceCodeInfo_Location[]; } +export interface SourceCodeInfoProtoMsg { + typeUrl: "/google.protobuf.SourceCodeInfo"; + value: Uint8Array; +} +/** + * Encapsulates information about the original source file from which a + * FileDescriptorProto was generated. + */ +export interface SourceCodeInfoAmino { + /** + * A Location identifies a piece of source code in a .proto file which + * corresponds to a particular definition. This information is intended + * to be useful to IDEs, code indexers, documentation generators, and similar + * tools. + * + * For example, say we have a file like: + * message Foo { + * optional string foo = 1; + * } + * Let's look at just the field definition: + * optional string foo = 1; + * ^ ^^ ^^ ^ ^^^ + * a bc de f ghi + * We have the following locations: + * span path represents + * [a,i) [ 4, 0, 2, 0 ] The whole field definition. + * [a,b) [ 4, 0, 2, 0, 4 ] The label (optional). + * [c,d) [ 4, 0, 2, 0, 5 ] The type (string). + * [e,f) [ 4, 0, 2, 0, 1 ] The name (foo). + * [g,h) [ 4, 0, 2, 0, 3 ] The number (1). + * + * Notes: + * - A location may refer to a repeated field itself (i.e. not to any + * particular index within it). This is used whenever a set of elements are + * logically enclosed in a single code segment. For example, an entire + * extend block (possibly containing multiple extension definitions) will + * have an outer location whose path refers to the "extensions" repeated + * field without an index. + * - Multiple locations may have the same path. This happens when a single + * logical declaration is spread out across multiple places. The most + * obvious example is the "extend" block again -- there may be multiple + * extend blocks in the same scope, each of which will have the same path. + * - A location's span is not always a subset of its parent's span. For + * example, the "extendee" of an extension declaration appears at the + * beginning of the "extend" block and is shared by all extensions within + * the block. + * - Just because a location's span is a subset of some other location's span + * does not mean that it is a descendant. For example, a "group" defines + * both a type and a field in a single declaration. Thus, the locations + * corresponding to the type and field and their components will overlap. + * - Code which tries to interpret locations should probably be designed to + * ignore those that it doesn't understand, as more types of locations could + * be recorded in the future. + */ + location: SourceCodeInfo_LocationAmino[]; +} +export interface SourceCodeInfoAminoMsg { + type: "/google.protobuf.SourceCodeInfo"; + value: SourceCodeInfoAmino; +} export interface SourceCodeInfo_Location { /** * Identifies which part of the FileDescriptorProto was defined at this @@ -1036,6 +1812,102 @@ export interface SourceCodeInfo_Location { trailingComments: string; leadingDetachedComments: string[]; } +export interface SourceCodeInfo_LocationProtoMsg { + typeUrl: "/google.protobuf.Location"; + value: Uint8Array; +} +export interface SourceCodeInfo_LocationAmino { + /** + * Identifies which part of the FileDescriptorProto was defined at this + * location. + * + * Each element is a field number or an index. They form a path from + * the root FileDescriptorProto to the place where the definition. For + * example, this path: + * [ 4, 3, 2, 7, 1 ] + * refers to: + * file.message_type(3) // 4, 3 + * .field(7) // 2, 7 + * .name() // 1 + * This is because FileDescriptorProto.message_type has field number 4: + * repeated DescriptorProto message_type = 4; + * and DescriptorProto.field has field number 2: + * repeated FieldDescriptorProto field = 2; + * and FieldDescriptorProto.name has field number 1: + * optional string name = 1; + * + * Thus, the above path gives the location of a field name. If we removed + * the last element: + * [ 4, 3, 2, 7 ] + * this path refers to the whole field declaration (from the beginning + * of the label to the terminating semicolon). + */ + path: number[]; + /** + * Always has exactly three or four elements: start line, start column, + * end line (optional, otherwise assumed same as start line), end column. + * These are packed into a single field for efficiency. Note that line + * and column numbers are zero-based -- typically you will want to add + * 1 to each before displaying to a user. + */ + span: number[]; + /** + * If this SourceCodeInfo represents a complete declaration, these are any + * comments appearing before and after the declaration which appear to be + * attached to the declaration. + * + * A series of line comments appearing on consecutive lines, with no other + * tokens appearing on those lines, will be treated as a single comment. + * + * leading_detached_comments will keep paragraphs of comments that appear + * before (but not connected to) the current element. Each paragraph, + * separated by empty lines, will be one comment element in the repeated + * field. + * + * Only the comment content is provided; comment markers (e.g. //) are + * stripped out. For block comments, leading whitespace and an asterisk + * will be stripped from the beginning of each line other than the first. + * Newlines are included in the output. + * + * Examples: + * + * optional int32 foo = 1; // Comment attached to foo. + * // Comment attached to bar. + * optional int32 bar = 2; + * + * optional string baz = 3; + * // Comment attached to baz. + * // Another line attached to baz. + * + * // Comment attached to qux. + * // + * // Another line attached to qux. + * optional double qux = 4; + * + * // Detached comment for corge. This is not leading or trailing comments + * // to qux or corge because there are blank lines separating it from + * // both. + * + * // Detached comment for corge paragraph 2. + * + * optional string corge = 5; + * /* Block comment attached + * * to corge. Leading asterisks + * * will be removed. *\/ + * /* Block comment attached to + * * grault. *\/ + * optional int32 grault = 6; + * + * // ignored detached comments. + */ + leading_comments: string; + trailing_comments: string; + leading_detached_comments: string[]; +} +export interface SourceCodeInfo_LocationAminoMsg { + type: "/google.protobuf.Location"; + value: SourceCodeInfo_LocationAmino; +} /** * Describes the relationship between generated code and its original source * file. A GeneratedCodeInfo message is associated with only one generated @@ -1048,6 +1920,26 @@ export interface GeneratedCodeInfo { */ annotation: GeneratedCodeInfo_Annotation[]; } +export interface GeneratedCodeInfoProtoMsg { + typeUrl: "/google.protobuf.GeneratedCodeInfo"; + value: Uint8Array; +} +/** + * Describes the relationship between generated code and its original source + * file. A GeneratedCodeInfo message is associated with only one generated + * source file, but may contain references to different source .proto files. + */ +export interface GeneratedCodeInfoAmino { + /** + * An Annotation connects some span of text in generated code to an element + * of its generating .proto file. + */ + annotation: GeneratedCodeInfo_AnnotationAmino[]; +} +export interface GeneratedCodeInfoAminoMsg { + type: "/google.protobuf.GeneratedCodeInfo"; + value: GeneratedCodeInfoAmino; +} export interface GeneratedCodeInfo_Annotation { /** * Identifies the element in the original source .proto file. This field @@ -1068,6 +1960,34 @@ export interface GeneratedCodeInfo_Annotation { */ end: number; } +export interface GeneratedCodeInfo_AnnotationProtoMsg { + typeUrl: "/google.protobuf.Annotation"; + value: Uint8Array; +} +export interface GeneratedCodeInfo_AnnotationAmino { + /** + * Identifies the element in the original source .proto file. This field + * is formatted the same as SourceCodeInfo.Location.path. + */ + path: number[]; + /** Identifies the filesystem path to the original source .proto. */ + source_file: string; + /** + * Identifies the starting offset in bytes in the generated code + * that relates to the identified object. + */ + begin: number; + /** + * Identifies the ending offset in bytes in the generated code that + * relates to the identified offset. The end offset should be one past + * the last relevant byte (so the length of the text = end - begin). + */ + end: number; +} +export interface GeneratedCodeInfo_AnnotationAminoMsg { + type: "/google.protobuf.Annotation"; + value: GeneratedCodeInfo_AnnotationAmino; +} function createBaseFileDescriptorSet(): FileDescriptorSet { return { file: [], @@ -1128,6 +2048,39 @@ export const FileDescriptorSet = { object.file?.map((e) => FileDescriptorProto.fromPartial(e)) || []; return message; }, + fromAmino(object: FileDescriptorSetAmino): FileDescriptorSet { + return { + file: Array.isArray(object?.file) + ? object.file.map((e: any) => FileDescriptorProto.fromAmino(e)) + : [], + }; + }, + toAmino(message: FileDescriptorSet): FileDescriptorSetAmino { + const obj: any = {}; + if (message.file) { + obj.file = message.file.map((e) => + e ? FileDescriptorProto.toAmino(e) : undefined + ); + } else { + obj.file = []; + } + return obj; + }, + fromAminoMsg(object: FileDescriptorSetAminoMsg): FileDescriptorSet { + return FileDescriptorSet.fromAmino(object.value); + }, + fromProtoMsg(message: FileDescriptorSetProtoMsg): FileDescriptorSet { + return FileDescriptorSet.decode(message.value); + }, + toProto(message: FileDescriptorSet): Uint8Array { + return FileDescriptorSet.encode(message).finish(); + }, + toProtoMsg(message: FileDescriptorSet): FileDescriptorSetProtoMsg { + return { + typeUrl: "/google.protobuf.FileDescriptorSet", + value: FileDescriptorSet.encode(message).finish(), + }; + }, }; function createBaseFileDescriptorProto(): FileDescriptorProto { return { @@ -1390,6 +2343,111 @@ export const FileDescriptorProto = { message.syntax = object.syntax ?? ""; return message; }, + fromAmino(object: FileDescriptorProtoAmino): FileDescriptorProto { + return { + name: object.name, + package: object.package, + dependency: Array.isArray(object?.dependency) + ? object.dependency.map((e: any) => e) + : [], + publicDependency: Array.isArray(object?.public_dependency) + ? object.public_dependency.map((e: any) => e) + : [], + weakDependency: Array.isArray(object?.weak_dependency) + ? object.weak_dependency.map((e: any) => e) + : [], + messageType: Array.isArray(object?.message_type) + ? object.message_type.map((e: any) => DescriptorProto.fromAmino(e)) + : [], + enumType: Array.isArray(object?.enum_type) + ? object.enum_type.map((e: any) => EnumDescriptorProto.fromAmino(e)) + : [], + service: Array.isArray(object?.service) + ? object.service.map((e: any) => ServiceDescriptorProto.fromAmino(e)) + : [], + extension: Array.isArray(object?.extension) + ? object.extension.map((e: any) => FieldDescriptorProto.fromAmino(e)) + : [], + options: object?.options + ? FileOptions.fromAmino(object.options) + : undefined, + sourceCodeInfo: object?.source_code_info + ? SourceCodeInfo.fromAmino(object.source_code_info) + : undefined, + syntax: object.syntax, + }; + }, + toAmino(message: FileDescriptorProto): FileDescriptorProtoAmino { + const obj: any = {}; + obj.name = message.name; + obj.package = message.package; + if (message.dependency) { + obj.dependency = message.dependency.map((e) => e); + } else { + obj.dependency = []; + } + if (message.publicDependency) { + obj.public_dependency = message.publicDependency.map((e) => e); + } else { + obj.public_dependency = []; + } + if (message.weakDependency) { + obj.weak_dependency = message.weakDependency.map((e) => e); + } else { + obj.weak_dependency = []; + } + if (message.messageType) { + obj.message_type = message.messageType.map((e) => + e ? DescriptorProto.toAmino(e) : undefined + ); + } else { + obj.message_type = []; + } + if (message.enumType) { + obj.enum_type = message.enumType.map((e) => + e ? EnumDescriptorProto.toAmino(e) : undefined + ); + } else { + obj.enum_type = []; + } + if (message.service) { + obj.service = message.service.map((e) => + e ? ServiceDescriptorProto.toAmino(e) : undefined + ); + } else { + obj.service = []; + } + if (message.extension) { + obj.extension = message.extension.map((e) => + e ? FieldDescriptorProto.toAmino(e) : undefined + ); + } else { + obj.extension = []; + } + obj.options = message.options + ? FileOptions.toAmino(message.options) + : undefined; + obj.source_code_info = message.sourceCodeInfo + ? SourceCodeInfo.toAmino(message.sourceCodeInfo) + : undefined; + obj.syntax = message.syntax; + return obj; + }, + fromAminoMsg(object: FileDescriptorProtoAminoMsg): FileDescriptorProto { + return FileDescriptorProto.fromAmino(object.value); + }, + fromProtoMsg(message: FileDescriptorProtoProtoMsg): FileDescriptorProto { + return FileDescriptorProto.decode(message.value); + }, + toProto(message: FileDescriptorProto): Uint8Array { + return FileDescriptorProto.encode(message).finish(); + }, + toProtoMsg(message: FileDescriptorProto): FileDescriptorProtoProtoMsg { + return { + typeUrl: "/google.protobuf.FileDescriptorProto", + value: FileDescriptorProto.encode(message).finish(), + }; + }, }; function createBaseDescriptorProto(): DescriptorProto { return { @@ -1635,6 +2693,119 @@ export const DescriptorProto = { message.reservedName = object.reservedName?.map((e) => e) || []; return message; }, + fromAmino(object: DescriptorProtoAmino): DescriptorProto { + return { + name: object.name, + field: Array.isArray(object?.field) + ? object.field.map((e: any) => FieldDescriptorProto.fromAmino(e)) + : [], + extension: Array.isArray(object?.extension) + ? object.extension.map((e: any) => FieldDescriptorProto.fromAmino(e)) + : [], + nestedType: Array.isArray(object?.nested_type) + ? object.nested_type.map((e: any) => DescriptorProto.fromAmino(e)) + : [], + enumType: Array.isArray(object?.enum_type) + ? object.enum_type.map((e: any) => EnumDescriptorProto.fromAmino(e)) + : [], + extensionRange: Array.isArray(object?.extension_range) + ? object.extension_range.map((e: any) => + DescriptorProto_ExtensionRange.fromAmino(e) + ) + : [], + oneofDecl: Array.isArray(object?.oneof_decl) + ? object.oneof_decl.map((e: any) => OneofDescriptorProto.fromAmino(e)) + : [], + options: object?.options + ? MessageOptions.fromAmino(object.options) + : undefined, + reservedRange: Array.isArray(object?.reserved_range) + ? object.reserved_range.map((e: any) => + DescriptorProto_ReservedRange.fromAmino(e) + ) + : [], + reservedName: Array.isArray(object?.reserved_name) + ? object.reserved_name.map((e: any) => e) + : [], + }; + }, + toAmino(message: DescriptorProto): DescriptorProtoAmino { + const obj: any = {}; + obj.name = message.name; + if (message.field) { + obj.field = message.field.map((e) => + e ? FieldDescriptorProto.toAmino(e) : undefined + ); + } else { + obj.field = []; + } + if (message.extension) { + obj.extension = message.extension.map((e) => + e ? FieldDescriptorProto.toAmino(e) : undefined + ); + } else { + obj.extension = []; + } + if (message.nestedType) { + obj.nested_type = message.nestedType.map((e) => + e ? DescriptorProto.toAmino(e) : undefined + ); + } else { + obj.nested_type = []; + } + if (message.enumType) { + obj.enum_type = message.enumType.map((e) => + e ? EnumDescriptorProto.toAmino(e) : undefined + ); + } else { + obj.enum_type = []; + } + if (message.extensionRange) { + obj.extension_range = message.extensionRange.map((e) => + e ? DescriptorProto_ExtensionRange.toAmino(e) : undefined + ); + } else { + obj.extension_range = []; + } + if (message.oneofDecl) { + obj.oneof_decl = message.oneofDecl.map((e) => + e ? OneofDescriptorProto.toAmino(e) : undefined + ); + } else { + obj.oneof_decl = []; + } + obj.options = message.options + ? MessageOptions.toAmino(message.options) + : undefined; + if (message.reservedRange) { + obj.reserved_range = message.reservedRange.map((e) => + e ? DescriptorProto_ReservedRange.toAmino(e) : undefined + ); + } else { + obj.reserved_range = []; + } + if (message.reservedName) { + obj.reserved_name = message.reservedName.map((e) => e); + } else { + obj.reserved_name = []; + } + return obj; + }, + fromAminoMsg(object: DescriptorProtoAminoMsg): DescriptorProto { + return DescriptorProto.fromAmino(object.value); + }, + fromProtoMsg(message: DescriptorProtoProtoMsg): DescriptorProto { + return DescriptorProto.decode(message.value); + }, + toProto(message: DescriptorProto): Uint8Array { + return DescriptorProto.encode(message).finish(); + }, + toProtoMsg(message: DescriptorProto): DescriptorProtoProtoMsg { + return { + typeUrl: "/google.protobuf.DescriptorProto", + value: DescriptorProto.encode(message).finish(), + }; + }, }; function createBaseDescriptorProto_ExtensionRange(): DescriptorProto_ExtensionRange { return { @@ -1722,6 +2893,49 @@ export const DescriptorProto_ExtensionRange = { : undefined; return message; }, + fromAmino( + object: DescriptorProto_ExtensionRangeAmino + ): DescriptorProto_ExtensionRange { + return { + start: object.start, + end: object.end, + options: object?.options + ? ExtensionRangeOptions.fromAmino(object.options) + : undefined, + }; + }, + toAmino( + message: DescriptorProto_ExtensionRange + ): DescriptorProto_ExtensionRangeAmino { + const obj: any = {}; + obj.start = message.start; + obj.end = message.end; + obj.options = message.options + ? ExtensionRangeOptions.toAmino(message.options) + : undefined; + return obj; + }, + fromAminoMsg( + object: DescriptorProto_ExtensionRangeAminoMsg + ): DescriptorProto_ExtensionRange { + return DescriptorProto_ExtensionRange.fromAmino(object.value); + }, + fromProtoMsg( + message: DescriptorProto_ExtensionRangeProtoMsg + ): DescriptorProto_ExtensionRange { + return DescriptorProto_ExtensionRange.decode(message.value); + }, + toProto(message: DescriptorProto_ExtensionRange): Uint8Array { + return DescriptorProto_ExtensionRange.encode(message).finish(); + }, + toProtoMsg( + message: DescriptorProto_ExtensionRange + ): DescriptorProto_ExtensionRangeProtoMsg { + return { + typeUrl: "/google.protobuf.ExtensionRange", + value: DescriptorProto_ExtensionRange.encode(message).finish(), + }; + }, }; function createBaseDescriptorProto_ReservedRange(): DescriptorProto_ReservedRange { return { @@ -1785,6 +2999,43 @@ export const DescriptorProto_ReservedRange = { message.end = object.end ?? 0; return message; }, + fromAmino( + object: DescriptorProto_ReservedRangeAmino + ): DescriptorProto_ReservedRange { + return { + start: object.start, + end: object.end, + }; + }, + toAmino( + message: DescriptorProto_ReservedRange + ): DescriptorProto_ReservedRangeAmino { + const obj: any = {}; + obj.start = message.start; + obj.end = message.end; + return obj; + }, + fromAminoMsg( + object: DescriptorProto_ReservedRangeAminoMsg + ): DescriptorProto_ReservedRange { + return DescriptorProto_ReservedRange.fromAmino(object.value); + }, + fromProtoMsg( + message: DescriptorProto_ReservedRangeProtoMsg + ): DescriptorProto_ReservedRange { + return DescriptorProto_ReservedRange.decode(message.value); + }, + toProto(message: DescriptorProto_ReservedRange): Uint8Array { + return DescriptorProto_ReservedRange.encode(message).finish(); + }, + toProtoMsg( + message: DescriptorProto_ReservedRange + ): DescriptorProto_ReservedRangeProtoMsg { + return { + typeUrl: "/google.protobuf.ReservedRange", + value: DescriptorProto_ReservedRange.encode(message).finish(), + }; + }, }; function createBaseExtensionRangeOptions(): ExtensionRangeOptions { return { @@ -1853,6 +3104,41 @@ export const ExtensionRangeOptions = { ) || []; return message; }, + fromAmino(object: ExtensionRangeOptionsAmino): ExtensionRangeOptions { + return { + uninterpretedOption: Array.isArray(object?.uninterpreted_option) + ? object.uninterpreted_option.map((e: any) => + UninterpretedOption.fromAmino(e) + ) + : [], + }; + }, + toAmino(message: ExtensionRangeOptions): ExtensionRangeOptionsAmino { + const obj: any = {}; + if (message.uninterpretedOption) { + obj.uninterpreted_option = message.uninterpretedOption.map((e) => + e ? UninterpretedOption.toAmino(e) : undefined + ); + } else { + obj.uninterpreted_option = []; + } + return obj; + }, + fromAminoMsg(object: ExtensionRangeOptionsAminoMsg): ExtensionRangeOptions { + return ExtensionRangeOptions.fromAmino(object.value); + }, + fromProtoMsg(message: ExtensionRangeOptionsProtoMsg): ExtensionRangeOptions { + return ExtensionRangeOptions.decode(message.value); + }, + toProto(message: ExtensionRangeOptions): Uint8Array { + return ExtensionRangeOptions.encode(message).finish(); + }, + toProtoMsg(message: ExtensionRangeOptions): ExtensionRangeOptionsProtoMsg { + return { + typeUrl: "/google.protobuf.ExtensionRangeOptions", + value: ExtensionRangeOptions.encode(message).finish(), + }; + }, }; function createBaseFieldDescriptorProto(): FieldDescriptorProto { return { @@ -2014,6 +3300,57 @@ export const FieldDescriptorProto = { : undefined; return message; }, + fromAmino(object: FieldDescriptorProtoAmino): FieldDescriptorProto { + return { + name: object.name, + number: object.number, + label: isSet(object.label) + ? fieldDescriptorProto_LabelFromJSON(object.label) + : 0, + type: isSet(object.type) + ? fieldDescriptorProto_TypeFromJSON(object.type) + : 0, + typeName: object.type_name, + extendee: object.extendee, + defaultValue: object.default_value, + oneofIndex: object.oneof_index, + jsonName: object.json_name, + options: object?.options + ? FieldOptions.fromAmino(object.options) + : undefined, + }; + }, + toAmino(message: FieldDescriptorProto): FieldDescriptorProtoAmino { + const obj: any = {}; + obj.name = message.name; + obj.number = message.number; + obj.label = message.label; + obj.type = message.type; + obj.type_name = message.typeName; + obj.extendee = message.extendee; + obj.default_value = message.defaultValue; + obj.oneof_index = message.oneofIndex; + obj.json_name = message.jsonName; + obj.options = message.options + ? FieldOptions.toAmino(message.options) + : undefined; + return obj; + }, + fromAminoMsg(object: FieldDescriptorProtoAminoMsg): FieldDescriptorProto { + return FieldDescriptorProto.fromAmino(object.value); + }, + fromProtoMsg(message: FieldDescriptorProtoProtoMsg): FieldDescriptorProto { + return FieldDescriptorProto.decode(message.value); + }, + toProto(message: FieldDescriptorProto): Uint8Array { + return FieldDescriptorProto.encode(message).finish(); + }, + toProtoMsg(message: FieldDescriptorProto): FieldDescriptorProtoProtoMsg { + return { + typeUrl: "/google.protobuf.FieldDescriptorProto", + value: FieldDescriptorProto.encode(message).finish(), + }; + }, }; function createBaseOneofDescriptorProto(): OneofDescriptorProto { return { @@ -2085,6 +3422,37 @@ export const OneofDescriptorProto = { : undefined; return message; }, + fromAmino(object: OneofDescriptorProtoAmino): OneofDescriptorProto { + return { + name: object.name, + options: object?.options + ? OneofOptions.fromAmino(object.options) + : undefined, + }; + }, + toAmino(message: OneofDescriptorProto): OneofDescriptorProtoAmino { + const obj: any = {}; + obj.name = message.name; + obj.options = message.options + ? OneofOptions.toAmino(message.options) + : undefined; + return obj; + }, + fromAminoMsg(object: OneofDescriptorProtoAminoMsg): OneofDescriptorProto { + return OneofDescriptorProto.fromAmino(object.value); + }, + fromProtoMsg(message: OneofDescriptorProtoProtoMsg): OneofDescriptorProto { + return OneofDescriptorProto.decode(message.value); + }, + toProto(message: OneofDescriptorProto): Uint8Array { + return OneofDescriptorProto.encode(message).finish(); + }, + toProtoMsg(message: OneofDescriptorProto): OneofDescriptorProtoProtoMsg { + return { + typeUrl: "/google.protobuf.OneofDescriptorProto", + value: OneofDescriptorProto.encode(message).finish(), + }; + }, }; function createBaseEnumDescriptorProto(): EnumDescriptorProto { return { @@ -2221,6 +3589,67 @@ export const EnumDescriptorProto = { message.reservedName = object.reservedName?.map((e) => e) || []; return message; }, + fromAmino(object: EnumDescriptorProtoAmino): EnumDescriptorProto { + return { + name: object.name, + value: Array.isArray(object?.value) + ? object.value.map((e: any) => EnumValueDescriptorProto.fromAmino(e)) + : [], + options: object?.options + ? EnumOptions.fromAmino(object.options) + : undefined, + reservedRange: Array.isArray(object?.reserved_range) + ? object.reserved_range.map((e: any) => + EnumDescriptorProto_EnumReservedRange.fromAmino(e) + ) + : [], + reservedName: Array.isArray(object?.reserved_name) + ? object.reserved_name.map((e: any) => e) + : [], + }; + }, + toAmino(message: EnumDescriptorProto): EnumDescriptorProtoAmino { + const obj: any = {}; + obj.name = message.name; + if (message.value) { + obj.value = message.value.map((e) => + e ? EnumValueDescriptorProto.toAmino(e) : undefined + ); + } else { + obj.value = []; + } + obj.options = message.options + ? EnumOptions.toAmino(message.options) + : undefined; + if (message.reservedRange) { + obj.reserved_range = message.reservedRange.map((e) => + e ? EnumDescriptorProto_EnumReservedRange.toAmino(e) : undefined + ); + } else { + obj.reserved_range = []; + } + if (message.reservedName) { + obj.reserved_name = message.reservedName.map((e) => e); + } else { + obj.reserved_name = []; + } + return obj; + }, + fromAminoMsg(object: EnumDescriptorProtoAminoMsg): EnumDescriptorProto { + return EnumDescriptorProto.fromAmino(object.value); + }, + fromProtoMsg(message: EnumDescriptorProtoProtoMsg): EnumDescriptorProto { + return EnumDescriptorProto.decode(message.value); + }, + toProto(message: EnumDescriptorProto): Uint8Array { + return EnumDescriptorProto.encode(message).finish(); + }, + toProtoMsg(message: EnumDescriptorProto): EnumDescriptorProtoProtoMsg { + return { + typeUrl: "/google.protobuf.EnumDescriptorProto", + value: EnumDescriptorProto.encode(message).finish(), + }; + }, }; function createBaseEnumDescriptorProto_EnumReservedRange(): EnumDescriptorProto_EnumReservedRange { return { @@ -2284,6 +3713,43 @@ export const EnumDescriptorProto_EnumReservedRange = { message.end = object.end ?? 0; return message; }, + fromAmino( + object: EnumDescriptorProto_EnumReservedRangeAmino + ): EnumDescriptorProto_EnumReservedRange { + return { + start: object.start, + end: object.end, + }; + }, + toAmino( + message: EnumDescriptorProto_EnumReservedRange + ): EnumDescriptorProto_EnumReservedRangeAmino { + const obj: any = {}; + obj.start = message.start; + obj.end = message.end; + return obj; + }, + fromAminoMsg( + object: EnumDescriptorProto_EnumReservedRangeAminoMsg + ): EnumDescriptorProto_EnumReservedRange { + return EnumDescriptorProto_EnumReservedRange.fromAmino(object.value); + }, + fromProtoMsg( + message: EnumDescriptorProto_EnumReservedRangeProtoMsg + ): EnumDescriptorProto_EnumReservedRange { + return EnumDescriptorProto_EnumReservedRange.decode(message.value); + }, + toProto(message: EnumDescriptorProto_EnumReservedRange): Uint8Array { + return EnumDescriptorProto_EnumReservedRange.encode(message).finish(); + }, + toProtoMsg( + message: EnumDescriptorProto_EnumReservedRange + ): EnumDescriptorProto_EnumReservedRangeProtoMsg { + return { + typeUrl: "/google.protobuf.EnumReservedRange", + value: EnumDescriptorProto_EnumReservedRange.encode(message).finish(), + }; + }, }; function createBaseEnumValueDescriptorProto(): EnumValueDescriptorProto { return { @@ -2368,6 +3834,45 @@ export const EnumValueDescriptorProto = { : undefined; return message; }, + fromAmino(object: EnumValueDescriptorProtoAmino): EnumValueDescriptorProto { + return { + name: object.name, + number: object.number, + options: object?.options + ? EnumValueOptions.fromAmino(object.options) + : undefined, + }; + }, + toAmino(message: EnumValueDescriptorProto): EnumValueDescriptorProtoAmino { + const obj: any = {}; + obj.name = message.name; + obj.number = message.number; + obj.options = message.options + ? EnumValueOptions.toAmino(message.options) + : undefined; + return obj; + }, + fromAminoMsg( + object: EnumValueDescriptorProtoAminoMsg + ): EnumValueDescriptorProto { + return EnumValueDescriptorProto.fromAmino(object.value); + }, + fromProtoMsg( + message: EnumValueDescriptorProtoProtoMsg + ): EnumValueDescriptorProto { + return EnumValueDescriptorProto.decode(message.value); + }, + toProto(message: EnumValueDescriptorProto): Uint8Array { + return EnumValueDescriptorProto.encode(message).finish(); + }, + toProtoMsg( + message: EnumValueDescriptorProto + ): EnumValueDescriptorProtoProtoMsg { + return { + typeUrl: "/google.protobuf.EnumValueDescriptorProto", + value: EnumValueDescriptorProto.encode(message).finish(), + }; + }, }; function createBaseServiceDescriptorProto(): ServiceDescriptorProto { return { @@ -2460,6 +3965,49 @@ export const ServiceDescriptorProto = { : undefined; return message; }, + fromAmino(object: ServiceDescriptorProtoAmino): ServiceDescriptorProto { + return { + name: object.name, + method: Array.isArray(object?.method) + ? object.method.map((e: any) => MethodDescriptorProto.fromAmino(e)) + : [], + options: object?.options + ? ServiceOptions.fromAmino(object.options) + : undefined, + }; + }, + toAmino(message: ServiceDescriptorProto): ServiceDescriptorProtoAmino { + const obj: any = {}; + obj.name = message.name; + if (message.method) { + obj.method = message.method.map((e) => + e ? MethodDescriptorProto.toAmino(e) : undefined + ); + } else { + obj.method = []; + } + obj.options = message.options + ? ServiceOptions.toAmino(message.options) + : undefined; + return obj; + }, + fromAminoMsg(object: ServiceDescriptorProtoAminoMsg): ServiceDescriptorProto { + return ServiceDescriptorProto.fromAmino(object.value); + }, + fromProtoMsg( + message: ServiceDescriptorProtoProtoMsg + ): ServiceDescriptorProto { + return ServiceDescriptorProto.decode(message.value); + }, + toProto(message: ServiceDescriptorProto): Uint8Array { + return ServiceDescriptorProto.encode(message).finish(); + }, + toProtoMsg(message: ServiceDescriptorProto): ServiceDescriptorProtoProtoMsg { + return { + typeUrl: "/google.protobuf.ServiceDescriptorProto", + value: ServiceDescriptorProto.encode(message).finish(), + }; + }, }; function createBaseMethodDescriptorProto(): MethodDescriptorProto { return { @@ -2577,6 +4125,45 @@ export const MethodDescriptorProto = { message.serverStreaming = object.serverStreaming ?? false; return message; }, + fromAmino(object: MethodDescriptorProtoAmino): MethodDescriptorProto { + return { + name: object.name, + inputType: object.input_type, + outputType: object.output_type, + options: object?.options + ? MethodOptions.fromAmino(object.options) + : undefined, + clientStreaming: object.client_streaming, + serverStreaming: object.server_streaming, + }; + }, + toAmino(message: MethodDescriptorProto): MethodDescriptorProtoAmino { + const obj: any = {}; + obj.name = message.name; + obj.input_type = message.inputType; + obj.output_type = message.outputType; + obj.options = message.options + ? MethodOptions.toAmino(message.options) + : undefined; + obj.client_streaming = message.clientStreaming; + obj.server_streaming = message.serverStreaming; + return obj; + }, + fromAminoMsg(object: MethodDescriptorProtoAminoMsg): MethodDescriptorProto { + return MethodDescriptorProto.fromAmino(object.value); + }, + fromProtoMsg(message: MethodDescriptorProtoProtoMsg): MethodDescriptorProto { + return MethodDescriptorProto.decode(message.value); + }, + toProto(message: MethodDescriptorProto): Uint8Array { + return MethodDescriptorProto.encode(message).finish(); + }, + toProtoMsg(message: MethodDescriptorProto): MethodDescriptorProtoProtoMsg { + return { + typeUrl: "/google.protobuf.MethodDescriptorProto", + value: MethodDescriptorProto.encode(message).finish(), + }; + }, }; function createBaseFileOptions(): FileOptions { return { @@ -2891,6 +4478,83 @@ export const FileOptions = { ) || []; return message; }, + fromAmino(object: FileOptionsAmino): FileOptions { + return { + javaPackage: object.java_package, + javaOuterClassname: object.java_outer_classname, + javaMultipleFiles: object.java_multiple_files, + javaGenerateEqualsAndHash: object.java_generate_equals_and_hash, + javaStringCheckUtf8: object.java_string_check_utf8, + optimizeFor: isSet(object.optimize_for) + ? fileOptions_OptimizeModeFromJSON(object.optimize_for) + : 0, + goPackage: object.go_package, + ccGenericServices: object.cc_generic_services, + javaGenericServices: object.java_generic_services, + pyGenericServices: object.py_generic_services, + phpGenericServices: object.php_generic_services, + deprecated: object.deprecated, + ccEnableArenas: object.cc_enable_arenas, + objcClassPrefix: object.objc_class_prefix, + csharpNamespace: object.csharp_namespace, + swiftPrefix: object.swift_prefix, + phpClassPrefix: object.php_class_prefix, + phpNamespace: object.php_namespace, + phpMetadataNamespace: object.php_metadata_namespace, + rubyPackage: object.ruby_package, + uninterpretedOption: Array.isArray(object?.uninterpreted_option) + ? object.uninterpreted_option.map((e: any) => + UninterpretedOption.fromAmino(e) + ) + : [], + }; + }, + toAmino(message: FileOptions): FileOptionsAmino { + const obj: any = {}; + obj.java_package = message.javaPackage; + obj.java_outer_classname = message.javaOuterClassname; + obj.java_multiple_files = message.javaMultipleFiles; + obj.java_generate_equals_and_hash = message.javaGenerateEqualsAndHash; + obj.java_string_check_utf8 = message.javaStringCheckUtf8; + obj.optimize_for = message.optimizeFor; + obj.go_package = message.goPackage; + obj.cc_generic_services = message.ccGenericServices; + obj.java_generic_services = message.javaGenericServices; + obj.py_generic_services = message.pyGenericServices; + obj.php_generic_services = message.phpGenericServices; + obj.deprecated = message.deprecated; + obj.cc_enable_arenas = message.ccEnableArenas; + obj.objc_class_prefix = message.objcClassPrefix; + obj.csharp_namespace = message.csharpNamespace; + obj.swift_prefix = message.swiftPrefix; + obj.php_class_prefix = message.phpClassPrefix; + obj.php_namespace = message.phpNamespace; + obj.php_metadata_namespace = message.phpMetadataNamespace; + obj.ruby_package = message.rubyPackage; + if (message.uninterpretedOption) { + obj.uninterpreted_option = message.uninterpretedOption.map((e) => + e ? UninterpretedOption.toAmino(e) : undefined + ); + } else { + obj.uninterpreted_option = []; + } + return obj; + }, + fromAminoMsg(object: FileOptionsAminoMsg): FileOptions { + return FileOptions.fromAmino(object.value); + }, + fromProtoMsg(message: FileOptionsProtoMsg): FileOptions { + return FileOptions.decode(message.value); + }, + toProto(message: FileOptions): Uint8Array { + return FileOptions.encode(message).finish(); + }, + toProtoMsg(message: FileOptions): FileOptionsProtoMsg { + return { + typeUrl: "/google.protobuf.FileOptions", + value: FileOptions.encode(message).finish(), + }; + }, }; function createBaseMessageOptions(): MessageOptions { return { @@ -3003,6 +4667,49 @@ export const MessageOptions = { ) || []; return message; }, + fromAmino(object: MessageOptionsAmino): MessageOptions { + return { + messageSetWireFormat: object.message_set_wire_format, + noStandardDescriptorAccessor: object.no_standard_descriptor_accessor, + deprecated: object.deprecated, + mapEntry: object.map_entry, + uninterpretedOption: Array.isArray(object?.uninterpreted_option) + ? object.uninterpreted_option.map((e: any) => + UninterpretedOption.fromAmino(e) + ) + : [], + }; + }, + toAmino(message: MessageOptions): MessageOptionsAmino { + const obj: any = {}; + obj.message_set_wire_format = message.messageSetWireFormat; + obj.no_standard_descriptor_accessor = message.noStandardDescriptorAccessor; + obj.deprecated = message.deprecated; + obj.map_entry = message.mapEntry; + if (message.uninterpretedOption) { + obj.uninterpreted_option = message.uninterpretedOption.map((e) => + e ? UninterpretedOption.toAmino(e) : undefined + ); + } else { + obj.uninterpreted_option = []; + } + return obj; + }, + fromAminoMsg(object: MessageOptionsAminoMsg): MessageOptions { + return MessageOptions.fromAmino(object.value); + }, + fromProtoMsg(message: MessageOptionsProtoMsg): MessageOptions { + return MessageOptions.decode(message.value); + }, + toProto(message: MessageOptions): Uint8Array { + return MessageOptions.encode(message).finish(); + }, + toProtoMsg(message: MessageOptions): MessageOptionsProtoMsg { + return { + typeUrl: "/google.protobuf.MessageOptions", + value: MessageOptions.encode(message).finish(), + }; + }, }; function createBaseFieldOptions(): FieldOptions { return { @@ -3132,6 +4839,55 @@ export const FieldOptions = { ) || []; return message; }, + fromAmino(object: FieldOptionsAmino): FieldOptions { + return { + ctype: isSet(object.ctype) ? fieldOptions_CTypeFromJSON(object.ctype) : 0, + packed: object.packed, + jstype: isSet(object.jstype) + ? fieldOptions_JSTypeFromJSON(object.jstype) + : 0, + lazy: object.lazy, + deprecated: object.deprecated, + weak: object.weak, + uninterpretedOption: Array.isArray(object?.uninterpreted_option) + ? object.uninterpreted_option.map((e: any) => + UninterpretedOption.fromAmino(e) + ) + : [], + }; + }, + toAmino(message: FieldOptions): FieldOptionsAmino { + const obj: any = {}; + obj.ctype = message.ctype; + obj.packed = message.packed; + obj.jstype = message.jstype; + obj.lazy = message.lazy; + obj.deprecated = message.deprecated; + obj.weak = message.weak; + if (message.uninterpretedOption) { + obj.uninterpreted_option = message.uninterpretedOption.map((e) => + e ? UninterpretedOption.toAmino(e) : undefined + ); + } else { + obj.uninterpreted_option = []; + } + return obj; + }, + fromAminoMsg(object: FieldOptionsAminoMsg): FieldOptions { + return FieldOptions.fromAmino(object.value); + }, + fromProtoMsg(message: FieldOptionsProtoMsg): FieldOptions { + return FieldOptions.decode(message.value); + }, + toProto(message: FieldOptions): Uint8Array { + return FieldOptions.encode(message).finish(); + }, + toProtoMsg(message: FieldOptions): FieldOptionsProtoMsg { + return { + typeUrl: "/google.protobuf.FieldOptions", + value: FieldOptions.encode(message).finish(), + }; + }, }; function createBaseOneofOptions(): OneofOptions { return { @@ -3197,6 +4953,41 @@ export const OneofOptions = { ) || []; return message; }, + fromAmino(object: OneofOptionsAmino): OneofOptions { + return { + uninterpretedOption: Array.isArray(object?.uninterpreted_option) + ? object.uninterpreted_option.map((e: any) => + UninterpretedOption.fromAmino(e) + ) + : [], + }; + }, + toAmino(message: OneofOptions): OneofOptionsAmino { + const obj: any = {}; + if (message.uninterpretedOption) { + obj.uninterpreted_option = message.uninterpretedOption.map((e) => + e ? UninterpretedOption.toAmino(e) : undefined + ); + } else { + obj.uninterpreted_option = []; + } + return obj; + }, + fromAminoMsg(object: OneofOptionsAminoMsg): OneofOptions { + return OneofOptions.fromAmino(object.value); + }, + fromProtoMsg(message: OneofOptionsProtoMsg): OneofOptions { + return OneofOptions.decode(message.value); + }, + toProto(message: OneofOptions): Uint8Array { + return OneofOptions.encode(message).finish(); + }, + toProtoMsg(message: OneofOptions): OneofOptionsProtoMsg { + return { + typeUrl: "/google.protobuf.OneofOptions", + value: OneofOptions.encode(message).finish(), + }; + }, }; function createBaseEnumOptions(): EnumOptions { return { @@ -3282,6 +5073,45 @@ export const EnumOptions = { ) || []; return message; }, + fromAmino(object: EnumOptionsAmino): EnumOptions { + return { + allowAlias: object.allow_alias, + deprecated: object.deprecated, + uninterpretedOption: Array.isArray(object?.uninterpreted_option) + ? object.uninterpreted_option.map((e: any) => + UninterpretedOption.fromAmino(e) + ) + : [], + }; + }, + toAmino(message: EnumOptions): EnumOptionsAmino { + const obj: any = {}; + obj.allow_alias = message.allowAlias; + obj.deprecated = message.deprecated; + if (message.uninterpretedOption) { + obj.uninterpreted_option = message.uninterpretedOption.map((e) => + e ? UninterpretedOption.toAmino(e) : undefined + ); + } else { + obj.uninterpreted_option = []; + } + return obj; + }, + fromAminoMsg(object: EnumOptionsAminoMsg): EnumOptions { + return EnumOptions.fromAmino(object.value); + }, + fromProtoMsg(message: EnumOptionsProtoMsg): EnumOptions { + return EnumOptions.decode(message.value); + }, + toProto(message: EnumOptions): Uint8Array { + return EnumOptions.encode(message).finish(); + }, + toProtoMsg(message: EnumOptions): EnumOptionsProtoMsg { + return { + typeUrl: "/google.protobuf.EnumOptions", + value: EnumOptions.encode(message).finish(), + }; + }, }; function createBaseEnumValueOptions(): EnumValueOptions { return { @@ -3357,6 +5187,43 @@ export const EnumValueOptions = { ) || []; return message; }, + fromAmino(object: EnumValueOptionsAmino): EnumValueOptions { + return { + deprecated: object.deprecated, + uninterpretedOption: Array.isArray(object?.uninterpreted_option) + ? object.uninterpreted_option.map((e: any) => + UninterpretedOption.fromAmino(e) + ) + : [], + }; + }, + toAmino(message: EnumValueOptions): EnumValueOptionsAmino { + const obj: any = {}; + obj.deprecated = message.deprecated; + if (message.uninterpretedOption) { + obj.uninterpreted_option = message.uninterpretedOption.map((e) => + e ? UninterpretedOption.toAmino(e) : undefined + ); + } else { + obj.uninterpreted_option = []; + } + return obj; + }, + fromAminoMsg(object: EnumValueOptionsAminoMsg): EnumValueOptions { + return EnumValueOptions.fromAmino(object.value); + }, + fromProtoMsg(message: EnumValueOptionsProtoMsg): EnumValueOptions { + return EnumValueOptions.decode(message.value); + }, + toProto(message: EnumValueOptions): Uint8Array { + return EnumValueOptions.encode(message).finish(); + }, + toProtoMsg(message: EnumValueOptions): EnumValueOptionsProtoMsg { + return { + typeUrl: "/google.protobuf.EnumValueOptions", + value: EnumValueOptions.encode(message).finish(), + }; + }, }; function createBaseServiceOptions(): ServiceOptions { return { @@ -3432,6 +5299,43 @@ export const ServiceOptions = { ) || []; return message; }, + fromAmino(object: ServiceOptionsAmino): ServiceOptions { + return { + deprecated: object.deprecated, + uninterpretedOption: Array.isArray(object?.uninterpreted_option) + ? object.uninterpreted_option.map((e: any) => + UninterpretedOption.fromAmino(e) + ) + : [], + }; + }, + toAmino(message: ServiceOptions): ServiceOptionsAmino { + const obj: any = {}; + obj.deprecated = message.deprecated; + if (message.uninterpretedOption) { + obj.uninterpreted_option = message.uninterpretedOption.map((e) => + e ? UninterpretedOption.toAmino(e) : undefined + ); + } else { + obj.uninterpreted_option = []; + } + return obj; + }, + fromAminoMsg(object: ServiceOptionsAminoMsg): ServiceOptions { + return ServiceOptions.fromAmino(object.value); + }, + fromProtoMsg(message: ServiceOptionsProtoMsg): ServiceOptions { + return ServiceOptions.decode(message.value); + }, + toProto(message: ServiceOptions): Uint8Array { + return ServiceOptions.encode(message).finish(); + }, + toProtoMsg(message: ServiceOptions): ServiceOptionsProtoMsg { + return { + typeUrl: "/google.protobuf.ServiceOptions", + value: ServiceOptions.encode(message).finish(), + }; + }, }; function createBaseMethodOptions(): MethodOptions { return { @@ -3522,6 +5426,47 @@ export const MethodOptions = { ) || []; return message; }, + fromAmino(object: MethodOptionsAmino): MethodOptions { + return { + deprecated: object.deprecated, + idempotencyLevel: isSet(object.idempotency_level) + ? methodOptions_IdempotencyLevelFromJSON(object.idempotency_level) + : 0, + uninterpretedOption: Array.isArray(object?.uninterpreted_option) + ? object.uninterpreted_option.map((e: any) => + UninterpretedOption.fromAmino(e) + ) + : [], + }; + }, + toAmino(message: MethodOptions): MethodOptionsAmino { + const obj: any = {}; + obj.deprecated = message.deprecated; + obj.idempotency_level = message.idempotencyLevel; + if (message.uninterpretedOption) { + obj.uninterpreted_option = message.uninterpretedOption.map((e) => + e ? UninterpretedOption.toAmino(e) : undefined + ); + } else { + obj.uninterpreted_option = []; + } + return obj; + }, + fromAminoMsg(object: MethodOptionsAminoMsg): MethodOptions { + return MethodOptions.fromAmino(object.value); + }, + fromProtoMsg(message: MethodOptionsProtoMsg): MethodOptions { + return MethodOptions.decode(message.value); + }, + toProto(message: MethodOptions): Uint8Array { + return MethodOptions.encode(message).finish(); + }, + toProtoMsg(message: MethodOptions): MethodOptionsProtoMsg { + return { + typeUrl: "/google.protobuf.MethodOptions", + value: MethodOptions.encode(message).finish(), + }; + }, }; function createBaseUninterpretedOption(): UninterpretedOption { return { @@ -3677,6 +5622,55 @@ export const UninterpretedOption = { message.aggregateValue = object.aggregateValue ?? ""; return message; }, + fromAmino(object: UninterpretedOptionAmino): UninterpretedOption { + return { + name: Array.isArray(object?.name) + ? object.name.map((e: any) => UninterpretedOption_NamePart.fromAmino(e)) + : [], + identifierValue: object.identifier_value, + positiveIntValue: Long.fromString(object.positive_int_value), + negativeIntValue: Long.fromString(object.negative_int_value), + doubleValue: object.double_value, + stringValue: object.string_value, + aggregateValue: object.aggregate_value, + }; + }, + toAmino(message: UninterpretedOption): UninterpretedOptionAmino { + const obj: any = {}; + if (message.name) { + obj.name = message.name.map((e) => + e ? UninterpretedOption_NamePart.toAmino(e) : undefined + ); + } else { + obj.name = []; + } + obj.identifier_value = message.identifierValue; + obj.positive_int_value = message.positiveIntValue + ? message.positiveIntValue.toString() + : undefined; + obj.negative_int_value = message.negativeIntValue + ? message.negativeIntValue.toString() + : undefined; + obj.double_value = message.doubleValue; + obj.string_value = message.stringValue; + obj.aggregate_value = message.aggregateValue; + return obj; + }, + fromAminoMsg(object: UninterpretedOptionAminoMsg): UninterpretedOption { + return UninterpretedOption.fromAmino(object.value); + }, + fromProtoMsg(message: UninterpretedOptionProtoMsg): UninterpretedOption { + return UninterpretedOption.decode(message.value); + }, + toProto(message: UninterpretedOption): Uint8Array { + return UninterpretedOption.encode(message).finish(); + }, + toProtoMsg(message: UninterpretedOption): UninterpretedOptionProtoMsg { + return { + typeUrl: "/google.protobuf.UninterpretedOption", + value: UninterpretedOption.encode(message).finish(), + }; + }, }; function createBaseUninterpretedOption_NamePart(): UninterpretedOption_NamePart { return { @@ -3743,6 +5737,43 @@ export const UninterpretedOption_NamePart = { message.isExtension = object.isExtension ?? false; return message; }, + fromAmino( + object: UninterpretedOption_NamePartAmino + ): UninterpretedOption_NamePart { + return { + namePart: object.name_part, + isExtension: object.is_extension, + }; + }, + toAmino( + message: UninterpretedOption_NamePart + ): UninterpretedOption_NamePartAmino { + const obj: any = {}; + obj.name_part = message.namePart; + obj.is_extension = message.isExtension; + return obj; + }, + fromAminoMsg( + object: UninterpretedOption_NamePartAminoMsg + ): UninterpretedOption_NamePart { + return UninterpretedOption_NamePart.fromAmino(object.value); + }, + fromProtoMsg( + message: UninterpretedOption_NamePartProtoMsg + ): UninterpretedOption_NamePart { + return UninterpretedOption_NamePart.decode(message.value); + }, + toProto(message: UninterpretedOption_NamePart): Uint8Array { + return UninterpretedOption_NamePart.encode(message).finish(); + }, + toProtoMsg( + message: UninterpretedOption_NamePart + ): UninterpretedOption_NamePartProtoMsg { + return { + typeUrl: "/google.protobuf.NamePart", + value: UninterpretedOption_NamePart.encode(message).finish(), + }; + }, }; function createBaseSourceCodeInfo(): SourceCodeInfo { return { @@ -3804,6 +5835,39 @@ export const SourceCodeInfo = { object.location?.map((e) => SourceCodeInfo_Location.fromPartial(e)) || []; return message; }, + fromAmino(object: SourceCodeInfoAmino): SourceCodeInfo { + return { + location: Array.isArray(object?.location) + ? object.location.map((e: any) => SourceCodeInfo_Location.fromAmino(e)) + : [], + }; + }, + toAmino(message: SourceCodeInfo): SourceCodeInfoAmino { + const obj: any = {}; + if (message.location) { + obj.location = message.location.map((e) => + e ? SourceCodeInfo_Location.toAmino(e) : undefined + ); + } else { + obj.location = []; + } + return obj; + }, + fromAminoMsg(object: SourceCodeInfoAminoMsg): SourceCodeInfo { + return SourceCodeInfo.fromAmino(object.value); + }, + fromProtoMsg(message: SourceCodeInfoProtoMsg): SourceCodeInfo { + return SourceCodeInfo.decode(message.value); + }, + toProto(message: SourceCodeInfo): Uint8Array { + return SourceCodeInfo.encode(message).finish(); + }, + toProtoMsg(message: SourceCodeInfo): SourceCodeInfoProtoMsg { + return { + typeUrl: "/google.protobuf.SourceCodeInfo", + value: SourceCodeInfo.encode(message).finish(), + }; + }, }; function createBaseSourceCodeInfo_Location(): SourceCodeInfo_Location { return { @@ -3942,6 +6006,61 @@ export const SourceCodeInfo_Location = { object.leadingDetachedComments?.map((e) => e) || []; return message; }, + fromAmino(object: SourceCodeInfo_LocationAmino): SourceCodeInfo_Location { + return { + path: Array.isArray(object?.path) ? object.path.map((e: any) => e) : [], + span: Array.isArray(object?.span) ? object.span.map((e: any) => e) : [], + leadingComments: object.leading_comments, + trailingComments: object.trailing_comments, + leadingDetachedComments: Array.isArray(object?.leading_detached_comments) + ? object.leading_detached_comments.map((e: any) => e) + : [], + }; + }, + toAmino(message: SourceCodeInfo_Location): SourceCodeInfo_LocationAmino { + const obj: any = {}; + if (message.path) { + obj.path = message.path.map((e) => e); + } else { + obj.path = []; + } + if (message.span) { + obj.span = message.span.map((e) => e); + } else { + obj.span = []; + } + obj.leading_comments = message.leadingComments; + obj.trailing_comments = message.trailingComments; + if (message.leadingDetachedComments) { + obj.leading_detached_comments = message.leadingDetachedComments.map( + (e) => e + ); + } else { + obj.leading_detached_comments = []; + } + return obj; + }, + fromAminoMsg( + object: SourceCodeInfo_LocationAminoMsg + ): SourceCodeInfo_Location { + return SourceCodeInfo_Location.fromAmino(object.value); + }, + fromProtoMsg( + message: SourceCodeInfo_LocationProtoMsg + ): SourceCodeInfo_Location { + return SourceCodeInfo_Location.decode(message.value); + }, + toProto(message: SourceCodeInfo_Location): Uint8Array { + return SourceCodeInfo_Location.encode(message).finish(); + }, + toProtoMsg( + message: SourceCodeInfo_Location + ): SourceCodeInfo_LocationProtoMsg { + return { + typeUrl: "/google.protobuf.Location", + value: SourceCodeInfo_Location.encode(message).finish(), + }; + }, }; function createBaseGeneratedCodeInfo(): GeneratedCodeInfo { return { @@ -4010,6 +6129,41 @@ export const GeneratedCodeInfo = { ) || []; return message; }, + fromAmino(object: GeneratedCodeInfoAmino): GeneratedCodeInfo { + return { + annotation: Array.isArray(object?.annotation) + ? object.annotation.map((e: any) => + GeneratedCodeInfo_Annotation.fromAmino(e) + ) + : [], + }; + }, + toAmino(message: GeneratedCodeInfo): GeneratedCodeInfoAmino { + const obj: any = {}; + if (message.annotation) { + obj.annotation = message.annotation.map((e) => + e ? GeneratedCodeInfo_Annotation.toAmino(e) : undefined + ); + } else { + obj.annotation = []; + } + return obj; + }, + fromAminoMsg(object: GeneratedCodeInfoAminoMsg): GeneratedCodeInfo { + return GeneratedCodeInfo.fromAmino(object.value); + }, + fromProtoMsg(message: GeneratedCodeInfoProtoMsg): GeneratedCodeInfo { + return GeneratedCodeInfo.decode(message.value); + }, + toProto(message: GeneratedCodeInfo): Uint8Array { + return GeneratedCodeInfo.encode(message).finish(); + }, + toProtoMsg(message: GeneratedCodeInfo): GeneratedCodeInfoProtoMsg { + return { + typeUrl: "/google.protobuf.GeneratedCodeInfo", + value: GeneratedCodeInfo.encode(message).finish(), + }; + }, }; function createBaseGeneratedCodeInfo_Annotation(): GeneratedCodeInfo_Annotation { return { @@ -4108,4 +6262,49 @@ export const GeneratedCodeInfo_Annotation = { message.end = object.end ?? 0; return message; }, + fromAmino( + object: GeneratedCodeInfo_AnnotationAmino + ): GeneratedCodeInfo_Annotation { + return { + path: Array.isArray(object?.path) ? object.path.map((e: any) => e) : [], + sourceFile: object.source_file, + begin: object.begin, + end: object.end, + }; + }, + toAmino( + message: GeneratedCodeInfo_Annotation + ): GeneratedCodeInfo_AnnotationAmino { + const obj: any = {}; + if (message.path) { + obj.path = message.path.map((e) => e); + } else { + obj.path = []; + } + obj.source_file = message.sourceFile; + obj.begin = message.begin; + obj.end = message.end; + return obj; + }, + fromAminoMsg( + object: GeneratedCodeInfo_AnnotationAminoMsg + ): GeneratedCodeInfo_Annotation { + return GeneratedCodeInfo_Annotation.fromAmino(object.value); + }, + fromProtoMsg( + message: GeneratedCodeInfo_AnnotationProtoMsg + ): GeneratedCodeInfo_Annotation { + return GeneratedCodeInfo_Annotation.decode(message.value); + }, + toProto(message: GeneratedCodeInfo_Annotation): Uint8Array { + return GeneratedCodeInfo_Annotation.encode(message).finish(); + }, + toProtoMsg( + message: GeneratedCodeInfo_Annotation + ): GeneratedCodeInfo_AnnotationProtoMsg { + return { + typeUrl: "/google.protobuf.Annotation", + value: GeneratedCodeInfo_Annotation.encode(message).finish(), + }; + }, }; diff --git a/packages/types/src/google/protobuf/duration.ts b/packages/types/src/google/protobuf/duration.ts index 3677b6b97..dd7280b4d 100644 --- a/packages/types/src/google/protobuf/duration.ts +++ b/packages/types/src/google/protobuf/duration.ts @@ -79,6 +79,75 @@ export interface Duration { */ nanos: number; } +export interface DurationProtoMsg { + typeUrl: "/google.protobuf.Duration"; + value: Uint8Array; +} +/** + * 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". + */ +export type DurationAmino = string; +export interface DurationAminoMsg { + type: "/google.protobuf.Duration"; + value: DurationAmino; +} function createBaseDuration(): Duration { return { seconds: Long.ZERO, @@ -142,4 +211,29 @@ export const Duration = { message.nanos = object.nanos ?? 0; return message; }, + fromAmino(object: DurationAmino): Duration { + const value = parseInt(object); + return { + seconds: Long.fromNumber(Math.floor(value / 1_000_000_000)), + nanos: value % 1_000_000_000, + }; + }, + toAmino(message: Duration): DurationAmino { + return (message.seconds.toInt() * 1_000_000_000 + message.nanos).toString(); + }, + fromAminoMsg(object: DurationAminoMsg): Duration { + return Duration.fromAmino(object.value); + }, + fromProtoMsg(message: DurationProtoMsg): Duration { + return Duration.decode(message.value); + }, + toProto(message: Duration): Uint8Array { + return Duration.encode(message).finish(); + }, + toProtoMsg(message: Duration): DurationProtoMsg { + return { + typeUrl: "/google.protobuf.Duration", + value: Duration.encode(message).finish(), + }; + }, }; diff --git a/packages/types/src/google/protobuf/empty.ts b/packages/types/src/google/protobuf/empty.ts index 4be04bee4..27821331e 100644 --- a/packages/types/src/google/protobuf/empty.ts +++ b/packages/types/src/google/protobuf/empty.ts @@ -14,6 +14,26 @@ export const protobufPackage = "google.protobuf"; * The JSON representation for `Empty` is empty JSON object `{}`. */ export interface Empty {} +export interface EmptyProtoMsg { + typeUrl: "/google.protobuf.Empty"; + value: Uint8Array; +} +/** + * A generic empty message that you can re-use to avoid defining duplicated + * empty messages in your APIs. A typical example is to use it as the request + * or the response type of an API method. For instance: + * + * service Foo { + * rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty); + * } + * + * The JSON representation for `Empty` is empty JSON object `{}`. + */ +export interface EmptyAmino {} +export interface EmptyAminoMsg { + type: "/google.protobuf.Empty"; + value: EmptyAmino; +} function createBaseEmpty(): Empty { return {}; } @@ -46,4 +66,26 @@ export const Empty = { const message = createBaseEmpty(); return message; }, + fromAmino(_: EmptyAmino): Empty { + return {}; + }, + toAmino(_: Empty): EmptyAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg(object: EmptyAminoMsg): Empty { + return Empty.fromAmino(object.value); + }, + fromProtoMsg(message: EmptyProtoMsg): Empty { + return Empty.decode(message.value); + }, + toProto(message: Empty): Uint8Array { + return Empty.encode(message).finish(); + }, + toProtoMsg(message: Empty): EmptyProtoMsg { + return { + typeUrl: "/google.protobuf.Empty", + value: Empty.encode(message).finish(), + }; + }, }; diff --git a/packages/types/src/google/protobuf/timestamp.ts b/packages/types/src/google/protobuf/timestamp.ts index 6a94c2040..1d82bae1d 100644 --- a/packages/types/src/google/protobuf/timestamp.ts +++ b/packages/types/src/google/protobuf/timestamp.ts @@ -101,6 +101,99 @@ export interface Timestamp { */ nanos: number; } +export interface TimestampProtoMsg { + typeUrl: "/google.protobuf.Timestamp"; + value: Uint8Array; +} +/** + * A Timestamp represents a point in time independent of any time zone or local + * calendar, encoded as a count of seconds and fractions of seconds at + * nanosecond resolution. The count is relative to an epoch at UTC midnight on + * January 1, 1970, in the proleptic Gregorian calendar which extends the + * Gregorian calendar backwards to year one. + * + * All minutes are 60 seconds long. Leap seconds are "smeared" so that no leap + * second table is needed for interpretation, using a [24-hour linear + * smear](https://developers.google.com/time/smear). + * + * The range is from 0001-01-01T00:00:00Z to 9999-12-31T23:59:59.999999999Z. By + * restricting to that range, we ensure that we can convert to and from [RFC + * 3339](https://www.ietf.org/rfc/rfc3339.txt) date strings. + * + * # Examples + * + * Example 1: Compute Timestamp from POSIX `time()`. + * + * Timestamp timestamp; + * timestamp.set_seconds(time(NULL)); + * timestamp.set_nanos(0); + * + * Example 2: Compute Timestamp from POSIX `gettimeofday()`. + * + * struct timeval tv; + * gettimeofday(&tv, NULL); + * + * Timestamp timestamp; + * timestamp.set_seconds(tv.tv_sec); + * timestamp.set_nanos(tv.tv_usec * 1000); + * + * Example 3: Compute Timestamp from Win32 `GetSystemTimeAsFileTime()`. + * + * FILETIME ft; + * GetSystemTimeAsFileTime(&ft); + * UINT64 ticks = (((UINT64)ft.dwHighDateTime) << 32) | ft.dwLowDateTime; + * + * // A Windows tick is 100 nanoseconds. Windows epoch 1601-01-01T00:00:00Z + * // is 11644473600 seconds before Unix epoch 1970-01-01T00:00:00Z. + * Timestamp timestamp; + * timestamp.set_seconds((INT64) ((ticks / 10000000) - 11644473600LL)); + * timestamp.set_nanos((INT32) ((ticks % 10000000) * 100)); + * + * Example 4: Compute Timestamp from Java `System.currentTimeMillis()`. + * + * long millis = System.currentTimeMillis(); + * + * Timestamp timestamp = Timestamp.newBuilder().setSeconds(millis / 1000) + * .setNanos((int) ((millis % 1000) * 1000000)).build(); + * + * + * Example 5: Compute Timestamp from current time in Python. + * + * timestamp = Timestamp() + * timestamp.GetCurrentTime() + * + * # JSON Mapping + * + * In JSON format, the Timestamp type is encoded as a string in the + * [RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) format. That is, the + * format is "{year}-{month}-{day}T{hour}:{min}:{sec}[.{frac_sec}]Z" + * where {year} is always expressed using four digits while {month}, {day}, + * {hour}, {min}, and {sec} are zero-padded to two digits each. The fractional + * seconds, which can go up to 9 digits (i.e. up to 1 nanosecond resolution), + * are optional. The "Z" suffix indicates the timezone ("UTC"); the timezone + * is required. A proto3 JSON serializer should always use UTC (as indicated by + * "Z") when printing the Timestamp type and a proto3 JSON parser should be + * able to accept both UTC and other timezones (as indicated by an offset). + * + * For example, "2017-01-15T01:30:15.01Z" encodes 15.01 seconds past + * 01:30 UTC on January 15, 2017. + * + * In JavaScript, one can convert a Date object to this format using the + * standard + * [toISOString()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toISOString) + * method. In Python, a standard `datetime.datetime` object can be converted + * to this format using + * [`strftime`](https://docs.python.org/2/library/time.html#time.strftime) with + * the time format spec '%Y-%m-%dT%H:%M:%S.%fZ'. Likewise, in Java, one can use + * the Joda Time's [`ISODateTimeFormat.dateTime()`]( + * http://www.joda.org/joda-time/apidocs/org/joda/time/format/ISODateTimeFormat.html#dateTime%2D%2D + * ) to obtain a formatter capable of generating timestamps in this format. + */ +export type TimestampAmino = string; +export interface TimestampAminoMsg { + type: "/google.protobuf.Timestamp"; + value: TimestampAmino; +} function createBaseTimestamp(): Timestamp { return { seconds: Long.ZERO, @@ -166,4 +259,33 @@ export const Timestamp = { message.nanos = object.nanos ?? 0; return message; }, + fromAmino(object: TimestampAmino): Timestamp { + const data = new Date(object); + const seconds = Math.trunc(data.getTime() / 1000); + const nanos = (data.getTime() % 1000) * 1000000; + return { + seconds: Long.fromNumber(seconds), + nanos, + }; + }, + toAmino(message: Timestamp): TimestampAmino { + const millisecondsSinceEpoch = message.seconds.multiply(1000).toNumber(); + const nanosFraction = Math.round(message.nanos / 1000000); + return new Date(millisecondsSinceEpoch + nanosFraction).toISOString(); + }, + fromAminoMsg(object: TimestampAminoMsg): Timestamp { + return Timestamp.fromAmino(object.value); + }, + fromProtoMsg(message: TimestampProtoMsg): Timestamp { + return Timestamp.decode(message.value); + }, + toProto(message: Timestamp): Uint8Array { + return Timestamp.encode(message).finish(); + }, + toProtoMsg(message: Timestamp): TimestampProtoMsg { + return { + typeUrl: "/google.protobuf.Timestamp", + value: Timestamp.encode(message).finish(), + }; + }, }; diff --git a/packages/types/src/helpers.ts b/packages/types/src/helpers.ts index 2a51e01ce..e1c5a8969 100644 --- a/packages/types/src/helpers.ts +++ b/packages/types/src/helpers.ts @@ -1,6 +1,6 @@ /* eslint-disable */ /** - * This file and any referenced files were automatically generated by @osmonauts/telescope@0.94.1 + * This file and any referenced files were automatically generated by @osmonauts/telescope@0.97.0 * DO NOT MODIFY BY HAND. Instead, download the latest proto files for your chain * and run the transpile command or yarn proto command to regenerate this bundle. */ diff --git a/packages/types/src/ibc/client.ts b/packages/types/src/ibc/client.ts new file mode 100644 index 000000000..72168fb94 --- /dev/null +++ b/packages/types/src/ibc/client.ts @@ -0,0 +1,43 @@ +/* eslint-disable */ +import { GeneratedType, Registry, OfflineSigner } from "@cosmjs/proto-signing"; +import { AminoTypes, SigningStargateClient } from "@cosmjs/stargate"; +import { HttpEndpoint } from "@cosmjs/tendermint-rpc"; +import * as ibcCoreClientV1TxRegistry from "./core/client/v1/tx.registry"; +import * as ibcCoreClientV1TxAmino from "./core/client/v1/tx.amino"; +export const ibcAminoConverters = { + ...ibcCoreClientV1TxAmino.AminoConverter, +}; +export const ibcProtoRegistry: ReadonlyArray<[string, GeneratedType]> = [ + ...ibcCoreClientV1TxRegistry.registry, +]; +export const getSigningIbcClientOptions = (): { + registry: Registry; + aminoTypes: AminoTypes; +} => { + const registry = new Registry([...ibcProtoRegistry]); + const aminoTypes = new AminoTypes({ + ...ibcAminoConverters, + }); + return { + registry, + aminoTypes, + }; +}; +export const getSigningIbcClient = async ({ + rpcEndpoint, + signer, +}: { + rpcEndpoint: string | HttpEndpoint; + signer: OfflineSigner; +}) => { + const { registry, aminoTypes } = getSigningIbcClientOptions(); + const client = await SigningStargateClient.connectWithSigner( + rpcEndpoint, + signer, + { + registry, + aminoTypes, + } + ); + return client; +}; diff --git a/packages/types/src/ibc/core/client/v1/client.ts b/packages/types/src/ibc/core/client/v1/client.ts index c1d8738ab..81658d15f 100644 --- a/packages/types/src/ibc/core/client/v1/client.ts +++ b/packages/types/src/ibc/core/client/v1/client.ts @@ -1,6 +1,6 @@ /* eslint-disable */ -import { Any } from "../../../../google/protobuf/any"; -import { Plan } from "../../../../cosmos/upgrade/v1beta1/upgrade"; +import { Any, AnyAmino } from "../../../../google/protobuf/any"; +import { Plan, PlanAmino } from "../../../../cosmos/upgrade/v1beta1/upgrade"; import { Long, isSet, DeepPartial, Exact } from "../../../../helpers"; import * as _m0 from "protobufjs/minimal"; export const protobufPackage = "ibc.core.client.v1"; @@ -14,6 +14,24 @@ export interface IdentifiedClientState { /** client state */ clientState?: Any; } +export interface IdentifiedClientStateProtoMsg { + typeUrl: "/ibc.core.client.v1.IdentifiedClientState"; + value: Uint8Array; +} +/** + * IdentifiedClientState defines a client state with an additional client + * identifier field. + */ +export interface IdentifiedClientStateAmino { + /** client identifier */ + client_id: string; + /** client state */ + client_state?: AnyAmino; +} +export interface IdentifiedClientStateAminoMsg { + type: "cosmos-sdk/IdentifiedClientState"; + value: IdentifiedClientStateAmino; +} /** * ConsensusStateWithHeight defines a consensus state with an additional height * field. @@ -24,6 +42,24 @@ export interface ConsensusStateWithHeight { /** consensus state */ consensusState?: Any; } +export interface ConsensusStateWithHeightProtoMsg { + typeUrl: "/ibc.core.client.v1.ConsensusStateWithHeight"; + value: Uint8Array; +} +/** + * ConsensusStateWithHeight defines a consensus state with an additional height + * field. + */ +export interface ConsensusStateWithHeightAmino { + /** consensus state height */ + height?: HeightAmino; + /** consensus state */ + consensus_state?: AnyAmino; +} +export interface ConsensusStateWithHeightAminoMsg { + type: "cosmos-sdk/ConsensusStateWithHeight"; + value: ConsensusStateWithHeightAmino; +} /** * ClientConsensusStates defines all the stored consensus states for a given * client. @@ -34,6 +70,24 @@ export interface ClientConsensusStates { /** consensus states and their heights associated with the client */ consensusStates: ConsensusStateWithHeight[]; } +export interface ClientConsensusStatesProtoMsg { + typeUrl: "/ibc.core.client.v1.ClientConsensusStates"; + value: Uint8Array; +} +/** + * ClientConsensusStates defines all the stored consensus states for a given + * client. + */ +export interface ClientConsensusStatesAmino { + /** client identifier */ + client_id: string; + /** consensus states and their heights associated with the client */ + consensus_states: ConsensusStateWithHeightAmino[]; +} +export interface ClientConsensusStatesAminoMsg { + type: "cosmos-sdk/ClientConsensusStates"; + value: ClientConsensusStatesAmino; +} /** * ClientUpdateProposal is a governance proposal. If it passes, the substitute * client's latest consensus state is copied over to the subject client. The proposal @@ -53,6 +107,33 @@ export interface ClientUpdateProposal { */ substituteClientId: string; } +export interface ClientUpdateProposalProtoMsg { + typeUrl: "/ibc.core.client.v1.ClientUpdateProposal"; + value: Uint8Array; +} +/** + * ClientUpdateProposal is a governance proposal. If it passes, the substitute + * client's latest consensus state is copied over to the subject client. The proposal + * handler may fail if the subject and the substitute do not match in client and + * chain parameters (with exception to latest height, frozen height, and chain-id). + */ +export interface ClientUpdateProposalAmino { + /** the title of the update proposal */ + title: string; + /** the description of the proposal */ + description: string; + /** the client identifier for the client to be updated if the proposal passes */ + subject_client_id: string; + /** + * the substitute client identifier for the client standing in for the subject + * client + */ + substitute_client_id: string; +} +export interface ClientUpdateProposalAminoMsg { + type: "cosmos-sdk/ClientUpdateProposal"; + value: ClientUpdateProposalAmino; +} /** * UpgradeProposal is a gov Content type for initiating an IBC breaking * upgrade. @@ -71,6 +152,32 @@ export interface UpgradeProposal { */ upgradedClientState?: Any; } +export interface UpgradeProposalProtoMsg { + typeUrl: "/ibc.core.client.v1.UpgradeProposal"; + value: Uint8Array; +} +/** + * UpgradeProposal is a gov Content type for initiating an IBC breaking + * upgrade. + */ +export interface UpgradeProposalAmino { + title: string; + description: string; + plan?: PlanAmino; + /** + * An UpgradedClientState must be provided to perform an IBC breaking upgrade. + * This will make the chain commit to the correct upgraded (self) client state + * before the upgrade occurs, so that connecting chains can verify that the + * new upgraded client is valid by verifying a proof on the previous version + * of the chain. This will allow IBC connections to persist smoothly across + * planned chain upgrades + */ + upgraded_client_state?: AnyAmino; +} +export interface UpgradeProposalAminoMsg { + type: "cosmos-sdk/UpgradeProposal"; + value: UpgradeProposalAmino; +} /** * Height is a monotonically increasing data type * that can be compared against another Height for the purposes of updating and @@ -89,11 +196,58 @@ export interface Height { /** the height within the given revision */ revisionHeight: Long; } +export interface HeightProtoMsg { + typeUrl: "/ibc.core.client.v1.Height"; + value: Uint8Array; +} +/** + * 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 + */ +export interface HeightAmino { + /** the revision that the client is currently on */ + revision_number: string; + /** the height within the given revision */ + revision_height: string; +} +export interface HeightAminoMsg { + type: "cosmos-sdk/Height"; + value: HeightAmino; +} /** Params defines the set of IBC light client parameters. */ export interface Params { - /** allowed_clients defines the list of allowed client state types. */ + /** + * allowed_clients defines the list of allowed client state types which can be created + * and interacted with. If a client type is removed from the allowed clients list, usage + * of this client will be disabled until it is added again to the list. + */ allowedClients: string[]; } +export interface ParamsProtoMsg { + typeUrl: "/ibc.core.client.v1.Params"; + value: Uint8Array; +} +/** Params defines the set of IBC light client parameters. */ +export interface ParamsAmino { + /** + * allowed_clients defines the list of allowed client state types which can be created + * and interacted with. If a client type is removed from the allowed clients list, usage + * of this client will be disabled until it is added again to the list. + */ + allowed_clients: string[]; +} +export interface ParamsAminoMsg { + type: "cosmos-sdk/Params"; + value: ParamsAmino; +} function createBaseIdentifiedClientState(): IdentifiedClientState { return { clientId: "", @@ -164,6 +318,43 @@ export const IdentifiedClientState = { : undefined; return message; }, + fromAmino(object: IdentifiedClientStateAmino): IdentifiedClientState { + return { + clientId: object.client_id, + clientState: object?.client_state + ? Any.fromAmino(object.client_state) + : undefined, + }; + }, + toAmino(message: IdentifiedClientState): IdentifiedClientStateAmino { + const obj: any = {}; + obj.client_id = message.clientId; + obj.client_state = message.clientState + ? Any.toAmino(message.clientState) + : undefined; + return obj; + }, + fromAminoMsg(object: IdentifiedClientStateAminoMsg): IdentifiedClientState { + return IdentifiedClientState.fromAmino(object.value); + }, + toAminoMsg(message: IdentifiedClientState): IdentifiedClientStateAminoMsg { + return { + type: "cosmos-sdk/IdentifiedClientState", + value: IdentifiedClientState.toAmino(message), + }; + }, + fromProtoMsg(message: IdentifiedClientStateProtoMsg): IdentifiedClientState { + return IdentifiedClientState.decode(message.value); + }, + toProto(message: IdentifiedClientState): Uint8Array { + return IdentifiedClientState.encode(message).finish(); + }, + toProtoMsg(message: IdentifiedClientState): IdentifiedClientStateProtoMsg { + return { + typeUrl: "/ibc.core.client.v1.IdentifiedClientState", + value: IdentifiedClientState.encode(message).finish(), + }; + }, }; function createBaseConsensusStateWithHeight(): ConsensusStateWithHeight { return { @@ -239,6 +430,51 @@ export const ConsensusStateWithHeight = { : undefined; return message; }, + fromAmino(object: ConsensusStateWithHeightAmino): ConsensusStateWithHeight { + return { + height: object?.height ? Height.fromAmino(object.height) : undefined, + consensusState: object?.consensus_state + ? Any.fromAmino(object.consensus_state) + : undefined, + }; + }, + toAmino(message: ConsensusStateWithHeight): ConsensusStateWithHeightAmino { + const obj: any = {}; + obj.height = message.height ? Height.toAmino(message.height) : undefined; + obj.consensus_state = message.consensusState + ? Any.toAmino(message.consensusState) + : undefined; + return obj; + }, + fromAminoMsg( + object: ConsensusStateWithHeightAminoMsg + ): ConsensusStateWithHeight { + return ConsensusStateWithHeight.fromAmino(object.value); + }, + toAminoMsg( + message: ConsensusStateWithHeight + ): ConsensusStateWithHeightAminoMsg { + return { + type: "cosmos-sdk/ConsensusStateWithHeight", + value: ConsensusStateWithHeight.toAmino(message), + }; + }, + fromProtoMsg( + message: ConsensusStateWithHeightProtoMsg + ): ConsensusStateWithHeight { + return ConsensusStateWithHeight.decode(message.value); + }, + toProto(message: ConsensusStateWithHeight): Uint8Array { + return ConsensusStateWithHeight.encode(message).finish(); + }, + toProtoMsg( + message: ConsensusStateWithHeight + ): ConsensusStateWithHeightProtoMsg { + return { + typeUrl: "/ibc.core.client.v1.ConsensusStateWithHeight", + value: ConsensusStateWithHeight.encode(message).finish(), + }; + }, }; function createBaseClientConsensusStates(): ClientConsensusStates { return { @@ -317,6 +553,49 @@ export const ClientConsensusStates = { ) || []; return message; }, + fromAmino(object: ClientConsensusStatesAmino): ClientConsensusStates { + return { + clientId: object.client_id, + consensusStates: Array.isArray(object?.consensus_states) + ? object.consensus_states.map((e: any) => + ConsensusStateWithHeight.fromAmino(e) + ) + : [], + }; + }, + toAmino(message: ClientConsensusStates): ClientConsensusStatesAmino { + const obj: any = {}; + obj.client_id = message.clientId; + if (message.consensusStates) { + obj.consensus_states = message.consensusStates.map((e) => + e ? ConsensusStateWithHeight.toAmino(e) : undefined + ); + } else { + obj.consensus_states = []; + } + return obj; + }, + fromAminoMsg(object: ClientConsensusStatesAminoMsg): ClientConsensusStates { + return ClientConsensusStates.fromAmino(object.value); + }, + toAminoMsg(message: ClientConsensusStates): ClientConsensusStatesAminoMsg { + return { + type: "cosmos-sdk/ClientConsensusStates", + value: ClientConsensusStates.toAmino(message), + }; + }, + fromProtoMsg(message: ClientConsensusStatesProtoMsg): ClientConsensusStates { + return ClientConsensusStates.decode(message.value); + }, + toProto(message: ClientConsensusStates): Uint8Array { + return ClientConsensusStates.encode(message).finish(); + }, + toProtoMsg(message: ClientConsensusStates): ClientConsensusStatesProtoMsg { + return { + typeUrl: "/ibc.core.client.v1.ClientConsensusStates", + value: ClientConsensusStates.encode(message).finish(), + }; + }, }; function createBaseClientUpdateProposal(): ClientUpdateProposal { return { @@ -407,6 +686,43 @@ export const ClientUpdateProposal = { message.substituteClientId = object.substituteClientId ?? ""; return message; }, + fromAmino(object: ClientUpdateProposalAmino): ClientUpdateProposal { + return { + title: object.title, + description: object.description, + subjectClientId: object.subject_client_id, + substituteClientId: object.substitute_client_id, + }; + }, + toAmino(message: ClientUpdateProposal): ClientUpdateProposalAmino { + const obj: any = {}; + obj.title = message.title; + obj.description = message.description; + obj.subject_client_id = message.subjectClientId; + obj.substitute_client_id = message.substituteClientId; + return obj; + }, + fromAminoMsg(object: ClientUpdateProposalAminoMsg): ClientUpdateProposal { + return ClientUpdateProposal.fromAmino(object.value); + }, + toAminoMsg(message: ClientUpdateProposal): ClientUpdateProposalAminoMsg { + return { + type: "cosmos-sdk/ClientUpdateProposal", + value: ClientUpdateProposal.toAmino(message), + }; + }, + fromProtoMsg(message: ClientUpdateProposalProtoMsg): ClientUpdateProposal { + return ClientUpdateProposal.decode(message.value); + }, + toProto(message: ClientUpdateProposal): Uint8Array { + return ClientUpdateProposal.encode(message).finish(); + }, + toProtoMsg(message: ClientUpdateProposal): ClientUpdateProposalProtoMsg { + return { + typeUrl: "/ibc.core.client.v1.ClientUpdateProposal", + value: ClientUpdateProposal.encode(message).finish(), + }; + }, }; function createBaseUpgradeProposal(): UpgradeProposal { return { @@ -504,6 +820,47 @@ export const UpgradeProposal = { : undefined; return message; }, + fromAmino(object: UpgradeProposalAmino): UpgradeProposal { + return { + title: object.title, + description: object.description, + plan: object?.plan ? Plan.fromAmino(object.plan) : undefined, + upgradedClientState: object?.upgraded_client_state + ? Any.fromAmino(object.upgraded_client_state) + : undefined, + }; + }, + toAmino(message: UpgradeProposal): UpgradeProposalAmino { + const obj: any = {}; + obj.title = message.title; + obj.description = message.description; + obj.plan = message.plan ? Plan.toAmino(message.plan) : undefined; + obj.upgraded_client_state = message.upgradedClientState + ? Any.toAmino(message.upgradedClientState) + : undefined; + return obj; + }, + fromAminoMsg(object: UpgradeProposalAminoMsg): UpgradeProposal { + return UpgradeProposal.fromAmino(object.value); + }, + toAminoMsg(message: UpgradeProposal): UpgradeProposalAminoMsg { + return { + type: "cosmos-sdk/UpgradeProposal", + value: UpgradeProposal.toAmino(message), + }; + }, + fromProtoMsg(message: UpgradeProposalProtoMsg): UpgradeProposal { + return UpgradeProposal.decode(message.value); + }, + toProto(message: UpgradeProposal): Uint8Array { + return UpgradeProposal.encode(message).finish(); + }, + toProtoMsg(message: UpgradeProposal): UpgradeProposalProtoMsg { + return { + typeUrl: "/ibc.core.client.v1.UpgradeProposal", + value: UpgradeProposal.encode(message).finish(), + }; + }, }; function createBaseHeight(): Height { return { @@ -574,6 +931,43 @@ export const Height = { : Long.UZERO; return message; }, + fromAmino(object: HeightAmino): Height { + return { + revisionNumber: Long.fromString(object.revision_number || "0", true), + revisionHeight: Long.fromString(object.revision_height || "0", true), + }; + }, + toAmino(message: Height): HeightAmino { + const obj: any = {}; + obj.revision_number = message.revisionNumber + ? message.revisionNumber.toString() + : undefined; + obj.revision_height = message.revisionHeight + ? message.revisionHeight.toString() + : undefined; + return obj; + }, + fromAminoMsg(object: HeightAminoMsg): Height { + return Height.fromAmino(object.value); + }, + toAminoMsg(message: Height): HeightAminoMsg { + return { + type: "cosmos-sdk/Height", + value: Height.toAmino(message), + }; + }, + fromProtoMsg(message: HeightProtoMsg): Height { + return Height.decode(message.value); + }, + toProto(message: Height): Uint8Array { + return Height.encode(message).finish(); + }, + toProtoMsg(message: Height): HeightProtoMsg { + return { + typeUrl: "/ibc.core.client.v1.Height", + value: Height.encode(message).finish(), + }; + }, }; function createBaseParams(): Params { return { @@ -628,4 +1022,41 @@ export const Params = { message.allowedClients = object.allowedClients?.map((e) => e) || []; return message; }, + fromAmino(object: ParamsAmino): Params { + return { + allowedClients: Array.isArray(object?.allowed_clients) + ? object.allowed_clients.map((e: any) => e) + : [], + }; + }, + toAmino(message: Params): ParamsAmino { + const obj: any = {}; + if (message.allowedClients) { + obj.allowed_clients = message.allowedClients.map((e) => e); + } else { + obj.allowed_clients = []; + } + return obj; + }, + fromAminoMsg(object: ParamsAminoMsg): Params { + return Params.fromAmino(object.value); + }, + toAminoMsg(message: Params): ParamsAminoMsg { + return { + type: "cosmos-sdk/Params", + value: Params.toAmino(message), + }; + }, + fromProtoMsg(message: ParamsProtoMsg): Params { + return Params.decode(message.value); + }, + toProto(message: Params): Uint8Array { + return Params.encode(message).finish(); + }, + toProtoMsg(message: Params): ParamsProtoMsg { + return { + typeUrl: "/ibc.core.client.v1.Params", + value: Params.encode(message).finish(), + }; + }, }; diff --git a/packages/types/src/ibc/core/client/v1/genesis.ts b/packages/types/src/ibc/core/client/v1/genesis.ts index 298839357..3f25e6fe1 100644 --- a/packages/types/src/ibc/core/client/v1/genesis.ts +++ b/packages/types/src/ibc/core/client/v1/genesis.ts @@ -1,5 +1,12 @@ /* eslint-disable */ -import { IdentifiedClientState, ClientConsensusStates, Params } from "./client"; +import { + IdentifiedClientState, + IdentifiedClientStateAmino, + ClientConsensusStates, + ClientConsensusStatesAmino, + Params, + ParamsAmino, +} from "./client"; import { Long, isSet, @@ -24,6 +31,28 @@ export interface GenesisState { /** the sequence for the next generated client identifier */ nextClientSequence: Long; } +export interface GenesisStateProtoMsg { + typeUrl: "/ibc.core.client.v1.GenesisState"; + value: Uint8Array; +} +/** GenesisState defines the ibc client submodule's genesis state. */ +export interface GenesisStateAmino { + /** client states with their corresponding identifiers */ + clients: IdentifiedClientStateAmino[]; + /** consensus states from each client */ + clients_consensus: ClientConsensusStatesAmino[]; + /** metadata from each client */ + clients_metadata: IdentifiedGenesisMetadataAmino[]; + params?: ParamsAmino; + /** create localhost on initialization */ + create_localhost: boolean; + /** the sequence for the next generated client identifier */ + next_client_sequence: string; +} +export interface GenesisStateAminoMsg { + type: "cosmos-sdk/GenesisState"; + value: GenesisStateAmino; +} /** * GenesisMetadata defines the genesis type for metadata that clients may return * with ExportMetadata @@ -34,6 +63,24 @@ export interface GenesisMetadata { /** metadata value */ value: Uint8Array; } +export interface GenesisMetadataProtoMsg { + typeUrl: "/ibc.core.client.v1.GenesisMetadata"; + value: Uint8Array; +} +/** + * GenesisMetadata defines the genesis type for metadata that clients may return + * with ExportMetadata + */ +export interface GenesisMetadataAmino { + /** store key of metadata without clientID-prefix */ + key: Uint8Array; + /** metadata value */ + value: Uint8Array; +} +export interface GenesisMetadataAminoMsg { + type: "cosmos-sdk/GenesisMetadata"; + value: GenesisMetadataAmino; +} /** * IdentifiedGenesisMetadata has the client metadata with the corresponding * client id. @@ -42,6 +89,22 @@ export interface IdentifiedGenesisMetadata { clientId: string; clientMetadata: GenesisMetadata[]; } +export interface IdentifiedGenesisMetadataProtoMsg { + typeUrl: "/ibc.core.client.v1.IdentifiedGenesisMetadata"; + value: Uint8Array; +} +/** + * IdentifiedGenesisMetadata has the client metadata with the corresponding + * client id. + */ +export interface IdentifiedGenesisMetadataAmino { + client_id: string; + client_metadata: GenesisMetadataAmino[]; +} +export interface IdentifiedGenesisMetadataAminoMsg { + type: "cosmos-sdk/IdentifiedGenesisMetadata"; + value: IdentifiedGenesisMetadataAmino; +} function createBaseGenesisState(): GenesisState { return { clients: [], @@ -198,6 +261,77 @@ export const GenesisState = { : Long.UZERO; return message; }, + fromAmino(object: GenesisStateAmino): GenesisState { + return { + clients: Array.isArray(object?.clients) + ? object.clients.map((e: any) => IdentifiedClientState.fromAmino(e)) + : [], + clientsConsensus: Array.isArray(object?.clients_consensus) + ? object.clients_consensus.map((e: any) => + ClientConsensusStates.fromAmino(e) + ) + : [], + clientsMetadata: Array.isArray(object?.clients_metadata) + ? object.clients_metadata.map((e: any) => + IdentifiedGenesisMetadata.fromAmino(e) + ) + : [], + params: object?.params ? Params.fromAmino(object.params) : undefined, + createLocalhost: object.create_localhost, + nextClientSequence: Long.fromString(object.next_client_sequence), + }; + }, + toAmino(message: GenesisState): GenesisStateAmino { + const obj: any = {}; + if (message.clients) { + obj.clients = message.clients.map((e) => + e ? IdentifiedClientState.toAmino(e) : undefined + ); + } else { + obj.clients = []; + } + if (message.clientsConsensus) { + obj.clients_consensus = message.clientsConsensus.map((e) => + e ? ClientConsensusStates.toAmino(e) : undefined + ); + } else { + obj.clients_consensus = []; + } + if (message.clientsMetadata) { + obj.clients_metadata = message.clientsMetadata.map((e) => + e ? IdentifiedGenesisMetadata.toAmino(e) : undefined + ); + } else { + obj.clients_metadata = []; + } + obj.params = message.params ? Params.toAmino(message.params) : undefined; + obj.create_localhost = message.createLocalhost; + obj.next_client_sequence = message.nextClientSequence + ? message.nextClientSequence.toString() + : undefined; + return obj; + }, + fromAminoMsg(object: GenesisStateAminoMsg): GenesisState { + return GenesisState.fromAmino(object.value); + }, + toAminoMsg(message: GenesisState): GenesisStateAminoMsg { + return { + type: "cosmos-sdk/GenesisState", + value: GenesisState.toAmino(message), + }; + }, + fromProtoMsg(message: GenesisStateProtoMsg): GenesisState { + return GenesisState.decode(message.value); + }, + toProto(message: GenesisState): Uint8Array { + return GenesisState.encode(message).finish(); + }, + toProtoMsg(message: GenesisState): GenesisStateProtoMsg { + return { + typeUrl: "/ibc.core.client.v1.GenesisState", + value: GenesisState.encode(message).finish(), + }; + }, }; function createBaseGenesisMetadata(): GenesisMetadata { return { @@ -266,6 +400,39 @@ export const GenesisMetadata = { message.value = object.value ?? new Uint8Array(); return message; }, + fromAmino(object: GenesisMetadataAmino): GenesisMetadata { + return { + key: object.key, + value: object.value, + }; + }, + toAmino(message: GenesisMetadata): GenesisMetadataAmino { + const obj: any = {}; + obj.key = message.key; + obj.value = message.value; + return obj; + }, + fromAminoMsg(object: GenesisMetadataAminoMsg): GenesisMetadata { + return GenesisMetadata.fromAmino(object.value); + }, + toAminoMsg(message: GenesisMetadata): GenesisMetadataAminoMsg { + return { + type: "cosmos-sdk/GenesisMetadata", + value: GenesisMetadata.toAmino(message), + }; + }, + fromProtoMsg(message: GenesisMetadataProtoMsg): GenesisMetadata { + return GenesisMetadata.decode(message.value); + }, + toProto(message: GenesisMetadata): Uint8Array { + return GenesisMetadata.encode(message).finish(); + }, + toProtoMsg(message: GenesisMetadata): GenesisMetadataProtoMsg { + return { + typeUrl: "/ibc.core.client.v1.GenesisMetadata", + value: GenesisMetadata.encode(message).finish(), + }; + }, }; function createBaseIdentifiedGenesisMetadata(): IdentifiedGenesisMetadata { return { @@ -340,4 +507,53 @@ export const IdentifiedGenesisMetadata = { object.clientMetadata?.map((e) => GenesisMetadata.fromPartial(e)) || []; return message; }, + fromAmino(object: IdentifiedGenesisMetadataAmino): IdentifiedGenesisMetadata { + return { + clientId: object.client_id, + clientMetadata: Array.isArray(object?.client_metadata) + ? object.client_metadata.map((e: any) => GenesisMetadata.fromAmino(e)) + : [], + }; + }, + toAmino(message: IdentifiedGenesisMetadata): IdentifiedGenesisMetadataAmino { + const obj: any = {}; + obj.client_id = message.clientId; + if (message.clientMetadata) { + obj.client_metadata = message.clientMetadata.map((e) => + e ? GenesisMetadata.toAmino(e) : undefined + ); + } else { + obj.client_metadata = []; + } + return obj; + }, + fromAminoMsg( + object: IdentifiedGenesisMetadataAminoMsg + ): IdentifiedGenesisMetadata { + return IdentifiedGenesisMetadata.fromAmino(object.value); + }, + toAminoMsg( + message: IdentifiedGenesisMetadata + ): IdentifiedGenesisMetadataAminoMsg { + return { + type: "cosmos-sdk/IdentifiedGenesisMetadata", + value: IdentifiedGenesisMetadata.toAmino(message), + }; + }, + fromProtoMsg( + message: IdentifiedGenesisMetadataProtoMsg + ): IdentifiedGenesisMetadata { + return IdentifiedGenesisMetadata.decode(message.value); + }, + toProto(message: IdentifiedGenesisMetadata): Uint8Array { + return IdentifiedGenesisMetadata.encode(message).finish(); + }, + toProtoMsg( + message: IdentifiedGenesisMetadata + ): IdentifiedGenesisMetadataProtoMsg { + return { + typeUrl: "/ibc.core.client.v1.IdentifiedGenesisMetadata", + value: IdentifiedGenesisMetadata.encode(message).finish(), + }; + }, }; diff --git a/packages/types/src/ibc/core/client/v1/query.ts b/packages/types/src/ibc/core/client/v1/query.ts index 8c5e16375..579baaae2 100644 --- a/packages/types/src/ibc/core/client/v1/query.ts +++ b/packages/types/src/ibc/core/client/v1/query.ts @@ -1,14 +1,20 @@ /* eslint-disable */ import { PageRequest, + PageRequestAmino, PageResponse, + PageResponseAmino, } from "../../../../cosmos/base/query/v1beta1/pagination"; -import { Any } from "../../../../google/protobuf/any"; +import { Any, AnyAmino } from "../../../../google/protobuf/any"; import { Height, + HeightAmino, IdentifiedClientState, + IdentifiedClientStateAmino, ConsensusStateWithHeight, + ConsensusStateWithHeightAmino, Params, + ParamsAmino, } from "./client"; import { Long, @@ -29,6 +35,22 @@ export interface QueryClientStateRequest { /** client state unique identifier */ clientId: string; } +export interface QueryClientStateRequestProtoMsg { + typeUrl: "/ibc.core.client.v1.QueryClientStateRequest"; + value: Uint8Array; +} +/** + * QueryClientStateRequest is the request type for the Query/ClientState RPC + * method + */ +export interface QueryClientStateRequestAmino { + /** client state unique identifier */ + client_id: string; +} +export interface QueryClientStateRequestAminoMsg { + type: "cosmos-sdk/QueryClientStateRequest"; + value: QueryClientStateRequestAmino; +} /** * QueryClientStateResponse is the response type for the Query/ClientState RPC * method. Besides the client state, it includes a proof and the height from @@ -42,6 +64,27 @@ export interface QueryClientStateResponse { /** height at which the proof was retrieved */ proofHeight?: Height; } +export interface QueryClientStateResponseProtoMsg { + typeUrl: "/ibc.core.client.v1.QueryClientStateResponse"; + value: Uint8Array; +} +/** + * QueryClientStateResponse is the response type for the Query/ClientState RPC + * method. Besides the client state, it includes a proof and the height from + * which the proof was retrieved. + */ +export interface QueryClientStateResponseAmino { + /** client state associated with the request identifier */ + client_state?: AnyAmino; + /** merkle proof of existence */ + proof: Uint8Array; + /** height at which the proof was retrieved */ + proof_height?: HeightAmino; +} +export interface QueryClientStateResponseAminoMsg { + type: "cosmos-sdk/QueryClientStateResponse"; + value: QueryClientStateResponseAmino; +} /** * QueryClientStatesRequest is the request type for the Query/ClientStates RPC * method @@ -50,6 +93,22 @@ export interface QueryClientStatesRequest { /** pagination request */ pagination?: PageRequest; } +export interface QueryClientStatesRequestProtoMsg { + typeUrl: "/ibc.core.client.v1.QueryClientStatesRequest"; + value: Uint8Array; +} +/** + * QueryClientStatesRequest is the request type for the Query/ClientStates RPC + * method + */ +export interface QueryClientStatesRequestAmino { + /** pagination request */ + pagination?: PageRequestAmino; +} +export interface QueryClientStatesRequestAminoMsg { + type: "cosmos-sdk/QueryClientStatesRequest"; + value: QueryClientStatesRequestAmino; +} /** * QueryClientStatesResponse is the response type for the Query/ClientStates RPC * method. @@ -60,6 +119,24 @@ export interface QueryClientStatesResponse { /** pagination response */ pagination?: PageResponse; } +export interface QueryClientStatesResponseProtoMsg { + typeUrl: "/ibc.core.client.v1.QueryClientStatesResponse"; + value: Uint8Array; +} +/** + * QueryClientStatesResponse is the response type for the Query/ClientStates RPC + * method. + */ +export interface QueryClientStatesResponseAmino { + /** list of stored ClientStates of the chain. */ + client_states: IdentifiedClientStateAmino[]; + /** pagination response */ + pagination?: PageResponseAmino; +} +export interface QueryClientStatesResponseAminoMsg { + type: "cosmos-sdk/QueryClientStatesResponse"; + value: QueryClientStatesResponseAmino; +} /** * QueryConsensusStateRequest is the request type for the Query/ConsensusState * RPC method. Besides the consensus state, it includes a proof and the height @@ -78,6 +155,32 @@ export interface QueryConsensusStateRequest { */ latestHeight: boolean; } +export interface QueryConsensusStateRequestProtoMsg { + typeUrl: "/ibc.core.client.v1.QueryConsensusStateRequest"; + value: Uint8Array; +} +/** + * QueryConsensusStateRequest is the request type for the Query/ConsensusState + * RPC method. Besides the consensus state, it includes a proof and the height + * from which the proof was retrieved. + */ +export interface QueryConsensusStateRequestAmino { + /** client identifier */ + client_id: string; + /** consensus state revision number */ + revision_number: string; + /** consensus state revision height */ + revision_height: string; + /** + * latest_height overrrides the height field and queries the latest stored + * ConsensusState + */ + latest_height: boolean; +} +export interface QueryConsensusStateRequestAminoMsg { + type: "cosmos-sdk/QueryConsensusStateRequest"; + value: QueryConsensusStateRequestAmino; +} /** * QueryConsensusStateResponse is the response type for the Query/ConsensusState * RPC method @@ -90,6 +193,26 @@ export interface QueryConsensusStateResponse { /** height at which the proof was retrieved */ proofHeight?: Height; } +export interface QueryConsensusStateResponseProtoMsg { + typeUrl: "/ibc.core.client.v1.QueryConsensusStateResponse"; + value: Uint8Array; +} +/** + * QueryConsensusStateResponse is the response type for the Query/ConsensusState + * RPC method + */ +export interface QueryConsensusStateResponseAmino { + /** consensus state associated with the client identifier at the given height */ + consensus_state?: AnyAmino; + /** merkle proof of existence */ + proof: Uint8Array; + /** height at which the proof was retrieved */ + proof_height?: HeightAmino; +} +export interface QueryConsensusStateResponseAminoMsg { + type: "cosmos-sdk/QueryConsensusStateResponse"; + value: QueryConsensusStateResponseAmino; +} /** * QueryConsensusStatesRequest is the request type for the Query/ConsensusStates * RPC method. @@ -100,6 +223,24 @@ export interface QueryConsensusStatesRequest { /** pagination request */ pagination?: PageRequest; } +export interface QueryConsensusStatesRequestProtoMsg { + typeUrl: "/ibc.core.client.v1.QueryConsensusStatesRequest"; + value: Uint8Array; +} +/** + * QueryConsensusStatesRequest is the request type for the Query/ConsensusStates + * RPC method. + */ +export interface QueryConsensusStatesRequestAmino { + /** client identifier */ + client_id: string; + /** pagination request */ + pagination?: PageRequestAmino; +} +export interface QueryConsensusStatesRequestAminoMsg { + type: "cosmos-sdk/QueryConsensusStatesRequest"; + value: QueryConsensusStatesRequestAmino; +} /** * QueryConsensusStatesResponse is the response type for the * Query/ConsensusStates RPC method @@ -110,6 +251,80 @@ export interface QueryConsensusStatesResponse { /** pagination response */ pagination?: PageResponse; } +export interface QueryConsensusStatesResponseProtoMsg { + typeUrl: "/ibc.core.client.v1.QueryConsensusStatesResponse"; + value: Uint8Array; +} +/** + * QueryConsensusStatesResponse is the response type for the + * Query/ConsensusStates RPC method + */ +export interface QueryConsensusStatesResponseAmino { + /** consensus states associated with the identifier */ + consensus_states: ConsensusStateWithHeightAmino[]; + /** pagination response */ + pagination?: PageResponseAmino; +} +export interface QueryConsensusStatesResponseAminoMsg { + type: "cosmos-sdk/QueryConsensusStatesResponse"; + value: QueryConsensusStatesResponseAmino; +} +/** + * QueryConsensusStateHeightsRequest is the request type for Query/ConsensusStateHeights + * RPC method. + */ +export interface QueryConsensusStateHeightsRequest { + /** client identifier */ + clientId: string; + /** pagination request */ + pagination?: PageRequest; +} +export interface QueryConsensusStateHeightsRequestProtoMsg { + typeUrl: "/ibc.core.client.v1.QueryConsensusStateHeightsRequest"; + value: Uint8Array; +} +/** + * QueryConsensusStateHeightsRequest is the request type for Query/ConsensusStateHeights + * RPC method. + */ +export interface QueryConsensusStateHeightsRequestAmino { + /** client identifier */ + client_id: string; + /** pagination request */ + pagination?: PageRequestAmino; +} +export interface QueryConsensusStateHeightsRequestAminoMsg { + type: "cosmos-sdk/QueryConsensusStateHeightsRequest"; + value: QueryConsensusStateHeightsRequestAmino; +} +/** + * QueryConsensusStateHeightsResponse is the response type for the + * Query/ConsensusStateHeights RPC method + */ +export interface QueryConsensusStateHeightsResponse { + /** consensus state heights */ + consensusStateHeights: Height[]; + /** pagination response */ + pagination?: PageResponse; +} +export interface QueryConsensusStateHeightsResponseProtoMsg { + typeUrl: "/ibc.core.client.v1.QueryConsensusStateHeightsResponse"; + value: Uint8Array; +} +/** + * QueryConsensusStateHeightsResponse is the response type for the + * Query/ConsensusStateHeights RPC method + */ +export interface QueryConsensusStateHeightsResponseAmino { + /** consensus state heights */ + consensus_state_heights: HeightAmino[]; + /** pagination response */ + pagination?: PageResponseAmino; +} +export interface QueryConsensusStateHeightsResponseAminoMsg { + type: "cosmos-sdk/QueryConsensusStateHeightsResponse"; + value: QueryConsensusStateHeightsResponseAmino; +} /** * QueryClientStatusRequest is the request type for the Query/ClientStatus RPC * method @@ -118,6 +333,22 @@ export interface QueryClientStatusRequest { /** client unique identifier */ clientId: string; } +export interface QueryClientStatusRequestProtoMsg { + typeUrl: "/ibc.core.client.v1.QueryClientStatusRequest"; + value: Uint8Array; +} +/** + * QueryClientStatusRequest is the request type for the Query/ClientStatus RPC + * method + */ +export interface QueryClientStatusRequestAmino { + /** client unique identifier */ + client_id: string; +} +export interface QueryClientStatusRequestAminoMsg { + type: "cosmos-sdk/QueryClientStatusRequest"; + value: QueryClientStatusRequestAmino; +} /** * QueryClientStatusResponse is the response type for the Query/ClientStatus RPC * method. It returns the current status of the IBC client. @@ -125,11 +356,39 @@ export interface QueryClientStatusRequest { export interface QueryClientStatusResponse { status: string; } +export interface QueryClientStatusResponseProtoMsg { + typeUrl: "/ibc.core.client.v1.QueryClientStatusResponse"; + value: Uint8Array; +} +/** + * QueryClientStatusResponse is the response type for the Query/ClientStatus RPC + * method. It returns the current status of the IBC client. + */ +export interface QueryClientStatusResponseAmino { + status: string; +} +export interface QueryClientStatusResponseAminoMsg { + type: "cosmos-sdk/QueryClientStatusResponse"; + value: QueryClientStatusResponseAmino; +} /** * QueryClientParamsRequest is the request type for the Query/ClientParams RPC * method. */ export interface QueryClientParamsRequest {} +export interface QueryClientParamsRequestProtoMsg { + typeUrl: "/ibc.core.client.v1.QueryClientParamsRequest"; + value: Uint8Array; +} +/** + * QueryClientParamsRequest is the request type for the Query/ClientParams RPC + * method. + */ +export interface QueryClientParamsRequestAmino {} +export interface QueryClientParamsRequestAminoMsg { + type: "cosmos-sdk/QueryClientParamsRequest"; + value: QueryClientParamsRequestAmino; +} /** * QueryClientParamsResponse is the response type for the Query/ClientParams RPC * method. @@ -138,11 +397,40 @@ export interface QueryClientParamsResponse { /** params defines the parameters of the module. */ params?: Params; } +export interface QueryClientParamsResponseProtoMsg { + typeUrl: "/ibc.core.client.v1.QueryClientParamsResponse"; + value: Uint8Array; +} +/** + * QueryClientParamsResponse is the response type for the Query/ClientParams RPC + * method. + */ +export interface QueryClientParamsResponseAmino { + /** params defines the parameters of the module. */ + params?: ParamsAmino; +} +export interface QueryClientParamsResponseAminoMsg { + type: "cosmos-sdk/QueryClientParamsResponse"; + value: QueryClientParamsResponseAmino; +} /** * QueryUpgradedClientStateRequest is the request type for the * Query/UpgradedClientState RPC method */ export interface QueryUpgradedClientStateRequest {} +export interface QueryUpgradedClientStateRequestProtoMsg { + typeUrl: "/ibc.core.client.v1.QueryUpgradedClientStateRequest"; + value: Uint8Array; +} +/** + * QueryUpgradedClientStateRequest is the request type for the + * Query/UpgradedClientState RPC method + */ +export interface QueryUpgradedClientStateRequestAmino {} +export interface QueryUpgradedClientStateRequestAminoMsg { + type: "cosmos-sdk/QueryUpgradedClientStateRequest"; + value: QueryUpgradedClientStateRequestAmino; +} /** * QueryUpgradedClientStateResponse is the response type for the * Query/UpgradedClientState RPC method. @@ -151,11 +439,40 @@ export interface QueryUpgradedClientStateResponse { /** client state associated with the request identifier */ upgradedClientState?: Any; } +export interface QueryUpgradedClientStateResponseProtoMsg { + typeUrl: "/ibc.core.client.v1.QueryUpgradedClientStateResponse"; + value: Uint8Array; +} +/** + * QueryUpgradedClientStateResponse is the response type for the + * Query/UpgradedClientState RPC method. + */ +export interface QueryUpgradedClientStateResponseAmino { + /** client state associated with the request identifier */ + upgraded_client_state?: AnyAmino; +} +export interface QueryUpgradedClientStateResponseAminoMsg { + type: "cosmos-sdk/QueryUpgradedClientStateResponse"; + value: QueryUpgradedClientStateResponseAmino; +} /** * QueryUpgradedConsensusStateRequest is the request type for the * Query/UpgradedConsensusState RPC method */ export interface QueryUpgradedConsensusStateRequest {} +export interface QueryUpgradedConsensusStateRequestProtoMsg { + typeUrl: "/ibc.core.client.v1.QueryUpgradedConsensusStateRequest"; + value: Uint8Array; +} +/** + * QueryUpgradedConsensusStateRequest is the request type for the + * Query/UpgradedConsensusState RPC method + */ +export interface QueryUpgradedConsensusStateRequestAmino {} +export interface QueryUpgradedConsensusStateRequestAminoMsg { + type: "cosmos-sdk/QueryUpgradedConsensusStateRequest"; + value: QueryUpgradedConsensusStateRequestAmino; +} /** * QueryUpgradedConsensusStateResponse is the response type for the * Query/UpgradedConsensusState RPC method. @@ -164,6 +481,22 @@ export interface QueryUpgradedConsensusStateResponse { /** Consensus state associated with the request identifier */ upgradedConsensusState?: Any; } +export interface QueryUpgradedConsensusStateResponseProtoMsg { + typeUrl: "/ibc.core.client.v1.QueryUpgradedConsensusStateResponse"; + value: Uint8Array; +} +/** + * QueryUpgradedConsensusStateResponse is the response type for the + * Query/UpgradedConsensusState RPC method. + */ +export interface QueryUpgradedConsensusStateResponseAmino { + /** Consensus state associated with the request identifier */ + upgraded_consensus_state?: AnyAmino; +} +export interface QueryUpgradedConsensusStateResponseAminoMsg { + type: "cosmos-sdk/QueryUpgradedConsensusStateResponse"; + value: QueryUpgradedConsensusStateResponseAmino; +} function createBaseQueryClientStateRequest(): QueryClientStateRequest { return { clientId: "", @@ -216,6 +549,45 @@ export const QueryClientStateRequest = { message.clientId = object.clientId ?? ""; return message; }, + fromAmino(object: QueryClientStateRequestAmino): QueryClientStateRequest { + return { + clientId: object.client_id, + }; + }, + toAmino(message: QueryClientStateRequest): QueryClientStateRequestAmino { + const obj: any = {}; + obj.client_id = message.clientId; + return obj; + }, + fromAminoMsg( + object: QueryClientStateRequestAminoMsg + ): QueryClientStateRequest { + return QueryClientStateRequest.fromAmino(object.value); + }, + toAminoMsg( + message: QueryClientStateRequest + ): QueryClientStateRequestAminoMsg { + return { + type: "cosmos-sdk/QueryClientStateRequest", + value: QueryClientStateRequest.toAmino(message), + }; + }, + fromProtoMsg( + message: QueryClientStateRequestProtoMsg + ): QueryClientStateRequest { + return QueryClientStateRequest.decode(message.value); + }, + toProto(message: QueryClientStateRequest): Uint8Array { + return QueryClientStateRequest.encode(message).finish(); + }, + toProtoMsg( + message: QueryClientStateRequest + ): QueryClientStateRequestProtoMsg { + return { + typeUrl: "/ibc.core.client.v1.QueryClientStateRequest", + value: QueryClientStateRequest.encode(message).finish(), + }; + }, }; function createBaseQueryClientStateResponse(): QueryClientStateResponse { return { @@ -310,6 +682,57 @@ export const QueryClientStateResponse = { : undefined; return message; }, + fromAmino(object: QueryClientStateResponseAmino): QueryClientStateResponse { + return { + clientState: object?.client_state + ? Any.fromAmino(object.client_state) + : undefined, + proof: object.proof, + proofHeight: object?.proof_height + ? Height.fromAmino(object.proof_height) + : undefined, + }; + }, + toAmino(message: QueryClientStateResponse): QueryClientStateResponseAmino { + const obj: any = {}; + obj.client_state = message.clientState + ? Any.toAmino(message.clientState) + : undefined; + obj.proof = message.proof; + obj.proof_height = message.proofHeight + ? Height.toAmino(message.proofHeight) + : {}; + return obj; + }, + fromAminoMsg( + object: QueryClientStateResponseAminoMsg + ): QueryClientStateResponse { + return QueryClientStateResponse.fromAmino(object.value); + }, + toAminoMsg( + message: QueryClientStateResponse + ): QueryClientStateResponseAminoMsg { + return { + type: "cosmos-sdk/QueryClientStateResponse", + value: QueryClientStateResponse.toAmino(message), + }; + }, + fromProtoMsg( + message: QueryClientStateResponseProtoMsg + ): QueryClientStateResponse { + return QueryClientStateResponse.decode(message.value); + }, + toProto(message: QueryClientStateResponse): Uint8Array { + return QueryClientStateResponse.encode(message).finish(); + }, + toProtoMsg( + message: QueryClientStateResponse + ): QueryClientStateResponseProtoMsg { + return { + typeUrl: "/ibc.core.client.v1.QueryClientStateResponse", + value: QueryClientStateResponse.encode(message).finish(), + }; + }, }; function createBaseQueryClientStatesRequest(): QueryClientStatesRequest { return { @@ -371,6 +794,49 @@ export const QueryClientStatesRequest = { : undefined; return message; }, + fromAmino(object: QueryClientStatesRequestAmino): QueryClientStatesRequest { + return { + pagination: object?.pagination + ? PageRequest.fromAmino(object.pagination) + : undefined, + }; + }, + toAmino(message: QueryClientStatesRequest): QueryClientStatesRequestAmino { + const obj: any = {}; + obj.pagination = message.pagination + ? PageRequest.toAmino(message.pagination) + : undefined; + return obj; + }, + fromAminoMsg( + object: QueryClientStatesRequestAminoMsg + ): QueryClientStatesRequest { + return QueryClientStatesRequest.fromAmino(object.value); + }, + toAminoMsg( + message: QueryClientStatesRequest + ): QueryClientStatesRequestAminoMsg { + return { + type: "cosmos-sdk/QueryClientStatesRequest", + value: QueryClientStatesRequest.toAmino(message), + }; + }, + fromProtoMsg( + message: QueryClientStatesRequestProtoMsg + ): QueryClientStatesRequest { + return QueryClientStatesRequest.decode(message.value); + }, + toProto(message: QueryClientStatesRequest): Uint8Array { + return QueryClientStatesRequest.encode(message).finish(); + }, + toProtoMsg( + message: QueryClientStatesRequest + ): QueryClientStatesRequestProtoMsg { + return { + typeUrl: "/ibc.core.client.v1.QueryClientStatesRequest", + value: QueryClientStatesRequest.encode(message).finish(), + }; + }, }; function createBaseQueryClientStatesResponse(): QueryClientStatesResponse { return { @@ -457,6 +923,61 @@ export const QueryClientStatesResponse = { : undefined; return message; }, + fromAmino(object: QueryClientStatesResponseAmino): QueryClientStatesResponse { + return { + clientStates: Array.isArray(object?.client_states) + ? object.client_states.map((e: any) => + IdentifiedClientState.fromAmino(e) + ) + : [], + pagination: object?.pagination + ? PageResponse.fromAmino(object.pagination) + : undefined, + }; + }, + toAmino(message: QueryClientStatesResponse): QueryClientStatesResponseAmino { + const obj: any = {}; + if (message.clientStates) { + obj.client_states = message.clientStates.map((e) => + e ? IdentifiedClientState.toAmino(e) : undefined + ); + } else { + obj.client_states = []; + } + obj.pagination = message.pagination + ? PageResponse.toAmino(message.pagination) + : undefined; + return obj; + }, + fromAminoMsg( + object: QueryClientStatesResponseAminoMsg + ): QueryClientStatesResponse { + return QueryClientStatesResponse.fromAmino(object.value); + }, + toAminoMsg( + message: QueryClientStatesResponse + ): QueryClientStatesResponseAminoMsg { + return { + type: "cosmos-sdk/QueryClientStatesResponse", + value: QueryClientStatesResponse.toAmino(message), + }; + }, + fromProtoMsg( + message: QueryClientStatesResponseProtoMsg + ): QueryClientStatesResponse { + return QueryClientStatesResponse.decode(message.value); + }, + toProto(message: QueryClientStatesResponse): Uint8Array { + return QueryClientStatesResponse.encode(message).finish(); + }, + toProtoMsg( + message: QueryClientStatesResponse + ): QueryClientStatesResponseProtoMsg { + return { + typeUrl: "/ibc.core.client.v1.QueryClientStatesResponse", + value: QueryClientStatesResponse.encode(message).finish(), + }; + }, }; function createBaseQueryConsensusStateRequest(): QueryConsensusStateRequest { return { @@ -555,6 +1076,59 @@ export const QueryConsensusStateRequest = { message.latestHeight = object.latestHeight ?? false; return message; }, + fromAmino( + object: QueryConsensusStateRequestAmino + ): QueryConsensusStateRequest { + return { + clientId: object.client_id, + revisionNumber: Long.fromString(object.revision_number), + revisionHeight: Long.fromString(object.revision_height), + latestHeight: object.latest_height, + }; + }, + toAmino( + message: QueryConsensusStateRequest + ): QueryConsensusStateRequestAmino { + const obj: any = {}; + obj.client_id = message.clientId; + obj.revision_number = message.revisionNumber + ? message.revisionNumber.toString() + : undefined; + obj.revision_height = message.revisionHeight + ? message.revisionHeight.toString() + : undefined; + obj.latest_height = message.latestHeight; + return obj; + }, + fromAminoMsg( + object: QueryConsensusStateRequestAminoMsg + ): QueryConsensusStateRequest { + return QueryConsensusStateRequest.fromAmino(object.value); + }, + toAminoMsg( + message: QueryConsensusStateRequest + ): QueryConsensusStateRequestAminoMsg { + return { + type: "cosmos-sdk/QueryConsensusStateRequest", + value: QueryConsensusStateRequest.toAmino(message), + }; + }, + fromProtoMsg( + message: QueryConsensusStateRequestProtoMsg + ): QueryConsensusStateRequest { + return QueryConsensusStateRequest.decode(message.value); + }, + toProto(message: QueryConsensusStateRequest): Uint8Array { + return QueryConsensusStateRequest.encode(message).finish(); + }, + toProtoMsg( + message: QueryConsensusStateRequest + ): QueryConsensusStateRequestProtoMsg { + return { + typeUrl: "/ibc.core.client.v1.QueryConsensusStateRequest", + value: QueryConsensusStateRequest.encode(message).finish(), + }; + }, }; function createBaseQueryConsensusStateResponse(): QueryConsensusStateResponse { return { @@ -618,47 +1192,370 @@ export const QueryConsensusStateResponse = { : undefined, }; }, - toJSON(message: QueryConsensusStateResponse): unknown { - const obj: any = {}; - message.consensusState !== undefined && - (obj.consensusState = message.consensusState - ? Any.toJSON(message.consensusState) - : undefined); - message.proof !== undefined && - (obj.proof = base64FromBytes( - message.proof !== undefined ? message.proof : new Uint8Array() - )); - message.proofHeight !== undefined && - (obj.proofHeight = message.proofHeight - ? Height.toJSON(message.proofHeight) - : undefined); - return obj; + toJSON(message: QueryConsensusStateResponse): unknown { + const obj: any = {}; + message.consensusState !== undefined && + (obj.consensusState = message.consensusState + ? Any.toJSON(message.consensusState) + : undefined); + message.proof !== undefined && + (obj.proof = base64FromBytes( + message.proof !== undefined ? message.proof : new Uint8Array() + )); + message.proofHeight !== undefined && + (obj.proofHeight = message.proofHeight + ? Height.toJSON(message.proofHeight) + : undefined); + return obj; + }, + fromPartial, I>>( + object: I + ): QueryConsensusStateResponse { + const message = createBaseQueryConsensusStateResponse(); + message.consensusState = + object.consensusState !== undefined && object.consensusState !== null + ? Any.fromPartial(object.consensusState) + : undefined; + message.proof = object.proof ?? new Uint8Array(); + message.proofHeight = + object.proofHeight !== undefined && object.proofHeight !== null + ? Height.fromPartial(object.proofHeight) + : undefined; + return message; + }, + fromAmino( + object: QueryConsensusStateResponseAmino + ): QueryConsensusStateResponse { + return { + consensusState: object?.consensus_state + ? Any.fromAmino(object.consensus_state) + : undefined, + proof: object.proof, + proofHeight: object?.proof_height + ? Height.fromAmino(object.proof_height) + : undefined, + }; + }, + toAmino( + message: QueryConsensusStateResponse + ): QueryConsensusStateResponseAmino { + const obj: any = {}; + obj.consensus_state = message.consensusState + ? Any.toAmino(message.consensusState) + : undefined; + obj.proof = message.proof; + obj.proof_height = message.proofHeight + ? Height.toAmino(message.proofHeight) + : {}; + return obj; + }, + fromAminoMsg( + object: QueryConsensusStateResponseAminoMsg + ): QueryConsensusStateResponse { + return QueryConsensusStateResponse.fromAmino(object.value); + }, + toAminoMsg( + message: QueryConsensusStateResponse + ): QueryConsensusStateResponseAminoMsg { + return { + type: "cosmos-sdk/QueryConsensusStateResponse", + value: QueryConsensusStateResponse.toAmino(message), + }; + }, + fromProtoMsg( + message: QueryConsensusStateResponseProtoMsg + ): QueryConsensusStateResponse { + return QueryConsensusStateResponse.decode(message.value); + }, + toProto(message: QueryConsensusStateResponse): Uint8Array { + return QueryConsensusStateResponse.encode(message).finish(); + }, + toProtoMsg( + message: QueryConsensusStateResponse + ): QueryConsensusStateResponseProtoMsg { + return { + typeUrl: "/ibc.core.client.v1.QueryConsensusStateResponse", + value: QueryConsensusStateResponse.encode(message).finish(), + }; + }, +}; +function createBaseQueryConsensusStatesRequest(): QueryConsensusStatesRequest { + return { + clientId: "", + pagination: undefined, + }; +} +export const QueryConsensusStatesRequest = { + encode( + message: QueryConsensusStatesRequest, + writer: _m0.Writer = _m0.Writer.create() + ): _m0.Writer { + if (message.clientId !== "") { + writer.uint32(10).string(message.clientId); + } + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode( + input: _m0.Reader | Uint8Array, + length?: number + ): QueryConsensusStatesRequest { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryConsensusStatesRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.clientId = reader.string(); + break; + case 2: + message.pagination = PageRequest.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object: any): QueryConsensusStatesRequest { + return { + clientId: isSet(object.clientId) ? String(object.clientId) : "", + pagination: isSet(object.pagination) + ? PageRequest.fromJSON(object.pagination) + : undefined, + }; + }, + toJSON(message: QueryConsensusStatesRequest): unknown { + const obj: any = {}; + message.clientId !== undefined && (obj.clientId = message.clientId); + message.pagination !== undefined && + (obj.pagination = message.pagination + ? PageRequest.toJSON(message.pagination) + : undefined); + return obj; + }, + fromPartial, I>>( + object: I + ): QueryConsensusStatesRequest { + const message = createBaseQueryConsensusStatesRequest(); + message.clientId = object.clientId ?? ""; + message.pagination = + object.pagination !== undefined && object.pagination !== null + ? PageRequest.fromPartial(object.pagination) + : undefined; + return message; + }, + fromAmino( + object: QueryConsensusStatesRequestAmino + ): QueryConsensusStatesRequest { + return { + clientId: object.client_id, + pagination: object?.pagination + ? PageRequest.fromAmino(object.pagination) + : undefined, + }; + }, + toAmino( + message: QueryConsensusStatesRequest + ): QueryConsensusStatesRequestAmino { + const obj: any = {}; + obj.client_id = message.clientId; + obj.pagination = message.pagination + ? PageRequest.toAmino(message.pagination) + : undefined; + return obj; + }, + fromAminoMsg( + object: QueryConsensusStatesRequestAminoMsg + ): QueryConsensusStatesRequest { + return QueryConsensusStatesRequest.fromAmino(object.value); + }, + toAminoMsg( + message: QueryConsensusStatesRequest + ): QueryConsensusStatesRequestAminoMsg { + return { + type: "cosmos-sdk/QueryConsensusStatesRequest", + value: QueryConsensusStatesRequest.toAmino(message), + }; + }, + fromProtoMsg( + message: QueryConsensusStatesRequestProtoMsg + ): QueryConsensusStatesRequest { + return QueryConsensusStatesRequest.decode(message.value); + }, + toProto(message: QueryConsensusStatesRequest): Uint8Array { + return QueryConsensusStatesRequest.encode(message).finish(); + }, + toProtoMsg( + message: QueryConsensusStatesRequest + ): QueryConsensusStatesRequestProtoMsg { + return { + typeUrl: "/ibc.core.client.v1.QueryConsensusStatesRequest", + value: QueryConsensusStatesRequest.encode(message).finish(), + }; + }, +}; +function createBaseQueryConsensusStatesResponse(): QueryConsensusStatesResponse { + return { + consensusStates: [], + pagination: undefined, + }; +} +export const QueryConsensusStatesResponse = { + encode( + message: QueryConsensusStatesResponse, + writer: _m0.Writer = _m0.Writer.create() + ): _m0.Writer { + for (const v of message.consensusStates) { + ConsensusStateWithHeight.encode(v!, writer.uint32(10).fork()).ldelim(); + } + if (message.pagination !== undefined) { + PageResponse.encode( + message.pagination, + writer.uint32(18).fork() + ).ldelim(); + } + return writer; + }, + decode( + input: _m0.Reader | Uint8Array, + length?: number + ): QueryConsensusStatesResponse { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryConsensusStatesResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.consensusStates.push( + ConsensusStateWithHeight.decode(reader, reader.uint32()) + ); + break; + case 2: + message.pagination = PageResponse.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object: any): QueryConsensusStatesResponse { + return { + consensusStates: Array.isArray(object?.consensusStates) + ? object.consensusStates.map((e: any) => + ConsensusStateWithHeight.fromJSON(e) + ) + : [], + pagination: isSet(object.pagination) + ? PageResponse.fromJSON(object.pagination) + : undefined, + }; + }, + toJSON(message: QueryConsensusStatesResponse): unknown { + const obj: any = {}; + if (message.consensusStates) { + obj.consensusStates = message.consensusStates.map((e) => + e ? ConsensusStateWithHeight.toJSON(e) : undefined + ); + } else { + obj.consensusStates = []; + } + message.pagination !== undefined && + (obj.pagination = message.pagination + ? PageResponse.toJSON(message.pagination) + : undefined); + return obj; + }, + fromPartial, I>>( + object: I + ): QueryConsensusStatesResponse { + const message = createBaseQueryConsensusStatesResponse(); + message.consensusStates = + object.consensusStates?.map((e) => + ConsensusStateWithHeight.fromPartial(e) + ) || []; + message.pagination = + object.pagination !== undefined && object.pagination !== null + ? PageResponse.fromPartial(object.pagination) + : undefined; + return message; + }, + fromAmino( + object: QueryConsensusStatesResponseAmino + ): QueryConsensusStatesResponse { + return { + consensusStates: Array.isArray(object?.consensus_states) + ? object.consensus_states.map((e: any) => + ConsensusStateWithHeight.fromAmino(e) + ) + : [], + pagination: object?.pagination + ? PageResponse.fromAmino(object.pagination) + : undefined, + }; + }, + toAmino( + message: QueryConsensusStatesResponse + ): QueryConsensusStatesResponseAmino { + const obj: any = {}; + if (message.consensusStates) { + obj.consensus_states = message.consensusStates.map((e) => + e ? ConsensusStateWithHeight.toAmino(e) : undefined + ); + } else { + obj.consensus_states = []; + } + obj.pagination = message.pagination + ? PageResponse.toAmino(message.pagination) + : undefined; + return obj; + }, + fromAminoMsg( + object: QueryConsensusStatesResponseAminoMsg + ): QueryConsensusStatesResponse { + return QueryConsensusStatesResponse.fromAmino(object.value); + }, + toAminoMsg( + message: QueryConsensusStatesResponse + ): QueryConsensusStatesResponseAminoMsg { + return { + type: "cosmos-sdk/QueryConsensusStatesResponse", + value: QueryConsensusStatesResponse.toAmino(message), + }; + }, + fromProtoMsg( + message: QueryConsensusStatesResponseProtoMsg + ): QueryConsensusStatesResponse { + return QueryConsensusStatesResponse.decode(message.value); }, - fromPartial, I>>( - object: I - ): QueryConsensusStateResponse { - const message = createBaseQueryConsensusStateResponse(); - message.consensusState = - object.consensusState !== undefined && object.consensusState !== null - ? Any.fromPartial(object.consensusState) - : undefined; - message.proof = object.proof ?? new Uint8Array(); - message.proofHeight = - object.proofHeight !== undefined && object.proofHeight !== null - ? Height.fromPartial(object.proofHeight) - : undefined; - return message; + toProto(message: QueryConsensusStatesResponse): Uint8Array { + return QueryConsensusStatesResponse.encode(message).finish(); + }, + toProtoMsg( + message: QueryConsensusStatesResponse + ): QueryConsensusStatesResponseProtoMsg { + return { + typeUrl: "/ibc.core.client.v1.QueryConsensusStatesResponse", + value: QueryConsensusStatesResponse.encode(message).finish(), + }; }, }; -function createBaseQueryConsensusStatesRequest(): QueryConsensusStatesRequest { +function createBaseQueryConsensusStateHeightsRequest(): QueryConsensusStateHeightsRequest { return { clientId: "", pagination: undefined, }; } -export const QueryConsensusStatesRequest = { +export const QueryConsensusStateHeightsRequest = { encode( - message: QueryConsensusStatesRequest, + message: QueryConsensusStateHeightsRequest, writer: _m0.Writer = _m0.Writer.create() ): _m0.Writer { if (message.clientId !== "") { @@ -672,10 +1569,10 @@ export const QueryConsensusStatesRequest = { decode( input: _m0.Reader | Uint8Array, length?: number - ): QueryConsensusStatesRequest { + ): QueryConsensusStateHeightsRequest { const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseQueryConsensusStatesRequest(); + const message = createBaseQueryConsensusStateHeightsRequest(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { @@ -692,7 +1589,7 @@ export const QueryConsensusStatesRequest = { } return message; }, - fromJSON(object: any): QueryConsensusStatesRequest { + fromJSON(object: any): QueryConsensusStateHeightsRequest { return { clientId: isSet(object.clientId) ? String(object.clientId) : "", pagination: isSet(object.pagination) @@ -700,7 +1597,7 @@ export const QueryConsensusStatesRequest = { : undefined, }; }, - toJSON(message: QueryConsensusStatesRequest): unknown { + toJSON(message: QueryConsensusStateHeightsRequest): unknown { const obj: any = {}; message.clientId !== undefined && (obj.clientId = message.clientId); message.pagination !== undefined && @@ -709,10 +1606,10 @@ export const QueryConsensusStatesRequest = { : undefined); return obj; }, - fromPartial, I>>( - object: I - ): QueryConsensusStatesRequest { - const message = createBaseQueryConsensusStatesRequest(); + fromPartial< + I extends Exact, I> + >(object: I): QueryConsensusStateHeightsRequest { + const message = createBaseQueryConsensusStateHeightsRequest(); message.clientId = object.clientId ?? ""; message.pagination = object.pagination !== undefined && object.pagination !== null @@ -720,20 +1617,69 @@ export const QueryConsensusStatesRequest = { : undefined; return message; }, + fromAmino( + object: QueryConsensusStateHeightsRequestAmino + ): QueryConsensusStateHeightsRequest { + return { + clientId: object.client_id, + pagination: object?.pagination + ? PageRequest.fromAmino(object.pagination) + : undefined, + }; + }, + toAmino( + message: QueryConsensusStateHeightsRequest + ): QueryConsensusStateHeightsRequestAmino { + const obj: any = {}; + obj.client_id = message.clientId; + obj.pagination = message.pagination + ? PageRequest.toAmino(message.pagination) + : undefined; + return obj; + }, + fromAminoMsg( + object: QueryConsensusStateHeightsRequestAminoMsg + ): QueryConsensusStateHeightsRequest { + return QueryConsensusStateHeightsRequest.fromAmino(object.value); + }, + toAminoMsg( + message: QueryConsensusStateHeightsRequest + ): QueryConsensusStateHeightsRequestAminoMsg { + return { + type: "cosmos-sdk/QueryConsensusStateHeightsRequest", + value: QueryConsensusStateHeightsRequest.toAmino(message), + }; + }, + fromProtoMsg( + message: QueryConsensusStateHeightsRequestProtoMsg + ): QueryConsensusStateHeightsRequest { + return QueryConsensusStateHeightsRequest.decode(message.value); + }, + toProto(message: QueryConsensusStateHeightsRequest): Uint8Array { + return QueryConsensusStateHeightsRequest.encode(message).finish(); + }, + toProtoMsg( + message: QueryConsensusStateHeightsRequest + ): QueryConsensusStateHeightsRequestProtoMsg { + return { + typeUrl: "/ibc.core.client.v1.QueryConsensusStateHeightsRequest", + value: QueryConsensusStateHeightsRequest.encode(message).finish(), + }; + }, }; -function createBaseQueryConsensusStatesResponse(): QueryConsensusStatesResponse { +function createBaseQueryConsensusStateHeightsResponse(): QueryConsensusStateHeightsResponse { return { - consensusStates: [], + consensusStateHeights: [], pagination: undefined, }; } -export const QueryConsensusStatesResponse = { +export const QueryConsensusStateHeightsResponse = { encode( - message: QueryConsensusStatesResponse, + message: QueryConsensusStateHeightsResponse, writer: _m0.Writer = _m0.Writer.create() ): _m0.Writer { - for (const v of message.consensusStates) { - ConsensusStateWithHeight.encode(v!, writer.uint32(10).fork()).ldelim(); + for (const v of message.consensusStateHeights) { + Height.encode(v!, writer.uint32(10).fork()).ldelim(); } if (message.pagination !== undefined) { PageResponse.encode( @@ -746,16 +1692,16 @@ export const QueryConsensusStatesResponse = { decode( input: _m0.Reader | Uint8Array, length?: number - ): QueryConsensusStatesResponse { + ): QueryConsensusStateHeightsResponse { const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseQueryConsensusStatesResponse(); + const message = createBaseQueryConsensusStateHeightsResponse(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.consensusStates.push( - ConsensusStateWithHeight.decode(reader, reader.uint32()) + message.consensusStateHeights.push( + Height.decode(reader, reader.uint32()) ); break; case 2: @@ -768,26 +1714,24 @@ export const QueryConsensusStatesResponse = { } return message; }, - fromJSON(object: any): QueryConsensusStatesResponse { + fromJSON(object: any): QueryConsensusStateHeightsResponse { return { - consensusStates: Array.isArray(object?.consensusStates) - ? object.consensusStates.map((e: any) => - ConsensusStateWithHeight.fromJSON(e) - ) + consensusStateHeights: Array.isArray(object?.consensusStateHeights) + ? object.consensusStateHeights.map((e: any) => Height.fromJSON(e)) : [], pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined, }; }, - toJSON(message: QueryConsensusStatesResponse): unknown { + toJSON(message: QueryConsensusStateHeightsResponse): unknown { const obj: any = {}; - if (message.consensusStates) { - obj.consensusStates = message.consensusStates.map((e) => - e ? ConsensusStateWithHeight.toJSON(e) : undefined + if (message.consensusStateHeights) { + obj.consensusStateHeights = message.consensusStateHeights.map((e) => + e ? Height.toJSON(e) : undefined ); } else { - obj.consensusStates = []; + obj.consensusStateHeights = []; } message.pagination !== undefined && (obj.pagination = message.pagination @@ -795,20 +1739,75 @@ export const QueryConsensusStatesResponse = { : undefined); return obj; }, - fromPartial, I>>( - object: I - ): QueryConsensusStatesResponse { - const message = createBaseQueryConsensusStatesResponse(); - message.consensusStates = - object.consensusStates?.map((e) => - ConsensusStateWithHeight.fromPartial(e) - ) || []; + fromPartial< + I extends Exact, I> + >(object: I): QueryConsensusStateHeightsResponse { + const message = createBaseQueryConsensusStateHeightsResponse(); + message.consensusStateHeights = + object.consensusStateHeights?.map((e) => Height.fromPartial(e)) || []; message.pagination = object.pagination !== undefined && object.pagination !== null ? PageResponse.fromPartial(object.pagination) : undefined; return message; }, + fromAmino( + object: QueryConsensusStateHeightsResponseAmino + ): QueryConsensusStateHeightsResponse { + return { + consensusStateHeights: Array.isArray(object?.consensus_state_heights) + ? object.consensus_state_heights.map((e: any) => Height.fromAmino(e)) + : [], + pagination: object?.pagination + ? PageResponse.fromAmino(object.pagination) + : undefined, + }; + }, + toAmino( + message: QueryConsensusStateHeightsResponse + ): QueryConsensusStateHeightsResponseAmino { + const obj: any = {}; + if (message.consensusStateHeights) { + obj.consensus_state_heights = message.consensusStateHeights.map((e) => + e ? Height.toAmino(e) : undefined + ); + } else { + obj.consensus_state_heights = []; + } + obj.pagination = message.pagination + ? PageResponse.toAmino(message.pagination) + : undefined; + return obj; + }, + fromAminoMsg( + object: QueryConsensusStateHeightsResponseAminoMsg + ): QueryConsensusStateHeightsResponse { + return QueryConsensusStateHeightsResponse.fromAmino(object.value); + }, + toAminoMsg( + message: QueryConsensusStateHeightsResponse + ): QueryConsensusStateHeightsResponseAminoMsg { + return { + type: "cosmos-sdk/QueryConsensusStateHeightsResponse", + value: QueryConsensusStateHeightsResponse.toAmino(message), + }; + }, + fromProtoMsg( + message: QueryConsensusStateHeightsResponseProtoMsg + ): QueryConsensusStateHeightsResponse { + return QueryConsensusStateHeightsResponse.decode(message.value); + }, + toProto(message: QueryConsensusStateHeightsResponse): Uint8Array { + return QueryConsensusStateHeightsResponse.encode(message).finish(); + }, + toProtoMsg( + message: QueryConsensusStateHeightsResponse + ): QueryConsensusStateHeightsResponseProtoMsg { + return { + typeUrl: "/ibc.core.client.v1.QueryConsensusStateHeightsResponse", + value: QueryConsensusStateHeightsResponse.encode(message).finish(), + }; + }, }; function createBaseQueryClientStatusRequest(): QueryClientStatusRequest { return { @@ -862,6 +1861,45 @@ export const QueryClientStatusRequest = { message.clientId = object.clientId ?? ""; return message; }, + fromAmino(object: QueryClientStatusRequestAmino): QueryClientStatusRequest { + return { + clientId: object.client_id, + }; + }, + toAmino(message: QueryClientStatusRequest): QueryClientStatusRequestAmino { + const obj: any = {}; + obj.client_id = message.clientId; + return obj; + }, + fromAminoMsg( + object: QueryClientStatusRequestAminoMsg + ): QueryClientStatusRequest { + return QueryClientStatusRequest.fromAmino(object.value); + }, + toAminoMsg( + message: QueryClientStatusRequest + ): QueryClientStatusRequestAminoMsg { + return { + type: "cosmos-sdk/QueryClientStatusRequest", + value: QueryClientStatusRequest.toAmino(message), + }; + }, + fromProtoMsg( + message: QueryClientStatusRequestProtoMsg + ): QueryClientStatusRequest { + return QueryClientStatusRequest.decode(message.value); + }, + toProto(message: QueryClientStatusRequest): Uint8Array { + return QueryClientStatusRequest.encode(message).finish(); + }, + toProtoMsg( + message: QueryClientStatusRequest + ): QueryClientStatusRequestProtoMsg { + return { + typeUrl: "/ibc.core.client.v1.QueryClientStatusRequest", + value: QueryClientStatusRequest.encode(message).finish(), + }; + }, }; function createBaseQueryClientStatusResponse(): QueryClientStatusResponse { return { @@ -915,6 +1953,45 @@ export const QueryClientStatusResponse = { message.status = object.status ?? ""; return message; }, + fromAmino(object: QueryClientStatusResponseAmino): QueryClientStatusResponse { + return { + status: object.status, + }; + }, + toAmino(message: QueryClientStatusResponse): QueryClientStatusResponseAmino { + const obj: any = {}; + obj.status = message.status; + return obj; + }, + fromAminoMsg( + object: QueryClientStatusResponseAminoMsg + ): QueryClientStatusResponse { + return QueryClientStatusResponse.fromAmino(object.value); + }, + toAminoMsg( + message: QueryClientStatusResponse + ): QueryClientStatusResponseAminoMsg { + return { + type: "cosmos-sdk/QueryClientStatusResponse", + value: QueryClientStatusResponse.toAmino(message), + }; + }, + fromProtoMsg( + message: QueryClientStatusResponseProtoMsg + ): QueryClientStatusResponse { + return QueryClientStatusResponse.decode(message.value); + }, + toProto(message: QueryClientStatusResponse): Uint8Array { + return QueryClientStatusResponse.encode(message).finish(); + }, + toProtoMsg( + message: QueryClientStatusResponse + ): QueryClientStatusResponseProtoMsg { + return { + typeUrl: "/ibc.core.client.v1.QueryClientStatusResponse", + value: QueryClientStatusResponse.encode(message).finish(), + }; + }, }; function createBaseQueryClientParamsRequest(): QueryClientParamsRequest { return {}; @@ -956,6 +2033,42 @@ export const QueryClientParamsRequest = { const message = createBaseQueryClientParamsRequest(); return message; }, + fromAmino(_: QueryClientParamsRequestAmino): QueryClientParamsRequest { + return {}; + }, + toAmino(_: QueryClientParamsRequest): QueryClientParamsRequestAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg( + object: QueryClientParamsRequestAminoMsg + ): QueryClientParamsRequest { + return QueryClientParamsRequest.fromAmino(object.value); + }, + toAminoMsg( + message: QueryClientParamsRequest + ): QueryClientParamsRequestAminoMsg { + return { + type: "cosmos-sdk/QueryClientParamsRequest", + value: QueryClientParamsRequest.toAmino(message), + }; + }, + fromProtoMsg( + message: QueryClientParamsRequestProtoMsg + ): QueryClientParamsRequest { + return QueryClientParamsRequest.decode(message.value); + }, + toProto(message: QueryClientParamsRequest): Uint8Array { + return QueryClientParamsRequest.encode(message).finish(); + }, + toProtoMsg( + message: QueryClientParamsRequest + ): QueryClientParamsRequestProtoMsg { + return { + typeUrl: "/ibc.core.client.v1.QueryClientParamsRequest", + value: QueryClientParamsRequest.encode(message).finish(), + }; + }, }; function createBaseQueryClientParamsResponse(): QueryClientParamsResponse { return { @@ -1013,6 +2126,45 @@ export const QueryClientParamsResponse = { : undefined; return message; }, + fromAmino(object: QueryClientParamsResponseAmino): QueryClientParamsResponse { + return { + params: object?.params ? Params.fromAmino(object.params) : undefined, + }; + }, + toAmino(message: QueryClientParamsResponse): QueryClientParamsResponseAmino { + const obj: any = {}; + obj.params = message.params ? Params.toAmino(message.params) : undefined; + return obj; + }, + fromAminoMsg( + object: QueryClientParamsResponseAminoMsg + ): QueryClientParamsResponse { + return QueryClientParamsResponse.fromAmino(object.value); + }, + toAminoMsg( + message: QueryClientParamsResponse + ): QueryClientParamsResponseAminoMsg { + return { + type: "cosmos-sdk/QueryClientParamsResponse", + value: QueryClientParamsResponse.toAmino(message), + }; + }, + fromProtoMsg( + message: QueryClientParamsResponseProtoMsg + ): QueryClientParamsResponse { + return QueryClientParamsResponse.decode(message.value); + }, + toProto(message: QueryClientParamsResponse): Uint8Array { + return QueryClientParamsResponse.encode(message).finish(); + }, + toProtoMsg( + message: QueryClientParamsResponse + ): QueryClientParamsResponseProtoMsg { + return { + typeUrl: "/ibc.core.client.v1.QueryClientParamsResponse", + value: QueryClientParamsResponse.encode(message).finish(), + }; + }, }; function createBaseQueryUpgradedClientStateRequest(): QueryUpgradedClientStateRequest { return {}; @@ -1054,6 +2206,46 @@ export const QueryUpgradedClientStateRequest = { const message = createBaseQueryUpgradedClientStateRequest(); return message; }, + fromAmino( + _: QueryUpgradedClientStateRequestAmino + ): QueryUpgradedClientStateRequest { + return {}; + }, + toAmino( + _: QueryUpgradedClientStateRequest + ): QueryUpgradedClientStateRequestAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg( + object: QueryUpgradedClientStateRequestAminoMsg + ): QueryUpgradedClientStateRequest { + return QueryUpgradedClientStateRequest.fromAmino(object.value); + }, + toAminoMsg( + message: QueryUpgradedClientStateRequest + ): QueryUpgradedClientStateRequestAminoMsg { + return { + type: "cosmos-sdk/QueryUpgradedClientStateRequest", + value: QueryUpgradedClientStateRequest.toAmino(message), + }; + }, + fromProtoMsg( + message: QueryUpgradedClientStateRequestProtoMsg + ): QueryUpgradedClientStateRequest { + return QueryUpgradedClientStateRequest.decode(message.value); + }, + toProto(message: QueryUpgradedClientStateRequest): Uint8Array { + return QueryUpgradedClientStateRequest.encode(message).finish(); + }, + toProtoMsg( + message: QueryUpgradedClientStateRequest + ): QueryUpgradedClientStateRequestProtoMsg { + return { + typeUrl: "/ibc.core.client.v1.QueryUpgradedClientStateRequest", + value: QueryUpgradedClientStateRequest.encode(message).finish(), + }; + }, }; function createBaseQueryUpgradedClientStateResponse(): QueryUpgradedClientStateResponse { return { @@ -1119,6 +2311,53 @@ export const QueryUpgradedClientStateResponse = { : undefined; return message; }, + fromAmino( + object: QueryUpgradedClientStateResponseAmino + ): QueryUpgradedClientStateResponse { + return { + upgradedClientState: object?.upgraded_client_state + ? Any.fromAmino(object.upgraded_client_state) + : undefined, + }; + }, + toAmino( + message: QueryUpgradedClientStateResponse + ): QueryUpgradedClientStateResponseAmino { + const obj: any = {}; + obj.upgraded_client_state = message.upgradedClientState + ? Any.toAmino(message.upgradedClientState) + : undefined; + return obj; + }, + fromAminoMsg( + object: QueryUpgradedClientStateResponseAminoMsg + ): QueryUpgradedClientStateResponse { + return QueryUpgradedClientStateResponse.fromAmino(object.value); + }, + toAminoMsg( + message: QueryUpgradedClientStateResponse + ): QueryUpgradedClientStateResponseAminoMsg { + return { + type: "cosmos-sdk/QueryUpgradedClientStateResponse", + value: QueryUpgradedClientStateResponse.toAmino(message), + }; + }, + fromProtoMsg( + message: QueryUpgradedClientStateResponseProtoMsg + ): QueryUpgradedClientStateResponse { + return QueryUpgradedClientStateResponse.decode(message.value); + }, + toProto(message: QueryUpgradedClientStateResponse): Uint8Array { + return QueryUpgradedClientStateResponse.encode(message).finish(); + }, + toProtoMsg( + message: QueryUpgradedClientStateResponse + ): QueryUpgradedClientStateResponseProtoMsg { + return { + typeUrl: "/ibc.core.client.v1.QueryUpgradedClientStateResponse", + value: QueryUpgradedClientStateResponse.encode(message).finish(), + }; + }, }; function createBaseQueryUpgradedConsensusStateRequest(): QueryUpgradedConsensusStateRequest { return {}; @@ -1160,6 +2399,46 @@ export const QueryUpgradedConsensusStateRequest = { const message = createBaseQueryUpgradedConsensusStateRequest(); return message; }, + fromAmino( + _: QueryUpgradedConsensusStateRequestAmino + ): QueryUpgradedConsensusStateRequest { + return {}; + }, + toAmino( + _: QueryUpgradedConsensusStateRequest + ): QueryUpgradedConsensusStateRequestAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg( + object: QueryUpgradedConsensusStateRequestAminoMsg + ): QueryUpgradedConsensusStateRequest { + return QueryUpgradedConsensusStateRequest.fromAmino(object.value); + }, + toAminoMsg( + message: QueryUpgradedConsensusStateRequest + ): QueryUpgradedConsensusStateRequestAminoMsg { + return { + type: "cosmos-sdk/QueryUpgradedConsensusStateRequest", + value: QueryUpgradedConsensusStateRequest.toAmino(message), + }; + }, + fromProtoMsg( + message: QueryUpgradedConsensusStateRequestProtoMsg + ): QueryUpgradedConsensusStateRequest { + return QueryUpgradedConsensusStateRequest.decode(message.value); + }, + toProto(message: QueryUpgradedConsensusStateRequest): Uint8Array { + return QueryUpgradedConsensusStateRequest.encode(message).finish(); + }, + toProtoMsg( + message: QueryUpgradedConsensusStateRequest + ): QueryUpgradedConsensusStateRequestProtoMsg { + return { + typeUrl: "/ibc.core.client.v1.QueryUpgradedConsensusStateRequest", + value: QueryUpgradedConsensusStateRequest.encode(message).finish(), + }; + }, }; function createBaseQueryUpgradedConsensusStateResponse(): QueryUpgradedConsensusStateResponse { return { @@ -1225,6 +2504,53 @@ export const QueryUpgradedConsensusStateResponse = { : undefined; return message; }, + fromAmino( + object: QueryUpgradedConsensusStateResponseAmino + ): QueryUpgradedConsensusStateResponse { + return { + upgradedConsensusState: object?.upgraded_consensus_state + ? Any.fromAmino(object.upgraded_consensus_state) + : undefined, + }; + }, + toAmino( + message: QueryUpgradedConsensusStateResponse + ): QueryUpgradedConsensusStateResponseAmino { + const obj: any = {}; + obj.upgraded_consensus_state = message.upgradedConsensusState + ? Any.toAmino(message.upgradedConsensusState) + : undefined; + return obj; + }, + fromAminoMsg( + object: QueryUpgradedConsensusStateResponseAminoMsg + ): QueryUpgradedConsensusStateResponse { + return QueryUpgradedConsensusStateResponse.fromAmino(object.value); + }, + toAminoMsg( + message: QueryUpgradedConsensusStateResponse + ): QueryUpgradedConsensusStateResponseAminoMsg { + return { + type: "cosmos-sdk/QueryUpgradedConsensusStateResponse", + value: QueryUpgradedConsensusStateResponse.toAmino(message), + }; + }, + fromProtoMsg( + message: QueryUpgradedConsensusStateResponseProtoMsg + ): QueryUpgradedConsensusStateResponse { + return QueryUpgradedConsensusStateResponse.decode(message.value); + }, + toProto(message: QueryUpgradedConsensusStateResponse): Uint8Array { + return QueryUpgradedConsensusStateResponse.encode(message).finish(); + }, + toProtoMsg( + message: QueryUpgradedConsensusStateResponse + ): QueryUpgradedConsensusStateResponseProtoMsg { + return { + typeUrl: "/ibc.core.client.v1.QueryUpgradedConsensusStateResponse", + value: QueryUpgradedConsensusStateResponse.encode(message).finish(), + }; + }, }; /** Query provides defines the gRPC querier service */ export interface Query { @@ -1250,11 +2576,15 @@ export interface Query { ConsensusStates( request: QueryConsensusStatesRequest ): Promise; + /** ConsensusStateHeights queries the height of every consensus states associated with a given client. */ + ConsensusStateHeights( + request: QueryConsensusStateHeightsRequest + ): Promise; /** Status queries the status of an IBC client. */ ClientStatus( request: QueryClientStatusRequest ): Promise; - /** ClientParams queries all parameters of the ibc client. */ + /** ClientParams queries all parameters of the ibc client submodule. */ ClientParams( request?: QueryClientParamsRequest ): Promise; @@ -1275,6 +2605,7 @@ export class QueryClientImpl implements Query { this.ClientStates = this.ClientStates.bind(this); this.ConsensusState = this.ConsensusState.bind(this); this.ConsensusStates = this.ConsensusStates.bind(this); + this.ConsensusStateHeights = this.ConsensusStateHeights.bind(this); this.ClientStatus = this.ClientStatus.bind(this); this.ClientParams = this.ClientParams.bind(this); this.UpgradedClientState = this.UpgradedClientState.bind(this); @@ -1334,6 +2665,19 @@ export class QueryClientImpl implements Query { QueryConsensusStatesResponse.decode(new _m0.Reader(data)) ); } + ConsensusStateHeights( + request: QueryConsensusStateHeightsRequest + ): Promise { + const data = QueryConsensusStateHeightsRequest.encode(request).finish(); + const promise = this.rpc.request( + "ibc.core.client.v1.Query", + "ConsensusStateHeights", + data + ); + return promise.then((data) => + QueryConsensusStateHeightsResponse.decode(new _m0.Reader(data)) + ); + } ClientStatus( request: QueryClientStatusRequest ): Promise { diff --git a/packages/types/src/ibc/core/client/v1/tx.amino.ts b/packages/types/src/ibc/core/client/v1/tx.amino.ts new file mode 100644 index 000000000..4f8aee26a --- /dev/null +++ b/packages/types/src/ibc/core/client/v1/tx.amino.ts @@ -0,0 +1,29 @@ +/* eslint-disable */ +import { + MsgCreateClient, + MsgUpdateClient, + MsgUpgradeClient, + MsgSubmitMisbehaviour, +} from "./tx"; +export const AminoConverter = { + "/ibc.core.client.v1.MsgCreateClient": { + aminoType: "cosmos-sdk/MsgCreateClient", + toAmino: MsgCreateClient.toAmino, + fromAmino: MsgCreateClient.fromAmino, + }, + "/ibc.core.client.v1.MsgUpdateClient": { + aminoType: "cosmos-sdk/MsgUpdateClient", + toAmino: MsgUpdateClient.toAmino, + fromAmino: MsgUpdateClient.fromAmino, + }, + "/ibc.core.client.v1.MsgUpgradeClient": { + aminoType: "cosmos-sdk/MsgUpgradeClient", + toAmino: MsgUpgradeClient.toAmino, + fromAmino: MsgUpgradeClient.fromAmino, + }, + "/ibc.core.client.v1.MsgSubmitMisbehaviour": { + aminoType: "cosmos-sdk/MsgSubmitMisbehaviour", + toAmino: MsgSubmitMisbehaviour.toAmino, + fromAmino: MsgSubmitMisbehaviour.fromAmino, + }, +}; diff --git a/packages/types/src/ibc/core/client/v1/tx.registry.ts b/packages/types/src/ibc/core/client/v1/tx.registry.ts new file mode 100644 index 000000000..116de694e --- /dev/null +++ b/packages/types/src/ibc/core/client/v1/tx.registry.ts @@ -0,0 +1,151 @@ +/* eslint-disable */ +import { GeneratedType, Registry } from "@cosmjs/proto-signing"; +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 MessageComposer = { + encoded: { + createClient(value: MsgCreateClient) { + return { + typeUrl: "/ibc.core.client.v1.MsgCreateClient", + value: MsgCreateClient.encode(value).finish(), + }; + }, + updateClient(value: MsgUpdateClient) { + return { + typeUrl: "/ibc.core.client.v1.MsgUpdateClient", + value: MsgUpdateClient.encode(value).finish(), + }; + }, + upgradeClient(value: MsgUpgradeClient) { + return { + typeUrl: "/ibc.core.client.v1.MsgUpgradeClient", + value: MsgUpgradeClient.encode(value).finish(), + }; + }, + submitMisbehaviour(value: MsgSubmitMisbehaviour) { + return { + typeUrl: "/ibc.core.client.v1.MsgSubmitMisbehaviour", + value: MsgSubmitMisbehaviour.encode(value).finish(), + }; + }, + }, + withTypeUrl: { + createClient(value: MsgCreateClient) { + return { + typeUrl: "/ibc.core.client.v1.MsgCreateClient", + value, + }; + }, + updateClient(value: MsgUpdateClient) { + return { + typeUrl: "/ibc.core.client.v1.MsgUpdateClient", + value, + }; + }, + upgradeClient(value: MsgUpgradeClient) { + return { + typeUrl: "/ibc.core.client.v1.MsgUpgradeClient", + value, + }; + }, + submitMisbehaviour(value: MsgSubmitMisbehaviour) { + return { + typeUrl: "/ibc.core.client.v1.MsgSubmitMisbehaviour", + value, + }; + }, + }, + toJSON: { + createClient(value: MsgCreateClient) { + return { + typeUrl: "/ibc.core.client.v1.MsgCreateClient", + value: MsgCreateClient.toJSON(value), + }; + }, + updateClient(value: MsgUpdateClient) { + return { + typeUrl: "/ibc.core.client.v1.MsgUpdateClient", + value: MsgUpdateClient.toJSON(value), + }; + }, + upgradeClient(value: MsgUpgradeClient) { + return { + typeUrl: "/ibc.core.client.v1.MsgUpgradeClient", + value: MsgUpgradeClient.toJSON(value), + }; + }, + submitMisbehaviour(value: MsgSubmitMisbehaviour) { + return { + typeUrl: "/ibc.core.client.v1.MsgSubmitMisbehaviour", + value: MsgSubmitMisbehaviour.toJSON(value), + }; + }, + }, + fromJSON: { + createClient(value: any) { + return { + typeUrl: "/ibc.core.client.v1.MsgCreateClient", + value: MsgCreateClient.fromJSON(value), + }; + }, + updateClient(value: any) { + return { + typeUrl: "/ibc.core.client.v1.MsgUpdateClient", + value: MsgUpdateClient.fromJSON(value), + }; + }, + upgradeClient(value: any) { + return { + typeUrl: "/ibc.core.client.v1.MsgUpgradeClient", + value: MsgUpgradeClient.fromJSON(value), + }; + }, + submitMisbehaviour(value: any) { + return { + typeUrl: "/ibc.core.client.v1.MsgSubmitMisbehaviour", + value: MsgSubmitMisbehaviour.fromJSON(value), + }; + }, + }, + fromPartial: { + createClient(value: MsgCreateClient) { + return { + typeUrl: "/ibc.core.client.v1.MsgCreateClient", + value: MsgCreateClient.fromPartial(value), + }; + }, + updateClient(value: MsgUpdateClient) { + return { + typeUrl: "/ibc.core.client.v1.MsgUpdateClient", + value: MsgUpdateClient.fromPartial(value), + }; + }, + upgradeClient(value: MsgUpgradeClient) { + return { + typeUrl: "/ibc.core.client.v1.MsgUpgradeClient", + value: MsgUpgradeClient.fromPartial(value), + }; + }, + submitMisbehaviour(value: MsgSubmitMisbehaviour) { + return { + typeUrl: "/ibc.core.client.v1.MsgSubmitMisbehaviour", + value: MsgSubmitMisbehaviour.fromPartial(value), + }; + }, + }, +}; diff --git a/packages/types/src/ibc/core/client/v1/tx.ts b/packages/types/src/ibc/core/client/v1/tx.ts index 379b0c79a..1baea5987 100644 --- a/packages/types/src/ibc/core/client/v1/tx.ts +++ b/packages/types/src/ibc/core/client/v1/tx.ts @@ -1,5 +1,5 @@ /* eslint-disable */ -import { Any } from "../../../../google/protobuf/any"; +import { Any, AnyAmino } from "../../../../google/protobuf/any"; import * as _m0 from "protobufjs/minimal"; import { isSet, @@ -22,22 +22,82 @@ export interface MsgCreateClient { /** signer address */ signer: string; } +export interface MsgCreateClientProtoMsg { + typeUrl: "/ibc.core.client.v1.MsgCreateClient"; + value: Uint8Array; +} +/** MsgCreateClient defines a message to create an IBC client */ +export interface MsgCreateClientAmino { + /** light client state */ + client_state?: AnyAmino; + /** + * consensus state associated with the client that corresponds to a given + * height. + */ + consensus_state?: AnyAmino; + /** signer address */ + signer: string; +} +export interface MsgCreateClientAminoMsg { + type: "cosmos-sdk/MsgCreateClient"; + value: MsgCreateClientAmino; +} /** MsgCreateClientResponse defines the Msg/CreateClient response type. */ export interface MsgCreateClientResponse {} +export interface MsgCreateClientResponseProtoMsg { + typeUrl: "/ibc.core.client.v1.MsgCreateClientResponse"; + value: Uint8Array; +} +/** MsgCreateClientResponse defines the Msg/CreateClient response type. */ +export interface MsgCreateClientResponseAmino {} +export interface MsgCreateClientResponseAminoMsg { + type: "cosmos-sdk/MsgCreateClientResponse"; + value: MsgCreateClientResponseAmino; +} /** * MsgUpdateClient defines an sdk.Msg to update a IBC client state using - * the given header. + * the given client message. */ export interface MsgUpdateClient { /** client unique identifier */ clientId: string; - /** header to update the light client */ - header?: Any; + /** client message to update the light client */ + clientMessage?: Any; + /** signer address */ + signer: string; +} +export interface MsgUpdateClientProtoMsg { + typeUrl: "/ibc.core.client.v1.MsgUpdateClient"; + value: Uint8Array; +} +/** + * MsgUpdateClient defines an sdk.Msg to update a IBC client state using + * the given client message. + */ +export interface MsgUpdateClientAmino { + /** client unique identifier */ + client_id: string; + /** client message to update the light client */ + client_message?: AnyAmino; /** signer address */ signer: string; } +export interface MsgUpdateClientAminoMsg { + type: "cosmos-sdk/MsgUpdateClient"; + value: MsgUpdateClientAmino; +} /** MsgUpdateClientResponse defines the Msg/UpdateClient response type. */ export interface MsgUpdateClientResponse {} +export interface MsgUpdateClientResponseProtoMsg { + typeUrl: "/ibc.core.client.v1.MsgUpdateClientResponse"; + value: Uint8Array; +} +/** MsgUpdateClientResponse defines the Msg/UpdateClient response type. */ +export interface MsgUpdateClientResponseAmino {} +export interface MsgUpdateClientResponseAminoMsg { + type: "cosmos-sdk/MsgUpdateClientResponse"; + value: MsgUpdateClientResponseAmino; +} /** * MsgUpgradeClient defines an sdk.Msg to upgrade an IBC client to a new client * state @@ -59,25 +119,105 @@ export interface MsgUpgradeClient { /** signer address */ signer: string; } +export interface MsgUpgradeClientProtoMsg { + typeUrl: "/ibc.core.client.v1.MsgUpgradeClient"; + value: Uint8Array; +} +/** + * MsgUpgradeClient defines an sdk.Msg to upgrade an IBC client to a new client + * state + */ +export interface MsgUpgradeClientAmino { + /** client unique identifier */ + client_id: string; + /** upgraded client state */ + client_state?: AnyAmino; + /** + * upgraded consensus state, only contains enough information to serve as a + * basis of trust in update logic + */ + consensus_state?: AnyAmino; + /** proof that old chain committed to new client */ + proof_upgrade_client: Uint8Array; + /** proof that old chain committed to new consensus state */ + proof_upgrade_consensus_state: Uint8Array; + /** signer address */ + signer: string; +} +export interface MsgUpgradeClientAminoMsg { + type: "cosmos-sdk/MsgUpgradeClient"; + value: MsgUpgradeClientAmino; +} /** MsgUpgradeClientResponse defines the Msg/UpgradeClient response type. */ export interface MsgUpgradeClientResponse {} +export interface MsgUpgradeClientResponseProtoMsg { + typeUrl: "/ibc.core.client.v1.MsgUpgradeClientResponse"; + value: Uint8Array; +} +/** MsgUpgradeClientResponse defines the Msg/UpgradeClient response type. */ +export interface MsgUpgradeClientResponseAmino {} +export interface MsgUpgradeClientResponseAminoMsg { + type: "cosmos-sdk/MsgUpgradeClientResponse"; + value: MsgUpgradeClientResponseAmino; +} /** * MsgSubmitMisbehaviour defines an sdk.Msg type that submits Evidence for * light client misbehaviour. + * Warning: DEPRECATED */ export interface MsgSubmitMisbehaviour { /** client unique identifier */ + /** @deprecated */ clientId: string; /** misbehaviour used for freezing the light client */ + /** @deprecated */ misbehaviour?: Any; /** signer address */ + /** @deprecated */ + signer: string; +} +export interface MsgSubmitMisbehaviourProtoMsg { + typeUrl: "/ibc.core.client.v1.MsgSubmitMisbehaviour"; + value: Uint8Array; +} +/** + * MsgSubmitMisbehaviour defines an sdk.Msg type that submits Evidence for + * light client misbehaviour. + * Warning: DEPRECATED + */ +export interface MsgSubmitMisbehaviourAmino { + /** client unique identifier */ + /** @deprecated */ + client_id: string; + /** misbehaviour used for freezing the light client */ + /** @deprecated */ + misbehaviour?: AnyAmino; + /** signer address */ + /** @deprecated */ signer: string; } +export interface MsgSubmitMisbehaviourAminoMsg { + type: "cosmos-sdk/MsgSubmitMisbehaviour"; + value: MsgSubmitMisbehaviourAmino; +} /** * MsgSubmitMisbehaviourResponse defines the Msg/SubmitMisbehaviour response * type. */ export interface MsgSubmitMisbehaviourResponse {} +export interface MsgSubmitMisbehaviourResponseProtoMsg { + typeUrl: "/ibc.core.client.v1.MsgSubmitMisbehaviourResponse"; + value: Uint8Array; +} +/** + * MsgSubmitMisbehaviourResponse defines the Msg/SubmitMisbehaviour response + * type. + */ +export interface MsgSubmitMisbehaviourResponseAmino {} +export interface MsgSubmitMisbehaviourResponseAminoMsg { + type: "cosmos-sdk/MsgSubmitMisbehaviourResponse"; + value: MsgSubmitMisbehaviourResponseAmino; +} function createBaseMsgCreateClient(): MsgCreateClient { return { clientState: undefined, @@ -163,6 +303,49 @@ export const MsgCreateClient = { message.signer = object.signer ?? ""; return message; }, + fromAmino(object: MsgCreateClientAmino): MsgCreateClient { + return { + clientState: object?.client_state + ? Any.fromAmino(object.client_state) + : undefined, + consensusState: object?.consensus_state + ? Any.fromAmino(object.consensus_state) + : undefined, + signer: object.signer, + }; + }, + toAmino(message: MsgCreateClient): MsgCreateClientAmino { + const obj: any = {}; + obj.client_state = message.clientState + ? Any.toAmino(message.clientState) + : undefined; + obj.consensus_state = message.consensusState + ? Any.toAmino(message.consensusState) + : undefined; + obj.signer = message.signer; + return obj; + }, + fromAminoMsg(object: MsgCreateClientAminoMsg): MsgCreateClient { + return MsgCreateClient.fromAmino(object.value); + }, + toAminoMsg(message: MsgCreateClient): MsgCreateClientAminoMsg { + return { + type: "cosmos-sdk/MsgCreateClient", + value: MsgCreateClient.toAmino(message), + }; + }, + fromProtoMsg(message: MsgCreateClientProtoMsg): MsgCreateClient { + return MsgCreateClient.decode(message.value); + }, + toProto(message: MsgCreateClient): Uint8Array { + return MsgCreateClient.encode(message).finish(); + }, + toProtoMsg(message: MsgCreateClient): MsgCreateClientProtoMsg { + return { + typeUrl: "/ibc.core.client.v1.MsgCreateClient", + value: MsgCreateClient.encode(message).finish(), + }; + }, }; function createBaseMsgCreateClientResponse(): MsgCreateClientResponse { return {}; @@ -204,11 +387,47 @@ export const MsgCreateClientResponse = { const message = createBaseMsgCreateClientResponse(); return message; }, + fromAmino(_: MsgCreateClientResponseAmino): MsgCreateClientResponse { + return {}; + }, + toAmino(_: MsgCreateClientResponse): MsgCreateClientResponseAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg( + object: MsgCreateClientResponseAminoMsg + ): MsgCreateClientResponse { + return MsgCreateClientResponse.fromAmino(object.value); + }, + toAminoMsg( + message: MsgCreateClientResponse + ): MsgCreateClientResponseAminoMsg { + return { + type: "cosmos-sdk/MsgCreateClientResponse", + value: MsgCreateClientResponse.toAmino(message), + }; + }, + fromProtoMsg( + message: MsgCreateClientResponseProtoMsg + ): MsgCreateClientResponse { + return MsgCreateClientResponse.decode(message.value); + }, + toProto(message: MsgCreateClientResponse): Uint8Array { + return MsgCreateClientResponse.encode(message).finish(); + }, + toProtoMsg( + message: MsgCreateClientResponse + ): MsgCreateClientResponseProtoMsg { + return { + typeUrl: "/ibc.core.client.v1.MsgCreateClientResponse", + value: MsgCreateClientResponse.encode(message).finish(), + }; + }, }; function createBaseMsgUpdateClient(): MsgUpdateClient { return { clientId: "", - header: undefined, + clientMessage: undefined, signer: "", }; } @@ -220,8 +439,8 @@ export const MsgUpdateClient = { if (message.clientId !== "") { writer.uint32(10).string(message.clientId); } - if (message.header !== undefined) { - Any.encode(message.header, writer.uint32(18).fork()).ldelim(); + if (message.clientMessage !== undefined) { + Any.encode(message.clientMessage, writer.uint32(18).fork()).ldelim(); } if (message.signer !== "") { writer.uint32(26).string(message.signer); @@ -239,7 +458,7 @@ export const MsgUpdateClient = { message.clientId = reader.string(); break; case 2: - message.header = Any.decode(reader, reader.uint32()); + message.clientMessage = Any.decode(reader, reader.uint32()); break; case 3: message.signer = reader.string(); @@ -254,15 +473,19 @@ export const MsgUpdateClient = { fromJSON(object: any): MsgUpdateClient { return { clientId: isSet(object.clientId) ? String(object.clientId) : "", - header: isSet(object.header) ? Any.fromJSON(object.header) : undefined, + clientMessage: isSet(object.clientMessage) + ? Any.fromJSON(object.clientMessage) + : undefined, signer: isSet(object.signer) ? String(object.signer) : "", }; }, toJSON(message: MsgUpdateClient): unknown { const obj: any = {}; message.clientId !== undefined && (obj.clientId = message.clientId); - message.header !== undefined && - (obj.header = message.header ? Any.toJSON(message.header) : undefined); + message.clientMessage !== undefined && + (obj.clientMessage = message.clientMessage + ? Any.toJSON(message.clientMessage) + : undefined); message.signer !== undefined && (obj.signer = message.signer); return obj; }, @@ -271,13 +494,52 @@ export const MsgUpdateClient = { ): MsgUpdateClient { const message = createBaseMsgUpdateClient(); message.clientId = object.clientId ?? ""; - message.header = - object.header !== undefined && object.header !== null - ? Any.fromPartial(object.header) + message.clientMessage = + object.clientMessage !== undefined && object.clientMessage !== null + ? Any.fromPartial(object.clientMessage) : undefined; message.signer = object.signer ?? ""; return message; }, + fromAmino(object: MsgUpdateClientAmino): MsgUpdateClient { + return { + clientId: object.client_id, + clientMessage: object?.client_message + ? Any.fromAmino(object.client_message) + : undefined, + signer: object.signer, + }; + }, + toAmino(message: MsgUpdateClient): MsgUpdateClientAmino { + const obj: any = {}; + obj.client_id = message.clientId; + obj.client_message = message.clientMessage + ? Any.toAmino(message.clientMessage) + : undefined; + obj.signer = message.signer; + return obj; + }, + fromAminoMsg(object: MsgUpdateClientAminoMsg): MsgUpdateClient { + return MsgUpdateClient.fromAmino(object.value); + }, + toAminoMsg(message: MsgUpdateClient): MsgUpdateClientAminoMsg { + return { + type: "cosmos-sdk/MsgUpdateClient", + value: MsgUpdateClient.toAmino(message), + }; + }, + fromProtoMsg(message: MsgUpdateClientProtoMsg): MsgUpdateClient { + return MsgUpdateClient.decode(message.value); + }, + toProto(message: MsgUpdateClient): Uint8Array { + return MsgUpdateClient.encode(message).finish(); + }, + toProtoMsg(message: MsgUpdateClient): MsgUpdateClientProtoMsg { + return { + typeUrl: "/ibc.core.client.v1.MsgUpdateClient", + value: MsgUpdateClient.encode(message).finish(), + }; + }, }; function createBaseMsgUpdateClientResponse(): MsgUpdateClientResponse { return {}; @@ -319,6 +581,42 @@ export const MsgUpdateClientResponse = { const message = createBaseMsgUpdateClientResponse(); return message; }, + fromAmino(_: MsgUpdateClientResponseAmino): MsgUpdateClientResponse { + return {}; + }, + toAmino(_: MsgUpdateClientResponse): MsgUpdateClientResponseAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg( + object: MsgUpdateClientResponseAminoMsg + ): MsgUpdateClientResponse { + return MsgUpdateClientResponse.fromAmino(object.value); + }, + toAminoMsg( + message: MsgUpdateClientResponse + ): MsgUpdateClientResponseAminoMsg { + return { + type: "cosmos-sdk/MsgUpdateClientResponse", + value: MsgUpdateClientResponse.toAmino(message), + }; + }, + fromProtoMsg( + message: MsgUpdateClientResponseProtoMsg + ): MsgUpdateClientResponse { + return MsgUpdateClientResponse.decode(message.value); + }, + toProto(message: MsgUpdateClientResponse): Uint8Array { + return MsgUpdateClientResponse.encode(message).finish(); + }, + toProtoMsg( + message: MsgUpdateClientResponse + ): MsgUpdateClientResponseProtoMsg { + return { + typeUrl: "/ibc.core.client.v1.MsgUpdateClientResponse", + value: MsgUpdateClientResponse.encode(message).finish(), + }; + }, }; function createBaseMsgUpgradeClient(): MsgUpgradeClient { return { @@ -450,6 +748,55 @@ export const MsgUpgradeClient = { message.signer = object.signer ?? ""; return message; }, + fromAmino(object: MsgUpgradeClientAmino): MsgUpgradeClient { + return { + clientId: object.client_id, + clientState: object?.client_state + ? Any.fromAmino(object.client_state) + : undefined, + consensusState: object?.consensus_state + ? Any.fromAmino(object.consensus_state) + : undefined, + proofUpgradeClient: object.proof_upgrade_client, + proofUpgradeConsensusState: object.proof_upgrade_consensus_state, + signer: object.signer, + }; + }, + toAmino(message: MsgUpgradeClient): MsgUpgradeClientAmino { + const obj: any = {}; + obj.client_id = message.clientId; + obj.client_state = message.clientState + ? Any.toAmino(message.clientState) + : undefined; + obj.consensus_state = message.consensusState + ? Any.toAmino(message.consensusState) + : undefined; + obj.proof_upgrade_client = message.proofUpgradeClient; + obj.proof_upgrade_consensus_state = message.proofUpgradeConsensusState; + obj.signer = message.signer; + return obj; + }, + fromAminoMsg(object: MsgUpgradeClientAminoMsg): MsgUpgradeClient { + return MsgUpgradeClient.fromAmino(object.value); + }, + toAminoMsg(message: MsgUpgradeClient): MsgUpgradeClientAminoMsg { + return { + type: "cosmos-sdk/MsgUpgradeClient", + value: MsgUpgradeClient.toAmino(message), + }; + }, + fromProtoMsg(message: MsgUpgradeClientProtoMsg): MsgUpgradeClient { + return MsgUpgradeClient.decode(message.value); + }, + toProto(message: MsgUpgradeClient): Uint8Array { + return MsgUpgradeClient.encode(message).finish(); + }, + toProtoMsg(message: MsgUpgradeClient): MsgUpgradeClientProtoMsg { + return { + typeUrl: "/ibc.core.client.v1.MsgUpgradeClient", + value: MsgUpgradeClient.encode(message).finish(), + }; + }, }; function createBaseMsgUpgradeClientResponse(): MsgUpgradeClientResponse { return {}; @@ -491,6 +838,42 @@ export const MsgUpgradeClientResponse = { const message = createBaseMsgUpgradeClientResponse(); return message; }, + fromAmino(_: MsgUpgradeClientResponseAmino): MsgUpgradeClientResponse { + return {}; + }, + toAmino(_: MsgUpgradeClientResponse): MsgUpgradeClientResponseAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg( + object: MsgUpgradeClientResponseAminoMsg + ): MsgUpgradeClientResponse { + return MsgUpgradeClientResponse.fromAmino(object.value); + }, + toAminoMsg( + message: MsgUpgradeClientResponse + ): MsgUpgradeClientResponseAminoMsg { + return { + type: "cosmos-sdk/MsgUpgradeClientResponse", + value: MsgUpgradeClientResponse.toAmino(message), + }; + }, + fromProtoMsg( + message: MsgUpgradeClientResponseProtoMsg + ): MsgUpgradeClientResponse { + return MsgUpgradeClientResponse.decode(message.value); + }, + toProto(message: MsgUpgradeClientResponse): Uint8Array { + return MsgUpgradeClientResponse.encode(message).finish(); + }, + toProtoMsg( + message: MsgUpgradeClientResponse + ): MsgUpgradeClientResponseProtoMsg { + return { + typeUrl: "/ibc.core.client.v1.MsgUpgradeClientResponse", + value: MsgUpgradeClientResponse.encode(message).finish(), + }; + }, }; function createBaseMsgSubmitMisbehaviour(): MsgSubmitMisbehaviour { return { @@ -572,6 +955,45 @@ export const MsgSubmitMisbehaviour = { message.signer = object.signer ?? ""; return message; }, + fromAmino(object: MsgSubmitMisbehaviourAmino): MsgSubmitMisbehaviour { + return { + clientId: object.client_id, + misbehaviour: object?.misbehaviour + ? Any.fromAmino(object.misbehaviour) + : undefined, + signer: object.signer, + }; + }, + toAmino(message: MsgSubmitMisbehaviour): MsgSubmitMisbehaviourAmino { + const obj: any = {}; + obj.client_id = message.clientId; + obj.misbehaviour = message.misbehaviour + ? Any.toAmino(message.misbehaviour) + : undefined; + obj.signer = message.signer; + return obj; + }, + fromAminoMsg(object: MsgSubmitMisbehaviourAminoMsg): MsgSubmitMisbehaviour { + return MsgSubmitMisbehaviour.fromAmino(object.value); + }, + toAminoMsg(message: MsgSubmitMisbehaviour): MsgSubmitMisbehaviourAminoMsg { + return { + type: "cosmos-sdk/MsgSubmitMisbehaviour", + value: MsgSubmitMisbehaviour.toAmino(message), + }; + }, + fromProtoMsg(message: MsgSubmitMisbehaviourProtoMsg): MsgSubmitMisbehaviour { + return MsgSubmitMisbehaviour.decode(message.value); + }, + toProto(message: MsgSubmitMisbehaviour): Uint8Array { + return MsgSubmitMisbehaviour.encode(message).finish(); + }, + toProtoMsg(message: MsgSubmitMisbehaviour): MsgSubmitMisbehaviourProtoMsg { + return { + typeUrl: "/ibc.core.client.v1.MsgSubmitMisbehaviour", + value: MsgSubmitMisbehaviour.encode(message).finish(), + }; + }, }; function createBaseMsgSubmitMisbehaviourResponse(): MsgSubmitMisbehaviourResponse { return {}; @@ -613,6 +1035,46 @@ export const MsgSubmitMisbehaviourResponse = { const message = createBaseMsgSubmitMisbehaviourResponse(); return message; }, + fromAmino( + _: MsgSubmitMisbehaviourResponseAmino + ): MsgSubmitMisbehaviourResponse { + return {}; + }, + toAmino( + _: MsgSubmitMisbehaviourResponse + ): MsgSubmitMisbehaviourResponseAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg( + object: MsgSubmitMisbehaviourResponseAminoMsg + ): MsgSubmitMisbehaviourResponse { + return MsgSubmitMisbehaviourResponse.fromAmino(object.value); + }, + toAminoMsg( + message: MsgSubmitMisbehaviourResponse + ): MsgSubmitMisbehaviourResponseAminoMsg { + return { + type: "cosmos-sdk/MsgSubmitMisbehaviourResponse", + value: MsgSubmitMisbehaviourResponse.toAmino(message), + }; + }, + fromProtoMsg( + message: MsgSubmitMisbehaviourResponseProtoMsg + ): MsgSubmitMisbehaviourResponse { + return MsgSubmitMisbehaviourResponse.decode(message.value); + }, + toProto(message: MsgSubmitMisbehaviourResponse): Uint8Array { + return MsgSubmitMisbehaviourResponse.encode(message).finish(); + }, + toProtoMsg( + message: MsgSubmitMisbehaviourResponse + ): MsgSubmitMisbehaviourResponseProtoMsg { + return { + typeUrl: "/ibc.core.client.v1.MsgSubmitMisbehaviourResponse", + value: MsgSubmitMisbehaviourResponse.encode(message).finish(), + }; + }, }; /** Msg defines the ibc/client Msg service. */ export interface Msg { diff --git a/packages/types/src/index.ts b/packages/types/src/index.ts index 46e1cd7e6..af7535dd8 100644 --- a/packages/types/src/index.ts +++ b/packages/types/src/index.ts @@ -1,4 +1,4 @@ -// Auto-generated, see scripts/codegen.js! +// Auto-generated, see scripts/codegen/patches/index.ts! // Exports we want to provide at the root of the "@desmoslabs/desmjs-types" package diff --git a/packages/types/src/tendermint/abci/types.ts b/packages/types/src/tendermint/abci/types.ts index bea1ce6f9..aa6e7256d 100644 --- a/packages/types/src/tendermint/abci/types.ts +++ b/packages/types/src/tendermint/abci/types.ts @@ -1,13 +1,9 @@ /* eslint-disable */ -import { Timestamp } from "../../google/protobuf/timestamp"; -import { Header } from "../types/types"; -import { ProofOps } from "../crypto/proof"; -import { - EvidenceParams, - ValidatorParams, - VersionParams, -} from "../types/params"; -import { PublicKey } from "../crypto/keys"; +import { Timestamp, TimestampAmino } from "../../google/protobuf/timestamp"; +import { ConsensusParams, ConsensusParamsAmino } from "../types/params"; +import { Header, HeaderAmino } from "../types/types"; +import { ProofOps, ProofOpsAmino } from "../crypto/proof"; +import { PublicKey, PublicKeyAmino } from "../crypto/keys"; import { Long, isSet, @@ -26,6 +22,7 @@ export enum CheckTxType { RECHECK = 1, UNRECOGNIZED = -1, } +export const CheckTxTypeAmino = CheckTxType; export function checkTxTypeFromJSON(object: any): CheckTxType { switch (object) { case 0: @@ -66,6 +63,7 @@ export enum ResponseOfferSnapshot_Result { REJECT_SENDER = 5, UNRECOGNIZED = -1, } +export const ResponseOfferSnapshot_ResultAmino = ResponseOfferSnapshot_Result; export function responseOfferSnapshot_ResultFromJSON( object: any ): ResponseOfferSnapshot_Result { @@ -130,6 +128,8 @@ export enum ResponseApplySnapshotChunk_Result { REJECT_SNAPSHOT = 5, UNRECOGNIZED = -1, } +export const ResponseApplySnapshotChunk_ResultAmino = + ResponseApplySnapshotChunk_Result; export function responseApplySnapshotChunk_ResultFromJSON( object: any ): ResponseApplySnapshotChunk_Result { @@ -179,38 +179,81 @@ export function responseApplySnapshotChunk_ResultToJSON( return "UNRECOGNIZED"; } } -export enum EvidenceType { +export enum ResponseProcessProposal_ProposalStatus { + UNKNOWN = 0, + ACCEPT = 1, + REJECT = 2, + UNRECOGNIZED = -1, +} +export const ResponseProcessProposal_ProposalStatusAmino = + ResponseProcessProposal_ProposalStatus; +export function responseProcessProposal_ProposalStatusFromJSON( + object: any +): ResponseProcessProposal_ProposalStatus { + switch (object) { + case 0: + case "UNKNOWN": + return ResponseProcessProposal_ProposalStatus.UNKNOWN; + case 1: + case "ACCEPT": + return ResponseProcessProposal_ProposalStatus.ACCEPT; + case 2: + case "REJECT": + return ResponseProcessProposal_ProposalStatus.REJECT; + case -1: + case "UNRECOGNIZED": + default: + return ResponseProcessProposal_ProposalStatus.UNRECOGNIZED; + } +} +export function responseProcessProposal_ProposalStatusToJSON( + object: ResponseProcessProposal_ProposalStatus +): string { + switch (object) { + case ResponseProcessProposal_ProposalStatus.UNKNOWN: + return "UNKNOWN"; + case ResponseProcessProposal_ProposalStatus.ACCEPT: + return "ACCEPT"; + case ResponseProcessProposal_ProposalStatus.REJECT: + return "REJECT"; + case ResponseProcessProposal_ProposalStatus.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} +export enum MisbehaviorType { UNKNOWN = 0, DUPLICATE_VOTE = 1, LIGHT_CLIENT_ATTACK = 2, UNRECOGNIZED = -1, } -export function evidenceTypeFromJSON(object: any): EvidenceType { +export const MisbehaviorTypeAmino = MisbehaviorType; +export function misbehaviorTypeFromJSON(object: any): MisbehaviorType { switch (object) { case 0: case "UNKNOWN": - return EvidenceType.UNKNOWN; + return MisbehaviorType.UNKNOWN; case 1: case "DUPLICATE_VOTE": - return EvidenceType.DUPLICATE_VOTE; + return MisbehaviorType.DUPLICATE_VOTE; case 2: case "LIGHT_CLIENT_ATTACK": - return EvidenceType.LIGHT_CLIENT_ATTACK; + return MisbehaviorType.LIGHT_CLIENT_ATTACK; case -1: case "UNRECOGNIZED": default: - return EvidenceType.UNRECOGNIZED; + return MisbehaviorType.UNRECOGNIZED; } } -export function evidenceTypeToJSON(object: EvidenceType): string { +export function misbehaviorTypeToJSON(object: MisbehaviorType): string { switch (object) { - case EvidenceType.UNKNOWN: + case MisbehaviorType.UNKNOWN: return "UNKNOWN"; - case EvidenceType.DUPLICATE_VOTE: + case MisbehaviorType.DUPLICATE_VOTE: return "DUPLICATE_VOTE"; - case EvidenceType.LIGHT_CLIENT_ATTACK: + case MisbehaviorType.LIGHT_CLIENT_ATTACK: return "LIGHT_CLIENT_ATTACK"; - case EvidenceType.UNRECOGNIZED: + case MisbehaviorType.UNRECOGNIZED: default: return "UNRECOGNIZED"; } @@ -219,7 +262,6 @@ export interface Request { echo?: RequestEcho; flush?: RequestFlush; info?: RequestInfo; - setOption?: RequestSetOption; initChain?: RequestInitChain; query?: RequestQuery; beginBlock?: RequestBeginBlock; @@ -231,20 +273,78 @@ export interface Request { offerSnapshot?: RequestOfferSnapshot; loadSnapshotChunk?: RequestLoadSnapshotChunk; applySnapshotChunk?: RequestApplySnapshotChunk; + prepareProposal?: RequestPrepareProposal; + processProposal?: RequestProcessProposal; +} +export interface RequestProtoMsg { + typeUrl: "/tendermint.abci.Request"; + value: Uint8Array; +} +export interface RequestAmino { + echo?: RequestEchoAmino; + flush?: RequestFlushAmino; + info?: RequestInfoAmino; + init_chain?: RequestInitChainAmino; + query?: RequestQueryAmino; + begin_block?: RequestBeginBlockAmino; + check_tx?: RequestCheckTxAmino; + deliver_tx?: RequestDeliverTxAmino; + end_block?: RequestEndBlockAmino; + commit?: RequestCommitAmino; + list_snapshots?: RequestListSnapshotsAmino; + offer_snapshot?: RequestOfferSnapshotAmino; + load_snapshot_chunk?: RequestLoadSnapshotChunkAmino; + apply_snapshot_chunk?: RequestApplySnapshotChunkAmino; + prepare_proposal?: RequestPrepareProposalAmino; + process_proposal?: RequestProcessProposalAmino; +} +export interface RequestAminoMsg { + type: "/tendermint.abci.Request"; + value: RequestAmino; } export interface RequestEcho { message: string; } +export interface RequestEchoProtoMsg { + typeUrl: "/tendermint.abci.RequestEcho"; + value: Uint8Array; +} +export interface RequestEchoAmino { + message: string; +} +export interface RequestEchoAminoMsg { + type: "/tendermint.abci.RequestEcho"; + value: RequestEchoAmino; +} export interface RequestFlush {} +export interface RequestFlushProtoMsg { + typeUrl: "/tendermint.abci.RequestFlush"; + value: Uint8Array; +} +export interface RequestFlushAmino {} +export interface RequestFlushAminoMsg { + type: "/tendermint.abci.RequestFlush"; + value: RequestFlushAmino; +} export interface RequestInfo { version: string; blockVersion: Long; p2pVersion: Long; + abciVersion: string; } -/** nondeterministic */ -export interface RequestSetOption { - key: string; - value: string; +export interface RequestInfoProtoMsg { + typeUrl: "/tendermint.abci.RequestInfo"; + value: Uint8Array; +} +export interface RequestInfoAmino { + version: string; + block_version: string; + p2p_version: string; + abci_version: string; +} +export interface RequestInfoAminoMsg { + type: "/tendermint.abci.RequestInfo"; + value: RequestInfoAmino; } export interface RequestInitChain { time?: Timestamp; @@ -254,31 +354,128 @@ export interface RequestInitChain { appStateBytes: Uint8Array; initialHeight: Long; } +export interface RequestInitChainProtoMsg { + typeUrl: "/tendermint.abci.RequestInitChain"; + value: Uint8Array; +} +export interface RequestInitChainAmino { + time?: TimestampAmino; + chain_id: string; + consensus_params?: ConsensusParamsAmino; + validators: ValidatorUpdateAmino[]; + app_state_bytes: Uint8Array; + initial_height: string; +} +export interface RequestInitChainAminoMsg { + type: "/tendermint.abci.RequestInitChain"; + value: RequestInitChainAmino; +} export interface RequestQuery { data: Uint8Array; path: string; height: Long; prove: boolean; } +export interface RequestQueryProtoMsg { + typeUrl: "/tendermint.abci.RequestQuery"; + value: Uint8Array; +} +export interface RequestQueryAmino { + data: Uint8Array; + path: string; + height: string; + prove: boolean; +} +export interface RequestQueryAminoMsg { + type: "/tendermint.abci.RequestQuery"; + value: RequestQueryAmino; +} export interface RequestBeginBlock { hash: Uint8Array; header?: Header; - lastCommitInfo?: LastCommitInfo; - byzantineValidators: Evidence[]; + lastCommitInfo?: CommitInfo; + byzantineValidators: Misbehavior[]; +} +export interface RequestBeginBlockProtoMsg { + typeUrl: "/tendermint.abci.RequestBeginBlock"; + value: Uint8Array; +} +export interface RequestBeginBlockAmino { + hash: Uint8Array; + header?: HeaderAmino; + last_commit_info?: CommitInfoAmino; + byzantine_validators: MisbehaviorAmino[]; +} +export interface RequestBeginBlockAminoMsg { + type: "/tendermint.abci.RequestBeginBlock"; + value: RequestBeginBlockAmino; } export interface RequestCheckTx { tx: Uint8Array; type: CheckTxType; } +export interface RequestCheckTxProtoMsg { + typeUrl: "/tendermint.abci.RequestCheckTx"; + value: Uint8Array; +} +export interface RequestCheckTxAmino { + tx: Uint8Array; + type: CheckTxType; +} +export interface RequestCheckTxAminoMsg { + type: "/tendermint.abci.RequestCheckTx"; + value: RequestCheckTxAmino; +} export interface RequestDeliverTx { tx: Uint8Array; } +export interface RequestDeliverTxProtoMsg { + typeUrl: "/tendermint.abci.RequestDeliverTx"; + value: Uint8Array; +} +export interface RequestDeliverTxAmino { + tx: Uint8Array; +} +export interface RequestDeliverTxAminoMsg { + type: "/tendermint.abci.RequestDeliverTx"; + value: RequestDeliverTxAmino; +} export interface RequestEndBlock { height: Long; } +export interface RequestEndBlockProtoMsg { + typeUrl: "/tendermint.abci.RequestEndBlock"; + value: Uint8Array; +} +export interface RequestEndBlockAmino { + height: string; +} +export interface RequestEndBlockAminoMsg { + type: "/tendermint.abci.RequestEndBlock"; + value: RequestEndBlockAmino; +} export interface RequestCommit {} +export interface RequestCommitProtoMsg { + typeUrl: "/tendermint.abci.RequestCommit"; + value: Uint8Array; +} +export interface RequestCommitAmino {} +export interface RequestCommitAminoMsg { + type: "/tendermint.abci.RequestCommit"; + value: RequestCommitAmino; +} /** lists available snapshots */ export interface RequestListSnapshots {} +export interface RequestListSnapshotsProtoMsg { + typeUrl: "/tendermint.abci.RequestListSnapshots"; + value: Uint8Array; +} +/** lists available snapshots */ +export interface RequestListSnapshotsAmino {} +export interface RequestListSnapshotsAminoMsg { + type: "/tendermint.abci.RequestListSnapshots"; + value: RequestListSnapshotsAmino; +} /** offers a snapshot to the application */ export interface RequestOfferSnapshot { /** snapshot offered by peers */ @@ -286,24 +483,138 @@ export interface RequestOfferSnapshot { /** light client-verified app hash for snapshot height */ appHash: Uint8Array; } +export interface RequestOfferSnapshotProtoMsg { + typeUrl: "/tendermint.abci.RequestOfferSnapshot"; + value: Uint8Array; +} +/** offers a snapshot to the application */ +export interface RequestOfferSnapshotAmino { + /** snapshot offered by peers */ + snapshot?: SnapshotAmino; + /** light client-verified app hash for snapshot height */ + app_hash: Uint8Array; +} +export interface RequestOfferSnapshotAminoMsg { + type: "/tendermint.abci.RequestOfferSnapshot"; + value: RequestOfferSnapshotAmino; +} /** loads a snapshot chunk */ export interface RequestLoadSnapshotChunk { height: Long; format: number; chunk: number; } +export interface RequestLoadSnapshotChunkProtoMsg { + typeUrl: "/tendermint.abci.RequestLoadSnapshotChunk"; + value: Uint8Array; +} +/** loads a snapshot chunk */ +export interface RequestLoadSnapshotChunkAmino { + height: string; + format: number; + chunk: number; +} +export interface RequestLoadSnapshotChunkAminoMsg { + type: "/tendermint.abci.RequestLoadSnapshotChunk"; + value: RequestLoadSnapshotChunkAmino; +} /** Applies a snapshot chunk */ export interface RequestApplySnapshotChunk { index: number; chunk: Uint8Array; sender: string; } +export interface RequestApplySnapshotChunkProtoMsg { + typeUrl: "/tendermint.abci.RequestApplySnapshotChunk"; + value: Uint8Array; +} +/** Applies a snapshot chunk */ +export interface RequestApplySnapshotChunkAmino { + index: number; + chunk: Uint8Array; + sender: string; +} +export interface RequestApplySnapshotChunkAminoMsg { + type: "/tendermint.abci.RequestApplySnapshotChunk"; + value: RequestApplySnapshotChunkAmino; +} +export interface RequestPrepareProposal { + /** the modified transactions cannot exceed this size. */ + maxTxBytes: Long; + /** + * txs is an array of transactions that will be included in a block, + * sent to the app for possible modifications. + */ + txs: Uint8Array[]; + localLastCommit?: ExtendedCommitInfo; + misbehavior: Misbehavior[]; + height: Long; + time?: Timestamp; + nextValidatorsHash: Uint8Array; + /** address of the public key of the validator proposing the block. */ + proposerAddress: Uint8Array; +} +export interface RequestPrepareProposalProtoMsg { + typeUrl: "/tendermint.abci.RequestPrepareProposal"; + value: Uint8Array; +} +export interface RequestPrepareProposalAmino { + /** the modified transactions cannot exceed this size. */ + max_tx_bytes: string; + /** + * txs is an array of transactions that will be included in a block, + * sent to the app for possible modifications. + */ + txs: Uint8Array[]; + local_last_commit?: ExtendedCommitInfoAmino; + misbehavior: MisbehaviorAmino[]; + height: string; + time?: TimestampAmino; + next_validators_hash: Uint8Array; + /** address of the public key of the validator proposing the block. */ + proposer_address: Uint8Array; +} +export interface RequestPrepareProposalAminoMsg { + type: "/tendermint.abci.RequestPrepareProposal"; + value: RequestPrepareProposalAmino; +} +export interface RequestProcessProposal { + txs: Uint8Array[]; + proposedLastCommit?: CommitInfo; + misbehavior: Misbehavior[]; + /** hash is the merkle root hash of the fields of the proposed block. */ + hash: Uint8Array; + height: Long; + time?: Timestamp; + nextValidatorsHash: Uint8Array; + /** address of the public key of the original proposer of the block. */ + proposerAddress: Uint8Array; +} +export interface RequestProcessProposalProtoMsg { + typeUrl: "/tendermint.abci.RequestProcessProposal"; + value: Uint8Array; +} +export interface RequestProcessProposalAmino { + txs: Uint8Array[]; + proposed_last_commit?: CommitInfoAmino; + misbehavior: MisbehaviorAmino[]; + /** hash is the merkle root hash of the fields of the proposed block. */ + hash: Uint8Array; + height: string; + time?: TimestampAmino; + next_validators_hash: Uint8Array; + /** address of the public key of the original proposer of the block. */ + proposer_address: Uint8Array; +} +export interface RequestProcessProposalAminoMsg { + type: "/tendermint.abci.RequestProcessProposal"; + value: RequestProcessProposalAmino; +} export interface Response { exception?: ResponseException; echo?: ResponseEcho; flush?: ResponseFlush; info?: ResponseInfo; - setOption?: ResponseSetOption; initChain?: ResponseInitChain; query?: ResponseQuery; beginBlock?: ResponseBeginBlock; @@ -315,15 +626,76 @@ export interface Response { offerSnapshot?: ResponseOfferSnapshot; loadSnapshotChunk?: ResponseLoadSnapshotChunk; applySnapshotChunk?: ResponseApplySnapshotChunk; + prepareProposal?: ResponsePrepareProposal; + processProposal?: ResponseProcessProposal; +} +export interface ResponseProtoMsg { + typeUrl: "/tendermint.abci.Response"; + value: Uint8Array; +} +export interface ResponseAmino { + exception?: ResponseExceptionAmino; + echo?: ResponseEchoAmino; + flush?: ResponseFlushAmino; + info?: ResponseInfoAmino; + init_chain?: ResponseInitChainAmino; + query?: ResponseQueryAmino; + begin_block?: ResponseBeginBlockAmino; + check_tx?: ResponseCheckTxAmino; + deliver_tx?: ResponseDeliverTxAmino; + end_block?: ResponseEndBlockAmino; + commit?: ResponseCommitAmino; + list_snapshots?: ResponseListSnapshotsAmino; + offer_snapshot?: ResponseOfferSnapshotAmino; + load_snapshot_chunk?: ResponseLoadSnapshotChunkAmino; + apply_snapshot_chunk?: ResponseApplySnapshotChunkAmino; + prepare_proposal?: ResponsePrepareProposalAmino; + process_proposal?: ResponseProcessProposalAmino; +} +export interface ResponseAminoMsg { + type: "/tendermint.abci.Response"; + value: ResponseAmino; } /** nondeterministic */ export interface ResponseException { error: string; } +export interface ResponseExceptionProtoMsg { + typeUrl: "/tendermint.abci.ResponseException"; + value: Uint8Array; +} +/** nondeterministic */ +export interface ResponseExceptionAmino { + error: string; +} +export interface ResponseExceptionAminoMsg { + type: "/tendermint.abci.ResponseException"; + value: ResponseExceptionAmino; +} export interface ResponseEcho { message: string; } +export interface ResponseEchoProtoMsg { + typeUrl: "/tendermint.abci.ResponseEcho"; + value: Uint8Array; +} +export interface ResponseEchoAmino { + message: string; +} +export interface ResponseEchoAminoMsg { + type: "/tendermint.abci.ResponseEcho"; + value: ResponseEchoAmino; +} export interface ResponseFlush {} +export interface ResponseFlushProtoMsg { + typeUrl: "/tendermint.abci.ResponseFlush"; + value: Uint8Array; +} +export interface ResponseFlushAmino {} +export interface ResponseFlushAminoMsg { + type: "/tendermint.abci.ResponseFlush"; + value: ResponseFlushAmino; +} export interface ResponseInfo { data: string; version: string; @@ -331,18 +703,39 @@ export interface ResponseInfo { lastBlockHeight: Long; lastBlockAppHash: Uint8Array; } -/** nondeterministic */ -export interface ResponseSetOption { - code: number; - /** bytes data = 2; */ - log: string; - info: string; +export interface ResponseInfoProtoMsg { + typeUrl: "/tendermint.abci.ResponseInfo"; + value: Uint8Array; +} +export interface ResponseInfoAmino { + data: string; + version: string; + app_version: string; + last_block_height: string; + last_block_app_hash: Uint8Array; +} +export interface ResponseInfoAminoMsg { + type: "/tendermint.abci.ResponseInfo"; + value: ResponseInfoAmino; } export interface ResponseInitChain { consensusParams?: ConsensusParams; validators: ValidatorUpdate[]; appHash: Uint8Array; } +export interface ResponseInitChainProtoMsg { + typeUrl: "/tendermint.abci.ResponseInitChain"; + value: Uint8Array; +} +export interface ResponseInitChainAmino { + consensus_params?: ConsensusParamsAmino; + validators: ValidatorUpdateAmino[]; + app_hash: Uint8Array; +} +export interface ResponseInitChainAminoMsg { + type: "/tendermint.abci.ResponseInitChain"; + value: ResponseInitChainAmino; +} export interface ResponseQuery { code: number; /** bytes data = 2; // use "value" instead. */ @@ -356,9 +749,41 @@ export interface ResponseQuery { height: Long; codespace: string; } +export interface ResponseQueryProtoMsg { + typeUrl: "/tendermint.abci.ResponseQuery"; + value: Uint8Array; +} +export interface ResponseQueryAmino { + code: number; + /** bytes data = 2; // use "value" instead. */ + log: string; + /** nondeterministic */ + info: string; + index: string; + key: Uint8Array; + value: Uint8Array; + proof_ops?: ProofOpsAmino; + height: string; + codespace: string; +} +export interface ResponseQueryAminoMsg { + type: "/tendermint.abci.ResponseQuery"; + value: ResponseQueryAmino; +} export interface ResponseBeginBlock { events: Event[]; } +export interface ResponseBeginBlockProtoMsg { + typeUrl: "/tendermint.abci.ResponseBeginBlock"; + value: Uint8Array; +} +export interface ResponseBeginBlockAmino { + events: EventAmino[]; +} +export interface ResponseBeginBlockAminoMsg { + type: "/tendermint.abci.ResponseBeginBlock"; + value: ResponseBeginBlockAmino; +} export interface ResponseCheckTx { code: number; data: Uint8Array; @@ -370,6 +795,40 @@ export interface ResponseCheckTx { gasUsed: Long; events: Event[]; codespace: string; + sender: string; + priority: Long; + /** + * mempool_error is set by CometBFT. + * ABCI applictions creating a ResponseCheckTX should not set mempool_error. + */ + mempoolError: string; +} +export interface ResponseCheckTxProtoMsg { + typeUrl: "/tendermint.abci.ResponseCheckTx"; + value: Uint8Array; +} +export interface ResponseCheckTxAmino { + code: number; + data: Uint8Array; + /** nondeterministic */ + log: string; + /** nondeterministic */ + info: string; + gas_wanted: string; + gas_used: string; + events: EventAmino[]; + codespace: string; + sender: string; + priority: string; + /** + * mempool_error is set by CometBFT. + * ABCI applictions creating a ResponseCheckTX should not set mempool_error. + */ + mempool_error: string; +} +export interface ResponseCheckTxAminoMsg { + type: "/tendermint.abci.ResponseCheckTx"; + value: ResponseCheckTxAmino; } export interface ResponseDeliverTx { code: number; @@ -383,25 +842,104 @@ export interface ResponseDeliverTx { events: Event[]; codespace: string; } +export interface ResponseDeliverTxProtoMsg { + typeUrl: "/tendermint.abci.ResponseDeliverTx"; + value: Uint8Array; +} +export interface ResponseDeliverTxAmino { + code: number; + data: Uint8Array; + /** nondeterministic */ + log: string; + /** nondeterministic */ + info: string; + gas_wanted: string; + gas_used: string; + events: EventAmino[]; + codespace: string; +} +export interface ResponseDeliverTxAminoMsg { + type: "/tendermint.abci.ResponseDeliverTx"; + value: ResponseDeliverTxAmino; +} export interface ResponseEndBlock { validatorUpdates: ValidatorUpdate[]; consensusParamUpdates?: ConsensusParams; events: Event[]; } +export interface ResponseEndBlockProtoMsg { + typeUrl: "/tendermint.abci.ResponseEndBlock"; + value: Uint8Array; +} +export interface ResponseEndBlockAmino { + validator_updates: ValidatorUpdateAmino[]; + consensus_param_updates?: ConsensusParamsAmino; + events: EventAmino[]; +} +export interface ResponseEndBlockAminoMsg { + type: "/tendermint.abci.ResponseEndBlock"; + value: ResponseEndBlockAmino; +} export interface ResponseCommit { /** reserve 1 */ data: Uint8Array; retainHeight: Long; } +export interface ResponseCommitProtoMsg { + typeUrl: "/tendermint.abci.ResponseCommit"; + value: Uint8Array; +} +export interface ResponseCommitAmino { + /** reserve 1 */ + data: Uint8Array; + retain_height: string; +} +export interface ResponseCommitAminoMsg { + type: "/tendermint.abci.ResponseCommit"; + value: ResponseCommitAmino; +} export interface ResponseListSnapshots { snapshots: Snapshot[]; } +export interface ResponseListSnapshotsProtoMsg { + typeUrl: "/tendermint.abci.ResponseListSnapshots"; + value: Uint8Array; +} +export interface ResponseListSnapshotsAmino { + snapshots: SnapshotAmino[]; +} +export interface ResponseListSnapshotsAminoMsg { + type: "/tendermint.abci.ResponseListSnapshots"; + value: ResponseListSnapshotsAmino; +} export interface ResponseOfferSnapshot { result: ResponseOfferSnapshot_Result; } +export interface ResponseOfferSnapshotProtoMsg { + typeUrl: "/tendermint.abci.ResponseOfferSnapshot"; + value: Uint8Array; +} +export interface ResponseOfferSnapshotAmino { + result: ResponseOfferSnapshot_Result; +} +export interface ResponseOfferSnapshotAminoMsg { + type: "/tendermint.abci.ResponseOfferSnapshot"; + value: ResponseOfferSnapshotAmino; +} export interface ResponseLoadSnapshotChunk { chunk: Uint8Array; } +export interface ResponseLoadSnapshotChunkProtoMsg { + typeUrl: "/tendermint.abci.ResponseLoadSnapshotChunk"; + value: Uint8Array; +} +export interface ResponseLoadSnapshotChunkAmino { + chunk: Uint8Array; +} +export interface ResponseLoadSnapshotChunkAminoMsg { + type: "/tendermint.abci.ResponseLoadSnapshotChunk"; + value: ResponseLoadSnapshotChunkAmino; +} export interface ResponseApplySnapshotChunk { result: ResponseApplySnapshotChunk_Result; /** Chunks to refetch and reapply */ @@ -409,54 +947,169 @@ export interface ResponseApplySnapshotChunk { /** Chunk senders to reject and ban */ rejectSenders: string[]; } -/** - * ConsensusParams contains all consensus-relevant parameters - * that can be adjusted by the abci app - */ -export interface ConsensusParams { - block?: BlockParams; - evidence?: EvidenceParams; - validator?: ValidatorParams; - version?: VersionParams; -} -/** BlockParams contains limits on the block size. */ -export interface BlockParams { - /** Note: must be greater than 0 */ - maxBytes: Long; - /** Note: must be greater or equal to -1 */ - maxGas: Long; -} -export interface LastCommitInfo { - round: number; - votes: VoteInfo[]; +export interface ResponseApplySnapshotChunkProtoMsg { + typeUrl: "/tendermint.abci.ResponseApplySnapshotChunk"; + value: Uint8Array; } -/** - * Event allows application developers to attach additional information to - * ResponseBeginBlock, ResponseEndBlock, ResponseCheckTx and ResponseDeliverTx. - * Later, transactions may be queried using these events. - */ -export interface Event { - type: string; - attributes: EventAttribute[]; +export interface ResponseApplySnapshotChunkAmino { + result: ResponseApplySnapshotChunk_Result; + /** Chunks to refetch and reapply */ + refetch_chunks: number[]; + /** Chunk senders to reject and ban */ + reject_senders: string[]; } -/** EventAttribute is a single key-value pair, associated with an event. */ -export interface EventAttribute { - key: Uint8Array; +export interface ResponseApplySnapshotChunkAminoMsg { + type: "/tendermint.abci.ResponseApplySnapshotChunk"; + value: ResponseApplySnapshotChunkAmino; +} +export interface ResponsePrepareProposal { + txs: Uint8Array[]; +} +export interface ResponsePrepareProposalProtoMsg { + typeUrl: "/tendermint.abci.ResponsePrepareProposal"; value: Uint8Array; - /** nondeterministic */ - index: boolean; } -/** - * TxResult contains results of executing the transaction. - * - * One usage is indexing transaction results. - */ -export interface TxResult { - height: Long; - index: number; +export interface ResponsePrepareProposalAmino { + txs: Uint8Array[]; +} +export interface ResponsePrepareProposalAminoMsg { + type: "/tendermint.abci.ResponsePrepareProposal"; + value: ResponsePrepareProposalAmino; +} +export interface ResponseProcessProposal { + status: ResponseProcessProposal_ProposalStatus; +} +export interface ResponseProcessProposalProtoMsg { + typeUrl: "/tendermint.abci.ResponseProcessProposal"; + value: Uint8Array; +} +export interface ResponseProcessProposalAmino { + status: ResponseProcessProposal_ProposalStatus; +} +export interface ResponseProcessProposalAminoMsg { + type: "/tendermint.abci.ResponseProcessProposal"; + value: ResponseProcessProposalAmino; +} +export interface CommitInfo { + round: number; + votes: VoteInfo[]; +} +export interface CommitInfoProtoMsg { + typeUrl: "/tendermint.abci.CommitInfo"; + value: Uint8Array; +} +export interface CommitInfoAmino { + round: number; + votes: VoteInfoAmino[]; +} +export interface CommitInfoAminoMsg { + type: "/tendermint.abci.CommitInfo"; + value: CommitInfoAmino; +} +export interface ExtendedCommitInfo { + /** The round at which the block proposer decided in the previous height. */ + round: number; + /** + * List of validators' addresses in the last validator set with their voting + * information, including vote extensions. + */ + votes: ExtendedVoteInfo[]; +} +export interface ExtendedCommitInfoProtoMsg { + typeUrl: "/tendermint.abci.ExtendedCommitInfo"; + value: Uint8Array; +} +export interface ExtendedCommitInfoAmino { + /** The round at which the block proposer decided in the previous height. */ + round: number; + /** + * List of validators' addresses in the last validator set with their voting + * information, including vote extensions. + */ + votes: ExtendedVoteInfoAmino[]; +} +export interface ExtendedCommitInfoAminoMsg { + type: "/tendermint.abci.ExtendedCommitInfo"; + value: ExtendedCommitInfoAmino; +} +/** + * Event allows application developers to attach additional information to + * ResponseBeginBlock, ResponseEndBlock, ResponseCheckTx and ResponseDeliverTx. + * Later, transactions may be queried using these events. + */ +export interface Event { + type: string; + attributes: EventAttribute[]; +} +export interface EventProtoMsg { + typeUrl: "/tendermint.abci.Event"; + value: Uint8Array; +} +/** + * Event allows application developers to attach additional information to + * ResponseBeginBlock, ResponseEndBlock, ResponseCheckTx and ResponseDeliverTx. + * Later, transactions may be queried using these events. + */ +export interface EventAmino { + type: string; + attributes: EventAttributeAmino[]; +} +export interface EventAminoMsg { + type: "/tendermint.abci.Event"; + value: EventAmino; +} +/** EventAttribute is a single key-value pair, associated with an event. */ +export interface EventAttribute { + key: string; + value: string; + /** nondeterministic */ + index: boolean; +} +export interface EventAttributeProtoMsg { + typeUrl: "/tendermint.abci.EventAttribute"; + value: Uint8Array; +} +/** EventAttribute is a single key-value pair, associated with an event. */ +export interface EventAttributeAmino { + key: string; + value: string; + /** nondeterministic */ + index: boolean; +} +export interface EventAttributeAminoMsg { + type: "/tendermint.abci.EventAttribute"; + value: EventAttributeAmino; +} +/** + * TxResult contains results of executing the transaction. + * + * One usage is indexing transaction results. + */ +export interface TxResult { + height: Long; + index: number; tx: Uint8Array; result?: ResponseDeliverTx; } +export interface TxResultProtoMsg { + typeUrl: "/tendermint.abci.TxResult"; + value: Uint8Array; +} +/** + * TxResult contains results of executing the transaction. + * + * One usage is indexing transaction results. + */ +export interface TxResultAmino { + height: string; + index: number; + tx: Uint8Array; + result?: ResponseDeliverTxAmino; +} +export interface TxResultAminoMsg { + type: "/tendermint.abci.TxResult"; + value: TxResultAmino; +} /** Validator */ export interface Validator { /** @@ -467,18 +1120,82 @@ export interface Validator { /** The voting power */ power: Long; } +export interface ValidatorProtoMsg { + typeUrl: "/tendermint.abci.Validator"; + value: Uint8Array; +} +/** Validator */ +export interface ValidatorAmino { + /** + * The first 20 bytes of SHA256(public key) + * PubKey pub_key = 2 [(gogoproto.nullable)=false]; + */ + address: Uint8Array; + /** The voting power */ + power: string; +} +export interface ValidatorAminoMsg { + type: "/tendermint.abci.Validator"; + value: ValidatorAmino; +} /** ValidatorUpdate */ export interface ValidatorUpdate { pubKey?: PublicKey; power: Long; } +export interface ValidatorUpdateProtoMsg { + typeUrl: "/tendermint.abci.ValidatorUpdate"; + value: Uint8Array; +} +/** ValidatorUpdate */ +export interface ValidatorUpdateAmino { + pub_key?: PublicKeyAmino; + power: string; +} +export interface ValidatorUpdateAminoMsg { + type: "/tendermint.abci.ValidatorUpdate"; + value: ValidatorUpdateAmino; +} /** VoteInfo */ export interface VoteInfo { validator?: Validator; signedLastBlock: boolean; } -export interface Evidence { - type: EvidenceType; +export interface VoteInfoProtoMsg { + typeUrl: "/tendermint.abci.VoteInfo"; + value: Uint8Array; +} +/** VoteInfo */ +export interface VoteInfoAmino { + validator?: ValidatorAmino; + signed_last_block: boolean; +} +export interface VoteInfoAminoMsg { + type: "/tendermint.abci.VoteInfo"; + value: VoteInfoAmino; +} +export interface ExtendedVoteInfo { + validator?: Validator; + signedLastBlock: boolean; + /** Reserved for future use */ + voteExtension: Uint8Array; +} +export interface ExtendedVoteInfoProtoMsg { + typeUrl: "/tendermint.abci.ExtendedVoteInfo"; + value: Uint8Array; +} +export interface ExtendedVoteInfoAmino { + validator?: ValidatorAmino; + signed_last_block: boolean; + /** Reserved for future use */ + vote_extension: Uint8Array; +} +export interface ExtendedVoteInfoAminoMsg { + type: "/tendermint.abci.ExtendedVoteInfo"; + value: ExtendedVoteInfoAmino; +} +export interface Misbehavior { + type: MisbehaviorType; /** The offending validator */ validator?: Validator; /** The height when the offense occurred */ @@ -492,6 +1209,29 @@ export interface Evidence { */ totalVotingPower: Long; } +export interface MisbehaviorProtoMsg { + typeUrl: "/tendermint.abci.Misbehavior"; + value: Uint8Array; +} +export interface MisbehaviorAmino { + type: MisbehaviorType; + /** The offending validator */ + validator?: ValidatorAmino; + /** The height when the offense occurred */ + height: string; + /** The corresponding time where the offense occurred */ + time?: TimestampAmino; + /** + * Total voting power of the validator set in case the ABCI application does + * not store historical validators. + * https://github.com/tendermint/tendermint/issues/4581 + */ + total_voting_power: string; +} +export interface MisbehaviorAminoMsg { + type: "/tendermint.abci.Misbehavior"; + value: MisbehaviorAmino; +} export interface Snapshot { /** The height at which the snapshot was taken */ height: Long; @@ -504,12 +1244,31 @@ export interface Snapshot { /** Arbitrary application metadata */ metadata: Uint8Array; } +export interface SnapshotProtoMsg { + typeUrl: "/tendermint.abci.Snapshot"; + value: Uint8Array; +} +export interface SnapshotAmino { + /** The height at which the snapshot was taken */ + height: string; + /** The application-specific snapshot format */ + format: number; + /** Number of chunks in the snapshot */ + chunks: number; + /** Arbitrary snapshot hash, equal only if identical */ + hash: Uint8Array; + /** Arbitrary application metadata */ + metadata: Uint8Array; +} +export interface SnapshotAminoMsg { + type: "/tendermint.abci.Snapshot"; + value: SnapshotAmino; +} function createBaseRequest(): Request { return { echo: undefined, flush: undefined, info: undefined, - setOption: undefined, initChain: undefined, query: undefined, beginBlock: undefined, @@ -521,6 +1280,8 @@ function createBaseRequest(): Request { offerSnapshot: undefined, loadSnapshotChunk: undefined, applySnapshotChunk: undefined, + prepareProposal: undefined, + processProposal: undefined, }; } export const Request = { @@ -537,12 +1298,6 @@ export const Request = { if (message.info !== undefined) { RequestInfo.encode(message.info, writer.uint32(26).fork()).ldelim(); } - if (message.setOption !== undefined) { - RequestSetOption.encode( - message.setOption, - writer.uint32(34).fork() - ).ldelim(); - } if (message.initChain !== undefined) { RequestInitChain.encode( message.initChain, @@ -600,6 +1355,18 @@ export const Request = { writer.uint32(122).fork() ).ldelim(); } + if (message.prepareProposal !== undefined) { + RequestPrepareProposal.encode( + message.prepareProposal, + writer.uint32(130).fork() + ).ldelim(); + } + if (message.processProposal !== undefined) { + RequestProcessProposal.encode( + message.processProposal, + writer.uint32(138).fork() + ).ldelim(); + } return writer; }, decode(input: _m0.Reader | Uint8Array, length?: number): Request { @@ -618,9 +1385,6 @@ export const Request = { case 3: message.info = RequestInfo.decode(reader, reader.uint32()); break; - case 4: - message.setOption = RequestSetOption.decode(reader, reader.uint32()); - break; case 5: message.initChain = RequestInitChain.decode(reader, reader.uint32()); break; @@ -669,6 +1433,18 @@ export const Request = { reader.uint32() ); break; + case 16: + message.prepareProposal = RequestPrepareProposal.decode( + reader, + reader.uint32() + ); + break; + case 17: + message.processProposal = RequestProcessProposal.decode( + reader, + reader.uint32() + ); + break; default: reader.skipType(tag & 7); break; @@ -683,9 +1459,6 @@ export const Request = { ? RequestFlush.fromJSON(object.flush) : undefined, info: isSet(object.info) ? RequestInfo.fromJSON(object.info) : undefined, - setOption: isSet(object.setOption) - ? RequestSetOption.fromJSON(object.setOption) - : undefined, initChain: isSet(object.initChain) ? RequestInitChain.fromJSON(object.initChain) : undefined, @@ -719,6 +1492,12 @@ export const Request = { applySnapshotChunk: isSet(object.applySnapshotChunk) ? RequestApplySnapshotChunk.fromJSON(object.applySnapshotChunk) : undefined, + prepareProposal: isSet(object.prepareProposal) + ? RequestPrepareProposal.fromJSON(object.prepareProposal) + : undefined, + processProposal: isSet(object.processProposal) + ? RequestProcessProposal.fromJSON(object.processProposal) + : undefined, }; }, toJSON(message: Request): unknown { @@ -731,10 +1510,6 @@ export const Request = { : undefined); message.info !== undefined && (obj.info = message.info ? RequestInfo.toJSON(message.info) : undefined); - message.setOption !== undefined && - (obj.setOption = message.setOption - ? RequestSetOption.toJSON(message.setOption) - : undefined); message.initChain !== undefined && (obj.initChain = message.initChain ? RequestInitChain.toJSON(message.initChain) @@ -779,6 +1554,14 @@ export const Request = { (obj.applySnapshotChunk = message.applySnapshotChunk ? RequestApplySnapshotChunk.toJSON(message.applySnapshotChunk) : undefined); + message.prepareProposal !== undefined && + (obj.prepareProposal = message.prepareProposal + ? RequestPrepareProposal.toJSON(message.prepareProposal) + : undefined); + message.processProposal !== undefined && + (obj.processProposal = message.processProposal + ? RequestProcessProposal.toJSON(message.processProposal) + : undefined); return obj; }, fromPartial, I>>(object: I): Request { @@ -795,10 +1578,6 @@ export const Request = { object.info !== undefined && object.info !== null ? RequestInfo.fromPartial(object.info) : undefined; - message.setOption = - object.setOption !== undefined && object.setOption !== null - ? RequestSetOption.fromPartial(object.setOption) - : undefined; message.initChain = object.initChain !== undefined && object.initChain !== null ? RequestInitChain.fromPartial(object.initChain) @@ -845,8 +1624,119 @@ export const Request = { object.applySnapshotChunk !== null ? RequestApplySnapshotChunk.fromPartial(object.applySnapshotChunk) : undefined; + message.prepareProposal = + object.prepareProposal !== undefined && object.prepareProposal !== null + ? RequestPrepareProposal.fromPartial(object.prepareProposal) + : undefined; + message.processProposal = + object.processProposal !== undefined && object.processProposal !== null + ? RequestProcessProposal.fromPartial(object.processProposal) + : undefined; return message; }, + fromAmino(object: RequestAmino): Request { + return { + echo: object?.echo ? RequestEcho.fromAmino(object.echo) : undefined, + flush: object?.flush ? RequestFlush.fromAmino(object.flush) : undefined, + info: object?.info ? RequestInfo.fromAmino(object.info) : undefined, + initChain: object?.init_chain + ? RequestInitChain.fromAmino(object.init_chain) + : undefined, + query: object?.query ? RequestQuery.fromAmino(object.query) : undefined, + beginBlock: object?.begin_block + ? RequestBeginBlock.fromAmino(object.begin_block) + : undefined, + checkTx: object?.check_tx + ? RequestCheckTx.fromAmino(object.check_tx) + : undefined, + deliverTx: object?.deliver_tx + ? RequestDeliverTx.fromAmino(object.deliver_tx) + : undefined, + endBlock: object?.end_block + ? RequestEndBlock.fromAmino(object.end_block) + : undefined, + commit: object?.commit + ? RequestCommit.fromAmino(object.commit) + : undefined, + listSnapshots: object?.list_snapshots + ? RequestListSnapshots.fromAmino(object.list_snapshots) + : undefined, + offerSnapshot: object?.offer_snapshot + ? RequestOfferSnapshot.fromAmino(object.offer_snapshot) + : undefined, + loadSnapshotChunk: object?.load_snapshot_chunk + ? RequestLoadSnapshotChunk.fromAmino(object.load_snapshot_chunk) + : undefined, + applySnapshotChunk: object?.apply_snapshot_chunk + ? RequestApplySnapshotChunk.fromAmino(object.apply_snapshot_chunk) + : undefined, + prepareProposal: object?.prepare_proposal + ? RequestPrepareProposal.fromAmino(object.prepare_proposal) + : undefined, + processProposal: object?.process_proposal + ? RequestProcessProposal.fromAmino(object.process_proposal) + : undefined, + }; + }, + toAmino(message: Request): RequestAmino { + const obj: any = {}; + obj.echo = message.echo ? RequestEcho.toAmino(message.echo) : undefined; + obj.flush = message.flush ? RequestFlush.toAmino(message.flush) : undefined; + obj.info = message.info ? RequestInfo.toAmino(message.info) : undefined; + obj.init_chain = message.initChain + ? RequestInitChain.toAmino(message.initChain) + : undefined; + obj.query = message.query ? RequestQuery.toAmino(message.query) : undefined; + obj.begin_block = message.beginBlock + ? RequestBeginBlock.toAmino(message.beginBlock) + : undefined; + obj.check_tx = message.checkTx + ? RequestCheckTx.toAmino(message.checkTx) + : undefined; + obj.deliver_tx = message.deliverTx + ? RequestDeliverTx.toAmino(message.deliverTx) + : undefined; + obj.end_block = message.endBlock + ? RequestEndBlock.toAmino(message.endBlock) + : undefined; + obj.commit = message.commit + ? RequestCommit.toAmino(message.commit) + : undefined; + obj.list_snapshots = message.listSnapshots + ? RequestListSnapshots.toAmino(message.listSnapshots) + : undefined; + obj.offer_snapshot = message.offerSnapshot + ? RequestOfferSnapshot.toAmino(message.offerSnapshot) + : undefined; + obj.load_snapshot_chunk = message.loadSnapshotChunk + ? RequestLoadSnapshotChunk.toAmino(message.loadSnapshotChunk) + : undefined; + obj.apply_snapshot_chunk = message.applySnapshotChunk + ? RequestApplySnapshotChunk.toAmino(message.applySnapshotChunk) + : undefined; + obj.prepare_proposal = message.prepareProposal + ? RequestPrepareProposal.toAmino(message.prepareProposal) + : undefined; + obj.process_proposal = message.processProposal + ? RequestProcessProposal.toAmino(message.processProposal) + : undefined; + return obj; + }, + fromAminoMsg(object: RequestAminoMsg): Request { + return Request.fromAmino(object.value); + }, + fromProtoMsg(message: RequestProtoMsg): Request { + return Request.decode(message.value); + }, + toProto(message: Request): Uint8Array { + return Request.encode(message).finish(); + }, + toProtoMsg(message: Request): RequestProtoMsg { + return { + typeUrl: "/tendermint.abci.Request", + value: Request.encode(message).finish(), + }; + }, }; function createBaseRequestEcho(): RequestEcho { return { @@ -897,6 +1787,31 @@ export const RequestEcho = { message.message = object.message ?? ""; return message; }, + fromAmino(object: RequestEchoAmino): RequestEcho { + return { + message: object.message, + }; + }, + toAmino(message: RequestEcho): RequestEchoAmino { + const obj: any = {}; + obj.message = message.message; + return obj; + }, + fromAminoMsg(object: RequestEchoAminoMsg): RequestEcho { + return RequestEcho.fromAmino(object.value); + }, + fromProtoMsg(message: RequestEchoProtoMsg): RequestEcho { + return RequestEcho.decode(message.value); + }, + toProto(message: RequestEcho): Uint8Array { + return RequestEcho.encode(message).finish(); + }, + toProtoMsg(message: RequestEcho): RequestEchoProtoMsg { + return { + typeUrl: "/tendermint.abci.RequestEcho", + value: RequestEcho.encode(message).finish(), + }; + }, }; function createBaseRequestFlush(): RequestFlush { return {}; @@ -935,12 +1850,35 @@ export const RequestFlush = { const message = createBaseRequestFlush(); return message; }, + fromAmino(_: RequestFlushAmino): RequestFlush { + return {}; + }, + toAmino(_: RequestFlush): RequestFlushAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg(object: RequestFlushAminoMsg): RequestFlush { + return RequestFlush.fromAmino(object.value); + }, + fromProtoMsg(message: RequestFlushProtoMsg): RequestFlush { + return RequestFlush.decode(message.value); + }, + toProto(message: RequestFlush): Uint8Array { + return RequestFlush.encode(message).finish(); + }, + toProtoMsg(message: RequestFlush): RequestFlushProtoMsg { + return { + typeUrl: "/tendermint.abci.RequestFlush", + value: RequestFlush.encode(message).finish(), + }; + }, }; function createBaseRequestInfo(): RequestInfo { return { version: "", blockVersion: Long.UZERO, p2pVersion: Long.UZERO, + abciVersion: "", }; } export const RequestInfo = { @@ -957,6 +1895,9 @@ export const RequestInfo = { if (!message.p2pVersion.isZero()) { writer.uint32(24).uint64(message.p2pVersion); } + if (message.abciVersion !== "") { + writer.uint32(34).string(message.abciVersion); + } return writer; }, decode(input: _m0.Reader | Uint8Array, length?: number): RequestInfo { @@ -975,6 +1916,9 @@ export const RequestInfo = { case 3: message.p2pVersion = reader.uint64() as Long; break; + case 4: + message.abciVersion = reader.string(); + break; default: reader.skipType(tag & 7); break; @@ -991,6 +1935,7 @@ export const RequestInfo = { p2pVersion: isSet(object.p2pVersion) ? Long.fromValue(object.p2pVersion) : Long.UZERO, + abciVersion: isSet(object.abciVersion) ? String(object.abciVersion) : "", }; }, toJSON(message: RequestInfo): unknown { @@ -1000,6 +1945,8 @@ export const RequestInfo = { (obj.blockVersion = (message.blockVersion || Long.UZERO).toString()); message.p2pVersion !== undefined && (obj.p2pVersion = (message.p2pVersion || Long.UZERO).toString()); + message.abciVersion !== undefined && + (obj.abciVersion = message.abciVersion); return obj; }, fromPartial, I>>( @@ -1015,89 +1962,65 @@ export const RequestInfo = { object.p2pVersion !== undefined && object.p2pVersion !== null ? Long.fromValue(object.p2pVersion) : Long.UZERO; + message.abciVersion = object.abciVersion ?? ""; return message; }, + fromAmino(object: RequestInfoAmino): RequestInfo { + return { + version: object.version, + blockVersion: Long.fromString(object.block_version), + p2pVersion: Long.fromString(object.p2p_version), + abciVersion: object.abci_version, + }; + }, + toAmino(message: RequestInfo): RequestInfoAmino { + const obj: any = {}; + obj.version = message.version; + obj.block_version = message.blockVersion + ? message.blockVersion.toString() + : undefined; + obj.p2p_version = message.p2pVersion + ? message.p2pVersion.toString() + : undefined; + obj.abci_version = message.abciVersion; + return obj; + }, + fromAminoMsg(object: RequestInfoAminoMsg): RequestInfo { + return RequestInfo.fromAmino(object.value); + }, + fromProtoMsg(message: RequestInfoProtoMsg): RequestInfo { + return RequestInfo.decode(message.value); + }, + toProto(message: RequestInfo): Uint8Array { + return RequestInfo.encode(message).finish(); + }, + toProtoMsg(message: RequestInfo): RequestInfoProtoMsg { + return { + typeUrl: "/tendermint.abci.RequestInfo", + value: RequestInfo.encode(message).finish(), + }; + }, }; -function createBaseRequestSetOption(): RequestSetOption { +function createBaseRequestInitChain(): RequestInitChain { return { - key: "", - value: "", + time: undefined, + chainId: "", + consensusParams: undefined, + validators: [], + appStateBytes: new Uint8Array(), + initialHeight: Long.ZERO, }; } -export const RequestSetOption = { +export const RequestInitChain = { encode( - message: RequestSetOption, + message: RequestInitChain, writer: _m0.Writer = _m0.Writer.create() ): _m0.Writer { - if (message.key !== "") { - writer.uint32(10).string(message.key); + if (message.time !== undefined) { + Timestamp.encode(message.time, writer.uint32(10).fork()).ldelim(); } - if (message.value !== "") { - writer.uint32(18).string(message.value); - } - return writer; - }, - decode(input: _m0.Reader | Uint8Array, length?: number): RequestSetOption { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseRequestSetOption(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.key = reader.string(); - break; - case 2: - message.value = reader.string(); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }, - fromJSON(object: any): RequestSetOption { - return { - key: isSet(object.key) ? String(object.key) : "", - value: isSet(object.value) ? String(object.value) : "", - }; - }, - toJSON(message: RequestSetOption): unknown { - const obj: any = {}; - message.key !== undefined && (obj.key = message.key); - message.value !== undefined && (obj.value = message.value); - return obj; - }, - fromPartial, I>>( - object: I - ): RequestSetOption { - const message = createBaseRequestSetOption(); - message.key = object.key ?? ""; - message.value = object.value ?? ""; - return message; - }, -}; -function createBaseRequestInitChain(): RequestInitChain { - return { - time: undefined, - chainId: "", - consensusParams: undefined, - validators: [], - appStateBytes: new Uint8Array(), - initialHeight: Long.ZERO, - }; -} -export const RequestInitChain = { - encode( - message: RequestInitChain, - writer: _m0.Writer = _m0.Writer.create() - ): _m0.Writer { - if (message.time !== undefined) { - Timestamp.encode(message.time, writer.uint32(10).fork()).ldelim(); - } - if (message.chainId !== "") { - writer.uint32(18).string(message.chainId); + if (message.chainId !== "") { + writer.uint32(18).string(message.chainId); } if (message.consensusParams !== undefined) { ConsensusParams.encode( @@ -1219,6 +2142,55 @@ export const RequestInitChain = { : Long.ZERO; return message; }, + fromAmino(object: RequestInitChainAmino): RequestInitChain { + return { + time: object?.time ? Timestamp.fromAmino(object.time) : undefined, + chainId: object.chain_id, + consensusParams: object?.consensus_params + ? ConsensusParams.fromAmino(object.consensus_params) + : undefined, + validators: Array.isArray(object?.validators) + ? object.validators.map((e: any) => ValidatorUpdate.fromAmino(e)) + : [], + appStateBytes: object.app_state_bytes, + initialHeight: Long.fromString(object.initial_height), + }; + }, + toAmino(message: RequestInitChain): RequestInitChainAmino { + const obj: any = {}; + obj.time = message.time ? Timestamp.toAmino(message.time) : undefined; + obj.chain_id = message.chainId; + obj.consensus_params = message.consensusParams + ? ConsensusParams.toAmino(message.consensusParams) + : undefined; + if (message.validators) { + obj.validators = message.validators.map((e) => + e ? ValidatorUpdate.toAmino(e) : undefined + ); + } else { + obj.validators = []; + } + obj.app_state_bytes = message.appStateBytes; + obj.initial_height = message.initialHeight + ? message.initialHeight.toString() + : undefined; + return obj; + }, + fromAminoMsg(object: RequestInitChainAminoMsg): RequestInitChain { + return RequestInitChain.fromAmino(object.value); + }, + fromProtoMsg(message: RequestInitChainProtoMsg): RequestInitChain { + return RequestInitChain.decode(message.value); + }, + toProto(message: RequestInitChain): Uint8Array { + return RequestInitChain.encode(message).finish(); + }, + toProtoMsg(message: RequestInitChain): RequestInitChainProtoMsg { + return { + typeUrl: "/tendermint.abci.RequestInitChain", + value: RequestInitChain.encode(message).finish(), + }; + }, }; function createBaseRequestQuery(): RequestQuery { return { @@ -1308,6 +2280,37 @@ export const RequestQuery = { message.prove = object.prove ?? false; return message; }, + fromAmino(object: RequestQueryAmino): RequestQuery { + return { + data: object.data, + path: object.path, + height: Long.fromString(object.height), + prove: object.prove, + }; + }, + toAmino(message: RequestQuery): RequestQueryAmino { + const obj: any = {}; + obj.data = message.data; + obj.path = message.path; + obj.height = message.height ? message.height.toString() : undefined; + obj.prove = message.prove; + return obj; + }, + fromAminoMsg(object: RequestQueryAminoMsg): RequestQuery { + return RequestQuery.fromAmino(object.value); + }, + fromProtoMsg(message: RequestQueryProtoMsg): RequestQuery { + return RequestQuery.decode(message.value); + }, + toProto(message: RequestQuery): Uint8Array { + return RequestQuery.encode(message).finish(); + }, + toProtoMsg(message: RequestQuery): RequestQueryProtoMsg { + return { + typeUrl: "/tendermint.abci.RequestQuery", + value: RequestQuery.encode(message).finish(), + }; + }, }; function createBaseRequestBeginBlock(): RequestBeginBlock { return { @@ -1329,13 +2332,13 @@ export const RequestBeginBlock = { Header.encode(message.header, writer.uint32(18).fork()).ldelim(); } if (message.lastCommitInfo !== undefined) { - LastCommitInfo.encode( + CommitInfo.encode( message.lastCommitInfo, writer.uint32(26).fork() ).ldelim(); } for (const v of message.byzantineValidators) { - Evidence.encode(v!, writer.uint32(34).fork()).ldelim(); + Misbehavior.encode(v!, writer.uint32(34).fork()).ldelim(); } return writer; }, @@ -1353,14 +2356,11 @@ export const RequestBeginBlock = { message.header = Header.decode(reader, reader.uint32()); break; case 3: - message.lastCommitInfo = LastCommitInfo.decode( - reader, - reader.uint32() - ); + message.lastCommitInfo = CommitInfo.decode(reader, reader.uint32()); break; case 4: message.byzantineValidators.push( - Evidence.decode(reader, reader.uint32()) + Misbehavior.decode(reader, reader.uint32()) ); break; default: @@ -1377,10 +2377,10 @@ export const RequestBeginBlock = { : new Uint8Array(), header: isSet(object.header) ? Header.fromJSON(object.header) : undefined, lastCommitInfo: isSet(object.lastCommitInfo) - ? LastCommitInfo.fromJSON(object.lastCommitInfo) + ? CommitInfo.fromJSON(object.lastCommitInfo) : undefined, byzantineValidators: Array.isArray(object?.byzantineValidators) - ? object.byzantineValidators.map((e: any) => Evidence.fromJSON(e)) + ? object.byzantineValidators.map((e: any) => Misbehavior.fromJSON(e)) : [], }; }, @@ -1394,11 +2394,11 @@ export const RequestBeginBlock = { (obj.header = message.header ? Header.toJSON(message.header) : undefined); message.lastCommitInfo !== undefined && (obj.lastCommitInfo = message.lastCommitInfo - ? LastCommitInfo.toJSON(message.lastCommitInfo) + ? CommitInfo.toJSON(message.lastCommitInfo) : undefined); if (message.byzantineValidators) { obj.byzantineValidators = message.byzantineValidators.map((e) => - e ? Evidence.toJSON(e) : undefined + e ? Misbehavior.toJSON(e) : undefined ); } else { obj.byzantineValidators = []; @@ -1416,12 +2416,55 @@ export const RequestBeginBlock = { : undefined; message.lastCommitInfo = object.lastCommitInfo !== undefined && object.lastCommitInfo !== null - ? LastCommitInfo.fromPartial(object.lastCommitInfo) + ? CommitInfo.fromPartial(object.lastCommitInfo) : undefined; message.byzantineValidators = - object.byzantineValidators?.map((e) => Evidence.fromPartial(e)) || []; + object.byzantineValidators?.map((e) => Misbehavior.fromPartial(e)) || []; return message; }, + fromAmino(object: RequestBeginBlockAmino): RequestBeginBlock { + return { + hash: object.hash, + header: object?.header ? Header.fromAmino(object.header) : undefined, + lastCommitInfo: object?.last_commit_info + ? CommitInfo.fromAmino(object.last_commit_info) + : undefined, + byzantineValidators: Array.isArray(object?.byzantine_validators) + ? object.byzantine_validators.map((e: any) => Misbehavior.fromAmino(e)) + : [], + }; + }, + toAmino(message: RequestBeginBlock): RequestBeginBlockAmino { + const obj: any = {}; + obj.hash = message.hash; + obj.header = message.header ? Header.toAmino(message.header) : undefined; + obj.last_commit_info = message.lastCommitInfo + ? CommitInfo.toAmino(message.lastCommitInfo) + : undefined; + if (message.byzantineValidators) { + obj.byzantine_validators = message.byzantineValidators.map((e) => + e ? Misbehavior.toAmino(e) : undefined + ); + } else { + obj.byzantine_validators = []; + } + return obj; + }, + fromAminoMsg(object: RequestBeginBlockAminoMsg): RequestBeginBlock { + return RequestBeginBlock.fromAmino(object.value); + }, + fromProtoMsg(message: RequestBeginBlockProtoMsg): RequestBeginBlock { + return RequestBeginBlock.decode(message.value); + }, + toProto(message: RequestBeginBlock): Uint8Array { + return RequestBeginBlock.encode(message).finish(); + }, + toProtoMsg(message: RequestBeginBlock): RequestBeginBlockProtoMsg { + return { + typeUrl: "/tendermint.abci.RequestBeginBlock", + value: RequestBeginBlock.encode(message).finish(), + }; + }, }; function createBaseRequestCheckTx(): RequestCheckTx { return { @@ -1485,6 +2528,33 @@ export const RequestCheckTx = { message.type = object.type ?? 0; return message; }, + fromAmino(object: RequestCheckTxAmino): RequestCheckTx { + return { + tx: object.tx, + type: isSet(object.type) ? checkTxTypeFromJSON(object.type) : 0, + }; + }, + toAmino(message: RequestCheckTx): RequestCheckTxAmino { + const obj: any = {}; + obj.tx = message.tx; + obj.type = message.type; + return obj; + }, + fromAminoMsg(object: RequestCheckTxAminoMsg): RequestCheckTx { + return RequestCheckTx.fromAmino(object.value); + }, + fromProtoMsg(message: RequestCheckTxProtoMsg): RequestCheckTx { + return RequestCheckTx.decode(message.value); + }, + toProto(message: RequestCheckTx): Uint8Array { + return RequestCheckTx.encode(message).finish(); + }, + toProtoMsg(message: RequestCheckTx): RequestCheckTxProtoMsg { + return { + typeUrl: "/tendermint.abci.RequestCheckTx", + value: RequestCheckTx.encode(message).finish(), + }; + }, }; function createBaseRequestDeliverTx(): RequestDeliverTx { return { @@ -1538,6 +2608,31 @@ export const RequestDeliverTx = { message.tx = object.tx ?? new Uint8Array(); return message; }, + fromAmino(object: RequestDeliverTxAmino): RequestDeliverTx { + return { + tx: object.tx, + }; + }, + toAmino(message: RequestDeliverTx): RequestDeliverTxAmino { + const obj: any = {}; + obj.tx = message.tx; + return obj; + }, + fromAminoMsg(object: RequestDeliverTxAminoMsg): RequestDeliverTx { + return RequestDeliverTx.fromAmino(object.value); + }, + fromProtoMsg(message: RequestDeliverTxProtoMsg): RequestDeliverTx { + return RequestDeliverTx.decode(message.value); + }, + toProto(message: RequestDeliverTx): Uint8Array { + return RequestDeliverTx.encode(message).finish(); + }, + toProtoMsg(message: RequestDeliverTx): RequestDeliverTxProtoMsg { + return { + typeUrl: "/tendermint.abci.RequestDeliverTx", + value: RequestDeliverTx.encode(message).finish(), + }; + }, }; function createBaseRequestEndBlock(): RequestEndBlock { return { @@ -1592,6 +2687,31 @@ export const RequestEndBlock = { : Long.ZERO; return message; }, + fromAmino(object: RequestEndBlockAmino): RequestEndBlock { + return { + height: Long.fromString(object.height), + }; + }, + toAmino(message: RequestEndBlock): RequestEndBlockAmino { + const obj: any = {}; + obj.height = message.height ? message.height.toString() : undefined; + return obj; + }, + fromAminoMsg(object: RequestEndBlockAminoMsg): RequestEndBlock { + return RequestEndBlock.fromAmino(object.value); + }, + fromProtoMsg(message: RequestEndBlockProtoMsg): RequestEndBlock { + return RequestEndBlock.decode(message.value); + }, + toProto(message: RequestEndBlock): Uint8Array { + return RequestEndBlock.encode(message).finish(); + }, + toProtoMsg(message: RequestEndBlock): RequestEndBlockProtoMsg { + return { + typeUrl: "/tendermint.abci.RequestEndBlock", + value: RequestEndBlock.encode(message).finish(), + }; + }, }; function createBaseRequestCommit(): RequestCommit { return {}; @@ -1630,6 +2750,28 @@ export const RequestCommit = { const message = createBaseRequestCommit(); return message; }, + fromAmino(_: RequestCommitAmino): RequestCommit { + return {}; + }, + toAmino(_: RequestCommit): RequestCommitAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg(object: RequestCommitAminoMsg): RequestCommit { + return RequestCommit.fromAmino(object.value); + }, + fromProtoMsg(message: RequestCommitProtoMsg): RequestCommit { + return RequestCommit.decode(message.value); + }, + toProto(message: RequestCommit): Uint8Array { + return RequestCommit.encode(message).finish(); + }, + toProtoMsg(message: RequestCommit): RequestCommitProtoMsg { + return { + typeUrl: "/tendermint.abci.RequestCommit", + value: RequestCommit.encode(message).finish(), + }; + }, }; function createBaseRequestListSnapshots(): RequestListSnapshots { return {}; @@ -1671,6 +2813,28 @@ export const RequestListSnapshots = { const message = createBaseRequestListSnapshots(); return message; }, + fromAmino(_: RequestListSnapshotsAmino): RequestListSnapshots { + return {}; + }, + toAmino(_: RequestListSnapshots): RequestListSnapshotsAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg(object: RequestListSnapshotsAminoMsg): RequestListSnapshots { + return RequestListSnapshots.fromAmino(object.value); + }, + fromProtoMsg(message: RequestListSnapshotsProtoMsg): RequestListSnapshots { + return RequestListSnapshots.decode(message.value); + }, + toProto(message: RequestListSnapshots): Uint8Array { + return RequestListSnapshots.encode(message).finish(); + }, + toProtoMsg(message: RequestListSnapshots): RequestListSnapshotsProtoMsg { + return { + typeUrl: "/tendermint.abci.RequestListSnapshots", + value: RequestListSnapshots.encode(message).finish(), + }; + }, }; function createBaseRequestOfferSnapshot(): RequestOfferSnapshot { return { @@ -1747,6 +2911,37 @@ export const RequestOfferSnapshot = { message.appHash = object.appHash ?? new Uint8Array(); return message; }, + fromAmino(object: RequestOfferSnapshotAmino): RequestOfferSnapshot { + return { + snapshot: object?.snapshot + ? Snapshot.fromAmino(object.snapshot) + : undefined, + appHash: object.app_hash, + }; + }, + toAmino(message: RequestOfferSnapshot): RequestOfferSnapshotAmino { + const obj: any = {}; + obj.snapshot = message.snapshot + ? Snapshot.toAmino(message.snapshot) + : undefined; + obj.app_hash = message.appHash; + return obj; + }, + fromAminoMsg(object: RequestOfferSnapshotAminoMsg): RequestOfferSnapshot { + return RequestOfferSnapshot.fromAmino(object.value); + }, + fromProtoMsg(message: RequestOfferSnapshotProtoMsg): RequestOfferSnapshot { + return RequestOfferSnapshot.decode(message.value); + }, + toProto(message: RequestOfferSnapshot): Uint8Array { + return RequestOfferSnapshot.encode(message).finish(); + }, + toProtoMsg(message: RequestOfferSnapshot): RequestOfferSnapshotProtoMsg { + return { + typeUrl: "/tendermint.abci.RequestOfferSnapshot", + value: RequestOfferSnapshot.encode(message).finish(), + }; + }, }; function createBaseRequestLoadSnapshotChunk(): RequestLoadSnapshotChunk { return { @@ -1824,6 +3019,41 @@ export const RequestLoadSnapshotChunk = { message.chunk = object.chunk ?? 0; return message; }, + fromAmino(object: RequestLoadSnapshotChunkAmino): RequestLoadSnapshotChunk { + return { + height: Long.fromString(object.height), + format: object.format, + chunk: object.chunk, + }; + }, + toAmino(message: RequestLoadSnapshotChunk): RequestLoadSnapshotChunkAmino { + const obj: any = {}; + obj.height = message.height ? message.height.toString() : undefined; + obj.format = message.format; + obj.chunk = message.chunk; + return obj; + }, + fromAminoMsg( + object: RequestLoadSnapshotChunkAminoMsg + ): RequestLoadSnapshotChunk { + return RequestLoadSnapshotChunk.fromAmino(object.value); + }, + fromProtoMsg( + message: RequestLoadSnapshotChunkProtoMsg + ): RequestLoadSnapshotChunk { + return RequestLoadSnapshotChunk.decode(message.value); + }, + toProto(message: RequestLoadSnapshotChunk): Uint8Array { + return RequestLoadSnapshotChunk.encode(message).finish(); + }, + toProtoMsg( + message: RequestLoadSnapshotChunk + ): RequestLoadSnapshotChunkProtoMsg { + return { + typeUrl: "/tendermint.abci.RequestLoadSnapshotChunk", + value: RequestLoadSnapshotChunk.encode(message).finish(), + }; + }, }; function createBaseRequestApplySnapshotChunk(): RequestApplySnapshotChunk { return { @@ -1902,6 +3132,521 @@ export const RequestApplySnapshotChunk = { message.sender = object.sender ?? ""; return message; }, + fromAmino(object: RequestApplySnapshotChunkAmino): RequestApplySnapshotChunk { + return { + index: object.index, + chunk: object.chunk, + sender: object.sender, + }; + }, + toAmino(message: RequestApplySnapshotChunk): RequestApplySnapshotChunkAmino { + const obj: any = {}; + obj.index = message.index; + obj.chunk = message.chunk; + obj.sender = message.sender; + return obj; + }, + fromAminoMsg( + object: RequestApplySnapshotChunkAminoMsg + ): RequestApplySnapshotChunk { + return RequestApplySnapshotChunk.fromAmino(object.value); + }, + fromProtoMsg( + message: RequestApplySnapshotChunkProtoMsg + ): RequestApplySnapshotChunk { + return RequestApplySnapshotChunk.decode(message.value); + }, + toProto(message: RequestApplySnapshotChunk): Uint8Array { + return RequestApplySnapshotChunk.encode(message).finish(); + }, + toProtoMsg( + message: RequestApplySnapshotChunk + ): RequestApplySnapshotChunkProtoMsg { + return { + typeUrl: "/tendermint.abci.RequestApplySnapshotChunk", + value: RequestApplySnapshotChunk.encode(message).finish(), + }; + }, +}; +function createBaseRequestPrepareProposal(): RequestPrepareProposal { + return { + maxTxBytes: Long.ZERO, + txs: [], + localLastCommit: undefined, + misbehavior: [], + height: Long.ZERO, + time: undefined, + nextValidatorsHash: new Uint8Array(), + proposerAddress: new Uint8Array(), + }; +} +export const RequestPrepareProposal = { + encode( + message: RequestPrepareProposal, + writer: _m0.Writer = _m0.Writer.create() + ): _m0.Writer { + if (!message.maxTxBytes.isZero()) { + writer.uint32(8).int64(message.maxTxBytes); + } + for (const v of message.txs) { + writer.uint32(18).bytes(v!); + } + if (message.localLastCommit !== undefined) { + ExtendedCommitInfo.encode( + message.localLastCommit, + writer.uint32(26).fork() + ).ldelim(); + } + for (const v of message.misbehavior) { + Misbehavior.encode(v!, writer.uint32(34).fork()).ldelim(); + } + if (!message.height.isZero()) { + writer.uint32(40).int64(message.height); + } + if (message.time !== undefined) { + Timestamp.encode(message.time, writer.uint32(50).fork()).ldelim(); + } + if (message.nextValidatorsHash.length !== 0) { + writer.uint32(58).bytes(message.nextValidatorsHash); + } + if (message.proposerAddress.length !== 0) { + writer.uint32(66).bytes(message.proposerAddress); + } + return writer; + }, + decode( + input: _m0.Reader | Uint8Array, + length?: number + ): RequestPrepareProposal { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRequestPrepareProposal(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.maxTxBytes = reader.int64() as Long; + break; + case 2: + message.txs.push(reader.bytes()); + break; + case 3: + message.localLastCommit = ExtendedCommitInfo.decode( + reader, + reader.uint32() + ); + break; + case 4: + message.misbehavior.push(Misbehavior.decode(reader, reader.uint32())); + break; + case 5: + message.height = reader.int64() as Long; + break; + case 6: + message.time = Timestamp.decode(reader, reader.uint32()); + break; + case 7: + message.nextValidatorsHash = reader.bytes(); + break; + case 8: + message.proposerAddress = reader.bytes(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object: any): RequestPrepareProposal { + return { + maxTxBytes: isSet(object.maxTxBytes) + ? Long.fromValue(object.maxTxBytes) + : Long.ZERO, + txs: Array.isArray(object?.txs) + ? object.txs.map((e: any) => bytesFromBase64(e)) + : [], + localLastCommit: isSet(object.localLastCommit) + ? ExtendedCommitInfo.fromJSON(object.localLastCommit) + : undefined, + misbehavior: Array.isArray(object?.misbehavior) + ? object.misbehavior.map((e: any) => Misbehavior.fromJSON(e)) + : [], + height: isSet(object.height) ? Long.fromValue(object.height) : Long.ZERO, + time: isSet(object.time) ? fromJsonTimestamp(object.time) : undefined, + nextValidatorsHash: isSet(object.nextValidatorsHash) + ? bytesFromBase64(object.nextValidatorsHash) + : new Uint8Array(), + proposerAddress: isSet(object.proposerAddress) + ? bytesFromBase64(object.proposerAddress) + : new Uint8Array(), + }; + }, + toJSON(message: RequestPrepareProposal): unknown { + const obj: any = {}; + message.maxTxBytes !== undefined && + (obj.maxTxBytes = (message.maxTxBytes || Long.ZERO).toString()); + if (message.txs) { + obj.txs = message.txs.map((e) => + base64FromBytes(e !== undefined ? e : new Uint8Array()) + ); + } else { + obj.txs = []; + } + message.localLastCommit !== undefined && + (obj.localLastCommit = message.localLastCommit + ? ExtendedCommitInfo.toJSON(message.localLastCommit) + : undefined); + if (message.misbehavior) { + obj.misbehavior = message.misbehavior.map((e) => + e ? Misbehavior.toJSON(e) : undefined + ); + } else { + obj.misbehavior = []; + } + message.height !== undefined && + (obj.height = (message.height || Long.ZERO).toString()); + message.time !== undefined && + (obj.time = fromTimestamp(message.time).toISOString()); + message.nextValidatorsHash !== undefined && + (obj.nextValidatorsHash = base64FromBytes( + message.nextValidatorsHash !== undefined + ? message.nextValidatorsHash + : new Uint8Array() + )); + message.proposerAddress !== undefined && + (obj.proposerAddress = base64FromBytes( + message.proposerAddress !== undefined + ? message.proposerAddress + : new Uint8Array() + )); + return obj; + }, + fromPartial, I>>( + object: I + ): RequestPrepareProposal { + const message = createBaseRequestPrepareProposal(); + message.maxTxBytes = + object.maxTxBytes !== undefined && object.maxTxBytes !== null + ? Long.fromValue(object.maxTxBytes) + : Long.ZERO; + message.txs = object.txs?.map((e) => e) || []; + message.localLastCommit = + object.localLastCommit !== undefined && object.localLastCommit !== null + ? ExtendedCommitInfo.fromPartial(object.localLastCommit) + : undefined; + message.misbehavior = + object.misbehavior?.map((e) => Misbehavior.fromPartial(e)) || []; + message.height = + object.height !== undefined && object.height !== null + ? Long.fromValue(object.height) + : Long.ZERO; + message.time = + object.time !== undefined && object.time !== null + ? Timestamp.fromPartial(object.time) + : undefined; + message.nextValidatorsHash = object.nextValidatorsHash ?? new Uint8Array(); + message.proposerAddress = object.proposerAddress ?? new Uint8Array(); + return message; + }, + fromAmino(object: RequestPrepareProposalAmino): RequestPrepareProposal { + return { + maxTxBytes: Long.fromString(object.max_tx_bytes), + txs: Array.isArray(object?.txs) ? object.txs.map((e: any) => e) : [], + localLastCommit: object?.local_last_commit + ? ExtendedCommitInfo.fromAmino(object.local_last_commit) + : undefined, + misbehavior: Array.isArray(object?.misbehavior) + ? object.misbehavior.map((e: any) => Misbehavior.fromAmino(e)) + : [], + height: Long.fromString(object.height), + time: object?.time ? Timestamp.fromAmino(object.time) : undefined, + nextValidatorsHash: object.next_validators_hash, + proposerAddress: object.proposer_address, + }; + }, + toAmino(message: RequestPrepareProposal): RequestPrepareProposalAmino { + const obj: any = {}; + obj.max_tx_bytes = message.maxTxBytes + ? message.maxTxBytes.toString() + : undefined; + if (message.txs) { + obj.txs = message.txs.map((e) => e); + } else { + obj.txs = []; + } + obj.local_last_commit = message.localLastCommit + ? ExtendedCommitInfo.toAmino(message.localLastCommit) + : undefined; + if (message.misbehavior) { + obj.misbehavior = message.misbehavior.map((e) => + e ? Misbehavior.toAmino(e) : undefined + ); + } else { + obj.misbehavior = []; + } + obj.height = message.height ? message.height.toString() : undefined; + obj.time = message.time ? Timestamp.toAmino(message.time) : undefined; + obj.next_validators_hash = message.nextValidatorsHash; + obj.proposer_address = message.proposerAddress; + return obj; + }, + fromAminoMsg(object: RequestPrepareProposalAminoMsg): RequestPrepareProposal { + return RequestPrepareProposal.fromAmino(object.value); + }, + fromProtoMsg( + message: RequestPrepareProposalProtoMsg + ): RequestPrepareProposal { + return RequestPrepareProposal.decode(message.value); + }, + toProto(message: RequestPrepareProposal): Uint8Array { + return RequestPrepareProposal.encode(message).finish(); + }, + toProtoMsg(message: RequestPrepareProposal): RequestPrepareProposalProtoMsg { + return { + typeUrl: "/tendermint.abci.RequestPrepareProposal", + value: RequestPrepareProposal.encode(message).finish(), + }; + }, +}; +function createBaseRequestProcessProposal(): RequestProcessProposal { + return { + txs: [], + proposedLastCommit: undefined, + misbehavior: [], + hash: new Uint8Array(), + height: Long.ZERO, + time: undefined, + nextValidatorsHash: new Uint8Array(), + proposerAddress: new Uint8Array(), + }; +} +export const RequestProcessProposal = { + encode( + message: RequestProcessProposal, + writer: _m0.Writer = _m0.Writer.create() + ): _m0.Writer { + for (const v of message.txs) { + writer.uint32(10).bytes(v!); + } + if (message.proposedLastCommit !== undefined) { + CommitInfo.encode( + message.proposedLastCommit, + writer.uint32(18).fork() + ).ldelim(); + } + for (const v of message.misbehavior) { + Misbehavior.encode(v!, writer.uint32(26).fork()).ldelim(); + } + if (message.hash.length !== 0) { + writer.uint32(34).bytes(message.hash); + } + if (!message.height.isZero()) { + writer.uint32(40).int64(message.height); + } + if (message.time !== undefined) { + Timestamp.encode(message.time, writer.uint32(50).fork()).ldelim(); + } + if (message.nextValidatorsHash.length !== 0) { + writer.uint32(58).bytes(message.nextValidatorsHash); + } + if (message.proposerAddress.length !== 0) { + writer.uint32(66).bytes(message.proposerAddress); + } + return writer; + }, + decode( + input: _m0.Reader | Uint8Array, + length?: number + ): RequestProcessProposal { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRequestProcessProposal(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.txs.push(reader.bytes()); + break; + case 2: + message.proposedLastCommit = CommitInfo.decode( + reader, + reader.uint32() + ); + break; + case 3: + message.misbehavior.push(Misbehavior.decode(reader, reader.uint32())); + break; + case 4: + message.hash = reader.bytes(); + break; + case 5: + message.height = reader.int64() as Long; + break; + case 6: + message.time = Timestamp.decode(reader, reader.uint32()); + break; + case 7: + message.nextValidatorsHash = reader.bytes(); + break; + case 8: + message.proposerAddress = reader.bytes(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object: any): RequestProcessProposal { + return { + txs: Array.isArray(object?.txs) + ? object.txs.map((e: any) => bytesFromBase64(e)) + : [], + proposedLastCommit: isSet(object.proposedLastCommit) + ? CommitInfo.fromJSON(object.proposedLastCommit) + : undefined, + misbehavior: Array.isArray(object?.misbehavior) + ? object.misbehavior.map((e: any) => Misbehavior.fromJSON(e)) + : [], + hash: isSet(object.hash) + ? bytesFromBase64(object.hash) + : new Uint8Array(), + height: isSet(object.height) ? Long.fromValue(object.height) : Long.ZERO, + time: isSet(object.time) ? fromJsonTimestamp(object.time) : undefined, + nextValidatorsHash: isSet(object.nextValidatorsHash) + ? bytesFromBase64(object.nextValidatorsHash) + : new Uint8Array(), + proposerAddress: isSet(object.proposerAddress) + ? bytesFromBase64(object.proposerAddress) + : new Uint8Array(), + }; + }, + toJSON(message: RequestProcessProposal): unknown { + const obj: any = {}; + if (message.txs) { + obj.txs = message.txs.map((e) => + base64FromBytes(e !== undefined ? e : new Uint8Array()) + ); + } else { + obj.txs = []; + } + message.proposedLastCommit !== undefined && + (obj.proposedLastCommit = message.proposedLastCommit + ? CommitInfo.toJSON(message.proposedLastCommit) + : undefined); + if (message.misbehavior) { + obj.misbehavior = message.misbehavior.map((e) => + e ? Misbehavior.toJSON(e) : undefined + ); + } else { + obj.misbehavior = []; + } + message.hash !== undefined && + (obj.hash = base64FromBytes( + message.hash !== undefined ? message.hash : new Uint8Array() + )); + message.height !== undefined && + (obj.height = (message.height || Long.ZERO).toString()); + message.time !== undefined && + (obj.time = fromTimestamp(message.time).toISOString()); + message.nextValidatorsHash !== undefined && + (obj.nextValidatorsHash = base64FromBytes( + message.nextValidatorsHash !== undefined + ? message.nextValidatorsHash + : new Uint8Array() + )); + message.proposerAddress !== undefined && + (obj.proposerAddress = base64FromBytes( + message.proposerAddress !== undefined + ? message.proposerAddress + : new Uint8Array() + )); + return obj; + }, + fromPartial, I>>( + object: I + ): RequestProcessProposal { + const message = createBaseRequestProcessProposal(); + message.txs = object.txs?.map((e) => e) || []; + message.proposedLastCommit = + object.proposedLastCommit !== undefined && + object.proposedLastCommit !== null + ? CommitInfo.fromPartial(object.proposedLastCommit) + : undefined; + message.misbehavior = + object.misbehavior?.map((e) => Misbehavior.fromPartial(e)) || []; + message.hash = object.hash ?? new Uint8Array(); + message.height = + object.height !== undefined && object.height !== null + ? Long.fromValue(object.height) + : Long.ZERO; + message.time = + object.time !== undefined && object.time !== null + ? Timestamp.fromPartial(object.time) + : undefined; + message.nextValidatorsHash = object.nextValidatorsHash ?? new Uint8Array(); + message.proposerAddress = object.proposerAddress ?? new Uint8Array(); + return message; + }, + fromAmino(object: RequestProcessProposalAmino): RequestProcessProposal { + return { + txs: Array.isArray(object?.txs) ? object.txs.map((e: any) => e) : [], + proposedLastCommit: object?.proposed_last_commit + ? CommitInfo.fromAmino(object.proposed_last_commit) + : undefined, + misbehavior: Array.isArray(object?.misbehavior) + ? object.misbehavior.map((e: any) => Misbehavior.fromAmino(e)) + : [], + hash: object.hash, + height: Long.fromString(object.height), + time: object?.time ? Timestamp.fromAmino(object.time) : undefined, + nextValidatorsHash: object.next_validators_hash, + proposerAddress: object.proposer_address, + }; + }, + toAmino(message: RequestProcessProposal): RequestProcessProposalAmino { + const obj: any = {}; + if (message.txs) { + obj.txs = message.txs.map((e) => e); + } else { + obj.txs = []; + } + obj.proposed_last_commit = message.proposedLastCommit + ? CommitInfo.toAmino(message.proposedLastCommit) + : undefined; + if (message.misbehavior) { + obj.misbehavior = message.misbehavior.map((e) => + e ? Misbehavior.toAmino(e) : undefined + ); + } else { + obj.misbehavior = []; + } + obj.hash = message.hash; + obj.height = message.height ? message.height.toString() : undefined; + obj.time = message.time ? Timestamp.toAmino(message.time) : undefined; + obj.next_validators_hash = message.nextValidatorsHash; + obj.proposer_address = message.proposerAddress; + return obj; + }, + fromAminoMsg(object: RequestProcessProposalAminoMsg): RequestProcessProposal { + return RequestProcessProposal.fromAmino(object.value); + }, + fromProtoMsg( + message: RequestProcessProposalProtoMsg + ): RequestProcessProposal { + return RequestProcessProposal.decode(message.value); + }, + toProto(message: RequestProcessProposal): Uint8Array { + return RequestProcessProposal.encode(message).finish(); + }, + toProtoMsg(message: RequestProcessProposal): RequestProcessProposalProtoMsg { + return { + typeUrl: "/tendermint.abci.RequestProcessProposal", + value: RequestProcessProposal.encode(message).finish(), + }; + }, }; function createBaseResponse(): Response { return { @@ -1909,7 +3654,6 @@ function createBaseResponse(): Response { echo: undefined, flush: undefined, info: undefined, - setOption: undefined, initChain: undefined, query: undefined, beginBlock: undefined, @@ -1921,6 +3665,8 @@ function createBaseResponse(): Response { offerSnapshot: undefined, loadSnapshotChunk: undefined, applySnapshotChunk: undefined, + prepareProposal: undefined, + processProposal: undefined, }; } export const Response = { @@ -1943,12 +3689,6 @@ export const Response = { if (message.info !== undefined) { ResponseInfo.encode(message.info, writer.uint32(34).fork()).ldelim(); } - if (message.setOption !== undefined) { - ResponseSetOption.encode( - message.setOption, - writer.uint32(42).fork() - ).ldelim(); - } if (message.initChain !== undefined) { ResponseInitChain.encode( message.initChain, @@ -2009,6 +3749,18 @@ export const Response = { writer.uint32(130).fork() ).ldelim(); } + if (message.prepareProposal !== undefined) { + ResponsePrepareProposal.encode( + message.prepareProposal, + writer.uint32(138).fork() + ).ldelim(); + } + if (message.processProposal !== undefined) { + ResponseProcessProposal.encode( + message.processProposal, + writer.uint32(146).fork() + ).ldelim(); + } return writer; }, decode(input: _m0.Reader | Uint8Array, length?: number): Response { @@ -2030,9 +3782,6 @@ export const Response = { case 4: message.info = ResponseInfo.decode(reader, reader.uint32()); break; - case 5: - message.setOption = ResponseSetOption.decode(reader, reader.uint32()); - break; case 6: message.initChain = ResponseInitChain.decode(reader, reader.uint32()); break; @@ -2081,6 +3830,18 @@ export const Response = { reader.uint32() ); break; + case 17: + message.prepareProposal = ResponsePrepareProposal.decode( + reader, + reader.uint32() + ); + break; + case 18: + message.processProposal = ResponseProcessProposal.decode( + reader, + reader.uint32() + ); + break; default: reader.skipType(tag & 7); break; @@ -2098,9 +3859,6 @@ export const Response = { ? ResponseFlush.fromJSON(object.flush) : undefined, info: isSet(object.info) ? ResponseInfo.fromJSON(object.info) : undefined, - setOption: isSet(object.setOption) - ? ResponseSetOption.fromJSON(object.setOption) - : undefined, initChain: isSet(object.initChain) ? ResponseInitChain.fromJSON(object.initChain) : undefined, @@ -2134,6 +3892,12 @@ export const Response = { applySnapshotChunk: isSet(object.applySnapshotChunk) ? ResponseApplySnapshotChunk.fromJSON(object.applySnapshotChunk) : undefined, + prepareProposal: isSet(object.prepareProposal) + ? ResponsePrepareProposal.fromJSON(object.prepareProposal) + : undefined, + processProposal: isSet(object.processProposal) + ? ResponseProcessProposal.fromJSON(object.processProposal) + : undefined, }; }, toJSON(message: Response): unknown { @@ -2150,10 +3914,6 @@ export const Response = { : undefined); message.info !== undefined && (obj.info = message.info ? ResponseInfo.toJSON(message.info) : undefined); - message.setOption !== undefined && - (obj.setOption = message.setOption - ? ResponseSetOption.toJSON(message.setOption) - : undefined); message.initChain !== undefined && (obj.initChain = message.initChain ? ResponseInitChain.toJSON(message.initChain) @@ -2198,6 +3958,14 @@ export const Response = { (obj.applySnapshotChunk = message.applySnapshotChunk ? ResponseApplySnapshotChunk.toJSON(message.applySnapshotChunk) : undefined); + message.prepareProposal !== undefined && + (obj.prepareProposal = message.prepareProposal + ? ResponsePrepareProposal.toJSON(message.prepareProposal) + : undefined); + message.processProposal !== undefined && + (obj.processProposal = message.processProposal + ? ResponseProcessProposal.toJSON(message.processProposal) + : undefined); return obj; }, fromPartial, I>>(object: I): Response { @@ -2218,10 +3986,6 @@ export const Response = { object.info !== undefined && object.info !== null ? ResponseInfo.fromPartial(object.info) : undefined; - message.setOption = - object.setOption !== undefined && object.setOption !== null - ? ResponseSetOption.fromPartial(object.setOption) - : undefined; message.initChain = object.initChain !== undefined && object.initChain !== null ? ResponseInitChain.fromPartial(object.initChain) @@ -2268,8 +4032,129 @@ export const Response = { object.applySnapshotChunk !== null ? ResponseApplySnapshotChunk.fromPartial(object.applySnapshotChunk) : undefined; + message.prepareProposal = + object.prepareProposal !== undefined && object.prepareProposal !== null + ? ResponsePrepareProposal.fromPartial(object.prepareProposal) + : undefined; + message.processProposal = + object.processProposal !== undefined && object.processProposal !== null + ? ResponseProcessProposal.fromPartial(object.processProposal) + : undefined; return message; }, + fromAmino(object: ResponseAmino): Response { + return { + exception: object?.exception + ? ResponseException.fromAmino(object.exception) + : undefined, + echo: object?.echo ? ResponseEcho.fromAmino(object.echo) : undefined, + flush: object?.flush ? ResponseFlush.fromAmino(object.flush) : undefined, + info: object?.info ? ResponseInfo.fromAmino(object.info) : undefined, + initChain: object?.init_chain + ? ResponseInitChain.fromAmino(object.init_chain) + : undefined, + query: object?.query ? ResponseQuery.fromAmino(object.query) : undefined, + beginBlock: object?.begin_block + ? ResponseBeginBlock.fromAmino(object.begin_block) + : undefined, + checkTx: object?.check_tx + ? ResponseCheckTx.fromAmino(object.check_tx) + : undefined, + deliverTx: object?.deliver_tx + ? ResponseDeliverTx.fromAmino(object.deliver_tx) + : undefined, + endBlock: object?.end_block + ? ResponseEndBlock.fromAmino(object.end_block) + : undefined, + commit: object?.commit + ? ResponseCommit.fromAmino(object.commit) + : undefined, + listSnapshots: object?.list_snapshots + ? ResponseListSnapshots.fromAmino(object.list_snapshots) + : undefined, + offerSnapshot: object?.offer_snapshot + ? ResponseOfferSnapshot.fromAmino(object.offer_snapshot) + : undefined, + loadSnapshotChunk: object?.load_snapshot_chunk + ? ResponseLoadSnapshotChunk.fromAmino(object.load_snapshot_chunk) + : undefined, + applySnapshotChunk: object?.apply_snapshot_chunk + ? ResponseApplySnapshotChunk.fromAmino(object.apply_snapshot_chunk) + : undefined, + prepareProposal: object?.prepare_proposal + ? ResponsePrepareProposal.fromAmino(object.prepare_proposal) + : undefined, + processProposal: object?.process_proposal + ? ResponseProcessProposal.fromAmino(object.process_proposal) + : undefined, + }; + }, + toAmino(message: Response): ResponseAmino { + const obj: any = {}; + obj.exception = message.exception + ? ResponseException.toAmino(message.exception) + : undefined; + obj.echo = message.echo ? ResponseEcho.toAmino(message.echo) : undefined; + obj.flush = message.flush + ? ResponseFlush.toAmino(message.flush) + : undefined; + obj.info = message.info ? ResponseInfo.toAmino(message.info) : undefined; + obj.init_chain = message.initChain + ? ResponseInitChain.toAmino(message.initChain) + : undefined; + obj.query = message.query + ? ResponseQuery.toAmino(message.query) + : undefined; + obj.begin_block = message.beginBlock + ? ResponseBeginBlock.toAmino(message.beginBlock) + : undefined; + obj.check_tx = message.checkTx + ? ResponseCheckTx.toAmino(message.checkTx) + : undefined; + obj.deliver_tx = message.deliverTx + ? ResponseDeliverTx.toAmino(message.deliverTx) + : undefined; + obj.end_block = message.endBlock + ? ResponseEndBlock.toAmino(message.endBlock) + : undefined; + obj.commit = message.commit + ? ResponseCommit.toAmino(message.commit) + : undefined; + obj.list_snapshots = message.listSnapshots + ? ResponseListSnapshots.toAmino(message.listSnapshots) + : undefined; + obj.offer_snapshot = message.offerSnapshot + ? ResponseOfferSnapshot.toAmino(message.offerSnapshot) + : undefined; + obj.load_snapshot_chunk = message.loadSnapshotChunk + ? ResponseLoadSnapshotChunk.toAmino(message.loadSnapshotChunk) + : undefined; + obj.apply_snapshot_chunk = message.applySnapshotChunk + ? ResponseApplySnapshotChunk.toAmino(message.applySnapshotChunk) + : undefined; + obj.prepare_proposal = message.prepareProposal + ? ResponsePrepareProposal.toAmino(message.prepareProposal) + : undefined; + obj.process_proposal = message.processProposal + ? ResponseProcessProposal.toAmino(message.processProposal) + : undefined; + return obj; + }, + fromAminoMsg(object: ResponseAminoMsg): Response { + return Response.fromAmino(object.value); + }, + fromProtoMsg(message: ResponseProtoMsg): Response { + return Response.decode(message.value); + }, + toProto(message: Response): Uint8Array { + return Response.encode(message).finish(); + }, + toProtoMsg(message: Response): ResponseProtoMsg { + return { + typeUrl: "/tendermint.abci.Response", + value: Response.encode(message).finish(), + }; + }, }; function createBaseResponseException(): ResponseException { return { @@ -2320,6 +4205,31 @@ export const ResponseException = { message.error = object.error ?? ""; return message; }, + fromAmino(object: ResponseExceptionAmino): ResponseException { + return { + error: object.error, + }; + }, + toAmino(message: ResponseException): ResponseExceptionAmino { + const obj: any = {}; + obj.error = message.error; + return obj; + }, + fromAminoMsg(object: ResponseExceptionAminoMsg): ResponseException { + return ResponseException.fromAmino(object.value); + }, + fromProtoMsg(message: ResponseExceptionProtoMsg): ResponseException { + return ResponseException.decode(message.value); + }, + toProto(message: ResponseException): Uint8Array { + return ResponseException.encode(message).finish(); + }, + toProtoMsg(message: ResponseException): ResponseExceptionProtoMsg { + return { + typeUrl: "/tendermint.abci.ResponseException", + value: ResponseException.encode(message).finish(), + }; + }, }; function createBaseResponseEcho(): ResponseEcho { return { @@ -2370,6 +4280,31 @@ export const ResponseEcho = { message.message = object.message ?? ""; return message; }, + fromAmino(object: ResponseEchoAmino): ResponseEcho { + return { + message: object.message, + }; + }, + toAmino(message: ResponseEcho): ResponseEchoAmino { + const obj: any = {}; + obj.message = message.message; + return obj; + }, + fromAminoMsg(object: ResponseEchoAminoMsg): ResponseEcho { + return ResponseEcho.fromAmino(object.value); + }, + fromProtoMsg(message: ResponseEchoProtoMsg): ResponseEcho { + return ResponseEcho.decode(message.value); + }, + toProto(message: ResponseEcho): Uint8Array { + return ResponseEcho.encode(message).finish(); + }, + toProtoMsg(message: ResponseEcho): ResponseEchoProtoMsg { + return { + typeUrl: "/tendermint.abci.ResponseEcho", + value: ResponseEcho.encode(message).finish(), + }; + }, }; function createBaseResponseFlush(): ResponseFlush { return {}; @@ -2408,6 +4343,28 @@ export const ResponseFlush = { const message = createBaseResponseFlush(); return message; }, + fromAmino(_: ResponseFlushAmino): ResponseFlush { + return {}; + }, + toAmino(_: ResponseFlush): ResponseFlushAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg(object: ResponseFlushAminoMsg): ResponseFlush { + return ResponseFlush.fromAmino(object.value); + }, + fromProtoMsg(message: ResponseFlushProtoMsg): ResponseFlush { + return ResponseFlush.decode(message.value); + }, + toProto(message: ResponseFlush): Uint8Array { + return ResponseFlush.encode(message).finish(); + }, + toProtoMsg(message: ResponseFlush): ResponseFlushProtoMsg { + return { + typeUrl: "/tendermint.abci.ResponseFlush", + value: ResponseFlush.encode(message).finish(), + }; + }, }; function createBaseResponseInfo(): ResponseInfo { return { @@ -2517,75 +4474,42 @@ export const ResponseInfo = { message.lastBlockAppHash = object.lastBlockAppHash ?? new Uint8Array(); return message; }, -}; -function createBaseResponseSetOption(): ResponseSetOption { - return { - code: 0, - log: "", - info: "", - }; -} -export const ResponseSetOption = { - encode( - message: ResponseSetOption, - writer: _m0.Writer = _m0.Writer.create() - ): _m0.Writer { - if (message.code !== 0) { - writer.uint32(8).uint32(message.code); - } - if (message.log !== "") { - writer.uint32(26).string(message.log); - } - if (message.info !== "") { - writer.uint32(34).string(message.info); - } - return writer; - }, - decode(input: _m0.Reader | Uint8Array, length?: number): ResponseSetOption { - const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseResponseSetOption(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.code = reader.uint32(); - break; - case 3: - message.log = reader.string(); - break; - case 4: - message.info = reader.string(); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }, - fromJSON(object: any): ResponseSetOption { + fromAmino(object: ResponseInfoAmino): ResponseInfo { return { - code: isSet(object.code) ? Number(object.code) : 0, - log: isSet(object.log) ? String(object.log) : "", - info: isSet(object.info) ? String(object.info) : "", + data: object.data, + version: object.version, + appVersion: Long.fromString(object.app_version), + lastBlockHeight: Long.fromString(object.last_block_height), + lastBlockAppHash: object.last_block_app_hash, }; }, - toJSON(message: ResponseSetOption): unknown { + toAmino(message: ResponseInfo): ResponseInfoAmino { const obj: any = {}; - message.code !== undefined && (obj.code = Math.round(message.code)); - message.log !== undefined && (obj.log = message.log); - message.info !== undefined && (obj.info = message.info); + obj.data = message.data; + obj.version = message.version; + obj.app_version = message.appVersion + ? message.appVersion.toString() + : undefined; + obj.last_block_height = message.lastBlockHeight + ? message.lastBlockHeight.toString() + : undefined; + obj.last_block_app_hash = message.lastBlockAppHash; return obj; }, - fromPartial, I>>( - object: I - ): ResponseSetOption { - const message = createBaseResponseSetOption(); - message.code = object.code ?? 0; - message.log = object.log ?? ""; - message.info = object.info ?? ""; - return message; + fromAminoMsg(object: ResponseInfoAminoMsg): ResponseInfo { + return ResponseInfo.fromAmino(object.value); + }, + fromProtoMsg(message: ResponseInfoProtoMsg): ResponseInfo { + return ResponseInfo.decode(message.value); + }, + toProto(message: ResponseInfo): Uint8Array { + return ResponseInfo.encode(message).finish(); + }, + toProtoMsg(message: ResponseInfo): ResponseInfoProtoMsg { + return { + typeUrl: "/tendermint.abci.ResponseInfo", + value: ResponseInfo.encode(message).finish(), + }; }, }; function createBaseResponseInitChain(): ResponseInitChain { @@ -2687,6 +4611,47 @@ export const ResponseInitChain = { message.appHash = object.appHash ?? new Uint8Array(); return message; }, + fromAmino(object: ResponseInitChainAmino): ResponseInitChain { + return { + consensusParams: object?.consensus_params + ? ConsensusParams.fromAmino(object.consensus_params) + : undefined, + validators: Array.isArray(object?.validators) + ? object.validators.map((e: any) => ValidatorUpdate.fromAmino(e)) + : [], + appHash: object.app_hash, + }; + }, + toAmino(message: ResponseInitChain): ResponseInitChainAmino { + const obj: any = {}; + obj.consensus_params = message.consensusParams + ? ConsensusParams.toAmino(message.consensusParams) + : undefined; + if (message.validators) { + obj.validators = message.validators.map((e) => + e ? ValidatorUpdate.toAmino(e) : undefined + ); + } else { + obj.validators = []; + } + obj.app_hash = message.appHash; + return obj; + }, + fromAminoMsg(object: ResponseInitChainAminoMsg): ResponseInitChain { + return ResponseInitChain.fromAmino(object.value); + }, + fromProtoMsg(message: ResponseInitChainProtoMsg): ResponseInitChain { + return ResponseInitChain.decode(message.value); + }, + toProto(message: ResponseInitChain): Uint8Array { + return ResponseInitChain.encode(message).finish(); + }, + toProtoMsg(message: ResponseInitChain): ResponseInitChainProtoMsg { + return { + typeUrl: "/tendermint.abci.ResponseInitChain", + value: ResponseInitChain.encode(message).finish(), + }; + }, }; function createBaseResponseQuery(): ResponseQuery { return { @@ -2841,6 +4806,51 @@ export const ResponseQuery = { message.codespace = object.codespace ?? ""; return message; }, + fromAmino(object: ResponseQueryAmino): ResponseQuery { + return { + code: object.code, + log: object.log, + info: object.info, + index: Long.fromString(object.index), + key: object.key, + value: object.value, + proofOps: object?.proof_ops + ? ProofOps.fromAmino(object.proof_ops) + : undefined, + height: Long.fromString(object.height), + codespace: object.codespace, + }; + }, + toAmino(message: ResponseQuery): ResponseQueryAmino { + const obj: any = {}; + obj.code = message.code; + obj.log = message.log; + obj.info = message.info; + obj.index = message.index ? message.index.toString() : undefined; + obj.key = message.key; + obj.value = message.value; + obj.proof_ops = message.proofOps + ? ProofOps.toAmino(message.proofOps) + : undefined; + obj.height = message.height ? message.height.toString() : undefined; + obj.codespace = message.codespace; + return obj; + }, + fromAminoMsg(object: ResponseQueryAminoMsg): ResponseQuery { + return ResponseQuery.fromAmino(object.value); + }, + fromProtoMsg(message: ResponseQueryProtoMsg): ResponseQuery { + return ResponseQuery.decode(message.value); + }, + toProto(message: ResponseQuery): Uint8Array { + return ResponseQuery.encode(message).finish(); + }, + toProtoMsg(message: ResponseQuery): ResponseQueryProtoMsg { + return { + typeUrl: "/tendermint.abci.ResponseQuery", + value: ResponseQuery.encode(message).finish(), + }; + }, }; function createBaseResponseBeginBlock(): ResponseBeginBlock { return { @@ -2897,6 +4907,39 @@ export const ResponseBeginBlock = { message.events = object.events?.map((e) => Event.fromPartial(e)) || []; return message; }, + fromAmino(object: ResponseBeginBlockAmino): ResponseBeginBlock { + return { + events: Array.isArray(object?.events) + ? object.events.map((e: any) => Event.fromAmino(e)) + : [], + }; + }, + toAmino(message: ResponseBeginBlock): ResponseBeginBlockAmino { + const obj: any = {}; + if (message.events) { + obj.events = message.events.map((e) => + e ? Event.toAmino(e) : undefined + ); + } else { + obj.events = []; + } + return obj; + }, + fromAminoMsg(object: ResponseBeginBlockAminoMsg): ResponseBeginBlock { + return ResponseBeginBlock.fromAmino(object.value); + }, + fromProtoMsg(message: ResponseBeginBlockProtoMsg): ResponseBeginBlock { + return ResponseBeginBlock.decode(message.value); + }, + toProto(message: ResponseBeginBlock): Uint8Array { + return ResponseBeginBlock.encode(message).finish(); + }, + toProtoMsg(message: ResponseBeginBlock): ResponseBeginBlockProtoMsg { + return { + typeUrl: "/tendermint.abci.ResponseBeginBlock", + value: ResponseBeginBlock.encode(message).finish(), + }; + }, }; function createBaseResponseCheckTx(): ResponseCheckTx { return { @@ -2908,6 +4951,9 @@ function createBaseResponseCheckTx(): ResponseCheckTx { gasUsed: Long.ZERO, events: [], codespace: "", + sender: "", + priority: Long.ZERO, + mempoolError: "", }; } export const ResponseCheckTx = { @@ -2939,6 +4985,15 @@ export const ResponseCheckTx = { if (message.codespace !== "") { writer.uint32(66).string(message.codespace); } + if (message.sender !== "") { + writer.uint32(74).string(message.sender); + } + if (!message.priority.isZero()) { + writer.uint32(80).int64(message.priority); + } + if (message.mempoolError !== "") { + writer.uint32(90).string(message.mempoolError); + } return writer; }, decode(input: _m0.Reader | Uint8Array, length?: number): ResponseCheckTx { @@ -2972,6 +5027,15 @@ export const ResponseCheckTx = { case 8: message.codespace = reader.string(); break; + case 9: + message.sender = reader.string(); + break; + case 10: + message.priority = reader.int64() as Long; + break; + case 11: + message.mempoolError = reader.string(); + break; default: reader.skipType(tag & 7); break; @@ -2997,6 +5061,13 @@ export const ResponseCheckTx = { ? object.events.map((e: any) => Event.fromJSON(e)) : [], codespace: isSet(object.codespace) ? String(object.codespace) : "", + sender: isSet(object.sender) ? String(object.sender) : "", + priority: isSet(object.priority) + ? Long.fromValue(object.priority) + : Long.ZERO, + mempoolError: isSet(object.mempoolError) + ? String(object.mempoolError) + : "", }; }, toJSON(message: ResponseCheckTx): unknown { @@ -3018,6 +5089,11 @@ export const ResponseCheckTx = { obj.events = []; } message.codespace !== undefined && (obj.codespace = message.codespace); + message.sender !== undefined && (obj.sender = message.sender); + message.priority !== undefined && + (obj.priority = (message.priority || Long.ZERO).toString()); + message.mempoolError !== undefined && + (obj.mempoolError = message.mempoolError); return obj; }, fromPartial, I>>( @@ -3038,8 +5114,69 @@ export const ResponseCheckTx = { : Long.ZERO; message.events = object.events?.map((e) => Event.fromPartial(e)) || []; message.codespace = object.codespace ?? ""; + message.sender = object.sender ?? ""; + message.priority = + object.priority !== undefined && object.priority !== null + ? Long.fromValue(object.priority) + : Long.ZERO; + message.mempoolError = object.mempoolError ?? ""; return message; }, + fromAmino(object: ResponseCheckTxAmino): ResponseCheckTx { + return { + code: object.code, + data: object.data, + log: object.log, + info: object.info, + gasWanted: Long.fromString(object.gas_wanted), + gasUsed: Long.fromString(object.gas_used), + events: Array.isArray(object?.events) + ? object.events.map((e: any) => Event.fromAmino(e)) + : [], + codespace: object.codespace, + sender: object.sender, + priority: Long.fromString(object.priority), + mempoolError: object.mempool_error, + }; + }, + toAmino(message: ResponseCheckTx): ResponseCheckTxAmino { + const obj: any = {}; + obj.code = message.code; + obj.data = message.data; + obj.log = message.log; + obj.info = message.info; + obj.gas_wanted = message.gasWanted + ? message.gasWanted.toString() + : undefined; + obj.gas_used = message.gasUsed ? message.gasUsed.toString() : undefined; + if (message.events) { + obj.events = message.events.map((e) => + e ? Event.toAmino(e) : undefined + ); + } else { + obj.events = []; + } + obj.codespace = message.codespace; + obj.sender = message.sender; + obj.priority = message.priority ? message.priority.toString() : undefined; + obj.mempool_error = message.mempoolError; + return obj; + }, + fromAminoMsg(object: ResponseCheckTxAminoMsg): ResponseCheckTx { + return ResponseCheckTx.fromAmino(object.value); + }, + fromProtoMsg(message: ResponseCheckTxProtoMsg): ResponseCheckTx { + return ResponseCheckTx.decode(message.value); + }, + toProto(message: ResponseCheckTx): Uint8Array { + return ResponseCheckTx.encode(message).finish(); + }, + toProtoMsg(message: ResponseCheckTx): ResponseCheckTxProtoMsg { + return { + typeUrl: "/tendermint.abci.ResponseCheckTx", + value: ResponseCheckTx.encode(message).finish(), + }; + }, }; function createBaseResponseDeliverTx(): ResponseDeliverTx { return { @@ -3183,6 +5320,55 @@ export const ResponseDeliverTx = { message.codespace = object.codespace ?? ""; return message; }, + fromAmino(object: ResponseDeliverTxAmino): ResponseDeliverTx { + return { + code: object.code, + data: object.data, + log: object.log, + info: object.info, + gasWanted: Long.fromString(object.gas_wanted), + gasUsed: Long.fromString(object.gas_used), + events: Array.isArray(object?.events) + ? object.events.map((e: any) => Event.fromAmino(e)) + : [], + codespace: object.codespace, + }; + }, + toAmino(message: ResponseDeliverTx): ResponseDeliverTxAmino { + const obj: any = {}; + obj.code = message.code; + obj.data = message.data; + obj.log = message.log; + obj.info = message.info; + obj.gas_wanted = message.gasWanted + ? message.gasWanted.toString() + : undefined; + obj.gas_used = message.gasUsed ? message.gasUsed.toString() : undefined; + if (message.events) { + obj.events = message.events.map((e) => + e ? Event.toAmino(e) : undefined + ); + } else { + obj.events = []; + } + obj.codespace = message.codespace; + return obj; + }, + fromAminoMsg(object: ResponseDeliverTxAminoMsg): ResponseDeliverTx { + return ResponseDeliverTx.fromAmino(object.value); + }, + fromProtoMsg(message: ResponseDeliverTxProtoMsg): ResponseDeliverTx { + return ResponseDeliverTx.decode(message.value); + }, + toProto(message: ResponseDeliverTx): Uint8Array { + return ResponseDeliverTx.encode(message).finish(); + }, + toProtoMsg(message: ResponseDeliverTx): ResponseDeliverTxProtoMsg { + return { + typeUrl: "/tendermint.abci.ResponseDeliverTx", + value: ResponseDeliverTx.encode(message).finish(), + }; + }, }; function createBaseResponseEndBlock(): ResponseEndBlock { return { @@ -3285,6 +5471,55 @@ export const ResponseEndBlock = { message.events = object.events?.map((e) => Event.fromPartial(e)) || []; return message; }, + fromAmino(object: ResponseEndBlockAmino): ResponseEndBlock { + return { + validatorUpdates: Array.isArray(object?.validator_updates) + ? object.validator_updates.map((e: any) => ValidatorUpdate.fromAmino(e)) + : [], + consensusParamUpdates: object?.consensus_param_updates + ? ConsensusParams.fromAmino(object.consensus_param_updates) + : undefined, + events: Array.isArray(object?.events) + ? object.events.map((e: any) => Event.fromAmino(e)) + : [], + }; + }, + toAmino(message: ResponseEndBlock): ResponseEndBlockAmino { + const obj: any = {}; + if (message.validatorUpdates) { + obj.validator_updates = message.validatorUpdates.map((e) => + e ? ValidatorUpdate.toAmino(e) : undefined + ); + } else { + obj.validator_updates = []; + } + obj.consensus_param_updates = message.consensusParamUpdates + ? ConsensusParams.toAmino(message.consensusParamUpdates) + : undefined; + if (message.events) { + obj.events = message.events.map((e) => + e ? Event.toAmino(e) : undefined + ); + } else { + obj.events = []; + } + return obj; + }, + fromAminoMsg(object: ResponseEndBlockAminoMsg): ResponseEndBlock { + return ResponseEndBlock.fromAmino(object.value); + }, + fromProtoMsg(message: ResponseEndBlockProtoMsg): ResponseEndBlock { + return ResponseEndBlock.decode(message.value); + }, + toProto(message: ResponseEndBlock): Uint8Array { + return ResponseEndBlock.encode(message).finish(); + }, + toProtoMsg(message: ResponseEndBlock): ResponseEndBlockProtoMsg { + return { + typeUrl: "/tendermint.abci.ResponseEndBlock", + value: ResponseEndBlock.encode(message).finish(), + }; + }, }; function createBaseResponseCommit(): ResponseCommit { return { @@ -3356,6 +5591,35 @@ export const ResponseCommit = { : Long.ZERO; return message; }, + fromAmino(object: ResponseCommitAmino): ResponseCommit { + return { + data: object.data, + retainHeight: Long.fromString(object.retain_height), + }; + }, + toAmino(message: ResponseCommit): ResponseCommitAmino { + const obj: any = {}; + obj.data = message.data; + obj.retain_height = message.retainHeight + ? message.retainHeight.toString() + : undefined; + return obj; + }, + fromAminoMsg(object: ResponseCommitAminoMsg): ResponseCommit { + return ResponseCommit.fromAmino(object.value); + }, + fromProtoMsg(message: ResponseCommitProtoMsg): ResponseCommit { + return ResponseCommit.decode(message.value); + }, + toProto(message: ResponseCommit): Uint8Array { + return ResponseCommit.encode(message).finish(); + }, + toProtoMsg(message: ResponseCommit): ResponseCommitProtoMsg { + return { + typeUrl: "/tendermint.abci.ResponseCommit", + value: ResponseCommit.encode(message).finish(), + }; + }, }; function createBaseResponseListSnapshots(): ResponseListSnapshots { return { @@ -3418,6 +5682,39 @@ export const ResponseListSnapshots = { object.snapshots?.map((e) => Snapshot.fromPartial(e)) || []; return message; }, + fromAmino(object: ResponseListSnapshotsAmino): ResponseListSnapshots { + return { + snapshots: Array.isArray(object?.snapshots) + ? object.snapshots.map((e: any) => Snapshot.fromAmino(e)) + : [], + }; + }, + toAmino(message: ResponseListSnapshots): ResponseListSnapshotsAmino { + const obj: any = {}; + if (message.snapshots) { + obj.snapshots = message.snapshots.map((e) => + e ? Snapshot.toAmino(e) : undefined + ); + } else { + obj.snapshots = []; + } + return obj; + }, + fromAminoMsg(object: ResponseListSnapshotsAminoMsg): ResponseListSnapshots { + return ResponseListSnapshots.fromAmino(object.value); + }, + fromProtoMsg(message: ResponseListSnapshotsProtoMsg): ResponseListSnapshots { + return ResponseListSnapshots.decode(message.value); + }, + toProto(message: ResponseListSnapshots): Uint8Array { + return ResponseListSnapshots.encode(message).finish(); + }, + toProtoMsg(message: ResponseListSnapshots): ResponseListSnapshotsProtoMsg { + return { + typeUrl: "/tendermint.abci.ResponseListSnapshots", + value: ResponseListSnapshots.encode(message).finish(), + }; + }, }; function createBaseResponseOfferSnapshot(): ResponseOfferSnapshot { return { @@ -3474,6 +5771,33 @@ export const ResponseOfferSnapshot = { message.result = object.result ?? 0; return message; }, + fromAmino(object: ResponseOfferSnapshotAmino): ResponseOfferSnapshot { + return { + result: isSet(object.result) + ? responseOfferSnapshot_ResultFromJSON(object.result) + : 0, + }; + }, + toAmino(message: ResponseOfferSnapshot): ResponseOfferSnapshotAmino { + const obj: any = {}; + obj.result = message.result; + return obj; + }, + fromAminoMsg(object: ResponseOfferSnapshotAminoMsg): ResponseOfferSnapshot { + return ResponseOfferSnapshot.fromAmino(object.value); + }, + fromProtoMsg(message: ResponseOfferSnapshotProtoMsg): ResponseOfferSnapshot { + return ResponseOfferSnapshot.decode(message.value); + }, + toProto(message: ResponseOfferSnapshot): Uint8Array { + return ResponseOfferSnapshot.encode(message).finish(); + }, + toProtoMsg(message: ResponseOfferSnapshot): ResponseOfferSnapshotProtoMsg { + return { + typeUrl: "/tendermint.abci.ResponseOfferSnapshot", + value: ResponseOfferSnapshot.encode(message).finish(), + }; + }, }; function createBaseResponseLoadSnapshotChunk(): ResponseLoadSnapshotChunk { return { @@ -3532,6 +5856,37 @@ export const ResponseLoadSnapshotChunk = { message.chunk = object.chunk ?? new Uint8Array(); return message; }, + fromAmino(object: ResponseLoadSnapshotChunkAmino): ResponseLoadSnapshotChunk { + return { + chunk: object.chunk, + }; + }, + toAmino(message: ResponseLoadSnapshotChunk): ResponseLoadSnapshotChunkAmino { + const obj: any = {}; + obj.chunk = message.chunk; + return obj; + }, + fromAminoMsg( + object: ResponseLoadSnapshotChunkAminoMsg + ): ResponseLoadSnapshotChunk { + return ResponseLoadSnapshotChunk.fromAmino(object.value); + }, + fromProtoMsg( + message: ResponseLoadSnapshotChunkProtoMsg + ): ResponseLoadSnapshotChunk { + return ResponseLoadSnapshotChunk.decode(message.value); + }, + toProto(message: ResponseLoadSnapshotChunk): Uint8Array { + return ResponseLoadSnapshotChunk.encode(message).finish(); + }, + toProtoMsg( + message: ResponseLoadSnapshotChunk + ): ResponseLoadSnapshotChunkProtoMsg { + return { + typeUrl: "/tendermint.abci.ResponseLoadSnapshotChunk", + value: ResponseLoadSnapshotChunk.encode(message).finish(), + }; + }, }; function createBaseResponseApplySnapshotChunk(): ResponseApplySnapshotChunk { return { @@ -3629,58 +5984,183 @@ export const ResponseApplySnapshotChunk = { message.rejectSenders = object.rejectSenders?.map((e) => e) || []; return message; }, + fromAmino( + object: ResponseApplySnapshotChunkAmino + ): ResponseApplySnapshotChunk { + return { + result: isSet(object.result) + ? responseApplySnapshotChunk_ResultFromJSON(object.result) + : 0, + refetchChunks: Array.isArray(object?.refetch_chunks) + ? object.refetch_chunks.map((e: any) => e) + : [], + rejectSenders: Array.isArray(object?.reject_senders) + ? object.reject_senders.map((e: any) => e) + : [], + }; + }, + toAmino( + message: ResponseApplySnapshotChunk + ): ResponseApplySnapshotChunkAmino { + const obj: any = {}; + obj.result = message.result; + if (message.refetchChunks) { + obj.refetch_chunks = message.refetchChunks.map((e) => e); + } else { + obj.refetch_chunks = []; + } + if (message.rejectSenders) { + obj.reject_senders = message.rejectSenders.map((e) => e); + } else { + obj.reject_senders = []; + } + return obj; + }, + fromAminoMsg( + object: ResponseApplySnapshotChunkAminoMsg + ): ResponseApplySnapshotChunk { + return ResponseApplySnapshotChunk.fromAmino(object.value); + }, + fromProtoMsg( + message: ResponseApplySnapshotChunkProtoMsg + ): ResponseApplySnapshotChunk { + return ResponseApplySnapshotChunk.decode(message.value); + }, + toProto(message: ResponseApplySnapshotChunk): Uint8Array { + return ResponseApplySnapshotChunk.encode(message).finish(); + }, + toProtoMsg( + message: ResponseApplySnapshotChunk + ): ResponseApplySnapshotChunkProtoMsg { + return { + typeUrl: "/tendermint.abci.ResponseApplySnapshotChunk", + value: ResponseApplySnapshotChunk.encode(message).finish(), + }; + }, }; -function createBaseConsensusParams(): ConsensusParams { +function createBaseResponsePrepareProposal(): ResponsePrepareProposal { return { - block: undefined, - evidence: undefined, - validator: undefined, - version: undefined, + txs: [], }; } -export const ConsensusParams = { +export const ResponsePrepareProposal = { encode( - message: ConsensusParams, + message: ResponsePrepareProposal, writer: _m0.Writer = _m0.Writer.create() ): _m0.Writer { - if (message.block !== undefined) { - BlockParams.encode(message.block, writer.uint32(10).fork()).ldelim(); + for (const v of message.txs) { + writer.uint32(10).bytes(v!); } - if (message.evidence !== undefined) { - EvidenceParams.encode( - message.evidence, - writer.uint32(18).fork() - ).ldelim(); + return writer; + }, + decode( + input: _m0.Reader | Uint8Array, + length?: number + ): ResponsePrepareProposal { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseResponsePrepareProposal(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.txs.push(reader.bytes()); + break; + default: + reader.skipType(tag & 7); + break; + } } - if (message.validator !== undefined) { - ValidatorParams.encode( - message.validator, - writer.uint32(26).fork() - ).ldelim(); + return message; + }, + fromJSON(object: any): ResponsePrepareProposal { + return { + txs: Array.isArray(object?.txs) + ? object.txs.map((e: any) => bytesFromBase64(e)) + : [], + }; + }, + toJSON(message: ResponsePrepareProposal): unknown { + const obj: any = {}; + if (message.txs) { + obj.txs = message.txs.map((e) => + base64FromBytes(e !== undefined ? e : new Uint8Array()) + ); + } else { + obj.txs = []; + } + return obj; + }, + fromPartial, I>>( + object: I + ): ResponsePrepareProposal { + const message = createBaseResponsePrepareProposal(); + message.txs = object.txs?.map((e) => e) || []; + return message; + }, + fromAmino(object: ResponsePrepareProposalAmino): ResponsePrepareProposal { + return { + txs: Array.isArray(object?.txs) ? object.txs.map((e: any) => e) : [], + }; + }, + toAmino(message: ResponsePrepareProposal): ResponsePrepareProposalAmino { + const obj: any = {}; + if (message.txs) { + obj.txs = message.txs.map((e) => e); + } else { + obj.txs = []; } - if (message.version !== undefined) { - VersionParams.encode(message.version, writer.uint32(34).fork()).ldelim(); + return obj; + }, + fromAminoMsg( + object: ResponsePrepareProposalAminoMsg + ): ResponsePrepareProposal { + return ResponsePrepareProposal.fromAmino(object.value); + }, + fromProtoMsg( + message: ResponsePrepareProposalProtoMsg + ): ResponsePrepareProposal { + return ResponsePrepareProposal.decode(message.value); + }, + toProto(message: ResponsePrepareProposal): Uint8Array { + return ResponsePrepareProposal.encode(message).finish(); + }, + toProtoMsg( + message: ResponsePrepareProposal + ): ResponsePrepareProposalProtoMsg { + return { + typeUrl: "/tendermint.abci.ResponsePrepareProposal", + value: ResponsePrepareProposal.encode(message).finish(), + }; + }, +}; +function createBaseResponseProcessProposal(): ResponseProcessProposal { + return { + status: 0, + }; +} +export const ResponseProcessProposal = { + encode( + message: ResponseProcessProposal, + writer: _m0.Writer = _m0.Writer.create() + ): _m0.Writer { + if (message.status !== 0) { + writer.uint32(8).int32(message.status); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): ConsensusParams { + decode( + input: _m0.Reader | Uint8Array, + length?: number + ): ResponseProcessProposal { const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseConsensusParams(); + const message = createBaseResponseProcessProposal(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.block = BlockParams.decode(reader, reader.uint32()); - break; - case 2: - message.evidence = EvidenceParams.decode(reader, reader.uint32()); - break; - case 3: - message.validator = ValidatorParams.decode(reader, reader.uint32()); - break; - case 4: - message.version = VersionParams.decode(reader, reader.uint32()); + message.status = reader.int32() as any; break; default: reader.skipType(tag & 7); @@ -3689,96 +6169,93 @@ export const ConsensusParams = { } return message; }, - fromJSON(object: any): ConsensusParams { + fromJSON(object: any): ResponseProcessProposal { return { - block: isSet(object.block) - ? BlockParams.fromJSON(object.block) - : undefined, - evidence: isSet(object.evidence) - ? EvidenceParams.fromJSON(object.evidence) - : undefined, - validator: isSet(object.validator) - ? ValidatorParams.fromJSON(object.validator) - : undefined, - version: isSet(object.version) - ? VersionParams.fromJSON(object.version) - : undefined, + status: isSet(object.status) + ? responseProcessProposal_ProposalStatusFromJSON(object.status) + : 0, }; }, - toJSON(message: ConsensusParams): unknown { + toJSON(message: ResponseProcessProposal): unknown { const obj: any = {}; - message.block !== undefined && - (obj.block = message.block - ? BlockParams.toJSON(message.block) - : undefined); - message.evidence !== undefined && - (obj.evidence = message.evidence - ? EvidenceParams.toJSON(message.evidence) - : undefined); - message.validator !== undefined && - (obj.validator = message.validator - ? ValidatorParams.toJSON(message.validator) - : undefined); - message.version !== undefined && - (obj.version = message.version - ? VersionParams.toJSON(message.version) - : undefined); + message.status !== undefined && + (obj.status = responseProcessProposal_ProposalStatusToJSON( + message.status + )); return obj; }, - fromPartial, I>>( + fromPartial, I>>( object: I - ): ConsensusParams { - const message = createBaseConsensusParams(); - message.block = - object.block !== undefined && object.block !== null - ? BlockParams.fromPartial(object.block) - : undefined; - message.evidence = - object.evidence !== undefined && object.evidence !== null - ? EvidenceParams.fromPartial(object.evidence) - : undefined; - message.validator = - object.validator !== undefined && object.validator !== null - ? ValidatorParams.fromPartial(object.validator) - : undefined; - message.version = - object.version !== undefined && object.version !== null - ? VersionParams.fromPartial(object.version) - : undefined; + ): ResponseProcessProposal { + const message = createBaseResponseProcessProposal(); + message.status = object.status ?? 0; return message; }, + fromAmino(object: ResponseProcessProposalAmino): ResponseProcessProposal { + return { + status: isSet(object.status) + ? responseProcessProposal_ProposalStatusFromJSON(object.status) + : 0, + }; + }, + toAmino(message: ResponseProcessProposal): ResponseProcessProposalAmino { + const obj: any = {}; + obj.status = message.status; + return obj; + }, + fromAminoMsg( + object: ResponseProcessProposalAminoMsg + ): ResponseProcessProposal { + return ResponseProcessProposal.fromAmino(object.value); + }, + fromProtoMsg( + message: ResponseProcessProposalProtoMsg + ): ResponseProcessProposal { + return ResponseProcessProposal.decode(message.value); + }, + toProto(message: ResponseProcessProposal): Uint8Array { + return ResponseProcessProposal.encode(message).finish(); + }, + toProtoMsg( + message: ResponseProcessProposal + ): ResponseProcessProposalProtoMsg { + return { + typeUrl: "/tendermint.abci.ResponseProcessProposal", + value: ResponseProcessProposal.encode(message).finish(), + }; + }, }; -function createBaseBlockParams(): BlockParams { +function createBaseCommitInfo(): CommitInfo { return { - maxBytes: Long.ZERO, - maxGas: Long.ZERO, + round: 0, + votes: [], }; } -export const BlockParams = { +export const CommitInfo = { encode( - message: BlockParams, + message: CommitInfo, writer: _m0.Writer = _m0.Writer.create() ): _m0.Writer { - if (!message.maxBytes.isZero()) { - writer.uint32(8).int64(message.maxBytes); + if (message.round !== 0) { + writer.uint32(8).int32(message.round); } - if (!message.maxGas.isZero()) { - writer.uint32(16).int64(message.maxGas); + for (const v of message.votes) { + VoteInfo.encode(v!, writer.uint32(18).fork()).ldelim(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): BlockParams { + decode(input: _m0.Reader | Uint8Array, length?: number): CommitInfo { const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseBlockParams(); + const message = createBaseCommitInfo(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.maxBytes = reader.int64() as Long; + message.round = reader.int32(); break; case 2: - message.maxGas = reader.int64() as Long; + message.votes.push(VoteInfo.decode(reader, reader.uint32())); break; default: reader.skipType(tag & 7); @@ -3787,60 +6264,93 @@ export const BlockParams = { } return message; }, - fromJSON(object: any): BlockParams { + fromJSON(object: any): CommitInfo { return { - maxBytes: isSet(object.maxBytes) - ? Long.fromValue(object.maxBytes) - : Long.ZERO, - maxGas: isSet(object.maxGas) ? Long.fromValue(object.maxGas) : Long.ZERO, + round: isSet(object.round) ? Number(object.round) : 0, + votes: Array.isArray(object?.votes) + ? object.votes.map((e: any) => VoteInfo.fromJSON(e)) + : [], }; }, - toJSON(message: BlockParams): unknown { + toJSON(message: CommitInfo): unknown { const obj: any = {}; - message.maxBytes !== undefined && - (obj.maxBytes = (message.maxBytes || Long.ZERO).toString()); - message.maxGas !== undefined && - (obj.maxGas = (message.maxGas || Long.ZERO).toString()); + message.round !== undefined && (obj.round = Math.round(message.round)); + if (message.votes) { + obj.votes = message.votes.map((e) => + e ? VoteInfo.toJSON(e) : undefined + ); + } else { + obj.votes = []; + } return obj; }, - fromPartial, I>>( + fromPartial, I>>( object: I - ): BlockParams { - const message = createBaseBlockParams(); - message.maxBytes = - object.maxBytes !== undefined && object.maxBytes !== null - ? Long.fromValue(object.maxBytes) - : Long.ZERO; - message.maxGas = - object.maxGas !== undefined && object.maxGas !== null - ? Long.fromValue(object.maxGas) - : Long.ZERO; + ): CommitInfo { + const message = createBaseCommitInfo(); + message.round = object.round ?? 0; + message.votes = object.votes?.map((e) => VoteInfo.fromPartial(e)) || []; return message; }, + fromAmino(object: CommitInfoAmino): CommitInfo { + return { + round: object.round, + votes: Array.isArray(object?.votes) + ? object.votes.map((e: any) => VoteInfo.fromAmino(e)) + : [], + }; + }, + toAmino(message: CommitInfo): CommitInfoAmino { + const obj: any = {}; + obj.round = message.round; + if (message.votes) { + obj.votes = message.votes.map((e) => + e ? VoteInfo.toAmino(e) : undefined + ); + } else { + obj.votes = []; + } + return obj; + }, + fromAminoMsg(object: CommitInfoAminoMsg): CommitInfo { + return CommitInfo.fromAmino(object.value); + }, + fromProtoMsg(message: CommitInfoProtoMsg): CommitInfo { + return CommitInfo.decode(message.value); + }, + toProto(message: CommitInfo): Uint8Array { + return CommitInfo.encode(message).finish(); + }, + toProtoMsg(message: CommitInfo): CommitInfoProtoMsg { + return { + typeUrl: "/tendermint.abci.CommitInfo", + value: CommitInfo.encode(message).finish(), + }; + }, }; -function createBaseLastCommitInfo(): LastCommitInfo { +function createBaseExtendedCommitInfo(): ExtendedCommitInfo { return { round: 0, votes: [], }; } -export const LastCommitInfo = { +export const ExtendedCommitInfo = { encode( - message: LastCommitInfo, + message: ExtendedCommitInfo, writer: _m0.Writer = _m0.Writer.create() ): _m0.Writer { if (message.round !== 0) { writer.uint32(8).int32(message.round); } for (const v of message.votes) { - VoteInfo.encode(v!, writer.uint32(18).fork()).ldelim(); + ExtendedVoteInfo.encode(v!, writer.uint32(18).fork()).ldelim(); } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): LastCommitInfo { + decode(input: _m0.Reader | Uint8Array, length?: number): ExtendedCommitInfo { const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseLastCommitInfo(); + const message = createBaseExtendedCommitInfo(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { @@ -3848,7 +6358,7 @@ export const LastCommitInfo = { message.round = reader.int32(); break; case 2: - message.votes.push(VoteInfo.decode(reader, reader.uint32())); + message.votes.push(ExtendedVoteInfo.decode(reader, reader.uint32())); break; default: reader.skipType(tag & 7); @@ -3857,33 +6367,69 @@ export const LastCommitInfo = { } return message; }, - fromJSON(object: any): LastCommitInfo { + fromJSON(object: any): ExtendedCommitInfo { + return { + round: isSet(object.round) ? Number(object.round) : 0, + votes: Array.isArray(object?.votes) + ? object.votes.map((e: any) => ExtendedVoteInfo.fromJSON(e)) + : [], + }; + }, + toJSON(message: ExtendedCommitInfo): unknown { + const obj: any = {}; + message.round !== undefined && (obj.round = Math.round(message.round)); + if (message.votes) { + obj.votes = message.votes.map((e) => + e ? ExtendedVoteInfo.toJSON(e) : undefined + ); + } else { + obj.votes = []; + } + return obj; + }, + fromPartial, I>>( + object: I + ): ExtendedCommitInfo { + const message = createBaseExtendedCommitInfo(); + message.round = object.round ?? 0; + message.votes = + object.votes?.map((e) => ExtendedVoteInfo.fromPartial(e)) || []; + return message; + }, + fromAmino(object: ExtendedCommitInfoAmino): ExtendedCommitInfo { return { - round: isSet(object.round) ? Number(object.round) : 0, + round: object.round, votes: Array.isArray(object?.votes) - ? object.votes.map((e: any) => VoteInfo.fromJSON(e)) + ? object.votes.map((e: any) => ExtendedVoteInfo.fromAmino(e)) : [], }; }, - toJSON(message: LastCommitInfo): unknown { + toAmino(message: ExtendedCommitInfo): ExtendedCommitInfoAmino { const obj: any = {}; - message.round !== undefined && (obj.round = Math.round(message.round)); + obj.round = message.round; if (message.votes) { obj.votes = message.votes.map((e) => - e ? VoteInfo.toJSON(e) : undefined + e ? ExtendedVoteInfo.toAmino(e) : undefined ); } else { obj.votes = []; } return obj; }, - fromPartial, I>>( - object: I - ): LastCommitInfo { - const message = createBaseLastCommitInfo(); - message.round = object.round ?? 0; - message.votes = object.votes?.map((e) => VoteInfo.fromPartial(e)) || []; - return message; + fromAminoMsg(object: ExtendedCommitInfoAminoMsg): ExtendedCommitInfo { + return ExtendedCommitInfo.fromAmino(object.value); + }, + fromProtoMsg(message: ExtendedCommitInfoProtoMsg): ExtendedCommitInfo { + return ExtendedCommitInfo.decode(message.value); + }, + toProto(message: ExtendedCommitInfo): Uint8Array { + return ExtendedCommitInfo.encode(message).finish(); + }, + toProtoMsg(message: ExtendedCommitInfo): ExtendedCommitInfoProtoMsg { + return { + typeUrl: "/tendermint.abci.ExtendedCommitInfo", + value: ExtendedCommitInfo.encode(message).finish(), + }; }, }; function createBaseEvent(): Event { @@ -3951,11 +6497,46 @@ export const Event = { object.attributes?.map((e) => EventAttribute.fromPartial(e)) || []; return message; }, + fromAmino(object: EventAmino): Event { + return { + type: object.type, + attributes: Array.isArray(object?.attributes) + ? object.attributes.map((e: any) => EventAttribute.fromAmino(e)) + : [], + }; + }, + toAmino(message: Event): EventAmino { + const obj: any = {}; + obj.type = message.type; + if (message.attributes) { + obj.attributes = message.attributes.map((e) => + e ? EventAttribute.toAmino(e) : undefined + ); + } else { + obj.attributes = []; + } + return obj; + }, + fromAminoMsg(object: EventAminoMsg): Event { + return Event.fromAmino(object.value); + }, + fromProtoMsg(message: EventProtoMsg): Event { + return Event.decode(message.value); + }, + toProto(message: Event): Uint8Array { + return Event.encode(message).finish(); + }, + toProtoMsg(message: Event): EventProtoMsg { + return { + typeUrl: "/tendermint.abci.Event", + value: Event.encode(message).finish(), + }; + }, }; function createBaseEventAttribute(): EventAttribute { return { - key: new Uint8Array(), - value: new Uint8Array(), + key: "", + value: "", index: false, }; } @@ -3964,11 +6545,11 @@ export const EventAttribute = { message: EventAttribute, writer: _m0.Writer = _m0.Writer.create() ): _m0.Writer { - if (message.key.length !== 0) { - writer.uint32(10).bytes(message.key); + if (message.key !== "") { + writer.uint32(10).string(message.key); } - if (message.value.length !== 0) { - writer.uint32(18).bytes(message.value); + if (message.value !== "") { + writer.uint32(18).string(message.value); } if (message.index === true) { writer.uint32(24).bool(message.index); @@ -3983,10 +6564,10 @@ export const EventAttribute = { const tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.key = reader.bytes(); + message.key = reader.string(); break; case 2: - message.value = reader.bytes(); + message.value = reader.string(); break; case 3: message.index = reader.bool(); @@ -4000,23 +6581,15 @@ export const EventAttribute = { }, fromJSON(object: any): EventAttribute { return { - key: isSet(object.key) ? bytesFromBase64(object.key) : new Uint8Array(), - value: isSet(object.value) - ? bytesFromBase64(object.value) - : new Uint8Array(), + key: isSet(object.key) ? String(object.key) : "", + value: isSet(object.value) ? String(object.value) : "", index: isSet(object.index) ? Boolean(object.index) : false, }; }, toJSON(message: EventAttribute): unknown { const obj: any = {}; - message.key !== undefined && - (obj.key = base64FromBytes( - message.key !== undefined ? message.key : new Uint8Array() - )); - message.value !== undefined && - (obj.value = base64FromBytes( - message.value !== undefined ? message.value : new Uint8Array() - )); + message.key !== undefined && (obj.key = message.key); + message.value !== undefined && (obj.value = message.value); message.index !== undefined && (obj.index = message.index); return obj; }, @@ -4024,11 +6597,40 @@ export const EventAttribute = { object: I ): EventAttribute { const message = createBaseEventAttribute(); - message.key = object.key ?? new Uint8Array(); - message.value = object.value ?? new Uint8Array(); + message.key = object.key ?? ""; + message.value = object.value ?? ""; message.index = object.index ?? false; return message; }, + fromAmino(object: EventAttributeAmino): EventAttribute { + return { + key: object.key, + value: object.value, + index: object.index, + }; + }, + toAmino(message: EventAttribute): EventAttributeAmino { + const obj: any = {}; + obj.key = message.key; + obj.value = message.value; + obj.index = message.index; + return obj; + }, + fromAminoMsg(object: EventAttributeAminoMsg): EventAttribute { + return EventAttribute.fromAmino(object.value); + }, + fromProtoMsg(message: EventAttributeProtoMsg): EventAttribute { + return EventAttribute.decode(message.value); + }, + toProto(message: EventAttribute): Uint8Array { + return EventAttribute.encode(message).finish(); + }, + toProtoMsg(message: EventAttribute): EventAttributeProtoMsg { + return { + typeUrl: "/tendermint.abci.EventAttribute", + value: EventAttribute.encode(message).finish(), + }; + }, }; function createBaseTxResult(): TxResult { return { @@ -4125,6 +6727,41 @@ export const TxResult = { : undefined; return message; }, + fromAmino(object: TxResultAmino): TxResult { + return { + height: Long.fromString(object.height), + index: object.index, + tx: object.tx, + result: object?.result + ? ResponseDeliverTx.fromAmino(object.result) + : undefined, + }; + }, + toAmino(message: TxResult): TxResultAmino { + const obj: any = {}; + obj.height = message.height ? message.height.toString() : undefined; + obj.index = message.index; + obj.tx = message.tx; + obj.result = message.result + ? ResponseDeliverTx.toAmino(message.result) + : undefined; + return obj; + }, + fromAminoMsg(object: TxResultAminoMsg): TxResult { + return TxResult.fromAmino(object.value); + }, + fromProtoMsg(message: TxResultProtoMsg): TxResult { + return TxResult.decode(message.value); + }, + toProto(message: TxResult): Uint8Array { + return TxResult.encode(message).finish(); + }, + toProtoMsg(message: TxResult): TxResultProtoMsg { + return { + typeUrl: "/tendermint.abci.TxResult", + value: TxResult.encode(message).finish(), + }; + }, }; function createBaseValidator(): Validator { return { @@ -4194,6 +6831,33 @@ export const Validator = { : Long.ZERO; return message; }, + fromAmino(object: ValidatorAmino): Validator { + return { + address: object.address, + power: Long.fromString(object.power), + }; + }, + toAmino(message: Validator): ValidatorAmino { + const obj: any = {}; + obj.address = message.address; + obj.power = message.power ? message.power.toString() : undefined; + return obj; + }, + fromAminoMsg(object: ValidatorAminoMsg): Validator { + return Validator.fromAmino(object.value); + }, + fromProtoMsg(message: ValidatorProtoMsg): Validator { + return Validator.decode(message.value); + }, + toProto(message: Validator): Uint8Array { + return Validator.encode(message).finish(); + }, + toProtoMsg(message: Validator): ValidatorProtoMsg { + return { + typeUrl: "/tendermint.abci.Validator", + value: Validator.encode(message).finish(), + }; + }, }; function createBaseValidatorUpdate(): ValidatorUpdate { return { @@ -4266,6 +6930,35 @@ export const ValidatorUpdate = { : Long.ZERO; return message; }, + fromAmino(object: ValidatorUpdateAmino): ValidatorUpdate { + return { + pubKey: object?.pub_key ? PublicKey.fromAmino(object.pub_key) : undefined, + power: Long.fromString(object.power), + }; + }, + toAmino(message: ValidatorUpdate): ValidatorUpdateAmino { + const obj: any = {}; + obj.pub_key = message.pubKey + ? PublicKey.toAmino(message.pubKey) + : undefined; + obj.power = message.power ? message.power.toString() : undefined; + return obj; + }, + fromAminoMsg(object: ValidatorUpdateAminoMsg): ValidatorUpdate { + return ValidatorUpdate.fromAmino(object.value); + }, + fromProtoMsg(message: ValidatorUpdateProtoMsg): ValidatorUpdate { + return ValidatorUpdate.decode(message.value); + }, + toProto(message: ValidatorUpdate): Uint8Array { + return ValidatorUpdate.encode(message).finish(); + }, + toProtoMsg(message: ValidatorUpdate): ValidatorUpdateProtoMsg { + return { + typeUrl: "/tendermint.abci.ValidatorUpdate", + value: ValidatorUpdate.encode(message).finish(), + }; + }, }; function createBaseVoteInfo(): VoteInfo { return { @@ -4335,8 +7028,160 @@ export const VoteInfo = { message.signedLastBlock = object.signedLastBlock ?? false; return message; }, + fromAmino(object: VoteInfoAmino): VoteInfo { + return { + validator: object?.validator + ? Validator.fromAmino(object.validator) + : undefined, + signedLastBlock: object.signed_last_block, + }; + }, + toAmino(message: VoteInfo): VoteInfoAmino { + const obj: any = {}; + obj.validator = message.validator + ? Validator.toAmino(message.validator) + : undefined; + obj.signed_last_block = message.signedLastBlock; + return obj; + }, + fromAminoMsg(object: VoteInfoAminoMsg): VoteInfo { + return VoteInfo.fromAmino(object.value); + }, + fromProtoMsg(message: VoteInfoProtoMsg): VoteInfo { + return VoteInfo.decode(message.value); + }, + toProto(message: VoteInfo): Uint8Array { + return VoteInfo.encode(message).finish(); + }, + toProtoMsg(message: VoteInfo): VoteInfoProtoMsg { + return { + typeUrl: "/tendermint.abci.VoteInfo", + value: VoteInfo.encode(message).finish(), + }; + }, +}; +function createBaseExtendedVoteInfo(): ExtendedVoteInfo { + return { + validator: undefined, + signedLastBlock: false, + voteExtension: new Uint8Array(), + }; +} +export const ExtendedVoteInfo = { + encode( + message: ExtendedVoteInfo, + writer: _m0.Writer = _m0.Writer.create() + ): _m0.Writer { + if (message.validator !== undefined) { + Validator.encode(message.validator, writer.uint32(10).fork()).ldelim(); + } + if (message.signedLastBlock === true) { + writer.uint32(16).bool(message.signedLastBlock); + } + if (message.voteExtension.length !== 0) { + writer.uint32(26).bytes(message.voteExtension); + } + return writer; + }, + decode(input: _m0.Reader | Uint8Array, length?: number): ExtendedVoteInfo { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseExtendedVoteInfo(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.validator = Validator.decode(reader, reader.uint32()); + break; + case 2: + message.signedLastBlock = reader.bool(); + break; + case 3: + message.voteExtension = reader.bytes(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object: any): ExtendedVoteInfo { + return { + validator: isSet(object.validator) + ? Validator.fromJSON(object.validator) + : undefined, + signedLastBlock: isSet(object.signedLastBlock) + ? Boolean(object.signedLastBlock) + : false, + voteExtension: isSet(object.voteExtension) + ? bytesFromBase64(object.voteExtension) + : new Uint8Array(), + }; + }, + toJSON(message: ExtendedVoteInfo): unknown { + const obj: any = {}; + message.validator !== undefined && + (obj.validator = message.validator + ? Validator.toJSON(message.validator) + : undefined); + message.signedLastBlock !== undefined && + (obj.signedLastBlock = message.signedLastBlock); + message.voteExtension !== undefined && + (obj.voteExtension = base64FromBytes( + message.voteExtension !== undefined + ? message.voteExtension + : new Uint8Array() + )); + return obj; + }, + fromPartial, I>>( + object: I + ): ExtendedVoteInfo { + const message = createBaseExtendedVoteInfo(); + message.validator = + object.validator !== undefined && object.validator !== null + ? Validator.fromPartial(object.validator) + : undefined; + message.signedLastBlock = object.signedLastBlock ?? false; + message.voteExtension = object.voteExtension ?? new Uint8Array(); + return message; + }, + fromAmino(object: ExtendedVoteInfoAmino): ExtendedVoteInfo { + return { + validator: object?.validator + ? Validator.fromAmino(object.validator) + : undefined, + signedLastBlock: object.signed_last_block, + voteExtension: object.vote_extension, + }; + }, + toAmino(message: ExtendedVoteInfo): ExtendedVoteInfoAmino { + const obj: any = {}; + obj.validator = message.validator + ? Validator.toAmino(message.validator) + : undefined; + obj.signed_last_block = message.signedLastBlock; + obj.vote_extension = message.voteExtension; + return obj; + }, + fromAminoMsg(object: ExtendedVoteInfoAminoMsg): ExtendedVoteInfo { + return ExtendedVoteInfo.fromAmino(object.value); + }, + fromProtoMsg(message: ExtendedVoteInfoProtoMsg): ExtendedVoteInfo { + return ExtendedVoteInfo.decode(message.value); + }, + toProto(message: ExtendedVoteInfo): Uint8Array { + return ExtendedVoteInfo.encode(message).finish(); + }, + toProtoMsg(message: ExtendedVoteInfo): ExtendedVoteInfoProtoMsg { + return { + typeUrl: "/tendermint.abci.ExtendedVoteInfo", + value: ExtendedVoteInfo.encode(message).finish(), + }; + }, }; -function createBaseEvidence(): Evidence { +function createBaseMisbehavior(): Misbehavior { return { type: 0, validator: undefined, @@ -4345,9 +7190,9 @@ function createBaseEvidence(): Evidence { totalVotingPower: Long.ZERO, }; } -export const Evidence = { +export const Misbehavior = { encode( - message: Evidence, + message: Misbehavior, writer: _m0.Writer = _m0.Writer.create() ): _m0.Writer { if (message.type !== 0) { @@ -4367,10 +7212,10 @@ export const Evidence = { } return writer; }, - decode(input: _m0.Reader | Uint8Array, length?: number): Evidence { + decode(input: _m0.Reader | Uint8Array, length?: number): Misbehavior { const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseEvidence(); + const message = createBaseMisbehavior(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { @@ -4396,9 +7241,9 @@ export const Evidence = { } return message; }, - fromJSON(object: any): Evidence { + fromJSON(object: any): Misbehavior { return { - type: isSet(object.type) ? evidenceTypeFromJSON(object.type) : 0, + type: isSet(object.type) ? misbehaviorTypeFromJSON(object.type) : 0, validator: isSet(object.validator) ? Validator.fromJSON(object.validator) : undefined, @@ -4409,9 +7254,10 @@ export const Evidence = { : Long.ZERO, }; }, - toJSON(message: Evidence): unknown { + toJSON(message: Misbehavior): unknown { const obj: any = {}; - message.type !== undefined && (obj.type = evidenceTypeToJSON(message.type)); + message.type !== undefined && + (obj.type = misbehaviorTypeToJSON(message.type)); message.validator !== undefined && (obj.validator = message.validator ? Validator.toJSON(message.validator) @@ -4426,8 +7272,10 @@ export const Evidence = { ).toString()); return obj; }, - fromPartial, I>>(object: I): Evidence { - const message = createBaseEvidence(); + fromPartial, I>>( + object: I + ): Misbehavior { + const message = createBaseMisbehavior(); message.type = object.type ?? 0; message.validator = object.validator !== undefined && object.validator !== null @@ -4447,6 +7295,45 @@ export const Evidence = { : Long.ZERO; return message; }, + fromAmino(object: MisbehaviorAmino): Misbehavior { + return { + type: isSet(object.type) ? misbehaviorTypeFromJSON(object.type) : 0, + validator: object?.validator + ? Validator.fromAmino(object.validator) + : undefined, + height: Long.fromString(object.height), + time: object?.time ? Timestamp.fromAmino(object.time) : undefined, + totalVotingPower: Long.fromString(object.total_voting_power), + }; + }, + toAmino(message: Misbehavior): MisbehaviorAmino { + const obj: any = {}; + obj.type = message.type; + obj.validator = message.validator + ? Validator.toAmino(message.validator) + : undefined; + obj.height = message.height ? message.height.toString() : undefined; + obj.time = message.time ? Timestamp.toAmino(message.time) : undefined; + obj.total_voting_power = message.totalVotingPower + ? message.totalVotingPower.toString() + : undefined; + return obj; + }, + fromAminoMsg(object: MisbehaviorAminoMsg): Misbehavior { + return Misbehavior.fromAmino(object.value); + }, + fromProtoMsg(message: MisbehaviorProtoMsg): Misbehavior { + return Misbehavior.decode(message.value); + }, + toProto(message: Misbehavior): Uint8Array { + return Misbehavior.encode(message).finish(); + }, + toProtoMsg(message: Misbehavior): MisbehaviorProtoMsg { + return { + typeUrl: "/tendermint.abci.Misbehavior", + value: Misbehavior.encode(message).finish(), + }; + }, }; function createBaseSnapshot(): Snapshot { return { @@ -4549,12 +7436,44 @@ export const Snapshot = { message.metadata = object.metadata ?? new Uint8Array(); return message; }, + fromAmino(object: SnapshotAmino): Snapshot { + return { + height: Long.fromString(object.height), + format: object.format, + chunks: object.chunks, + hash: object.hash, + metadata: object.metadata, + }; + }, + toAmino(message: Snapshot): SnapshotAmino { + const obj: any = {}; + obj.height = message.height ? message.height.toString() : undefined; + obj.format = message.format; + obj.chunks = message.chunks; + obj.hash = message.hash; + obj.metadata = message.metadata; + return obj; + }, + fromAminoMsg(object: SnapshotAminoMsg): Snapshot { + return Snapshot.fromAmino(object.value); + }, + fromProtoMsg(message: SnapshotProtoMsg): Snapshot { + return Snapshot.decode(message.value); + }, + toProto(message: Snapshot): Uint8Array { + return Snapshot.encode(message).finish(); + }, + toProtoMsg(message: Snapshot): SnapshotProtoMsg { + return { + typeUrl: "/tendermint.abci.Snapshot", + value: Snapshot.encode(message).finish(), + }; + }, }; export interface ABCIApplication { Echo(request: RequestEcho): Promise; Flush(request?: RequestFlush): Promise; Info(request: RequestInfo): Promise; - SetOption(request: RequestSetOption): Promise; DeliverTx(request: RequestDeliverTx): Promise; CheckTx(request: RequestCheckTx): Promise; Query(request: RequestQuery): Promise; @@ -4570,6 +7489,12 @@ export interface ABCIApplication { ApplySnapshotChunk( request: RequestApplySnapshotChunk ): Promise; + PrepareProposal( + request: RequestPrepareProposal + ): Promise; + ProcessProposal( + request: RequestProcessProposal + ): Promise; } export class ABCIApplicationClientImpl implements ABCIApplication { private readonly rpc: Rpc; @@ -4578,7 +7503,6 @@ export class ABCIApplicationClientImpl implements ABCIApplication { this.Echo = this.Echo.bind(this); this.Flush = this.Flush.bind(this); this.Info = this.Info.bind(this); - this.SetOption = this.SetOption.bind(this); this.DeliverTx = this.DeliverTx.bind(this); this.CheckTx = this.CheckTx.bind(this); this.Query = this.Query.bind(this); @@ -4590,6 +7514,8 @@ export class ABCIApplicationClientImpl implements ABCIApplication { this.OfferSnapshot = this.OfferSnapshot.bind(this); this.LoadSnapshotChunk = this.LoadSnapshotChunk.bind(this); this.ApplySnapshotChunk = this.ApplySnapshotChunk.bind(this); + this.PrepareProposal = this.PrepareProposal.bind(this); + this.ProcessProposal = this.ProcessProposal.bind(this); } Echo(request: RequestEcho): Promise { const data = RequestEcho.encode(request).finish(); @@ -4618,17 +7544,6 @@ export class ABCIApplicationClientImpl implements ABCIApplication { ); return promise.then((data) => ResponseInfo.decode(new _m0.Reader(data))); } - SetOption(request: RequestSetOption): Promise { - const data = RequestSetOption.encode(request).finish(); - const promise = this.rpc.request( - "tendermint.abci.ABCIApplication", - "SetOption", - data - ); - return promise.then((data) => - ResponseSetOption.decode(new _m0.Reader(data)) - ); - } DeliverTx(request: RequestDeliverTx): Promise { const data = RequestDeliverTx.encode(request).finish(); const promise = this.rpc.request( @@ -4750,4 +7665,30 @@ export class ABCIApplicationClientImpl implements ABCIApplication { ResponseApplySnapshotChunk.decode(new _m0.Reader(data)) ); } + PrepareProposal( + request: RequestPrepareProposal + ): Promise { + const data = RequestPrepareProposal.encode(request).finish(); + const promise = this.rpc.request( + "tendermint.abci.ABCIApplication", + "PrepareProposal", + data + ); + return promise.then((data) => + ResponsePrepareProposal.decode(new _m0.Reader(data)) + ); + } + ProcessProposal( + request: RequestProcessProposal + ): Promise { + const data = RequestProcessProposal.encode(request).finish(); + const promise = this.rpc.request( + "tendermint.abci.ABCIApplication", + "ProcessProposal", + data + ); + return promise.then((data) => + ResponseProcessProposal.decode(new _m0.Reader(data)) + ); + } } diff --git a/packages/types/src/tendermint/crypto/keys.ts b/packages/types/src/tendermint/crypto/keys.ts index e2fb5ef84..a3be7983b 100644 --- a/packages/types/src/tendermint/crypto/keys.ts +++ b/packages/types/src/tendermint/crypto/keys.ts @@ -8,11 +8,24 @@ import { Exact, } from "../../helpers"; export const protobufPackage = "tendermint.crypto"; -/** PublicKey defines the keys available for use with Tendermint Validators */ +/** PublicKey defines the keys available for use with Validators */ export interface PublicKey { ed25519?: Uint8Array; secp256k1?: Uint8Array; } +export interface PublicKeyProtoMsg { + typeUrl: "/tendermint.crypto.PublicKey"; + value: Uint8Array; +} +/** PublicKey defines the keys available for use with Validators */ +export interface PublicKeyAmino { + ed25519?: Uint8Array; + secp256k1?: Uint8Array; +} +export interface PublicKeyAminoMsg { + type: "/tendermint.crypto.PublicKey"; + value: PublicKeyAmino; +} function createBasePublicKey(): PublicKey { return { ed25519: undefined, @@ -84,4 +97,31 @@ export const PublicKey = { message.secp256k1 = object.secp256k1 ?? undefined; return message; }, + fromAmino(object: PublicKeyAmino): PublicKey { + return { + ed25519: object?.ed25519, + secp256k1: object?.secp256k1, + }; + }, + toAmino(message: PublicKey): PublicKeyAmino { + const obj: any = {}; + obj.ed25519 = message.ed25519; + obj.secp256k1 = message.secp256k1; + return obj; + }, + fromAminoMsg(object: PublicKeyAminoMsg): PublicKey { + return PublicKey.fromAmino(object.value); + }, + fromProtoMsg(message: PublicKeyProtoMsg): PublicKey { + return PublicKey.decode(message.value); + }, + toProto(message: PublicKey): Uint8Array { + return PublicKey.encode(message).finish(); + }, + toProtoMsg(message: PublicKey): PublicKeyProtoMsg { + return { + typeUrl: "/tendermint.crypto.PublicKey", + value: PublicKey.encode(message).finish(), + }; + }, }; diff --git a/packages/types/src/tendermint/crypto/proof.ts b/packages/types/src/tendermint/crypto/proof.ts index 30825c996..5085117de 100644 --- a/packages/types/src/tendermint/crypto/proof.ts +++ b/packages/types/src/tendermint/crypto/proof.ts @@ -15,17 +15,58 @@ export interface Proof { leafHash: Uint8Array; aunts: Uint8Array[]; } +export interface ProofProtoMsg { + typeUrl: "/tendermint.crypto.Proof"; + value: Uint8Array; +} +export interface ProofAmino { + total: string; + index: string; + leaf_hash: Uint8Array; + aunts: Uint8Array[]; +} +export interface ProofAminoMsg { + type: "/tendermint.crypto.Proof"; + value: ProofAmino; +} export interface ValueOp { /** Encoded in ProofOp.Key. */ key: Uint8Array; /** To encode in ProofOp.Data */ proof?: Proof; } +export interface ValueOpProtoMsg { + typeUrl: "/tendermint.crypto.ValueOp"; + value: Uint8Array; +} +export interface ValueOpAmino { + /** Encoded in ProofOp.Key. */ + key: Uint8Array; + /** To encode in ProofOp.Data */ + proof?: ProofAmino; +} +export interface ValueOpAminoMsg { + type: "/tendermint.crypto.ValueOp"; + value: ValueOpAmino; +} export interface DominoOp { key: string; input: string; output: string; } +export interface DominoOpProtoMsg { + typeUrl: "/tendermint.crypto.DominoOp"; + value: Uint8Array; +} +export interface DominoOpAmino { + key: string; + input: string; + output: string; +} +export interface DominoOpAminoMsg { + type: "/tendermint.crypto.DominoOp"; + value: DominoOpAmino; +} /** * ProofOp defines an operation used for calculating Merkle root * The data could be arbitrary format, providing nessecary data @@ -36,10 +77,40 @@ export interface ProofOp { key: Uint8Array; data: Uint8Array; } +export interface ProofOpProtoMsg { + typeUrl: "/tendermint.crypto.ProofOp"; + value: Uint8Array; +} +/** + * ProofOp defines an operation used for calculating Merkle root + * The data could be arbitrary format, providing nessecary data + * for example neighbouring node hash + */ +export interface ProofOpAmino { + type: string; + key: Uint8Array; + data: Uint8Array; +} +export interface ProofOpAminoMsg { + type: "/tendermint.crypto.ProofOp"; + value: ProofOpAmino; +} /** ProofOps is Merkle proof defined by the list of ProofOps */ export interface ProofOps { ops: ProofOp[]; } +export interface ProofOpsProtoMsg { + typeUrl: "/tendermint.crypto.ProofOps"; + value: Uint8Array; +} +/** ProofOps is Merkle proof defined by the list of ProofOps */ +export interface ProofOpsAmino { + ops: ProofOpAmino[]; +} +export interface ProofOpsAminoMsg { + type: "/tendermint.crypto.ProofOps"; + value: ProofOpsAmino; +} function createBaseProof(): Proof { return { total: Long.ZERO, @@ -135,6 +206,43 @@ export const Proof = { message.aunts = object.aunts?.map((e) => e) || []; return message; }, + fromAmino(object: ProofAmino): Proof { + return { + total: Long.fromString(object.total), + index: Long.fromString(object.index), + leafHash: object.leaf_hash, + aunts: Array.isArray(object?.aunts) + ? object.aunts.map((e: any) => e) + : [], + }; + }, + toAmino(message: Proof): ProofAmino { + const obj: any = {}; + obj.total = message.total ? message.total.toString() : undefined; + obj.index = message.index ? message.index.toString() : undefined; + obj.leaf_hash = message.leafHash; + if (message.aunts) { + obj.aunts = message.aunts.map((e) => e); + } else { + obj.aunts = []; + } + return obj; + }, + fromAminoMsg(object: ProofAminoMsg): Proof { + return Proof.fromAmino(object.value); + }, + fromProtoMsg(message: ProofProtoMsg): Proof { + return Proof.decode(message.value); + }, + toProto(message: Proof): Uint8Array { + return Proof.encode(message).finish(); + }, + toProtoMsg(message: Proof): ProofProtoMsg { + return { + typeUrl: "/tendermint.crypto.Proof", + value: Proof.encode(message).finish(), + }; + }, }; function createBaseValueOp(): ValueOp { return { @@ -200,6 +308,33 @@ export const ValueOp = { : undefined; return message; }, + fromAmino(object: ValueOpAmino): ValueOp { + return { + key: object.key, + proof: object?.proof ? Proof.fromAmino(object.proof) : undefined, + }; + }, + toAmino(message: ValueOp): ValueOpAmino { + const obj: any = {}; + obj.key = message.key; + obj.proof = message.proof ? Proof.toAmino(message.proof) : undefined; + return obj; + }, + fromAminoMsg(object: ValueOpAminoMsg): ValueOp { + return ValueOp.fromAmino(object.value); + }, + fromProtoMsg(message: ValueOpProtoMsg): ValueOp { + return ValueOp.decode(message.value); + }, + toProto(message: ValueOp): Uint8Array { + return ValueOp.encode(message).finish(); + }, + toProtoMsg(message: ValueOp): ValueOpProtoMsg { + return { + typeUrl: "/tendermint.crypto.ValueOp", + value: ValueOp.encode(message).finish(), + }; + }, }; function createBaseDominoOp(): DominoOp { return { @@ -268,6 +403,35 @@ export const DominoOp = { message.output = object.output ?? ""; return message; }, + fromAmino(object: DominoOpAmino): DominoOp { + return { + key: object.key, + input: object.input, + output: object.output, + }; + }, + toAmino(message: DominoOp): DominoOpAmino { + const obj: any = {}; + obj.key = message.key; + obj.input = message.input; + obj.output = message.output; + return obj; + }, + fromAminoMsg(object: DominoOpAminoMsg): DominoOp { + return DominoOp.fromAmino(object.value); + }, + fromProtoMsg(message: DominoOpProtoMsg): DominoOp { + return DominoOp.decode(message.value); + }, + toProto(message: DominoOp): Uint8Array { + return DominoOp.encode(message).finish(); + }, + toProtoMsg(message: DominoOp): DominoOpProtoMsg { + return { + typeUrl: "/tendermint.crypto.DominoOp", + value: DominoOp.encode(message).finish(), + }; + }, }; function createBaseProofOp(): ProofOp { return { @@ -344,6 +508,35 @@ export const ProofOp = { message.data = object.data ?? new Uint8Array(); return message; }, + fromAmino(object: ProofOpAmino): ProofOp { + return { + type: object.type, + key: object.key, + data: object.data, + }; + }, + toAmino(message: ProofOp): ProofOpAmino { + const obj: any = {}; + obj.type = message.type; + obj.key = message.key; + obj.data = message.data; + return obj; + }, + fromAminoMsg(object: ProofOpAminoMsg): ProofOp { + return ProofOp.fromAmino(object.value); + }, + fromProtoMsg(message: ProofOpProtoMsg): ProofOp { + return ProofOp.decode(message.value); + }, + toProto(message: ProofOp): Uint8Array { + return ProofOp.encode(message).finish(); + }, + toProtoMsg(message: ProofOp): ProofOpProtoMsg { + return { + typeUrl: "/tendermint.crypto.ProofOp", + value: ProofOp.encode(message).finish(), + }; + }, }; function createBaseProofOps(): ProofOps { return { @@ -398,4 +591,35 @@ export const ProofOps = { message.ops = object.ops?.map((e) => ProofOp.fromPartial(e)) || []; return message; }, + fromAmino(object: ProofOpsAmino): ProofOps { + return { + ops: Array.isArray(object?.ops) + ? object.ops.map((e: any) => ProofOp.fromAmino(e)) + : [], + }; + }, + toAmino(message: ProofOps): ProofOpsAmino { + const obj: any = {}; + if (message.ops) { + obj.ops = message.ops.map((e) => (e ? ProofOp.toAmino(e) : undefined)); + } else { + obj.ops = []; + } + return obj; + }, + fromAminoMsg(object: ProofOpsAminoMsg): ProofOps { + return ProofOps.fromAmino(object.value); + }, + fromProtoMsg(message: ProofOpsProtoMsg): ProofOps { + return ProofOps.decode(message.value); + }, + toProto(message: ProofOps): Uint8Array { + return ProofOps.encode(message).finish(); + }, + toProtoMsg(message: ProofOps): ProofOpsProtoMsg { + return { + typeUrl: "/tendermint.crypto.ProofOps", + value: ProofOps.encode(message).finish(), + }; + }, }; diff --git a/packages/types/src/tendermint/libs/bits/types.ts b/packages/types/src/tendermint/libs/bits/types.ts index 7c95013e6..53ef1aad3 100644 --- a/packages/types/src/tendermint/libs/bits/types.ts +++ b/packages/types/src/tendermint/libs/bits/types.ts @@ -6,6 +6,18 @@ export interface BitArray { bits: Long; elems: Long[]; } +export interface BitArrayProtoMsg { + typeUrl: "/tendermint.libs.bits.BitArray"; + value: Uint8Array; +} +export interface BitArrayAmino { + bits: string; + elems: string[]; +} +export interface BitArrayAminoMsg { + type: "/tendermint.libs.bits.BitArray"; + value: BitArrayAmino; +} function createBaseBitArray(): BitArray { return { bits: Long.ZERO, @@ -82,4 +94,37 @@ export const BitArray = { message.elems = object.elems?.map((e) => Long.fromValue(e)) || []; return message; }, + fromAmino(object: BitArrayAmino): BitArray { + return { + bits: Long.fromString(object.bits), + elems: Array.isArray(object?.elems) + ? object.elems.map((e: any) => e) + : [], + }; + }, + toAmino(message: BitArray): BitArrayAmino { + const obj: any = {}; + obj.bits = message.bits ? message.bits.toString() : undefined; + if (message.elems) { + obj.elems = message.elems.map((e) => e); + } else { + obj.elems = []; + } + return obj; + }, + fromAminoMsg(object: BitArrayAminoMsg): BitArray { + return BitArray.fromAmino(object.value); + }, + fromProtoMsg(message: BitArrayProtoMsg): BitArray { + return BitArray.decode(message.value); + }, + toProto(message: BitArray): Uint8Array { + return BitArray.encode(message).finish(); + }, + toProtoMsg(message: BitArray): BitArrayProtoMsg { + return { + typeUrl: "/tendermint.libs.bits.BitArray", + value: BitArray.encode(message).finish(), + }; + }, }; diff --git a/packages/types/src/tendermint/types/block.ts b/packages/types/src/tendermint/types/block.ts index 2ee198ff6..1a4d0b014 100644 --- a/packages/types/src/tendermint/types/block.ts +++ b/packages/types/src/tendermint/types/block.ts @@ -1,6 +1,13 @@ /* eslint-disable */ -import { Header, Data, Commit } from "./types"; -import { EvidenceList } from "./evidence"; +import { + Header, + HeaderAmino, + Data, + DataAmino, + Commit, + CommitAmino, +} from "./types"; +import { EvidenceList, EvidenceListAmino } from "./evidence"; import * as _m0 from "protobufjs/minimal"; import { isSet, DeepPartial, Exact } from "../../helpers"; export const protobufPackage = "tendermint.types"; @@ -10,6 +17,20 @@ export interface Block { evidence?: EvidenceList; lastCommit?: Commit; } +export interface BlockProtoMsg { + typeUrl: "/tendermint.types.Block"; + value: Uint8Array; +} +export interface BlockAmino { + header?: HeaderAmino; + data?: DataAmino; + evidence?: EvidenceListAmino; + last_commit?: CommitAmino; +} +export interface BlockAminoMsg { + type: "/tendermint.types.Block"; + value: BlockAmino; +} function createBaseBlock(): Block { return { header: undefined, @@ -108,4 +129,43 @@ export const Block = { : undefined; return message; }, + fromAmino(object: BlockAmino): Block { + return { + header: object?.header ? Header.fromAmino(object.header) : undefined, + data: object?.data ? Data.fromAmino(object.data) : undefined, + evidence: object?.evidence + ? EvidenceList.fromAmino(object.evidence) + : undefined, + lastCommit: object?.last_commit + ? Commit.fromAmino(object.last_commit) + : undefined, + }; + }, + toAmino(message: Block): BlockAmino { + const obj: any = {}; + obj.header = message.header ? Header.toAmino(message.header) : undefined; + obj.data = message.data ? Data.toAmino(message.data) : undefined; + obj.evidence = message.evidence + ? EvidenceList.toAmino(message.evidence) + : undefined; + obj.last_commit = message.lastCommit + ? Commit.toAmino(message.lastCommit) + : undefined; + return obj; + }, + fromAminoMsg(object: BlockAminoMsg): Block { + return Block.fromAmino(object.value); + }, + fromProtoMsg(message: BlockProtoMsg): Block { + return Block.decode(message.value); + }, + toProto(message: Block): Uint8Array { + return Block.encode(message).finish(); + }, + toProtoMsg(message: Block): BlockProtoMsg { + return { + typeUrl: "/tendermint.types.Block", + value: Block.encode(message).finish(), + }; + }, }; diff --git a/packages/types/src/tendermint/types/evidence.ts b/packages/types/src/tendermint/types/evidence.ts index 6873daa4d..24368b4c8 100644 --- a/packages/types/src/tendermint/types/evidence.ts +++ b/packages/types/src/tendermint/types/evidence.ts @@ -1,7 +1,7 @@ /* eslint-disable */ -import { Vote, LightBlock } from "./types"; -import { Timestamp } from "../../google/protobuf/timestamp"; -import { Validator } from "./validator"; +import { Vote, VoteAmino, LightBlock, LightBlockAmino } from "./types"; +import { Timestamp, TimestampAmino } from "../../google/protobuf/timestamp"; +import { Validator, ValidatorAmino } from "./validator"; import { Long, isSet, @@ -16,6 +16,18 @@ export interface Evidence { duplicateVoteEvidence?: DuplicateVoteEvidence; lightClientAttackEvidence?: LightClientAttackEvidence; } +export interface EvidenceProtoMsg { + typeUrl: "/tendermint.types.Evidence"; + value: Uint8Array; +} +export interface EvidenceAmino { + duplicate_vote_evidence?: DuplicateVoteEvidenceAmino; + light_client_attack_evidence?: LightClientAttackEvidenceAmino; +} +export interface EvidenceAminoMsg { + type: "/tendermint.types.Evidence"; + value: EvidenceAmino; +} /** DuplicateVoteEvidence contains evidence of a validator signed two conflicting votes. */ export interface DuplicateVoteEvidence { voteA?: Vote; @@ -24,6 +36,22 @@ export interface DuplicateVoteEvidence { validatorPower: Long; timestamp?: Timestamp; } +export interface DuplicateVoteEvidenceProtoMsg { + typeUrl: "/tendermint.types.DuplicateVoteEvidence"; + value: Uint8Array; +} +/** DuplicateVoteEvidence contains evidence of a validator signed two conflicting votes. */ +export interface DuplicateVoteEvidenceAmino { + vote_a?: VoteAmino; + vote_b?: VoteAmino; + total_voting_power: string; + validator_power: string; + timestamp?: TimestampAmino; +} +export interface DuplicateVoteEvidenceAminoMsg { + type: "/tendermint.types.DuplicateVoteEvidence"; + value: DuplicateVoteEvidenceAmino; +} /** LightClientAttackEvidence contains evidence of a set of validators attempting to mislead a light client. */ export interface LightClientAttackEvidence { conflictingBlock?: LightBlock; @@ -32,9 +60,36 @@ export interface LightClientAttackEvidence { totalVotingPower: Long; timestamp?: Timestamp; } +export interface LightClientAttackEvidenceProtoMsg { + typeUrl: "/tendermint.types.LightClientAttackEvidence"; + value: Uint8Array; +} +/** LightClientAttackEvidence contains evidence of a set of validators attempting to mislead a light client. */ +export interface LightClientAttackEvidenceAmino { + conflicting_block?: LightBlockAmino; + common_height: string; + byzantine_validators: ValidatorAmino[]; + total_voting_power: string; + timestamp?: TimestampAmino; +} +export interface LightClientAttackEvidenceAminoMsg { + type: "/tendermint.types.LightClientAttackEvidence"; + value: LightClientAttackEvidenceAmino; +} export interface EvidenceList { evidence: Evidence[]; } +export interface EvidenceListProtoMsg { + typeUrl: "/tendermint.types.EvidenceList"; + value: Uint8Array; +} +export interface EvidenceListAmino { + evidence: EvidenceAmino[]; +} +export interface EvidenceListAminoMsg { + type: "/tendermint.types.EvidenceList"; + value: EvidenceListAmino; +} function createBaseEvidence(): Evidence { return { duplicateVoteEvidence: undefined, @@ -124,6 +179,43 @@ export const Evidence = { : undefined; return message; }, + fromAmino(object: EvidenceAmino): Evidence { + return { + duplicateVoteEvidence: object?.duplicate_vote_evidence + ? DuplicateVoteEvidence.fromAmino(object.duplicate_vote_evidence) + : undefined, + lightClientAttackEvidence: object?.light_client_attack_evidence + ? LightClientAttackEvidence.fromAmino( + object.light_client_attack_evidence + ) + : undefined, + }; + }, + toAmino(message: Evidence): EvidenceAmino { + const obj: any = {}; + obj.duplicate_vote_evidence = message.duplicateVoteEvidence + ? DuplicateVoteEvidence.toAmino(message.duplicateVoteEvidence) + : undefined; + obj.light_client_attack_evidence = message.lightClientAttackEvidence + ? LightClientAttackEvidence.toAmino(message.lightClientAttackEvidence) + : undefined; + return obj; + }, + fromAminoMsg(object: EvidenceAminoMsg): Evidence { + return Evidence.fromAmino(object.value); + }, + fromProtoMsg(message: EvidenceProtoMsg): Evidence { + return Evidence.decode(message.value); + }, + toProto(message: Evidence): Uint8Array { + return Evidence.encode(message).finish(); + }, + toProtoMsg(message: Evidence): EvidenceProtoMsg { + return { + typeUrl: "/tendermint.types.Evidence", + value: Evidence.encode(message).finish(), + }; + }, }; function createBaseDuplicateVoteEvidence(): DuplicateVoteEvidence { return { @@ -245,6 +337,47 @@ export const DuplicateVoteEvidence = { : undefined; return message; }, + fromAmino(object: DuplicateVoteEvidenceAmino): DuplicateVoteEvidence { + return { + voteA: object?.vote_a ? Vote.fromAmino(object.vote_a) : undefined, + voteB: object?.vote_b ? Vote.fromAmino(object.vote_b) : undefined, + totalVotingPower: Long.fromString(object.total_voting_power), + validatorPower: Long.fromString(object.validator_power), + timestamp: object?.timestamp + ? Timestamp.fromAmino(object.timestamp) + : undefined, + }; + }, + toAmino(message: DuplicateVoteEvidence): DuplicateVoteEvidenceAmino { + const obj: any = {}; + obj.vote_a = message.voteA ? Vote.toAmino(message.voteA) : undefined; + obj.vote_b = message.voteB ? Vote.toAmino(message.voteB) : undefined; + obj.total_voting_power = message.totalVotingPower + ? message.totalVotingPower.toString() + : undefined; + obj.validator_power = message.validatorPower + ? message.validatorPower.toString() + : undefined; + obj.timestamp = message.timestamp + ? Timestamp.toAmino(message.timestamp) + : undefined; + return obj; + }, + fromAminoMsg(object: DuplicateVoteEvidenceAminoMsg): DuplicateVoteEvidence { + return DuplicateVoteEvidence.fromAmino(object.value); + }, + fromProtoMsg(message: DuplicateVoteEvidenceProtoMsg): DuplicateVoteEvidence { + return DuplicateVoteEvidence.decode(message.value); + }, + toProto(message: DuplicateVoteEvidence): Uint8Array { + return DuplicateVoteEvidence.encode(message).finish(); + }, + toProtoMsg(message: DuplicateVoteEvidence): DuplicateVoteEvidenceProtoMsg { + return { + typeUrl: "/tendermint.types.DuplicateVoteEvidence", + value: DuplicateVoteEvidence.encode(message).finish(), + }; + }, }; function createBaseLightClientAttackEvidence(): LightClientAttackEvidence { return { @@ -380,6 +513,65 @@ export const LightClientAttackEvidence = { : undefined; return message; }, + fromAmino(object: LightClientAttackEvidenceAmino): LightClientAttackEvidence { + return { + conflictingBlock: object?.conflicting_block + ? LightBlock.fromAmino(object.conflicting_block) + : undefined, + commonHeight: Long.fromString(object.common_height), + byzantineValidators: Array.isArray(object?.byzantine_validators) + ? object.byzantine_validators.map((e: any) => Validator.fromAmino(e)) + : [], + totalVotingPower: Long.fromString(object.total_voting_power), + timestamp: object?.timestamp + ? Timestamp.fromAmino(object.timestamp) + : undefined, + }; + }, + toAmino(message: LightClientAttackEvidence): LightClientAttackEvidenceAmino { + const obj: any = {}; + obj.conflicting_block = message.conflictingBlock + ? LightBlock.toAmino(message.conflictingBlock) + : undefined; + obj.common_height = message.commonHeight + ? message.commonHeight.toString() + : undefined; + if (message.byzantineValidators) { + obj.byzantine_validators = message.byzantineValidators.map((e) => + e ? Validator.toAmino(e) : undefined + ); + } else { + obj.byzantine_validators = []; + } + obj.total_voting_power = message.totalVotingPower + ? message.totalVotingPower.toString() + : undefined; + obj.timestamp = message.timestamp + ? Timestamp.toAmino(message.timestamp) + : undefined; + return obj; + }, + fromAminoMsg( + object: LightClientAttackEvidenceAminoMsg + ): LightClientAttackEvidence { + return LightClientAttackEvidence.fromAmino(object.value); + }, + fromProtoMsg( + message: LightClientAttackEvidenceProtoMsg + ): LightClientAttackEvidence { + return LightClientAttackEvidence.decode(message.value); + }, + toProto(message: LightClientAttackEvidence): Uint8Array { + return LightClientAttackEvidence.encode(message).finish(); + }, + toProtoMsg( + message: LightClientAttackEvidence + ): LightClientAttackEvidenceProtoMsg { + return { + typeUrl: "/tendermint.types.LightClientAttackEvidence", + value: LightClientAttackEvidence.encode(message).finish(), + }; + }, }; function createBaseEvidenceList(): EvidenceList { return { @@ -439,4 +631,37 @@ export const EvidenceList = { object.evidence?.map((e) => Evidence.fromPartial(e)) || []; return message; }, + fromAmino(object: EvidenceListAmino): EvidenceList { + return { + evidence: Array.isArray(object?.evidence) + ? object.evidence.map((e: any) => Evidence.fromAmino(e)) + : [], + }; + }, + toAmino(message: EvidenceList): EvidenceListAmino { + const obj: any = {}; + if (message.evidence) { + obj.evidence = message.evidence.map((e) => + e ? Evidence.toAmino(e) : undefined + ); + } else { + obj.evidence = []; + } + return obj; + }, + fromAminoMsg(object: EvidenceListAminoMsg): EvidenceList { + return EvidenceList.fromAmino(object.value); + }, + fromProtoMsg(message: EvidenceListProtoMsg): EvidenceList { + return EvidenceList.decode(message.value); + }, + toProto(message: EvidenceList): Uint8Array { + return EvidenceList.encode(message).finish(); + }, + toProtoMsg(message: EvidenceList): EvidenceListProtoMsg { + return { + typeUrl: "/tendermint.types.EvidenceList", + value: EvidenceList.encode(message).finish(), + }; + }, }; diff --git a/packages/types/src/tendermint/types/params.ts b/packages/types/src/tendermint/types/params.ts index 06d1e1af8..abe31b989 100644 --- a/packages/types/src/tendermint/types/params.ts +++ b/packages/types/src/tendermint/types/params.ts @@ -1,5 +1,5 @@ /* eslint-disable */ -import { Duration } from "../../google/protobuf/duration"; +import { Duration, DurationAmino } from "../../google/protobuf/duration"; import { Long, isSet, DeepPartial, Exact } from "../../helpers"; import * as _m0 from "protobufjs/minimal"; export const protobufPackage = "tendermint.types"; @@ -13,6 +13,24 @@ export interface ConsensusParams { validator?: ValidatorParams; version?: VersionParams; } +export interface ConsensusParamsProtoMsg { + typeUrl: "/tendermint.types.ConsensusParams"; + value: Uint8Array; +} +/** + * ConsensusParams contains consensus critical parameters that determine the + * validity of blocks. + */ +export interface ConsensusParamsAmino { + block?: BlockParamsAmino; + evidence?: EvidenceParamsAmino; + validator?: ValidatorParamsAmino; + version?: VersionParamsAmino; +} +export interface ConsensusParamsAminoMsg { + type: "/tendermint.types.ConsensusParams"; + value: ConsensusParamsAmino; +} /** BlockParams contains limits on the block size. */ export interface BlockParams { /** @@ -25,13 +43,27 @@ export interface BlockParams { * Note: must be greater or equal to -1 */ maxGas: Long; +} +export interface BlockParamsProtoMsg { + typeUrl: "/tendermint.types.BlockParams"; + value: Uint8Array; +} +/** BlockParams contains limits on the block size. */ +export interface BlockParamsAmino { /** - * Minimum time increment between consecutive blocks (in milliseconds) If the - * block header timestamp is ahead of the system clock, decrease this value. - * - * Not exposed to the application. + * Max block size, in bytes. + * Note: must be greater than 0 */ - timeIotaMs: Long; + max_bytes: string; + /** + * Max gas per block. + * Note: must be greater or equal to -1 + */ + max_gas: string; +} +export interface BlockParamsAminoMsg { + type: "/tendermint.types.BlockParams"; + value: BlockParamsAmino; } /** EvidenceParams determine how we handle evidence of malfeasance. */ export interface EvidenceParams { @@ -57,6 +89,38 @@ export interface EvidenceParams { */ maxBytes: Long; } +export interface EvidenceParamsProtoMsg { + typeUrl: "/tendermint.types.EvidenceParams"; + value: Uint8Array; +} +/** EvidenceParams determine how we handle evidence of malfeasance. */ +export interface EvidenceParamsAmino { + /** + * Max age of evidence, in blocks. + * + * The basic formula for calculating this is: MaxAgeDuration / {average block + * time}. + */ + max_age_num_blocks: string; + /** + * Max age of evidence, in time. + * + * It should correspond with an app's "unbonding period" or other similar + * mechanism for handling [Nothing-At-Stake + * attacks](https://github.com/ethereum/wiki/wiki/Proof-of-Stake-FAQ#what-is-the-nothing-at-stake-problem-and-how-can-it-be-fixed). + */ + max_age_duration?: DurationAmino; + /** + * This sets the maximum size of total evidence in bytes that can be committed in a single block. + * and should fall comfortably under the max block bytes. + * Default is 1048576 or 1MB + */ + max_bytes: string; +} +export interface EvidenceParamsAminoMsg { + type: "/tendermint.types.EvidenceParams"; + value: EvidenceParamsAmino; +} /** * ValidatorParams restrict the public key types validators can use. * NOTE: uses ABCI pubkey naming, not Amino names. @@ -64,9 +128,36 @@ export interface EvidenceParams { export interface ValidatorParams { pubKeyTypes: string[]; } +export interface ValidatorParamsProtoMsg { + typeUrl: "/tendermint.types.ValidatorParams"; + value: Uint8Array; +} +/** + * ValidatorParams restrict the public key types validators can use. + * NOTE: uses ABCI pubkey naming, not Amino names. + */ +export interface ValidatorParamsAmino { + pub_key_types: string[]; +} +export interface ValidatorParamsAminoMsg { + type: "/tendermint.types.ValidatorParams"; + value: ValidatorParamsAmino; +} /** VersionParams contains the ABCI application version. */ export interface VersionParams { - appVersion: Long; + app: Long; +} +export interface VersionParamsProtoMsg { + typeUrl: "/tendermint.types.VersionParams"; + value: Uint8Array; +} +/** VersionParams contains the ABCI application version. */ +export interface VersionParamsAmino { + app: string; +} +export interface VersionParamsAminoMsg { + type: "/tendermint.types.VersionParams"; + value: VersionParamsAmino; } /** * HashedParams is a subset of ConsensusParams. @@ -77,6 +168,23 @@ export interface HashedParams { blockMaxBytes: Long; blockMaxGas: Long; } +export interface HashedParamsProtoMsg { + typeUrl: "/tendermint.types.HashedParams"; + value: Uint8Array; +} +/** + * HashedParams is a subset of ConsensusParams. + * + * It is hashed into the Header.ConsensusHash. + */ +export interface HashedParamsAmino { + block_max_bytes: string; + block_max_gas: string; +} +export interface HashedParamsAminoMsg { + type: "/tendermint.types.HashedParams"; + value: HashedParamsAmino; +} function createBaseConsensusParams(): ConsensusParams { return { block: undefined, @@ -194,12 +302,54 @@ export const ConsensusParams = { : undefined; return message; }, + fromAmino(object: ConsensusParamsAmino): ConsensusParams { + return { + block: object?.block ? BlockParams.fromAmino(object.block) : undefined, + evidence: object?.evidence + ? EvidenceParams.fromAmino(object.evidence) + : undefined, + validator: object?.validator + ? ValidatorParams.fromAmino(object.validator) + : undefined, + version: object?.version + ? VersionParams.fromAmino(object.version) + : undefined, + }; + }, + toAmino(message: ConsensusParams): ConsensusParamsAmino { + const obj: any = {}; + obj.block = message.block ? BlockParams.toAmino(message.block) : undefined; + obj.evidence = message.evidence + ? EvidenceParams.toAmino(message.evidence) + : undefined; + obj.validator = message.validator + ? ValidatorParams.toAmino(message.validator) + : undefined; + obj.version = message.version + ? VersionParams.toAmino(message.version) + : undefined; + return obj; + }, + fromAminoMsg(object: ConsensusParamsAminoMsg): ConsensusParams { + return ConsensusParams.fromAmino(object.value); + }, + fromProtoMsg(message: ConsensusParamsProtoMsg): ConsensusParams { + return ConsensusParams.decode(message.value); + }, + toProto(message: ConsensusParams): Uint8Array { + return ConsensusParams.encode(message).finish(); + }, + toProtoMsg(message: ConsensusParams): ConsensusParamsProtoMsg { + return { + typeUrl: "/tendermint.types.ConsensusParams", + value: ConsensusParams.encode(message).finish(), + }; + }, }; function createBaseBlockParams(): BlockParams { return { maxBytes: Long.ZERO, maxGas: Long.ZERO, - timeIotaMs: Long.ZERO, }; } export const BlockParams = { @@ -213,9 +363,6 @@ export const BlockParams = { if (!message.maxGas.isZero()) { writer.uint32(16).int64(message.maxGas); } - if (!message.timeIotaMs.isZero()) { - writer.uint32(24).int64(message.timeIotaMs); - } return writer; }, decode(input: _m0.Reader | Uint8Array, length?: number): BlockParams { @@ -231,9 +378,6 @@ export const BlockParams = { case 2: message.maxGas = reader.int64() as Long; break; - case 3: - message.timeIotaMs = reader.int64() as Long; - break; default: reader.skipType(tag & 7); break; @@ -247,9 +391,6 @@ export const BlockParams = { ? Long.fromValue(object.maxBytes) : Long.ZERO, maxGas: isSet(object.maxGas) ? Long.fromValue(object.maxGas) : Long.ZERO, - timeIotaMs: isSet(object.timeIotaMs) - ? Long.fromValue(object.timeIotaMs) - : Long.ZERO, }; }, toJSON(message: BlockParams): unknown { @@ -258,8 +399,6 @@ export const BlockParams = { (obj.maxBytes = (message.maxBytes || Long.ZERO).toString()); message.maxGas !== undefined && (obj.maxGas = (message.maxGas || Long.ZERO).toString()); - message.timeIotaMs !== undefined && - (obj.timeIotaMs = (message.timeIotaMs || Long.ZERO).toString()); return obj; }, fromPartial, I>>( @@ -274,12 +413,35 @@ export const BlockParams = { object.maxGas !== undefined && object.maxGas !== null ? Long.fromValue(object.maxGas) : Long.ZERO; - message.timeIotaMs = - object.timeIotaMs !== undefined && object.timeIotaMs !== null - ? Long.fromValue(object.timeIotaMs) - : Long.ZERO; return message; }, + fromAmino(object: BlockParamsAmino): BlockParams { + return { + maxBytes: Long.fromString(object.max_bytes), + maxGas: Long.fromString(object.max_gas), + }; + }, + toAmino(message: BlockParams): BlockParamsAmino { + const obj: any = {}; + obj.max_bytes = message.maxBytes ? message.maxBytes.toString() : undefined; + obj.max_gas = message.maxGas ? message.maxGas.toString() : undefined; + return obj; + }, + fromAminoMsg(object: BlockParamsAminoMsg): BlockParams { + return BlockParams.fromAmino(object.value); + }, + fromProtoMsg(message: BlockParamsProtoMsg): BlockParams { + return BlockParams.decode(message.value); + }, + toProto(message: BlockParams): Uint8Array { + return BlockParams.encode(message).finish(); + }, + toProtoMsg(message: BlockParams): BlockParamsProtoMsg { + return { + typeUrl: "/tendermint.types.BlockParams", + value: BlockParams.encode(message).finish(), + }; + }, }; function createBaseEvidenceParams(): EvidenceParams { return { @@ -373,6 +535,41 @@ export const EvidenceParams = { : Long.ZERO; return message; }, + fromAmino(object: EvidenceParamsAmino): EvidenceParams { + return { + maxAgeNumBlocks: Long.fromString(object.max_age_num_blocks), + maxAgeDuration: object?.max_age_duration + ? Duration.fromAmino(object.max_age_duration) + : undefined, + maxBytes: Long.fromString(object.max_bytes), + }; + }, + toAmino(message: EvidenceParams): EvidenceParamsAmino { + const obj: any = {}; + obj.max_age_num_blocks = message.maxAgeNumBlocks + ? message.maxAgeNumBlocks.toString() + : undefined; + obj.max_age_duration = message.maxAgeDuration + ? Duration.toAmino(message.maxAgeDuration) + : undefined; + obj.max_bytes = message.maxBytes ? message.maxBytes.toString() : undefined; + return obj; + }, + fromAminoMsg(object: EvidenceParamsAminoMsg): EvidenceParams { + return EvidenceParams.fromAmino(object.value); + }, + fromProtoMsg(message: EvidenceParamsProtoMsg): EvidenceParams { + return EvidenceParams.decode(message.value); + }, + toProto(message: EvidenceParams): Uint8Array { + return EvidenceParams.encode(message).finish(); + }, + toProtoMsg(message: EvidenceParams): EvidenceParamsProtoMsg { + return { + typeUrl: "/tendermint.types.EvidenceParams", + value: EvidenceParams.encode(message).finish(), + }; + }, }; function createBaseValidatorParams(): ValidatorParams { return { @@ -429,10 +626,41 @@ export const ValidatorParams = { message.pubKeyTypes = object.pubKeyTypes?.map((e) => e) || []; return message; }, + fromAmino(object: ValidatorParamsAmino): ValidatorParams { + return { + pubKeyTypes: Array.isArray(object?.pub_key_types) + ? object.pub_key_types.map((e: any) => e) + : [], + }; + }, + toAmino(message: ValidatorParams): ValidatorParamsAmino { + const obj: any = {}; + if (message.pubKeyTypes) { + obj.pub_key_types = message.pubKeyTypes.map((e) => e); + } else { + obj.pub_key_types = []; + } + return obj; + }, + fromAminoMsg(object: ValidatorParamsAminoMsg): ValidatorParams { + return ValidatorParams.fromAmino(object.value); + }, + fromProtoMsg(message: ValidatorParamsProtoMsg): ValidatorParams { + return ValidatorParams.decode(message.value); + }, + toProto(message: ValidatorParams): Uint8Array { + return ValidatorParams.encode(message).finish(); + }, + toProtoMsg(message: ValidatorParams): ValidatorParamsProtoMsg { + return { + typeUrl: "/tendermint.types.ValidatorParams", + value: ValidatorParams.encode(message).finish(), + }; + }, }; function createBaseVersionParams(): VersionParams { return { - appVersion: Long.UZERO, + app: Long.UZERO, }; } export const VersionParams = { @@ -440,8 +668,8 @@ export const VersionParams = { message: VersionParams, writer: _m0.Writer = _m0.Writer.create() ): _m0.Writer { - if (!message.appVersion.isZero()) { - writer.uint32(8).uint64(message.appVersion); + if (!message.app.isZero()) { + writer.uint32(8).uint64(message.app); } return writer; }, @@ -453,7 +681,7 @@ export const VersionParams = { const tag = reader.uint32(); switch (tag >>> 3) { case 1: - message.appVersion = reader.uint64() as Long; + message.app = reader.uint64() as Long; break; default: reader.skipType(tag & 7); @@ -464,27 +692,50 @@ export const VersionParams = { }, fromJSON(object: any): VersionParams { return { - appVersion: isSet(object.appVersion) - ? Long.fromValue(object.appVersion) - : Long.UZERO, + app: isSet(object.app) ? Long.fromValue(object.app) : Long.UZERO, }; }, toJSON(message: VersionParams): unknown { const obj: any = {}; - message.appVersion !== undefined && - (obj.appVersion = (message.appVersion || Long.UZERO).toString()); + message.app !== undefined && + (obj.app = (message.app || Long.UZERO).toString()); return obj; }, fromPartial, I>>( object: I ): VersionParams { const message = createBaseVersionParams(); - message.appVersion = - object.appVersion !== undefined && object.appVersion !== null - ? Long.fromValue(object.appVersion) + message.app = + object.app !== undefined && object.app !== null + ? Long.fromValue(object.app) : Long.UZERO; return message; }, + fromAmino(object: VersionParamsAmino): VersionParams { + return { + app: Long.fromString(object.app), + }; + }, + toAmino(message: VersionParams): VersionParamsAmino { + const obj: any = {}; + obj.app = message.app ? message.app.toString() : undefined; + return obj; + }, + fromAminoMsg(object: VersionParamsAminoMsg): VersionParams { + return VersionParams.fromAmino(object.value); + }, + fromProtoMsg(message: VersionParamsProtoMsg): VersionParams { + return VersionParams.decode(message.value); + }, + toProto(message: VersionParams): Uint8Array { + return VersionParams.encode(message).finish(); + }, + toProtoMsg(message: VersionParams): VersionParamsProtoMsg { + return { + typeUrl: "/tendermint.types.VersionParams", + value: VersionParams.encode(message).finish(), + }; + }, }; function createBaseHashedParams(): HashedParams { return { @@ -557,4 +808,35 @@ export const HashedParams = { : Long.ZERO; return message; }, + fromAmino(object: HashedParamsAmino): HashedParams { + return { + blockMaxBytes: Long.fromString(object.block_max_bytes), + blockMaxGas: Long.fromString(object.block_max_gas), + }; + }, + toAmino(message: HashedParams): HashedParamsAmino { + const obj: any = {}; + obj.block_max_bytes = message.blockMaxBytes + ? message.blockMaxBytes.toString() + : undefined; + obj.block_max_gas = message.blockMaxGas + ? message.blockMaxGas.toString() + : undefined; + return obj; + }, + fromAminoMsg(object: HashedParamsAminoMsg): HashedParams { + return HashedParams.fromAmino(object.value); + }, + fromProtoMsg(message: HashedParamsProtoMsg): HashedParams { + return HashedParams.decode(message.value); + }, + toProto(message: HashedParams): Uint8Array { + return HashedParams.encode(message).finish(); + }, + toProtoMsg(message: HashedParams): HashedParamsProtoMsg { + return { + typeUrl: "/tendermint.types.HashedParams", + value: HashedParams.encode(message).finish(), + }; + }, }; diff --git a/packages/types/src/tendermint/types/types.ts b/packages/types/src/tendermint/types/types.ts index 6dbb29b8b..b81561a68 100644 --- a/packages/types/src/tendermint/types/types.ts +++ b/packages/types/src/tendermint/types/types.ts @@ -1,8 +1,8 @@ /* eslint-disable */ -import { Proof } from "../crypto/proof"; -import { Consensus } from "../version/types"; -import { Timestamp } from "../../google/protobuf/timestamp"; -import { ValidatorSet } from "./validator"; +import { Proof, ProofAmino } from "../crypto/proof"; +import { Consensus, ConsensusAmino } from "../version/types"; +import { Timestamp, TimestampAmino } from "../../google/protobuf/timestamp"; +import { ValidatorSet, ValidatorSetAmino } from "./validator"; import { Long, isSet, @@ -23,6 +23,7 @@ export enum BlockIDFlag { BLOCK_ID_FLAG_NIL = 3, UNRECOGNIZED = -1, } +export const BlockIDFlagAmino = BlockIDFlag; export function blockIDFlagFromJSON(object: any): BlockIDFlag { switch (object) { case 0: @@ -68,6 +69,7 @@ export enum SignedMsgType { SIGNED_MSG_TYPE_PROPOSAL = 32, UNRECOGNIZED = -1, } +export const SignedMsgTypeAmino = SignedMsgType; export function signedMsgTypeFromJSON(object: any): SignedMsgType { switch (object) { case 0: @@ -108,17 +110,56 @@ export interface PartSetHeader { total: number; hash: Uint8Array; } +export interface PartSetHeaderProtoMsg { + typeUrl: "/tendermint.types.PartSetHeader"; + value: Uint8Array; +} +/** PartsetHeader */ +export interface PartSetHeaderAmino { + total: number; + hash: Uint8Array; +} +export interface PartSetHeaderAminoMsg { + type: "/tendermint.types.PartSetHeader"; + value: PartSetHeaderAmino; +} export interface Part { index: number; bytes: Uint8Array; proof?: Proof; } +export interface PartProtoMsg { + typeUrl: "/tendermint.types.Part"; + value: Uint8Array; +} +export interface PartAmino { + index: number; + bytes: Uint8Array; + proof?: ProofAmino; +} +export interface PartAminoMsg { + type: "/tendermint.types.Part"; + value: PartAmino; +} /** BlockID */ export interface BlockID { hash: Uint8Array; partSetHeader?: PartSetHeader; } -/** Header defines the structure of a Tendermint block header. */ +export interface BlockIDProtoMsg { + typeUrl: "/tendermint.types.BlockID"; + value: Uint8Array; +} +/** BlockID */ +export interface BlockIDAmino { + hash: Uint8Array; + part_set_header?: PartSetHeaderAmino; +} +export interface BlockIDAminoMsg { + type: "/tendermint.types.BlockID"; + value: BlockIDAmino; +} +/** Header defines the structure of a block header. */ export interface Header { /** basic block info */ version?: Consensus; @@ -144,6 +185,40 @@ export interface Header { /** original proposer of the block */ proposerAddress: Uint8Array; } +export interface HeaderProtoMsg { + typeUrl: "/tendermint.types.Header"; + value: Uint8Array; +} +/** Header defines the structure of a block header. */ +export interface HeaderAmino { + /** basic block info */ + version?: ConsensusAmino; + chain_id: string; + height: string; + time?: TimestampAmino; + /** prev block info */ + last_block_id?: BlockIDAmino; + /** hashes of block data */ + last_commit_hash: Uint8Array; + data_hash: Uint8Array; + /** hashes from the app output from the prev block */ + validators_hash: Uint8Array; + /** validators for the next block */ + next_validators_hash: Uint8Array; + /** consensus params for current block */ + consensus_hash: Uint8Array; + /** state after txs from the previous block */ + app_hash: Uint8Array; + last_results_hash: Uint8Array; + /** consensus info */ + evidence_hash: Uint8Array; + /** original proposer of the block */ + proposer_address: Uint8Array; +} +export interface HeaderAminoMsg { + type: "/tendermint.types.Header"; + value: HeaderAmino; +} /** Data contains the set of transactions included in the block */ export interface Data { /** @@ -153,6 +228,23 @@ export interface Data { */ txs: Uint8Array[]; } +export interface DataProtoMsg { + typeUrl: "/tendermint.types.Data"; + value: Uint8Array; +} +/** Data contains the set of transactions included in the block */ +export interface DataAmino { + /** + * Txs that will be applied by state @ block.Height+1. + * NOTE: not all txs here are valid. We're just agreeing on the order first. + * This means that block.AppHash does not include these txs. + */ + txs: Uint8Array[]; +} +export interface DataAminoMsg { + type: "/tendermint.types.Data"; + value: DataAmino; +} /** * Vote represents a prevote, precommit, or commit vote from validators for * consensus. @@ -161,13 +253,34 @@ export interface Vote { type: SignedMsgType; height: Long; round: number; - /** zero if vote is nil. */ blockId?: BlockID; timestamp?: Timestamp; validatorAddress: Uint8Array; validatorIndex: number; signature: Uint8Array; } +export interface VoteProtoMsg { + typeUrl: "/tendermint.types.Vote"; + value: Uint8Array; +} +/** + * Vote represents a prevote, precommit, or commit vote from validators for + * consensus. + */ +export interface VoteAmino { + type: SignedMsgType; + height: string; + round: number; + block_id?: BlockIDAmino; + timestamp?: TimestampAmino; + validator_address: Uint8Array; + validator_index: number; + signature: Uint8Array; +} +export interface VoteAminoMsg { + type: "/tendermint.types.Vote"; + value: VoteAmino; +} /** Commit contains the evidence that a block was committed by a set of validators. */ export interface Commit { height: Long; @@ -175,6 +288,21 @@ export interface Commit { blockId?: BlockID; signatures: CommitSig[]; } +export interface CommitProtoMsg { + typeUrl: "/tendermint.types.Commit"; + value: Uint8Array; +} +/** Commit contains the evidence that a block was committed by a set of validators. */ +export interface CommitAmino { + height: string; + round: number; + block_id?: BlockIDAmino; + signatures: CommitSigAmino[]; +} +export interface CommitAminoMsg { + type: "/tendermint.types.Commit"; + value: CommitAmino; +} /** CommitSig is a part of the Vote included in a Commit. */ export interface CommitSig { blockIdFlag: BlockIDFlag; @@ -182,6 +310,21 @@ export interface CommitSig { timestamp?: Timestamp; signature: Uint8Array; } +export interface CommitSigProtoMsg { + typeUrl: "/tendermint.types.CommitSig"; + value: Uint8Array; +} +/** CommitSig is a part of the Vote included in a Commit. */ +export interface CommitSigAmino { + block_id_flag: BlockIDFlag; + validator_address: Uint8Array; + timestamp?: TimestampAmino; + signature: Uint8Array; +} +export interface CommitSigAminoMsg { + type: "/tendermint.types.CommitSig"; + value: CommitSigAmino; +} export interface Proposal { type: SignedMsgType; height: Long; @@ -191,26 +334,95 @@ export interface Proposal { timestamp?: Timestamp; signature: Uint8Array; } +export interface ProposalProtoMsg { + typeUrl: "/tendermint.types.Proposal"; + value: Uint8Array; +} +export interface ProposalAmino { + type: SignedMsgType; + height: string; + round: number; + pol_round: number; + block_id?: BlockIDAmino; + timestamp?: TimestampAmino; + signature: Uint8Array; +} +export interface ProposalAminoMsg { + type: "/tendermint.types.Proposal"; + value: ProposalAmino; +} export interface SignedHeader { header?: Header; commit?: Commit; } +export interface SignedHeaderProtoMsg { + typeUrl: "/tendermint.types.SignedHeader"; + value: Uint8Array; +} +export interface SignedHeaderAmino { + header?: HeaderAmino; + commit?: CommitAmino; +} +export interface SignedHeaderAminoMsg { + type: "/tendermint.types.SignedHeader"; + value: SignedHeaderAmino; +} export interface LightBlock { signedHeader?: SignedHeader; validatorSet?: ValidatorSet; } +export interface LightBlockProtoMsg { + typeUrl: "/tendermint.types.LightBlock"; + value: Uint8Array; +} +export interface LightBlockAmino { + signed_header?: SignedHeaderAmino; + validator_set?: ValidatorSetAmino; +} +export interface LightBlockAminoMsg { + type: "/tendermint.types.LightBlock"; + value: LightBlockAmino; +} export interface BlockMeta { blockId?: BlockID; blockSize: Long; header?: Header; numTxs: Long; } +export interface BlockMetaProtoMsg { + typeUrl: "/tendermint.types.BlockMeta"; + value: Uint8Array; +} +export interface BlockMetaAmino { + block_id?: BlockIDAmino; + block_size: string; + header?: HeaderAmino; + num_txs: string; +} +export interface BlockMetaAminoMsg { + type: "/tendermint.types.BlockMeta"; + value: BlockMetaAmino; +} /** TxProof represents a Merkle proof of the presence of a transaction in the Merkle tree. */ export interface TxProof { rootHash: Uint8Array; data: Uint8Array; proof?: Proof; } +export interface TxProofProtoMsg { + typeUrl: "/tendermint.types.TxProof"; + value: Uint8Array; +} +/** TxProof represents a Merkle proof of the presence of a transaction in the Merkle tree. */ +export interface TxProofAmino { + root_hash: Uint8Array; + data: Uint8Array; + proof?: ProofAmino; +} +export interface TxProofAminoMsg { + type: "/tendermint.types.TxProof"; + value: TxProofAmino; +} function createBasePartSetHeader(): PartSetHeader { return { total: 0, @@ -275,6 +487,33 @@ export const PartSetHeader = { message.hash = object.hash ?? new Uint8Array(); return message; }, + fromAmino(object: PartSetHeaderAmino): PartSetHeader { + return { + total: object.total, + hash: object.hash, + }; + }, + toAmino(message: PartSetHeader): PartSetHeaderAmino { + const obj: any = {}; + obj.total = message.total; + obj.hash = message.hash; + return obj; + }, + fromAminoMsg(object: PartSetHeaderAminoMsg): PartSetHeader { + return PartSetHeader.fromAmino(object.value); + }, + fromProtoMsg(message: PartSetHeaderProtoMsg): PartSetHeader { + return PartSetHeader.decode(message.value); + }, + toProto(message: PartSetHeader): Uint8Array { + return PartSetHeader.encode(message).finish(); + }, + toProtoMsg(message: PartSetHeader): PartSetHeaderProtoMsg { + return { + typeUrl: "/tendermint.types.PartSetHeader", + value: PartSetHeader.encode(message).finish(), + }; + }, }; function createBasePart(): Part { return { @@ -349,6 +588,35 @@ export const Part = { : undefined; return message; }, + fromAmino(object: PartAmino): Part { + return { + index: object.index, + bytes: object.bytes, + proof: object?.proof ? Proof.fromAmino(object.proof) : undefined, + }; + }, + toAmino(message: Part): PartAmino { + const obj: any = {}; + obj.index = message.index; + obj.bytes = message.bytes; + obj.proof = message.proof ? Proof.toAmino(message.proof) : undefined; + return obj; + }, + fromAminoMsg(object: PartAminoMsg): Part { + return Part.fromAmino(object.value); + }, + fromProtoMsg(message: PartProtoMsg): Part { + return Part.decode(message.value); + }, + toProto(message: Part): Uint8Array { + return Part.encode(message).finish(); + }, + toProtoMsg(message: Part): PartProtoMsg { + return { + typeUrl: "/tendermint.types.Part", + value: Part.encode(message).finish(), + }; + }, }; function createBaseBlockID(): BlockID { return { @@ -423,6 +691,37 @@ export const BlockID = { : undefined; return message; }, + fromAmino(object: BlockIDAmino): BlockID { + return { + hash: object.hash, + partSetHeader: object?.part_set_header + ? PartSetHeader.fromAmino(object.part_set_header) + : undefined, + }; + }, + toAmino(message: BlockID): BlockIDAmino { + const obj: any = {}; + obj.hash = message.hash; + obj.part_set_header = message.partSetHeader + ? PartSetHeader.toAmino(message.partSetHeader) + : undefined; + return obj; + }, + fromAminoMsg(object: BlockIDAminoMsg): BlockID { + return BlockID.fromAmino(object.value); + }, + fromProtoMsg(message: BlockIDProtoMsg): BlockID { + return BlockID.decode(message.value); + }, + toProto(message: BlockID): Uint8Array { + return BlockID.encode(message).finish(); + }, + toProtoMsg(message: BlockID): BlockIDProtoMsg { + return { + typeUrl: "/tendermint.types.BlockID", + value: BlockID.encode(message).finish(), + }; + }, }; function createBaseHeader(): Header { return { @@ -684,6 +983,65 @@ export const Header = { message.proposerAddress = object.proposerAddress ?? new Uint8Array(); return message; }, + fromAmino(object: HeaderAmino): Header { + return { + version: object?.version + ? Consensus.fromAmino(object.version) + : undefined, + chainId: object.chain_id, + height: Long.fromString(object.height), + time: object?.time ? Timestamp.fromAmino(object.time) : undefined, + lastBlockId: object?.last_block_id + ? BlockID.fromAmino(object.last_block_id) + : undefined, + lastCommitHash: object.last_commit_hash, + dataHash: object.data_hash, + validatorsHash: object.validators_hash, + nextValidatorsHash: object.next_validators_hash, + consensusHash: object.consensus_hash, + appHash: object.app_hash, + lastResultsHash: object.last_results_hash, + evidenceHash: object.evidence_hash, + proposerAddress: object.proposer_address, + }; + }, + toAmino(message: Header): HeaderAmino { + const obj: any = {}; + obj.version = message.version + ? Consensus.toAmino(message.version) + : undefined; + obj.chain_id = message.chainId; + obj.height = message.height ? message.height.toString() : undefined; + obj.time = message.time ? Timestamp.toAmino(message.time) : undefined; + obj.last_block_id = message.lastBlockId + ? BlockID.toAmino(message.lastBlockId) + : undefined; + obj.last_commit_hash = message.lastCommitHash; + obj.data_hash = message.dataHash; + obj.validators_hash = message.validatorsHash; + obj.next_validators_hash = message.nextValidatorsHash; + obj.consensus_hash = message.consensusHash; + obj.app_hash = message.appHash; + obj.last_results_hash = message.lastResultsHash; + obj.evidence_hash = message.evidenceHash; + obj.proposer_address = message.proposerAddress; + return obj; + }, + fromAminoMsg(object: HeaderAminoMsg): Header { + return Header.fromAmino(object.value); + }, + fromProtoMsg(message: HeaderProtoMsg): Header { + return Header.decode(message.value); + }, + toProto(message: Header): Uint8Array { + return Header.encode(message).finish(); + }, + toProtoMsg(message: Header): HeaderProtoMsg { + return { + typeUrl: "/tendermint.types.Header", + value: Header.encode(message).finish(), + }; + }, }; function createBaseData(): Data { return { @@ -737,6 +1095,35 @@ export const Data = { message.txs = object.txs?.map((e) => e) || []; return message; }, + fromAmino(object: DataAmino): Data { + return { + txs: Array.isArray(object?.txs) ? object.txs.map((e: any) => e) : [], + }; + }, + toAmino(message: Data): DataAmino { + const obj: any = {}; + if (message.txs) { + obj.txs = message.txs.map((e) => e); + } else { + obj.txs = []; + } + return obj; + }, + fromAminoMsg(object: DataAminoMsg): Data { + return Data.fromAmino(object.value); + }, + fromProtoMsg(message: DataProtoMsg): Data { + return Data.decode(message.value); + }, + toProto(message: Data): Uint8Array { + return Data.encode(message).finish(); + }, + toProtoMsg(message: Data): DataProtoMsg { + return { + typeUrl: "/tendermint.types.Data", + value: Data.encode(message).finish(), + }; + }, }; function createBaseVote(): Vote { return { @@ -886,6 +1273,53 @@ export const Vote = { message.signature = object.signature ?? new Uint8Array(); return message; }, + fromAmino(object: VoteAmino): Vote { + return { + type: isSet(object.type) ? signedMsgTypeFromJSON(object.type) : 0, + height: Long.fromString(object.height), + round: object.round, + blockId: object?.block_id + ? BlockID.fromAmino(object.block_id) + : undefined, + timestamp: object?.timestamp + ? Timestamp.fromAmino(object.timestamp) + : undefined, + validatorAddress: object.validator_address, + validatorIndex: object.validator_index, + signature: object.signature, + }; + }, + toAmino(message: Vote): VoteAmino { + const obj: any = {}; + obj.type = message.type; + obj.height = message.height ? message.height.toString() : undefined; + obj.round = message.round; + obj.block_id = message.blockId + ? BlockID.toAmino(message.blockId) + : undefined; + obj.timestamp = message.timestamp + ? Timestamp.toAmino(message.timestamp) + : undefined; + obj.validator_address = message.validatorAddress; + obj.validator_index = message.validatorIndex; + obj.signature = message.signature; + return obj; + }, + fromAminoMsg(object: VoteAminoMsg): Vote { + return Vote.fromAmino(object.value); + }, + fromProtoMsg(message: VoteProtoMsg): Vote { + return Vote.decode(message.value); + }, + toProto(message: Vote): Uint8Array { + return Vote.encode(message).finish(); + }, + toProtoMsg(message: Vote): VoteProtoMsg { + return { + typeUrl: "/tendermint.types.Vote", + value: Vote.encode(message).finish(), + }; + }, }; function createBaseCommit(): Commit { return { @@ -985,6 +1419,49 @@ export const Commit = { object.signatures?.map((e) => CommitSig.fromPartial(e)) || []; return message; }, + fromAmino(object: CommitAmino): Commit { + return { + height: Long.fromString(object.height), + round: object.round, + blockId: object?.block_id + ? BlockID.fromAmino(object.block_id) + : undefined, + signatures: Array.isArray(object?.signatures) + ? object.signatures.map((e: any) => CommitSig.fromAmino(e)) + : [], + }; + }, + toAmino(message: Commit): CommitAmino { + const obj: any = {}; + obj.height = message.height ? message.height.toString() : undefined; + obj.round = message.round; + obj.block_id = message.blockId + ? BlockID.toAmino(message.blockId) + : undefined; + if (message.signatures) { + obj.signatures = message.signatures.map((e) => + e ? CommitSig.toAmino(e) : undefined + ); + } else { + obj.signatures = []; + } + return obj; + }, + fromAminoMsg(object: CommitAminoMsg): Commit { + return Commit.fromAmino(object.value); + }, + fromProtoMsg(message: CommitProtoMsg): Commit { + return Commit.decode(message.value); + }, + toProto(message: Commit): Uint8Array { + return Commit.encode(message).finish(); + }, + toProtoMsg(message: Commit): CommitProtoMsg { + return { + typeUrl: "/tendermint.types.Commit", + value: Commit.encode(message).finish(), + }; + }, }; function createBaseCommitSig(): CommitSig { return { @@ -1086,6 +1563,43 @@ export const CommitSig = { message.signature = object.signature ?? new Uint8Array(); return message; }, + fromAmino(object: CommitSigAmino): CommitSig { + return { + blockIdFlag: isSet(object.block_id_flag) + ? blockIDFlagFromJSON(object.block_id_flag) + : 0, + validatorAddress: object.validator_address, + timestamp: object?.timestamp + ? Timestamp.fromAmino(object.timestamp) + : undefined, + signature: object.signature, + }; + }, + toAmino(message: CommitSig): CommitSigAmino { + const obj: any = {}; + obj.block_id_flag = message.blockIdFlag; + obj.validator_address = message.validatorAddress; + obj.timestamp = message.timestamp + ? Timestamp.toAmino(message.timestamp) + : undefined; + obj.signature = message.signature; + return obj; + }, + fromAminoMsg(object: CommitSigAminoMsg): CommitSig { + return CommitSig.fromAmino(object.value); + }, + fromProtoMsg(message: CommitSigProtoMsg): CommitSig { + return CommitSig.decode(message.value); + }, + toProto(message: CommitSig): Uint8Array { + return CommitSig.encode(message).finish(); + }, + toProtoMsg(message: CommitSig): CommitSigProtoMsg { + return { + typeUrl: "/tendermint.types.CommitSig", + value: CommitSig.encode(message).finish(), + }; + }, }; function createBaseProposal(): Proposal { return { @@ -1219,6 +1733,51 @@ export const Proposal = { message.signature = object.signature ?? new Uint8Array(); return message; }, + fromAmino(object: ProposalAmino): Proposal { + return { + type: isSet(object.type) ? signedMsgTypeFromJSON(object.type) : 0, + height: Long.fromString(object.height), + round: object.round, + polRound: object.pol_round, + blockId: object?.block_id + ? BlockID.fromAmino(object.block_id) + : undefined, + timestamp: object?.timestamp + ? Timestamp.fromAmino(object.timestamp) + : undefined, + signature: object.signature, + }; + }, + toAmino(message: Proposal): ProposalAmino { + const obj: any = {}; + obj.type = message.type; + obj.height = message.height ? message.height.toString() : undefined; + obj.round = message.round; + obj.pol_round = message.polRound; + obj.block_id = message.blockId + ? BlockID.toAmino(message.blockId) + : undefined; + obj.timestamp = message.timestamp + ? Timestamp.toAmino(message.timestamp) + : undefined; + obj.signature = message.signature; + return obj; + }, + fromAminoMsg(object: ProposalAminoMsg): Proposal { + return Proposal.fromAmino(object.value); + }, + fromProtoMsg(message: ProposalProtoMsg): Proposal { + return Proposal.decode(message.value); + }, + toProto(message: Proposal): Uint8Array { + return Proposal.encode(message).finish(); + }, + toProtoMsg(message: Proposal): ProposalProtoMsg { + return { + typeUrl: "/tendermint.types.Proposal", + value: Proposal.encode(message).finish(), + }; + }, }; function createBaseSignedHeader(): SignedHeader { return { @@ -1287,6 +1846,33 @@ export const SignedHeader = { : undefined; return message; }, + fromAmino(object: SignedHeaderAmino): SignedHeader { + return { + header: object?.header ? Header.fromAmino(object.header) : undefined, + commit: object?.commit ? Commit.fromAmino(object.commit) : undefined, + }; + }, + toAmino(message: SignedHeader): SignedHeaderAmino { + const obj: any = {}; + obj.header = message.header ? Header.toAmino(message.header) : undefined; + obj.commit = message.commit ? Commit.toAmino(message.commit) : undefined; + return obj; + }, + fromAminoMsg(object: SignedHeaderAminoMsg): SignedHeader { + return SignedHeader.fromAmino(object.value); + }, + fromProtoMsg(message: SignedHeaderProtoMsg): SignedHeader { + return SignedHeader.decode(message.value); + }, + toProto(message: SignedHeader): Uint8Array { + return SignedHeader.encode(message).finish(); + }, + toProtoMsg(message: SignedHeader): SignedHeaderProtoMsg { + return { + typeUrl: "/tendermint.types.SignedHeader", + value: SignedHeader.encode(message).finish(), + }; + }, }; function createBaseLightBlock(): LightBlock { return { @@ -1369,6 +1955,41 @@ export const LightBlock = { : undefined; return message; }, + fromAmino(object: LightBlockAmino): LightBlock { + return { + signedHeader: object?.signed_header + ? SignedHeader.fromAmino(object.signed_header) + : undefined, + validatorSet: object?.validator_set + ? ValidatorSet.fromAmino(object.validator_set) + : undefined, + }; + }, + toAmino(message: LightBlock): LightBlockAmino { + const obj: any = {}; + obj.signed_header = message.signedHeader + ? SignedHeader.toAmino(message.signedHeader) + : undefined; + obj.validator_set = message.validatorSet + ? ValidatorSet.toAmino(message.validatorSet) + : undefined; + return obj; + }, + fromAminoMsg(object: LightBlockAminoMsg): LightBlock { + return LightBlock.fromAmino(object.value); + }, + fromProtoMsg(message: LightBlockProtoMsg): LightBlock { + return LightBlock.decode(message.value); + }, + toProto(message: LightBlock): Uint8Array { + return LightBlock.encode(message).finish(); + }, + toProtoMsg(message: LightBlock): LightBlockProtoMsg { + return { + typeUrl: "/tendermint.types.LightBlock", + value: LightBlock.encode(message).finish(), + }; + }, }; function createBaseBlockMeta(): BlockMeta { return { @@ -1471,6 +2092,43 @@ export const BlockMeta = { : Long.ZERO; return message; }, + fromAmino(object: BlockMetaAmino): BlockMeta { + return { + blockId: object?.block_id + ? BlockID.fromAmino(object.block_id) + : undefined, + blockSize: Long.fromString(object.block_size), + header: object?.header ? Header.fromAmino(object.header) : undefined, + numTxs: Long.fromString(object.num_txs), + }; + }, + toAmino(message: BlockMeta): BlockMetaAmino { + const obj: any = {}; + obj.block_id = message.blockId + ? BlockID.toAmino(message.blockId) + : undefined; + obj.block_size = message.blockSize + ? message.blockSize.toString() + : undefined; + obj.header = message.header ? Header.toAmino(message.header) : undefined; + obj.num_txs = message.numTxs ? message.numTxs.toString() : undefined; + return obj; + }, + fromAminoMsg(object: BlockMetaAminoMsg): BlockMeta { + return BlockMeta.fromAmino(object.value); + }, + fromProtoMsg(message: BlockMetaProtoMsg): BlockMeta { + return BlockMeta.decode(message.value); + }, + toProto(message: BlockMeta): Uint8Array { + return BlockMeta.encode(message).finish(); + }, + toProtoMsg(message: BlockMeta): BlockMetaProtoMsg { + return { + typeUrl: "/tendermint.types.BlockMeta", + value: BlockMeta.encode(message).finish(), + }; + }, }; function createBaseTxProof(): TxProof { return { @@ -1553,4 +2211,33 @@ export const TxProof = { : undefined; return message; }, + fromAmino(object: TxProofAmino): TxProof { + return { + rootHash: object.root_hash, + data: object.data, + proof: object?.proof ? Proof.fromAmino(object.proof) : undefined, + }; + }, + toAmino(message: TxProof): TxProofAmino { + const obj: any = {}; + obj.root_hash = message.rootHash; + obj.data = message.data; + obj.proof = message.proof ? Proof.toAmino(message.proof) : undefined; + return obj; + }, + fromAminoMsg(object: TxProofAminoMsg): TxProof { + return TxProof.fromAmino(object.value); + }, + fromProtoMsg(message: TxProofProtoMsg): TxProof { + return TxProof.decode(message.value); + }, + toProto(message: TxProof): Uint8Array { + return TxProof.encode(message).finish(); + }, + toProtoMsg(message: TxProof): TxProofProtoMsg { + return { + typeUrl: "/tendermint.types.TxProof", + value: TxProof.encode(message).finish(), + }; + }, }; diff --git a/packages/types/src/tendermint/types/validator.ts b/packages/types/src/tendermint/types/validator.ts index f0e0884ca..637e87fe8 100644 --- a/packages/types/src/tendermint/types/validator.ts +++ b/packages/types/src/tendermint/types/validator.ts @@ -1,5 +1,5 @@ /* eslint-disable */ -import { PublicKey } from "../crypto/keys"; +import { PublicKey, PublicKeyAmino } from "../crypto/keys"; import { Long, isSet, @@ -15,16 +15,55 @@ export interface ValidatorSet { proposer?: Validator; totalVotingPower: Long; } +export interface ValidatorSetProtoMsg { + typeUrl: "/tendermint.types.ValidatorSet"; + value: Uint8Array; +} +export interface ValidatorSetAmino { + validators: ValidatorAmino[]; + proposer?: ValidatorAmino; + total_voting_power: string; +} +export interface ValidatorSetAminoMsg { + type: "/tendermint.types.ValidatorSet"; + value: ValidatorSetAmino; +} export interface Validator { address: Uint8Array; pubKey?: PublicKey; votingPower: Long; proposerPriority: Long; } +export interface ValidatorProtoMsg { + typeUrl: "/tendermint.types.Validator"; + value: Uint8Array; +} +export interface ValidatorAmino { + address: Uint8Array; + pub_key?: PublicKeyAmino; + voting_power: string; + proposer_priority: string; +} +export interface ValidatorAminoMsg { + type: "/tendermint.types.Validator"; + value: ValidatorAmino; +} export interface SimpleValidator { pubKey?: PublicKey; votingPower: Long; } +export interface SimpleValidatorProtoMsg { + typeUrl: "/tendermint.types.SimpleValidator"; + value: Uint8Array; +} +export interface SimpleValidatorAmino { + pub_key?: PublicKeyAmino; + voting_power: string; +} +export interface SimpleValidatorAminoMsg { + type: "/tendermint.types.SimpleValidator"; + value: SimpleValidatorAmino; +} function createBaseValidatorSet(): ValidatorSet { return { validators: [], @@ -119,6 +158,49 @@ export const ValidatorSet = { : Long.ZERO; return message; }, + fromAmino(object: ValidatorSetAmino): ValidatorSet { + return { + validators: Array.isArray(object?.validators) + ? object.validators.map((e: any) => Validator.fromAmino(e)) + : [], + proposer: object?.proposer + ? Validator.fromAmino(object.proposer) + : undefined, + totalVotingPower: Long.fromString(object.total_voting_power), + }; + }, + toAmino(message: ValidatorSet): ValidatorSetAmino { + const obj: any = {}; + if (message.validators) { + obj.validators = message.validators.map((e) => + e ? Validator.toAmino(e) : undefined + ); + } else { + obj.validators = []; + } + obj.proposer = message.proposer + ? Validator.toAmino(message.proposer) + : undefined; + obj.total_voting_power = message.totalVotingPower + ? message.totalVotingPower.toString() + : undefined; + return obj; + }, + fromAminoMsg(object: ValidatorSetAminoMsg): ValidatorSet { + return ValidatorSet.fromAmino(object.value); + }, + fromProtoMsg(message: ValidatorSetProtoMsg): ValidatorSet { + return ValidatorSet.decode(message.value); + }, + toProto(message: ValidatorSet): Uint8Array { + return ValidatorSet.encode(message).finish(); + }, + toProtoMsg(message: ValidatorSet): ValidatorSetProtoMsg { + return { + typeUrl: "/tendermint.types.ValidatorSet", + value: ValidatorSet.encode(message).finish(), + }; + }, }; function createBaseValidator(): Validator { return { @@ -226,6 +308,43 @@ export const Validator = { : Long.ZERO; return message; }, + fromAmino(object: ValidatorAmino): Validator { + return { + address: object.address, + pubKey: object?.pub_key ? PublicKey.fromAmino(object.pub_key) : undefined, + votingPower: Long.fromString(object.voting_power), + proposerPriority: Long.fromString(object.proposer_priority), + }; + }, + toAmino(message: Validator): ValidatorAmino { + const obj: any = {}; + obj.address = message.address; + obj.pub_key = message.pubKey + ? PublicKey.toAmino(message.pubKey) + : undefined; + obj.voting_power = message.votingPower + ? message.votingPower.toString() + : undefined; + obj.proposer_priority = message.proposerPriority + ? message.proposerPriority.toString() + : undefined; + return obj; + }, + fromAminoMsg(object: ValidatorAminoMsg): Validator { + return Validator.fromAmino(object.value); + }, + fromProtoMsg(message: ValidatorProtoMsg): Validator { + return Validator.decode(message.value); + }, + toProto(message: Validator): Uint8Array { + return Validator.encode(message).finish(); + }, + toProtoMsg(message: Validator): ValidatorProtoMsg { + return { + typeUrl: "/tendermint.types.Validator", + value: Validator.encode(message).finish(), + }; + }, }; function createBaseSimpleValidator(): SimpleValidator { return { @@ -300,4 +419,35 @@ export const SimpleValidator = { : Long.ZERO; return message; }, + fromAmino(object: SimpleValidatorAmino): SimpleValidator { + return { + pubKey: object?.pub_key ? PublicKey.fromAmino(object.pub_key) : undefined, + votingPower: Long.fromString(object.voting_power), + }; + }, + toAmino(message: SimpleValidator): SimpleValidatorAmino { + const obj: any = {}; + obj.pub_key = message.pubKey + ? PublicKey.toAmino(message.pubKey) + : undefined; + obj.voting_power = message.votingPower + ? message.votingPower.toString() + : undefined; + return obj; + }, + fromAminoMsg(object: SimpleValidatorAminoMsg): SimpleValidator { + return SimpleValidator.fromAmino(object.value); + }, + fromProtoMsg(message: SimpleValidatorProtoMsg): SimpleValidator { + return SimpleValidator.decode(message.value); + }, + toProto(message: SimpleValidator): Uint8Array { + return SimpleValidator.encode(message).finish(); + }, + toProtoMsg(message: SimpleValidator): SimpleValidatorProtoMsg { + return { + typeUrl: "/tendermint.types.SimpleValidator", + value: SimpleValidator.encode(message).finish(), + }; + }, }; diff --git a/packages/types/src/tendermint/version/types.ts b/packages/types/src/tendermint/version/types.ts index 2dedb45a4..fa4bbb643 100644 --- a/packages/types/src/tendermint/version/types.ts +++ b/packages/types/src/tendermint/version/types.ts @@ -11,6 +11,23 @@ export interface App { protocol: Long; software: string; } +export interface AppProtoMsg { + typeUrl: "/tendermint.version.App"; + value: Uint8Array; +} +/** + * App includes the protocol and software version for the application. + * This information is included in ResponseInfo. The App.Protocol can be + * updated in ResponseEndBlock. + */ +export interface AppAmino { + protocol: string; + software: string; +} +export interface AppAminoMsg { + type: "/tendermint.version.App"; + value: AppAmino; +} /** * Consensus captures the consensus rules for processing a block in the blockchain, * including all blockchain data structures and the rules of the application's @@ -20,6 +37,23 @@ export interface Consensus { block: Long; app: Long; } +export interface ConsensusProtoMsg { + typeUrl: "/tendermint.version.Consensus"; + value: Uint8Array; +} +/** + * Consensus captures the consensus rules for processing a block in the blockchain, + * including all blockchain data structures and the rules of the application's + * state transition machine. + */ +export interface ConsensusAmino { + block: string; + app: string; +} +export interface ConsensusAminoMsg { + type: "/tendermint.version.Consensus"; + value: ConsensusAmino; +} function createBaseApp(): App { return { protocol: Long.UZERO, @@ -80,6 +114,33 @@ export const App = { message.software = object.software ?? ""; return message; }, + fromAmino(object: AppAmino): App { + return { + protocol: Long.fromString(object.protocol), + software: object.software, + }; + }, + toAmino(message: App): AppAmino { + const obj: any = {}; + obj.protocol = message.protocol ? message.protocol.toString() : undefined; + obj.software = message.software; + return obj; + }, + fromAminoMsg(object: AppAminoMsg): App { + return App.fromAmino(object.value); + }, + fromProtoMsg(message: AppProtoMsg): App { + return App.decode(message.value); + }, + toProto(message: App): Uint8Array { + return App.encode(message).finish(); + }, + toProtoMsg(message: App): AppProtoMsg { + return { + typeUrl: "/tendermint.version.App", + value: App.encode(message).finish(), + }; + }, }; function createBaseConsensus(): Consensus { return { @@ -148,4 +209,31 @@ export const Consensus = { : Long.UZERO; return message; }, + fromAmino(object: ConsensusAmino): Consensus { + return { + block: Long.fromString(object.block), + app: Long.fromString(object.app), + }; + }, + toAmino(message: Consensus): ConsensusAmino { + const obj: any = {}; + obj.block = message.block ? message.block.toString() : undefined; + obj.app = message.app ? message.app.toString() : undefined; + return obj; + }, + fromAminoMsg(object: ConsensusAminoMsg): Consensus { + return Consensus.fromAmino(object.value); + }, + fromProtoMsg(message: ConsensusProtoMsg): Consensus { + return Consensus.decode(message.value); + }, + toProto(message: Consensus): Uint8Array { + return Consensus.encode(message).finish(); + }, + toProtoMsg(message: Consensus): ConsensusProtoMsg { + return { + typeUrl: "/tendermint.version.Consensus", + value: Consensus.encode(message).finish(), + }; + }, }; diff --git a/packages/walletconnect-v2/package.json b/packages/walletconnect-v2/package.json index ee889eac5..dff57eca1 100644 --- a/packages/walletconnect-v2/package.json +++ b/packages/walletconnect-v2/package.json @@ -28,10 +28,10 @@ "lint": "eslint src --ignore-path ../../.gitignore --max-warnings 0 --ext .js,.ts" }, "dependencies": { - "@cosmjs/amino": "0.30.1", + "@cosmjs/amino": "0.31.0", "@cosmjs/encoding": "0.31.0", - "@cosmjs/proto-signing": "0.30.1", - "@cosmjs/stargate": "0.30.1", + "@cosmjs/proto-signing": "0.31.0", + "@cosmjs/stargate": "0.31.0", "@cosmjs/utils": "^0.31.0", "@desmoslabs/desmjs": "workspace:packages/core", "@desmoslabs/desmjs-types": "workspace:packages/types", diff --git a/packages/walletconnect/package.json b/packages/walletconnect/package.json index eaedb5440..e2ac930d5 100644 --- a/packages/walletconnect/package.json +++ b/packages/walletconnect/package.json @@ -27,13 +27,13 @@ "build": "rm -rf ./build && yarn tsc" }, "dependencies": { - "@cosmjs/amino": "0.30.1", - "@cosmjs/crypto": "0.30.1", + "@cosmjs/amino": "0.31.0", + "@cosmjs/crypto": "0.31.0", "@cosmjs/encoding": "0.31.0", - "@cosmjs/math": "0.30.1", - "@cosmjs/proto-signing": "0.30.1", - "@cosmjs/stargate": "0.30.1", - "@cosmjs/tendermint-rpc": "0.30.1", + "@cosmjs/math": "0.31.0", + "@cosmjs/proto-signing": "0.31.0", + "@cosmjs/stargate": "0.31.0", + "@cosmjs/tendermint-rpc": "0.31.0", "@cosmjs/utils": "^0.31.0", "@desmoslabs/desmjs": "workspace:packages/core", "@walletconnect/client": "^1.8.0", diff --git a/packages/web3auth-web/package.json b/packages/web3auth-web/package.json index 35c25446a..ea701862d 100644 --- a/packages/web3auth-web/package.json +++ b/packages/web3auth-web/package.json @@ -28,9 +28,9 @@ "lint-fix": "yarn lint --fix" }, "dependencies": { - "@cosmjs/amino": "0.30.1", + "@cosmjs/amino": "0.31.0", "@cosmjs/encoding": "0.31.0", - "@cosmjs/proto-signing": "0.30.1", + "@cosmjs/proto-signing": "0.31.0", "@desmoslabs/desmjs": "workspace:packages/core", "@web3auth/base": "^6.1.1", "@web3auth/modal": "^5.2.1", diff --git a/scripts/setup_chain.sh b/scripts/setup_chain.sh index 9e699b705..f81901bbb 100755 --- a/scripts/setup_chain.sh +++ b/scripts/setup_chain.sh @@ -20,7 +20,7 @@ desmos() { "$SCRIPT_DIR/desmos" --home="$DESMOS_HOME" "$@" # Wait tx including block - sleep 10 + sleep 2 } # Force the script to exit at the first error @@ -29,12 +29,12 @@ set -e # Upload the smart contract echo "Uploading contract..." echo $KEYRING_PASS | desmos tx wasm store "$SMART_CONTRACT" \ - --from $USER1 --chain-id=testchain --keyring-backend=file -y --gas 3000000 \ + --from $USER1 --chain-id=testchain --keyring-backend=test -y --gas 3000000 \ -b=sync # Initialize the contract echo "Initializing contract..." -echo $KEYRING_PASS | desmos --keyring-backend=file tx wasm instantiate 1 "{}" \ +echo $KEYRING_PASS | desmos --keyring-backend=test tx wasm instantiate 1 "{}" \ --from $USER1 --label "test-contract" --admin $USER1_ADDRESS --chain-id=testchain -b=sync -y echo "Contract initialized" @@ -47,4 +47,4 @@ MSG="{\"desmos_messages\":{\"msgs\":[{\"custom\":{\"profiles\":{\"save_profile\" echo "Create smart contract profile" echo $KEYRING_PASS | desmos tx wasm execute "$CONTRACT" "$MSG" \ --from $USER1 \ - --chain-id=testchain --keyring-backend=file -b=sync -y + --chain-id=testchain --keyring-backend=test -b=sync -y diff --git a/scripts/spawn_test_chain.sh b/scripts/spawn_test_chain.sh index 1849cc3c0..75b08b887 100755 --- a/scripts/spawn_test_chain.sh +++ b/scripts/spawn_test_chain.sh @@ -30,15 +30,27 @@ desmos() { rm -r -f "$DESMOS_HOME" desmos tendermint unsafe-reset-all desmos init testchain --chain-id=testchain + # Add a default reason to the reports module params jq '.app_state.reports.params.standard_reasons[0] |= . + {"id":"1","title":"Spam","description":"Spam user or content"}' "$DESMOS_HOME/config/genesis.json" > "$DESMOS_HOME/config/genesis-patched.json" mv "$DESMOS_HOME/config/genesis-patched.json" "$DESMOS_HOME/config/genesis.json" -(echo "$USER1_MNEMONIC"; echo $KEYRING_PASS; echo $KEYRING_PASS) | desmos keys add "$USER1" --recover --keyring-backend=file -(echo "$USER2_MNEMONIC"; echo $KEYRING_PASS; echo $KEYRING_PASS) | desmos keys add "$USER2" --recover --keyring-backend=file -echo $KEYRING_PASS | desmos add-genesis-account $USER1 200000000000000stake --keyring-backend=file -echo $KEYRING_PASS | desmos add-genesis-account $USER2 200000000000000stake --keyring-backend=file -echo $KEYRING_PASS | desmos gentx $USER1 100000000000stake --amount 100000000000stake --chain-id=testchain --keyring-backend=file +# Add a proposal to the genesis file +jq '.app_state.gov.proposals += [{"id": "1", "messages": [], "status": 2, "totalDeposit": [], "metadata": "", "submit_time": "2000-06-26T19:03:16.004Z", "voting_end_time": "3000-06-26T20:03:16.004Z", "voting_start_time": "2000-06-26T19:04:16.004Z"}]' "$DESMOS_HOME/config/genesis.json" > "$DESMOS_HOME/config/genesis-patched.json" +mv "$DESMOS_HOME/config/genesis-patched.json" "$DESMOS_HOME/config/genesis.json" + +# Update gov module starting proposal id +jq '.app_state.gov.starting_proposal_id = "2"' "$DESMOS_HOME/config/genesis.json" > "$DESMOS_HOME/config/genesis-patched.json" +mv "$DESMOS_HOME/config/genesis-patched.json" "$DESMOS_HOME/config/genesis.json" + +# Set block time to 500 milliseconds +sed -i -e 's/timeout_commit = "5s"/timeout_commit = "500ms"/g' "$DESMOS_HOME/config/config.toml" + +(echo "$USER1_MNEMONIC"; echo $KEYRING_PASS; echo $KEYRING_PASS) | desmos keys add "$USER1" --recover --keyring-backend=test +(echo "$USER2_MNEMONIC"; echo $KEYRING_PASS; echo $KEYRING_PASS) | desmos keys add "$USER2" --recover --keyring-backend=test +echo $KEYRING_PASS | desmos add-genesis-account $USER1 200000000000000stake --keyring-backend=test +echo $KEYRING_PASS | desmos add-genesis-account $USER2 200000000000000stake --keyring-backend=test +echo $KEYRING_PASS | desmos gentx $USER1 100000000000stake --amount 100000000000stake --chain-id=testchain --keyring-backend=test desmos collect-gentxs diff --git a/yarn.lock b/yarn.lock index 9a7c9d0ae..51dee8898 100644 --- a/yarn.lock +++ b/yarn.lock @@ -4258,15 +4258,15 @@ __metadata: languageName: node linkType: hard -"@cosmjs/amino@npm:0.30.1, @cosmjs/amino@npm:^0.30.1": - version: 0.30.1 - resolution: "@cosmjs/amino@npm:0.30.1" +"@cosmjs/amino@npm:0.31.0, @cosmjs/amino@npm:^0.31.0": + version: 0.31.0 + resolution: "@cosmjs/amino@npm:0.31.0" dependencies: - "@cosmjs/crypto": ^0.30.1 - "@cosmjs/encoding": ^0.30.1 - "@cosmjs/math": ^0.30.1 - "@cosmjs/utils": ^0.30.1 - checksum: aa254f936fd95e146e05cc4d6e51f86f4fe7f2048d337d197ccb2cb6e488f8b8061aa6b21e63b1f7001d99b80417f029ef75a12bd0478749286932834157c5aa + "@cosmjs/crypto": ^0.31.0 + "@cosmjs/encoding": ^0.31.0 + "@cosmjs/math": ^0.31.0 + "@cosmjs/utils": ^0.31.0 + checksum: 5a89404788ac4687bc7066effc411dd0ceb3239ae6c6d54513bd4436ed0ebccf9587c6c25763202dc3946bc0fc941ad9c8eb63c48c1d8211b7cf04a4178a5018 languageName: node linkType: hard @@ -4282,37 +4282,37 @@ __metadata: languageName: node linkType: hard -"@cosmjs/cosmwasm-stargate@npm:0.30.1": - version: 0.30.1 - resolution: "@cosmjs/cosmwasm-stargate@npm:0.30.1" - dependencies: - "@cosmjs/amino": ^0.30.1 - "@cosmjs/crypto": ^0.30.1 - "@cosmjs/encoding": ^0.30.1 - "@cosmjs/math": ^0.30.1 - "@cosmjs/proto-signing": ^0.30.1 - "@cosmjs/stargate": ^0.30.1 - "@cosmjs/tendermint-rpc": ^0.30.1 - "@cosmjs/utils": ^0.30.1 - cosmjs-types: ^0.7.1 +"@cosmjs/cosmwasm-stargate@npm:0.31.0": + version: 0.31.0 + resolution: "@cosmjs/cosmwasm-stargate@npm:0.31.0" + dependencies: + "@cosmjs/amino": ^0.31.0 + "@cosmjs/crypto": ^0.31.0 + "@cosmjs/encoding": ^0.31.0 + "@cosmjs/math": ^0.31.0 + "@cosmjs/proto-signing": ^0.31.0 + "@cosmjs/stargate": ^0.31.0 + "@cosmjs/tendermint-rpc": ^0.31.0 + "@cosmjs/utils": ^0.31.0 + cosmjs-types: ^0.8.0 long: ^4.0.0 pako: ^2.0.2 - checksum: 1fca3cb1fbe3bc252d6960a98413afafde0281052dfb82c2b977861655d19255a0f7d62a06b4caff4739b43910b527f2614afa827b1a2ab0238f79ae9b4ba873 + checksum: 6576c55e4283341962b68c4cc665fbc62d633e0869a7efd9f0a6325777119a316e7268fab70d2c5c25c7013668908f42becfbb3e58a9bf6e963e0169f24ae0e2 languageName: node linkType: hard -"@cosmjs/crypto@npm:0.30.1, @cosmjs/crypto@npm:^0.30.1": - version: 0.30.1 - resolution: "@cosmjs/crypto@npm:0.30.1" +"@cosmjs/crypto@npm:0.31.0, @cosmjs/crypto@npm:^0.31.0": + version: 0.31.0 + resolution: "@cosmjs/crypto@npm:0.31.0" dependencies: - "@cosmjs/encoding": ^0.30.1 - "@cosmjs/math": ^0.30.1 - "@cosmjs/utils": ^0.30.1 + "@cosmjs/encoding": ^0.31.0 + "@cosmjs/math": ^0.31.0 + "@cosmjs/utils": ^0.31.0 "@noble/hashes": ^1 bn.js: ^5.2.0 elliptic: ^6.5.4 - libsodium-wrappers: ^0.7.6 - checksum: f1989a5cab92de4ad8c4fef65554b1f65e6c3e8b9ef0d550fa84e5f1aa13286b96a5310a374bcea7d0ebd6b9c46ea69a8469d06275b317a09b9ec7e0a3a07f0e + libsodium-wrappers-sumo: ^0.7.11 + checksum: a89b6ddec70aa407f435e4338f4e51731d589fba81ac71d004657338b3f00f99d4982e3fbbe8e077bd192453748baa1d18f422b456fb6b5a4eec6ab510218e40 languageName: node linkType: hard @@ -4334,7 +4334,7 @@ __metadata: languageName: node linkType: hard -"@cosmjs/encoding@npm:0.31.0": +"@cosmjs/encoding@npm:0.31.0, @cosmjs/encoding@npm:^0.31.0": version: 0.31.0 resolution: "@cosmjs/encoding@npm:0.31.0" dependencies: @@ -4356,33 +4356,22 @@ __metadata: languageName: node linkType: hard -"@cosmjs/encoding@npm:^0.30.1": - version: 0.30.1 - resolution: "@cosmjs/encoding@npm:0.30.1" - dependencies: - base64-js: ^1.3.0 - bech32: ^1.1.4 - readonly-date: ^1.0.0 - checksum: bd1932fafecbf9876ad97dee8133cc955f52d2fd9b6040d8c991b40ba4195c02cb4dc3c4beec7c237217ba96db78cd914840b2b895348482190d459a21c2b6dd - languageName: node - linkType: hard - -"@cosmjs/json-rpc@npm:^0.30.1": - version: 0.30.1 - resolution: "@cosmjs/json-rpc@npm:0.30.1" +"@cosmjs/json-rpc@npm:^0.31.0": + version: 0.31.0 + resolution: "@cosmjs/json-rpc@npm:0.31.0" dependencies: - "@cosmjs/stream": ^0.30.1 + "@cosmjs/stream": ^0.31.0 xstream: ^11.14.0 - checksum: 750686d53cd4ee239fd24a41d556ab08307f099c9f7bb633a566af417b0baad0ff954498272b6bdb02d4cad596c7ac8f24e38f0cf25c7fbe6200b539c2f56266 + checksum: d2e5fff7b2b8a3689fb2ed7c1267cafbe2e3526a352555f576a48e7f1d5b9f8424aad244663218095d7b56f3d78b56b6fc573d07ebccf4a504f813923660101d languageName: node linkType: hard -"@cosmjs/math@npm:0.30.1, @cosmjs/math@npm:^0.30.1": - version: 0.30.1 - resolution: "@cosmjs/math@npm:0.30.1" +"@cosmjs/math@npm:0.31.0, @cosmjs/math@npm:^0.31.0": + version: 0.31.0 + resolution: "@cosmjs/math@npm:0.31.0" dependencies: bn.js: ^5.2.0 - checksum: c13d2a89348407bcc0f737f989fc1eb850b81d1f0ae06f1cc656b9a3194bf9ee048ce2e5c948f6ada61e95f5bfa324fad43dc531ade7538bcf993ba2085cb5fe + checksum: 0917ab11f299d6a1fc372802e832feeaf30296c1e43aa4b911ebbf19c367bfb390e3a43f4aac1992e551275f74e2c91a7639100dfcbf45a10653d023f6e9e8f5 languageName: node linkType: hard @@ -4395,18 +4384,18 @@ __metadata: languageName: node linkType: hard -"@cosmjs/proto-signing@npm:0.30.1, @cosmjs/proto-signing@npm:^0.30.1": - version: 0.30.1 - resolution: "@cosmjs/proto-signing@npm:0.30.1" - dependencies: - "@cosmjs/amino": ^0.30.1 - "@cosmjs/crypto": ^0.30.1 - "@cosmjs/encoding": ^0.30.1 - "@cosmjs/math": ^0.30.1 - "@cosmjs/utils": ^0.30.1 - cosmjs-types: ^0.7.1 +"@cosmjs/proto-signing@npm:0.31.0, @cosmjs/proto-signing@npm:^0.31.0": + version: 0.31.0 + resolution: "@cosmjs/proto-signing@npm:0.31.0" + dependencies: + "@cosmjs/amino": ^0.31.0 + "@cosmjs/crypto": ^0.31.0 + "@cosmjs/encoding": ^0.31.0 + "@cosmjs/math": ^0.31.0 + "@cosmjs/utils": ^0.31.0 + cosmjs-types: ^0.8.0 long: ^4.0.0 - checksum: 15e13e33976c0a52e2ef93aec6171e3934543d116a3247d9b51ed495aa9da68dbb13a93a37808c02e4378be20d8ca326902ca721de6d2c9af470d6aa057019f5 + checksum: b025545671c1248f8e72b92c3d65b89b923e2ddc1dd589116299ab5b05e4fcc611edd5a32f1f2f5725dd167c68b1f64810825f9c95e0685a649453e8add206ec languageName: node linkType: hard @@ -4421,62 +4410,62 @@ __metadata: languageName: node linkType: hard -"@cosmjs/socket@npm:^0.30.1": - version: 0.30.1 - resolution: "@cosmjs/socket@npm:0.30.1" +"@cosmjs/socket@npm:^0.31.0": + version: 0.31.0 + resolution: "@cosmjs/socket@npm:0.31.0" dependencies: - "@cosmjs/stream": ^0.30.1 + "@cosmjs/stream": ^0.31.0 isomorphic-ws: ^4.0.1 ws: ^7 xstream: ^11.14.0 - checksum: ef5e5d7bbcd89b5bfbd6fa4039133e15e5db848e6b0bc812b89872d28d9ced73d8a12fbf6581e6b0b08de28f2c1a9c7b05825804be65eb07d2f3d3532babea91 + checksum: 97c3858274a2450b3fbecd373db39d220257c2d0f5470b8044931f260590fef25dc624ac20c38227e99afbaf6552797a2c07648d1438c70fbffdf83c4e70f2ad languageName: node linkType: hard -"@cosmjs/stargate@npm:0.30.1, @cosmjs/stargate@npm:^0.30.1": - version: 0.30.1 - resolution: "@cosmjs/stargate@npm:0.30.1" +"@cosmjs/stargate@npm:0.31.0, @cosmjs/stargate@npm:^0.31.0": + version: 0.31.0 + resolution: "@cosmjs/stargate@npm:0.31.0" dependencies: "@confio/ics23": ^0.6.8 - "@cosmjs/amino": ^0.30.1 - "@cosmjs/encoding": ^0.30.1 - "@cosmjs/math": ^0.30.1 - "@cosmjs/proto-signing": ^0.30.1 - "@cosmjs/stream": ^0.30.1 - "@cosmjs/tendermint-rpc": ^0.30.1 - "@cosmjs/utils": ^0.30.1 - cosmjs-types: ^0.7.1 + "@cosmjs/amino": ^0.31.0 + "@cosmjs/encoding": ^0.31.0 + "@cosmjs/math": ^0.31.0 + "@cosmjs/proto-signing": ^0.31.0 + "@cosmjs/stream": ^0.31.0 + "@cosmjs/tendermint-rpc": ^0.31.0 + "@cosmjs/utils": ^0.31.0 + cosmjs-types: ^0.8.0 long: ^4.0.0 protobufjs: ~6.11.3 xstream: ^11.14.0 - checksum: 2eb089c4a7f995b787702d52f22e1c808704cd02c29ec4feee57897d350d9dbde645785e89bf34181da7acd67547dc2b0f17f9f49cfbb0272d70cb7f553a8644 + checksum: e57f30ecfed45b58aa335e3e8edf3c0c857296bad82b320af3ab5df40003c9e690a03dbd15e1caf5108577e3fe7697bffa689f171d234fe97e502e354a9d0717 languageName: node linkType: hard -"@cosmjs/stream@npm:^0.30.1": - version: 0.30.1 - resolution: "@cosmjs/stream@npm:0.30.1" +"@cosmjs/stream@npm:^0.31.0": + version: 0.31.0 + resolution: "@cosmjs/stream@npm:0.31.0" dependencies: xstream: ^11.14.0 - checksum: f9e48a8377c2d3cfbf288fcf4fad745905c042dabc442d2cbb93d4280033e3c8e493a3328f58c0b645b60f9c2188d14603b2bb37a174bc0619686c5e70b13dca + checksum: cbc60f33c0c64694c303250cf912a32791148b5eb4d24a93f56051ae3e46cd510d9e80f244766db9e76c9df21adb980441297ae68b7275b60d4d3b36e2b24e3c languageName: node linkType: hard -"@cosmjs/tendermint-rpc@npm:0.30.1, @cosmjs/tendermint-rpc@npm:^0.30.1": - version: 0.30.1 - resolution: "@cosmjs/tendermint-rpc@npm:0.30.1" - dependencies: - "@cosmjs/crypto": ^0.30.1 - "@cosmjs/encoding": ^0.30.1 - "@cosmjs/json-rpc": ^0.30.1 - "@cosmjs/math": ^0.30.1 - "@cosmjs/socket": ^0.30.1 - "@cosmjs/stream": ^0.30.1 - "@cosmjs/utils": ^0.30.1 +"@cosmjs/tendermint-rpc@npm:0.31.0, @cosmjs/tendermint-rpc@npm:^0.31.0": + version: 0.31.0 + resolution: "@cosmjs/tendermint-rpc@npm:0.31.0" + dependencies: + "@cosmjs/crypto": ^0.31.0 + "@cosmjs/encoding": ^0.31.0 + "@cosmjs/json-rpc": ^0.31.0 + "@cosmjs/math": ^0.31.0 + "@cosmjs/socket": ^0.31.0 + "@cosmjs/stream": ^0.31.0 + "@cosmjs/utils": ^0.31.0 axios: ^0.21.2 readonly-date: ^1.0.0 xstream: ^11.14.0 - checksum: 6900711886d2d9b02dd9ec17d341a174d7d2a20c432618e96d7f33fa6732dcb77fe21f37c67d452c09095f099260a679a4ac5de0caeec376cd683d3d12790ed8 + checksum: d5213d52ba03a31583f4d433d4b11f1d3cc77a1f77d6ed655bea15d40f61677523695f1e1731ab36ab3591e9a2648fbd3f445d1a70b44785a70fe48ab91cb792 languageName: node linkType: hard @@ -4487,13 +4476,6 @@ __metadata: languageName: node linkType: hard -"@cosmjs/utils@npm:^0.30.1": - version: 0.30.1 - resolution: "@cosmjs/utils@npm:0.30.1" - checksum: 64ea16cdeba64d2b346a0b45ca47059ab4297fdf5c4e5fd89ec262eec488807f49f94dcdc294628142015ce4669c4eaf7426d1f8a6538146da5601dcc484cb19 - languageName: node - linkType: hard - "@cosmjs/utils@npm:^0.31.0": version: 0.31.0 resolution: "@cosmjs/utils@npm:0.31.0" @@ -4554,8 +4536,8 @@ __metadata: "@babel/core": ^7.22.5 "@babel/preset-env": ^7.22.5 "@babel/preset-typescript": ^7.22.5 - "@cosmjs/amino": 0.30.1 - "@cosmjs/proto-signing": 0.30.1 + "@cosmjs/amino": 0.31.0 + "@cosmjs/proto-signing": 0.31.0 "@cosmjs/utils": ^0.31.0 "@desmoslabs/desmjs": "workspace:packages/core" "@keplr-wallet/types": 0.12.12 @@ -4574,16 +4556,19 @@ __metadata: version: 0.0.0-use.local resolution: "@desmoslabs/desmjs-types@workspace:packages/types" dependencies: + "@cosmjs/proto-signing": ^0.31.0 "@osmonauts/telescope": ^0.97.0 - "@protobufs/cosmos": ^0.1.0 + "@protobufs/confio": ^0.0.6 "@protobufs/cosmos_proto": ^0.0.10 "@protobufs/gogoproto": ^0.0.10 - "@protobufs/ibc": ^0.1.0 + "@protobufs/google": ^0.0.10 "@types/long": ^4.0.1 "@types/node": ^20.3.1 long: ^4.0.0 prettier: ^2.8.8 protobufjs: ^7.2.3 + ts-morph: ^19.0.0 + ts-node: ^10.9.1 typescript: ^4.9.5 languageName: unknown linkType: soft @@ -4595,10 +4580,10 @@ __metadata: "@babel/core": ^7.22.5 "@babel/preset-env": ^7.22.5 "@babel/preset-typescript": ^7.22.5 - "@cosmjs/amino": 0.30.1 + "@cosmjs/amino": 0.31.0 "@cosmjs/encoding": 0.31.0 - "@cosmjs/proto-signing": 0.30.1 - "@cosmjs/stargate": 0.30.1 + "@cosmjs/proto-signing": 0.31.0 + "@cosmjs/stargate": 0.31.0 "@cosmjs/utils": ^0.31.0 "@desmoslabs/desmjs": "workspace:packages/core" "@desmoslabs/desmjs-types": "workspace:packages/types" @@ -4628,13 +4613,13 @@ __metadata: "@babel/core": ^7.22.5 "@babel/preset-env": ^7.22.5 "@babel/preset-typescript": ^7.22.5 - "@cosmjs/amino": 0.30.1 - "@cosmjs/crypto": 0.30.1 + "@cosmjs/amino": 0.31.0 + "@cosmjs/crypto": 0.31.0 "@cosmjs/encoding": 0.31.0 - "@cosmjs/math": 0.30.1 - "@cosmjs/proto-signing": 0.30.1 - "@cosmjs/stargate": 0.30.1 - "@cosmjs/tendermint-rpc": 0.30.1 + "@cosmjs/math": 0.31.0 + "@cosmjs/proto-signing": 0.31.0 + "@cosmjs/stargate": 0.31.0 + "@cosmjs/tendermint-rpc": 0.31.0 "@cosmjs/utils": ^0.31.0 "@desmoslabs/desmjs": "workspace:packages/core" "@types/jest": ^29.5.2 @@ -4682,9 +4667,9 @@ __metadata: "@babel/core": ^7.22.5 "@babel/preset-env": ^7.22.5 "@babel/preset-typescript": ^7.22.5 - "@cosmjs/amino": 0.30.1 + "@cosmjs/amino": 0.31.0 "@cosmjs/encoding": 0.31.0 - "@cosmjs/proto-signing": 0.30.1 + "@cosmjs/proto-signing": 0.31.0 "@desmoslabs/desmjs": "workspace:packages/core" "@types/jest": ^29.5.2 "@types/keccak": ^3.0.1 @@ -4705,14 +4690,14 @@ __metadata: "@babel/core": ^7.22.5 "@babel/preset-env": ^7.22.5 "@babel/preset-typescript": ^7.22.5 - "@cosmjs/amino": 0.30.1 - "@cosmjs/cosmwasm-stargate": 0.30.1 - "@cosmjs/crypto": 0.30.1 + "@cosmjs/amino": 0.31.0 + "@cosmjs/cosmwasm-stargate": 0.31.0 + "@cosmjs/crypto": 0.31.0 "@cosmjs/encoding": 0.31.0 - "@cosmjs/math": 0.30.1 - "@cosmjs/proto-signing": 0.30.1 - "@cosmjs/stargate": 0.30.1 - "@cosmjs/tendermint-rpc": 0.30.1 + "@cosmjs/math": 0.31.0 + "@cosmjs/proto-signing": 0.31.0 + "@cosmjs/stargate": 0.31.0 + "@cosmjs/tendermint-rpc": 0.31.0 "@cosmjs/utils": ^0.31.0 "@desmoslabs/desmjs-types": "workspace:packages/types" "@types/jest": ^29.5.2 @@ -6605,15 +6590,6 @@ __metadata: languageName: node linkType: hard -"@protobufs/amino@npm:^0.0.11": - version: 0.0.11 - resolution: "@protobufs/amino@npm:0.0.11" - dependencies: - "@protobufs/google": ^0.0.10 - checksum: 7edb8b2804c302055512ebe2518243ff2b1cc7701c29f1a7c940d873069bfbca831dab0c517f49b21083d729d30b0e52f4530b7bb8e2fe85c0a16aa01d5d4808 - languageName: node - linkType: hard - "@protobufs/confio@npm:^0.0.6": version: 0.0.6 resolution: "@protobufs/confio@npm:0.0.6" @@ -6621,19 +6597,6 @@ __metadata: languageName: node linkType: hard -"@protobufs/cosmos@npm:^0.1.0": - version: 0.1.0 - resolution: "@protobufs/cosmos@npm:0.1.0" - dependencies: - "@protobufs/amino": ^0.0.11 - "@protobufs/cosmos_proto": ^0.0.10 - "@protobufs/gogoproto": ^0.0.10 - "@protobufs/google": ^0.0.10 - "@protobufs/tendermint": ^0.0.10 - checksum: 263beb8a8fad2dabb95931aa70fa83b4dd48360e8cfceb030dd0d60f4975f8a59d98bd312895b9acc167f09cd15e369c3443e1c7d2a321fe903b48f93aa7a707 - languageName: node - linkType: hard - "@protobufs/cosmos_proto@npm:^0.0.10": version: 0.0.10 resolution: "@protobufs/cosmos_proto@npm:0.0.10" @@ -6659,30 +6622,6 @@ __metadata: languageName: node linkType: hard -"@protobufs/ibc@npm:^0.1.0": - version: 0.1.0 - resolution: "@protobufs/ibc@npm:0.1.0" - dependencies: - "@protobufs/amino": ^0.0.11 - "@protobufs/confio": ^0.0.6 - "@protobufs/cosmos": ^0.1.0 - "@protobufs/gogoproto": ^0.0.10 - "@protobufs/google": ^0.0.10 - "@protobufs/tendermint": ^0.0.10 - checksum: 8ee6a5205ee66c0f16efb0288e4d7f553174131757013dc9c2e6eb373568be3b2a995d9fb9c73bb7a0f9f5dd5b812fe24d6e902a25f71a30e085dcd7c690b872 - languageName: node - linkType: hard - -"@protobufs/tendermint@npm:^0.0.10": - version: 0.0.10 - resolution: "@protobufs/tendermint@npm:0.0.10" - dependencies: - "@protobufs/gogoproto": ^0.0.10 - "@protobufs/google": ^0.0.10 - checksum: b165b047aa4c683337f7afb81dd2c8224ec615edd3cdb5de08c80c1bb7d4bb320339c3759cd0dabd89e010651ab84a53a589868950b1155de9d8e25eb87c0d72 - languageName: node - linkType: hard - "@pyramation/json-schema-ref-parser@npm:9.0.6": version: 9.0.6 resolution: "@pyramation/json-schema-ref-parser@npm:9.0.6" @@ -8018,6 +7957,18 @@ __metadata: languageName: node linkType: hard +"@ts-morph/common@npm:~0.20.0": + version: 0.20.0 + resolution: "@ts-morph/common@npm:0.20.0" + dependencies: + fast-glob: ^3.2.12 + minimatch: ^7.4.3 + mkdirp: ^2.1.6 + path-browserify: ^1.0.1 + checksum: eb02480971fbe045b4dd099d1ddb262d47d657197fefb73a4a2c89523975bfb0b23050207d49d19e853ef23bffdcb9d89a778f52f6b3385ae5bcf63322523700 + languageName: node + linkType: hard + "@tsconfig/docusaurus@npm:^1.0.7": version: 1.0.7 resolution: "@tsconfig/docusaurus@npm:1.0.7" @@ -11750,6 +11701,13 @@ __metadata: languageName: node linkType: hard +"code-block-writer@npm:^12.0.0": + version: 12.0.0 + resolution: "code-block-writer@npm:12.0.0" + checksum: 9f6505a4d668c9131c6f3f686359079439e66d5f50c236614d52fcfa53aeb0bc615b2c6c64ef05b5511e3b0433ccfd9f7756ad40eb3b9298af6a7d791ab1981d + languageName: node + linkType: hard + "collapse-white-space@npm:^1.0.2": version: 1.0.6 resolution: "collapse-white-space@npm:1.0.6" @@ -12177,13 +12135,13 @@ __metadata: languageName: node linkType: hard -"cosmjs-types@npm:^0.7.1": - version: 0.7.1 - resolution: "cosmjs-types@npm:0.7.1" +"cosmjs-types@npm:^0.8.0": + version: 0.8.0 + resolution: "cosmjs-types@npm:0.8.0" dependencies: long: ^4.0.0 protobufjs: ~6.11.2 - checksum: 533d56d076a39fea98cac766ef965e92cc21e8de27cbebdd7396526c67167cef3aff683675337e95a21de212beedac8338a9e5405367115f68eb97cce2320aa8 + checksum: 99714ec956d2cb2e521d39896c9c9a24cf9df0d370265c203646ea015b51e86472efc0cb11f67a80f0649d178b0bcff77ac659e67fdfc8b2437cd7a42018577f languageName: node linkType: hard @@ -12733,10 +12691,10 @@ __metadata: version: 0.0.0-use.local resolution: "desmjs-monorepo-root@workspace:." dependencies: - "@cosmjs/cosmwasm-stargate": 0.30.1 - "@cosmjs/crypto": 0.30.1 + "@cosmjs/cosmwasm-stargate": 0.31.0 + "@cosmjs/crypto": 0.31.0 "@cosmjs/encoding": 0.31.0 - "@cosmjs/proto-signing": 0.30.1 + "@cosmjs/proto-signing": 0.31.0 "@cosmjs/utils": ^0.31.0 "@desmoslabs/desmjs": "workspace:packages/core" "@desmoslabs/desmjs-types": "workspace:packages/types" @@ -13964,7 +13922,7 @@ __metadata: languageName: node linkType: hard -"fast-glob@npm:^3.2.11, fast-glob@npm:^3.2.9": +"fast-glob@npm:^3.2.11, fast-glob@npm:^3.2.12, fast-glob@npm:^3.2.9": version: 3.2.12 resolution: "fast-glob@npm:3.2.12" dependencies: @@ -17167,6 +17125,22 @@ __metadata: languageName: node linkType: hard +"libsodium-sumo@npm:^0.7.11": + version: 0.7.11 + resolution: "libsodium-sumo@npm:0.7.11" + checksum: 9efac902a05002e1caca1c1df3a7cd838ac370588cfa31107d6e787cb5a181f4ca46c7961e3136943c8b07b1d543c0283b91e08a141f9b55a74f10808c3017ef + languageName: node + linkType: hard + +"libsodium-wrappers-sumo@npm:^0.7.11": + version: 0.7.11 + resolution: "libsodium-wrappers-sumo@npm:0.7.11" + dependencies: + libsodium-sumo: ^0.7.11 + checksum: 26c7aaf8c4b6da6b06ef17637e5541e16c796be9611b194d795501f021ac04abfeda09cadae66b3b515308993cd57361a571eefabdf9d9b3377b070a17535440 + languageName: node + linkType: hard + "libsodium-wrappers@npm:^0.7.6": version: 0.7.10 resolution: "libsodium-wrappers@npm:0.7.10" @@ -18142,6 +18116,15 @@ __metadata: languageName: node linkType: hard +"minimatch@npm:^7.4.3": + version: 7.4.6 + resolution: "minimatch@npm:7.4.6" + dependencies: + brace-expansion: ^2.0.1 + checksum: 1a6c8d22618df9d2a88aabeef1de5622eb7b558e9f8010be791cb6b0fa6e102d39b11c28d75b855a1e377b12edc7db8ff12a99c20353441caa6a05e78deb5da9 + languageName: node + linkType: hard + "minimatch@npm:^9.0.0": version: 9.0.0 resolution: "minimatch@npm:9.0.0" @@ -18278,6 +18261,15 @@ __metadata: languageName: node linkType: hard +"mkdirp@npm:^2.1.6": + version: 2.1.6 + resolution: "mkdirp@npm:2.1.6" + bin: + mkdirp: dist/cjs/src/bin.js + checksum: 8a1d09ffac585e55f41c54f445051f5bc33a7de99b952bb04c576cafdf1a67bb4bae8cb93736f7da6838771fbf75bc630430a3a59e1252047d2278690bd150ee + languageName: node + linkType: hard + "mocha@npm:^10.2.0": version: 10.2.0 resolution: "mocha@npm:10.2.0" @@ -19090,6 +19082,13 @@ __metadata: languageName: node linkType: hard +"path-browserify@npm:^1.0.1": + version: 1.0.1 + resolution: "path-browserify@npm:1.0.1" + checksum: c6d7fa376423fe35b95b2d67990060c3ee304fc815ff0a2dc1c6c3cfaff2bd0d572ee67e18f19d0ea3bbe32e8add2a05021132ac40509416459fffee35200699 + languageName: node + linkType: hard + "path-exists@npm:^3.0.0": version: 3.0.0 resolution: "path-exists@npm:3.0.0" @@ -22621,6 +22620,16 @@ __metadata: languageName: node linkType: hard +"ts-morph@npm:^19.0.0": + version: 19.0.0 + resolution: "ts-morph@npm:19.0.0" + dependencies: + "@ts-morph/common": ~0.20.0 + code-block-writer: ^12.0.0 + checksum: c2546da8dcbdfd5f987ef39f30e52de5cc89391b7357ad45e7a09d05d2fd0cabb92c9d1cf14860ba27e9e3476707b854ba9671a1c8e0a925b6457305ef3e23ea + languageName: node + linkType: hard + "ts-node@npm:^10.9.1": version: 10.9.1 resolution: "ts-node@npm:10.9.1"