diff --git a/.changeset/light-ligers-bake.md b/.changeset/light-ligers-bake.md new file mode 100644 index 000000000..39b022cc3 --- /dev/null +++ b/.changeset/light-ligers-bake.md @@ -0,0 +1,5 @@ +--- +"@sei-js/ledger": patch +--- + +Update library versions diff --git a/.changeset/witty-knives-help.md b/.changeset/witty-knives-help.md new file mode 100644 index 000000000..30a94de17 --- /dev/null +++ b/.changeset/witty-knives-help.md @@ -0,0 +1,5 @@ +--- +"@sei-js/cosmos": major +--- + +Adds libraries for all Sei Typescript Types, for querying cosmos REST endpoints, and for proto encoding/decoding. diff --git a/.github/workflows/checks.yml b/.github/workflows/checks.yml index 55de0d89d..b415497e0 100644 --- a/.github/workflows/checks.yml +++ b/.github/workflows/checks.yml @@ -10,9 +10,7 @@ jobs: - uses: actions/checkout@v3 - uses: actions/setup-node@v3 with: - node-version: 18 - - uses: browser-actions/setup-chrome@v1 - - run: chrome --version + node-version: 20 - run: yarn - run: yarn lint:all - run: yarn build:all diff --git a/.nvmrc b/.nvmrc index 6aab9b43f..9a2a0e219 100644 --- a/.nvmrc +++ b/.nvmrc @@ -1 +1 @@ -v18.18.0 +v20 diff --git a/package.json b/package.json index dc9d1fee2..bd137b304 100644 --- a/package.json +++ b/package.json @@ -7,7 +7,7 @@ "packages/*" ], "scripts": { - "build:all": "nx run-many --target=build", + "build:all": "nx run-many --target=build --all", "build:since": "nx affected --target=build", "prebuild": "yarn build:since", "postinstall": "yarn update-submodules", @@ -24,6 +24,7 @@ "test:coverage": "nx test --all --coverage --skip-nx-cache" }, "dependencies": { + "@biomejs/biome": "^1.9.2", "@changesets/cli": "^2.26.0", "axios": "^1.6.0", "glob": "^10.3.10", diff --git a/packages/cosmos/.npmignore b/packages/cosmos/.npmignore new file mode 100644 index 000000000..bcedcd002 --- /dev/null +++ b/packages/cosmos/.npmignore @@ -0,0 +1,16 @@ +node_modules +scripts/ +generated/ +public/ +bin/ + +.gitkeep +jest.config.ts +tsconfig.json + +yarn-error.log + +.eslintignore +eslintrc.json + +biome.json diff --git a/packages/cosmos/README.md b/packages/cosmos/README.md new file mode 100644 index 000000000..c1cd1dda1 --- /dev/null +++ b/packages/cosmos/README.md @@ -0,0 +1,276 @@ +# @sei-js/cosmos + +`@sei-js/cosmos` is a set of TypeScript libraries for interaction with Sei, using Cosmos standards and interfaces. It provides: + +> **For EVM Developers**: @sei-js/cosmos/types provides TypeScript types for all custom Sei modules, simplifying integration between Cosmos and EVM ecosystems. + +### Installation +Install the package using Yarn: `yarn add @sei-js/cosmos` + +### Exported Packages +- [@sei-js/cosmos/types](#sei-jscosmostypes): TypeScript types for all modules and types. +- [@sei-js/cosmos/encoding](#sei-jscosmosencoding): Protobuf encoding/decoding utilities. +- [@sei-js/cosmos/rest](#sei-jscosmosrest): REST client for querying Sei chain state through the Cosmos REST interface. + +## `@sei-js/cosmos/types` +Provides TypeScript types, enums, and interfaces for all Sei modules, including transaction messages, queries, coins, and REST and gRPC request/response types. + +## Features +- Msg, Query, and enum types for all Sei modules and transactions + +> **Usage with other packages**: Works with `@sei-js/cosmos/rest`, `@sei-js/cosmos/encoding`, `@sei-js/cosmjs` and `@cosmjs/stargate`. + +### Example Usage + +#### Ex.) Bank Send Tx Msg +```typescript +// Import the MsgSend type from the bank module +import { MsgSend } from '@sei-js/cosmos/types/cosmos/bank/v1beta1'; + +// Create an object that conforms to the MsgSend type +const msgSend: MsgSend = { + from_address: 'sei1hafptm4zxy5nw8rd2pxyg83c5ls2v62tstzuv2', + to_address: 'sei1v6459sl87jyfkvzmy6y8a6j2fj8k5r6x2n2l9', + amount: [{ denom: 'usei', amount: '100' }] +}; +``` + +#### Ex.) TokenFactory Tx Msg's +```typescript +// Import the MsgCreateDenom and MsgMint types from tokenfactory module +import type { MsgCreateDenom, MsgMint } from "@sei-js/cosmos/types/tokenfactory"; + +// Create an object that conforms to the MsgCreateDenom type +const msgCreateDenom: MsgCreateDenom = { + sender: accounts[0].address, + subdenom: "mytoken", + allow_list: { + addresses: ["sei123..."], + } +} + +// Create an object that conforms to the MsgMint type +const msgMint: MsgMint = { + sender: accounts[0].address, + amount: { denom: "usei", amount: "100000" }, +} + +// Do what you want with the messages +``` + +## `@sei-js/cosmos/encoding` + +The @sei-js/cosmos/encoding package provides utilities for encoding/decoding Sei transactions using Protobuf. It also includes amino converters and a type URL registry for gRPC and legacy Cosmos SDK interactions. + +> **gRPC interface only**: This package is meant for usage with gRPC interfaces. For REST interfaces, use `@sei-js/cosmos/rest`. + +### Features + +- Protobuf encoding/decoding for all Sei native transactions and queries +- Aggregated message typeUrl registry for usage `@cosmjs/stargate` clients +- Amino message converters for use with Ledger or legacy Cosmos signing +- Uses official types from `@sei-js/cosmos/types` + + +### Importing +```typescript +// Import Encoder, then follow the path to the desired module +import { Encoder } from '@sei-js/cosmos/encoding'; + +// Import Amino converters for legacy Cosmos SDK support +import { aminoConverters } from "@sei-js/cosmos/encoding/stargate"; + +// Import typeUrl registry for Stargate clients +import { seiProtoRegistry } from "@sei-js/cosmos/encoding/stargate"; +``` + +### Encoding/Decoding and getting type URLs. +Cosmos gRPC transactions are encoded using protobuf. This library exports encoding and decoding classes for all valid Sei Msg types. + +```typescript +import { Encoder } from '@sei-js/cosmos/encoding'; + +// Follow the path to the desired module and message type +const msgSend = Encoder.cosmos.bank.v1beta1.MsgSend.fromPartial({ + from_address: 'sei1hafptm4zxy5nw8rd2pxyg83c5ls2v62tstzuv2', + to_address: 'sei1v6459sl87jyfkvzmy6y8a6j2fj8k5r6x2n2l9', + amount: [{ denom: 'usei', amount: '100' }] +}); + + +// Or use @sei-js/cosmos/types to create the message, see below. + +// Encode the message +const encoded = Encoder.cosmos.bank.v1beta1.MsgSend.encode(msgSend).finish(); + +// Or if you have an encoded message, you can decode it +const decoded = Encoder.cosmos.bank.v1beta1.MsgSend.decode(encoded); + +// Create the proto message using the typeUrl and encoded message +const protoMsgSend = { typeUrl: `/${MsgSend.$type}`, value: encoded }; +``` + +### Usage with @cosmjs/stargate + +The package provides pre-built registries and amino converters for usage with `@cosmjs/stargate`. These can be used to set up Stargate clients to sign and broadcast Sei transactions. + +```typescript +import { Encoder } from '@sei-js/cosmos/encoding'; +import { seiProtoRegistry } from "@sei-js/cosmos/encoding/stargate"; + +import {SigningStargateClient} from "@cosmjs/stargate"; +import {Registry} from "@cosmjs/proto-signing"; + +// or any other way to get an offline signer +const offlineSigner = await window.compass.getOfflineSigner("arctic-1"); +const accounts = await offlineSigner.getAccounts(); + +// Create a @cosmjs/stargate registry with the Sei proto registry +const registry = new Registry(seiProtoRegistry); + +// Create a Stargate client with the registry and amino types +const stargateClient = await SigningStargateClient.connectWithSigner( + "https://rpc-arctic-1.sei-apis.com", + offlineSigner, + { registry }, +); + +// Create a MsgSend object +const msgSend = Encoder.cosmos.bank.v1beta1.MsgSend.fromPartial({ + from_address: accounts[0].address, + to_address: "sei1v6459sl87jyfkvzmy6y8a6j2fj8k5r6x2n2l9", + amount: [{ denom: "usei", amount: "10" }] +}); + +// Create a message object with the typeUrl and value. (For Stargate clients the value isn't encoded, but gRPC clients typically require it to be encoded) +const message = { typeUrl: `/${Encoder.cosmos.bank.v1beta1.MsgSend.$type}`, value: msgSend }; + + +const txResponse = await stargateClient.signAndBroadcast(accounts[0].address, [message], { + amount: [{ denom: "usei", amount: "100000" }], + gas: "200000", +}); + +console.log(txResponse.transactionHash); +``` + +### Interoperability with @sei-js/cosmos/types + +The `@sei-js/cosmos/encoding` package is built to work seamlessly with the `@sei-js/cosmos/types` package. You can use the types from `@sei-js/cosmos/types` directly if needed. However, in most cases, you don't need to import `@sei-js/cosmos/types` separately when using `@sei-js/cosmos/encoding`, as the values returned from the encoding functions are already typed correctly. + +#### Recommended: Using @sei-js/cosmos/encoding +```typescript +import { Encoder } from '@sei-js/cosmos/encoding'; + +// Encoder.cosmos.bank.v1beta1.MsgSend is already typed using the `MsgSend` type from the @sei-js/cosmos/types package +const msgSend = Encoder.cosmos.bank.v1beta1.MsgSend.fromPartial({ + from_address: 'sei1hafptm4zxy5nw8rd2pxyg83c5ls2v62tstzuv2', + to_address: 'sei1v6459sl87jyfkvzmy6y8a6j2fj8k5r6x2n2l9' +}); + +// Encode the message +const encoded = Encoder.cosmos.bank.v1beta1.MsgSend.encode(msgSend).finish(); + +// Or if you have an encoded message, you can decode it +const decoded = Encoder.cosmos.bank.v1beta1.MsgSend.decode(encoded); + +// Create the proto message using the typeUrl and encoded message +const protoMsgSend = { typeUrl: `/${MsgSend.$type}`, value: encoded }; +``` + +#### Optional: Using @sei-js/cosmos/types directly +```typescript +import { MsgSend } from '@sei-js/cosmos/types/cosmos/bank/v1beta1'; + +// This type can be used to create the proto message directly +const msgSend: MsgSend = { + from_address: 'sei1hafptm4zxy5nw8rd2pxyg83c5ls2v62tstzuv2', + to_address: 'sei1v6459sl87jyfkvzmy6y8a6j2fj8k5r6x2n2l9', + amount: [{ denom: 'usei', amount: '100' }] +}; + +// Encode the message +const encoded = Encoder.cosmos.bank.v1beta1.MsgSend.encode(msgSend).finish(); + +// Or if you have an encoded message, you can decode it +const decoded = Encoder.cosmos.bank.v1beta1.MsgSend.decode(encoded); + +// Create the proto message using the typeUrl and encoded message +const protoMsgSend = { typeUrl: `/${MsgSend.$type}`, value: encoded }; +``` + +### Usage with Ledger +```typescript +import {createTransportAndApp, SeiLedgerOfflineAminoSigner} from "@sei-js/ledger"; + +import { Encoder } from '@sei-js/cosmos/encoding'; + +import { aminoConverters } from "@sei-js/cosmos/encoding/stargate"; + +import { AminoTypes, SigningStargateClient, coin } from "@cosmjs/stargate"; + +const hdPath = "m/44'/60'/0'/0/0" +const validatorAddress = "seivaloper1r0tmhjhxmvwlzq5sy3z83qnyvc74uvs9ykek9l"; + +const { app } = await createTransportAndApp(); + +const cosmosAddressData = await app.getCosmosAddress(hdPath, false); + +const ledgerOfflineAminoSigner = new SeiLedgerOfflineAminoSigner(app, hdPath); +const aminoTypes = new AminoTypes(aminoConverters); +const signingStargateClient = await SigningStargateClient.connectWithSigner( + rpcUrl, + ledgerOfflineAminoSigner, + { aminoTypes }, +); + +const fee = { + amount: [{denom: "usei", amount: "20000"}], + gas: "200000", +}; + +const msgDelegate = Encoder.cosmos.staking.v1beta1.MsgDelegate.fromPartial({ + delegator_address: cosmosAddressData.address, + validator_address: validatorAddress, + amount: coin(2000, "usei"), +}); + +const protoMessage = { typeUrl: `/${Encoder.cosmos.staking.v1beta1.MsgDelegate.$type}`, value: msgDelegate }; + +// This will automatically get converted to the correct amino type due to the aminoTypes registry passed to the SigningStargateClient +const result = await signingStargateClient.signAndBroadcast(cosmosAddressData.address, [protoMessage], fee, memo) + +if (result.code === 0) { + console.log("Transaction broadcast successfully:", result); +} else { + console.error("Error broadcasting transaction:", result.rawLog); +} +``` + +## `@sei-js/cosmos/rest` + +Provides a REST client for all Sei REST endpoints. It uses types from `@sei-js/cosmos/types` for easy use across your stack. + +> **Looking for REST endpoints?**: You can view the full list of available REST endpoints in the [Sei Cosmos REST docs](https://www.docs.sei.io/endpoints/cosmos) if you prefer to manually make a call using fetch or another request library. + + +### Example Usage +Import the Querier and follow the path to the desired module and message type. Request and response types are automatically typed using `@sei-js/cosmos/types`. + +#### Ex.) Querying user balances +```typescript +import { Querier } from '@sei-js/cosmos/rest'; + +// Follow the path to the desired module and message type +const { balances } = await Querier.cosmos.bank.v1beta1.AllBalances({ address: seiAddress }, { pathPrefix: chainConfig.restUrl }); +``` + +## Local Package Development + +### Pre-requisites +- Buf installed on your machine. https://buf.build/docs/installation + +This package is generated using buf.build. To regenerate the types, run `yarn generate` which builds the types from proto files with the buf build `ts-proto` and `protoc-gen-grpc-gateway-ts` plugins. From there, typescript is used in a postprocessing script to extract the necessary types and perform any formatting required. + +### Regenerating Packages +To regenerate the packages, run `yarn generate`. This will rebuild the libraries using the scripts in this repo. diff --git a/packages/cosmos/__tests__/encoding.spec.ts b/packages/cosmos/__tests__/encoding.spec.ts new file mode 100644 index 000000000..ae52f6860 --- /dev/null +++ b/packages/cosmos/__tests__/encoding.spec.ts @@ -0,0 +1,26 @@ +import { Encoder } from "../generated/encoding"; + +describe("Encoder", () => { + it("should correctly encode and decode a MsgSend message", () => { + // Sample MsgSend object + const msgSend = Encoder.cosmos.bank.v1beta1.MsgSend.fromPartial({ + from_address: "sei1hafptm4zxy5nw8rd2pxyg83c5ls2v62tstzuv2", + to_address: "sei1v6459sl87jyfkvzmy6y8a6j2fj8k5r6x2n2l9", + amount: [{ denom: "usei", amount: "100" }], + }); + + // Encode the message + const encoded = Encoder.cosmos.bank.v1beta1.MsgSend.encode(msgSend).finish(); + expect(encoded).toBeInstanceOf(Uint8Array); + expect(encoded.length).toBeGreaterThan(0); + + // Decode the message back + const decoded = Encoder.cosmos.bank.v1beta1.MsgSend.decode(encoded); + expect(decoded).toEqual(msgSend); + + // Verify that decoded message matches the original object + expect(decoded.from_address).toBe(msgSend.from_address); + expect(decoded.to_address).toBe(msgSend.to_address); + expect(decoded.amount).toEqual(msgSend.amount); + }); +}); diff --git a/packages/cosmos/__tests__/types.spec.ts b/packages/cosmos/__tests__/types.spec.ts new file mode 100644 index 000000000..0bb72527c --- /dev/null +++ b/packages/cosmos/__tests__/types.spec.ts @@ -0,0 +1,32 @@ +import type { MsgSend } from "../generated/types/cosmos/bank/v1beta1"; +import type { Coin } from "../generated/types/cosmos/base/v1beta1"; + +describe("MsgSend Type Validation", () => { + it("should create a valid MsgSend object", () => { + const msgSend: MsgSend = { + from_address: "sei1hafptm4zxy5nw8rd2pxyg83c5ls2v62tstzuv2", + to_address: "sei1v6459sl87jyfkvzmy6y8a6j2fj8k5r6x2n2l9", + amount: [{ denom: "usei", amount: "100" }], + }; + + expect(msgSend).toHaveProperty("from_address"); + expect(msgSend).toHaveProperty("to_address"); + expect(msgSend).toHaveProperty("amount"); + expect(msgSend.amount).toBeInstanceOf(Array); + expect(msgSend.amount[0]).toHaveProperty("denom", "usei"); + expect(msgSend.amount[0]).toHaveProperty("amount", "100"); + }); + + it("should validate nested structures in MsgSend.amount", () => { + const coin: Coin = { denom: "usei", amount: "200" }; + const msgSend: MsgSend = { + from_address: "sei1hafptm4zxy5nw8rd2pxyg83c5ls2v62tstzuv2", + to_address: "sei1v6459sl87jyfkvzmy6y8a6j2fj8k5r6x2n2l9", + amount: [coin], + }; + + // Validate nested properties + expect(msgSend.amount[0].denom).toBe("usei"); + expect(msgSend.amount[0].amount).toBe("200"); + }); +}); diff --git a/packages/cosmos/bin/protoc-gen-grpc-gateway-ts b/packages/cosmos/bin/protoc-gen-grpc-gateway-ts new file mode 100755 index 000000000..2b1f012da Binary files /dev/null and b/packages/cosmos/bin/protoc-gen-grpc-gateway-ts differ diff --git a/packages/cosmos/biome.json b/packages/cosmos/biome.json new file mode 100644 index 000000000..d7ac5c096 --- /dev/null +++ b/packages/cosmos/biome.json @@ -0,0 +1,49 @@ +{ + "$schema": "https://biomejs.dev/schemas/1.9.2/schema.json", + "vcs": { + "enabled": false, + "clientKind": "git", + "useIgnoreFile": false + }, + "files": { + "ignoreUnknown": false, + "ignore": [] + }, + "formatter": { + "enabled": true, + "indentStyle": "tab", + "lineWidth": 160 + }, + "organizeImports": { + "enabled": true + }, + "linter": { + "enabled": true, + "rules": { + "recommended": true, + "correctness": { + "noUnusedImports": "error" + }, + "suspicious": { + "noExplicitAny": "off" + }, + "complexity": { + "noStaticOnlyClass": "off", + "noForEach": "off", + "noUselessSwitchCase": "off", + "noBannedTypes": "off", + "useLiteralKeys": "off" + }, + "style": { + "noUselessElse": "off", + "noNonNullAssertion": "off", + "noUnusedTemplateLiteral": "off" + } + } + }, + "javascript": { + "formatter": { + "quoteStyle": "double" + } + } +} diff --git a/packages/cosmos/buf.gen.yaml b/packages/cosmos/buf.gen.yaml new file mode 100644 index 000000000..cc3d06125 --- /dev/null +++ b/packages/cosmos/buf.gen.yaml @@ -0,0 +1,17 @@ +version: v2 +managed: + enabled: true +plugins: + - local: ./bin/protoc-gen-grpc-gateway-ts + out: ./gen/grpc-gateway + opt: + - use_proto_names=true + - remote: buf.build/community/stephenh-ts-proto:v2.2.0 + out: ./gen/ts-proto + opt: + - esModuleInterop=true + - useOptionals=messages + - outputServices=false + - useSnakeTypeName=false + - snakeToCamel=false + - outputTypeAnnotations=static-only diff --git a/packages/cosmos/generated/encoding/amino.ts b/packages/cosmos/generated/encoding/amino.ts new file mode 100644 index 000000000..dda2a4ff0 --- /dev/null +++ b/packages/cosmos/generated/encoding/amino.ts @@ -0,0 +1,226 @@ +import type { AminoConverters } from "@cosmjs/stargate"; +import { aminoConverters as confio_proofs_amino } from "./confio/proofs"; +import { aminoConverters as cosmos_accesscontrol_accesscontrol_amino } from "./cosmos/accesscontrol/accesscontrol"; +import { aminoConverters as cosmos_accesscontrol_x_genesis_amino } from "./cosmos/accesscontrol_x/genesis"; +import { aminoConverters as cosmos_accesscontrol_x_query_amino } from "./cosmos/accesscontrol_x/query"; +import { aminoConverters as cosmos_auth_v1beta1_auth_amino } from "./cosmos/auth/v1beta1/auth"; +import { aminoConverters as cosmos_auth_v1beta1_genesis_amino } from "./cosmos/auth/v1beta1/genesis"; +import { aminoConverters as cosmos_auth_v1beta1_query_amino } from "./cosmos/auth/v1beta1/query"; +import { aminoConverters as cosmos_authz_v1beta1_authz_amino } from "./cosmos/authz/v1beta1/authz"; +import { aminoConverters as cosmos_authz_v1beta1_event_amino } from "./cosmos/authz/v1beta1/event"; +import { aminoConverters as cosmos_authz_v1beta1_genesis_amino } from "./cosmos/authz/v1beta1/genesis"; +import { aminoConverters as cosmos_authz_v1beta1_query_amino } from "./cosmos/authz/v1beta1/query"; +import { aminoConverters as cosmos_authz_v1beta1_tx_amino } from "./cosmos/authz/v1beta1/tx"; +import { aminoConverters as cosmos_bank_v1beta1_authz_amino } from "./cosmos/bank/v1beta1/authz"; +import { aminoConverters as cosmos_bank_v1beta1_bank_amino } from "./cosmos/bank/v1beta1/bank"; +import { aminoConverters as cosmos_bank_v1beta1_genesis_amino } from "./cosmos/bank/v1beta1/genesis"; +import { aminoConverters as cosmos_bank_v1beta1_query_amino } from "./cosmos/bank/v1beta1/query"; +import { aminoConverters as cosmos_bank_v1beta1_tx_amino } from "./cosmos/bank/v1beta1/tx"; +import { aminoConverters as cosmos_base_abci_v1beta1_abci_amino } from "./cosmos/base/abci/v1beta1/abci"; +import { aminoConverters as cosmos_base_kv_v1beta1_kv_amino } from "./cosmos/base/kv/v1beta1/kv"; +import { aminoConverters as cosmos_base_query_v1beta1_pagination_amino } from "./cosmos/base/query/v1beta1/pagination"; +import { aminoConverters as cosmos_base_reflection_v2alpha1_reflection_amino } from "./cosmos/base/reflection/v2alpha1/reflection"; +import { aminoConverters as cosmos_base_snapshots_v1beta1_snapshot_amino } from "./cosmos/base/snapshots/v1beta1/snapshot"; +import { aminoConverters as cosmos_base_store_v1beta1_commit_info_amino } from "./cosmos/base/store/v1beta1/commit_info"; +import { aminoConverters as cosmos_base_store_v1beta1_listening_amino } from "./cosmos/base/store/v1beta1/listening"; +import { aminoConverters as cosmos_base_tendermint_v1beta1_query_amino } from "./cosmos/base/tendermint/v1beta1/query"; +import { aminoConverters as cosmos_base_v1beta1_coin_amino } from "./cosmos/base/v1beta1/coin"; +import { aminoConverters as cosmos_capability_v1beta1_capability_amino } from "./cosmos/capability/v1beta1/capability"; +import { aminoConverters as cosmos_capability_v1beta1_genesis_amino } from "./cosmos/capability/v1beta1/genesis"; +import { aminoConverters as cosmos_crisis_v1beta1_genesis_amino } from "./cosmos/crisis/v1beta1/genesis"; +import { aminoConverters as cosmos_crisis_v1beta1_tx_amino } from "./cosmos/crisis/v1beta1/tx"; +import { aminoConverters as cosmos_crypto_ed25519_keys_amino } from "./cosmos/crypto/ed25519/keys"; +import { aminoConverters as cosmos_crypto_multisig_keys_amino } from "./cosmos/crypto/multisig/keys"; +import { aminoConverters as cosmos_crypto_multisig_v1beta1_multisig_amino } from "./cosmos/crypto/multisig/v1beta1/multisig"; +import { aminoConverters as cosmos_crypto_secp256k1_keys_amino } from "./cosmos/crypto/secp256k1/keys"; +import { aminoConverters as cosmos_crypto_secp256r1_keys_amino } from "./cosmos/crypto/secp256r1/keys"; +import { aminoConverters as cosmos_crypto_sr25519_keys_amino } from "./cosmos/crypto/sr25519/keys"; +import { aminoConverters as cosmos_distribution_v1beta1_distribution_amino } from "./cosmos/distribution/v1beta1/distribution"; +import { aminoConverters as cosmos_distribution_v1beta1_genesis_amino } from "./cosmos/distribution/v1beta1/genesis"; +import { aminoConverters as cosmos_distribution_v1beta1_query_amino } from "./cosmos/distribution/v1beta1/query"; +import { aminoConverters as cosmos_evidence_v1beta1_evidence_amino } from "./cosmos/evidence/v1beta1/evidence"; +import { aminoConverters as cosmos_evidence_v1beta1_genesis_amino } from "./cosmos/evidence/v1beta1/genesis"; +import { aminoConverters as cosmos_evidence_v1beta1_query_amino } from "./cosmos/evidence/v1beta1/query"; +import { aminoConverters as cosmos_evidence_v1beta1_tx_amino } from "./cosmos/evidence/v1beta1/tx"; +import { aminoConverters as cosmos_feegrant_v1beta1_feegrant_amino } from "./cosmos/feegrant/v1beta1/feegrant"; +import { aminoConverters as cosmos_feegrant_v1beta1_genesis_amino } from "./cosmos/feegrant/v1beta1/genesis"; +import { aminoConverters as cosmos_feegrant_v1beta1_query_amino } from "./cosmos/feegrant/v1beta1/query"; +import { aminoConverters as cosmos_feegrant_v1beta1_tx_amino } from "./cosmos/feegrant/v1beta1/tx"; +import { aminoConverters as cosmos_genutil_v1beta1_genesis_amino } from "./cosmos/genutil/v1beta1/genesis"; +import { aminoConverters as cosmos_gov_v1beta1_genesis_amino } from "./cosmos/gov/v1beta1/genesis"; +import { aminoConverters as cosmos_gov_v1beta1_gov_amino } from "./cosmos/gov/v1beta1/gov"; +import { aminoConverters as cosmos_gov_v1beta1_query_amino } from "./cosmos/gov/v1beta1/query"; +import { aminoConverters as cosmos_gov_v1beta1_tx_amino } from "./cosmos/gov/v1beta1/tx"; +import { aminoConverters as cosmos_mint_v1beta1_genesis_amino } from "./cosmos/mint/v1beta1/genesis"; +import { aminoConverters as cosmos_mint_v1beta1_mint_amino } from "./cosmos/mint/v1beta1/mint"; +import { aminoConverters as cosmos_mint_v1beta1_query_amino } from "./cosmos/mint/v1beta1/query"; +import { aminoConverters as cosmos_params_types_types_amino } from "./cosmos/params/types/types"; +import { aminoConverters as cosmos_params_v1beta1_params_amino } from "./cosmos/params/v1beta1/params"; +import { aminoConverters as cosmos_params_v1beta1_query_amino } from "./cosmos/params/v1beta1/query"; +import { aminoConverters as cosmos_slashing_v1beta1_genesis_amino } from "./cosmos/slashing/v1beta1/genesis"; +import { aminoConverters as cosmos_slashing_v1beta1_query_amino } from "./cosmos/slashing/v1beta1/query"; +import { aminoConverters as cosmos_slashing_v1beta1_slashing_amino } from "./cosmos/slashing/v1beta1/slashing"; +import { aminoConverters as cosmos_slashing_v1beta1_tx_amino } from "./cosmos/slashing/v1beta1/tx"; +import { aminoConverters as cosmos_staking_v1beta1_authz_amino } from "./cosmos/staking/v1beta1/authz"; +import { aminoConverters as cosmos_staking_v1beta1_genesis_amino } from "./cosmos/staking/v1beta1/genesis"; +import { aminoConverters as cosmos_staking_v1beta1_query_amino } from "./cosmos/staking/v1beta1/query"; +import { aminoConverters as cosmos_staking_v1beta1_staking_amino } from "./cosmos/staking/v1beta1/staking"; +import { aminoConverters as cosmos_staking_v1beta1_tx_amino } from "./cosmos/staking/v1beta1/tx"; +import { aminoConverters as cosmos_tx_signing_v1beta1_signing_amino } from "./cosmos/tx/signing/v1beta1/signing"; +import { aminoConverters as cosmos_tx_v1beta1_service_amino } from "./cosmos/tx/v1beta1/service"; +import { aminoConverters as cosmos_tx_v1beta1_tx_amino } from "./cosmos/tx/v1beta1/tx"; +import { aminoConverters as cosmos_upgrade_v1beta1_upgrade_amino } from "./cosmos/upgrade/v1beta1/upgrade"; +import { aminoConverters as cosmos_vesting_v1beta1_vesting_amino } from "./cosmos/vesting/v1beta1/vesting"; +import { aminoConverters as epoch_epoch_amino } from "./epoch/epoch"; +import { aminoConverters as epoch_genesis_amino } from "./epoch/genesis"; +import { aminoConverters as epoch_params_amino } from "./epoch/params"; +import { aminoConverters as epoch_query_amino } from "./epoch/query"; +import { aminoConverters as eth_tx_amino } from "./eth/tx"; +import { aminoConverters as evm_config_amino } from "./evm/config"; +import { aminoConverters as evm_genesis_amino } from "./evm/genesis"; +import { aminoConverters as evm_params_amino } from "./evm/params"; +import { aminoConverters as evm_query_amino } from "./evm/query"; +import { aminoConverters as evm_receipt_amino } from "./evm/receipt"; +import { aminoConverters as evm_tx_amino } from "./evm/tx"; +import { aminoConverters as evm_types_amino } from "./evm/types"; +import { aminoConverters as google_api_http_amino } from "./google/api/http"; +import { aminoConverters as google_api_httpbody_amino } from "./google/api/httpbody"; +import { aminoConverters as google_protobuf_any_amino } from "./google/protobuf/any"; +import { aminoConverters as google_protobuf_descriptor_amino } from "./google/protobuf/descriptor"; +import { aminoConverters as google_protobuf_duration_amino } from "./google/protobuf/duration"; +import { aminoConverters as google_protobuf_timestamp_amino } from "./google/protobuf/timestamp"; +import { aminoConverters as mint_v1beta1_genesis_amino } from "./mint/v1beta1/genesis"; +import { aminoConverters as mint_v1beta1_gov_amino } from "./mint/v1beta1/gov"; +import { aminoConverters as mint_v1beta1_mint_amino } from "./mint/v1beta1/mint"; +import { aminoConverters as mint_v1beta1_query_amino } from "./mint/v1beta1/query"; +import { aminoConverters as oracle_genesis_amino } from "./oracle/genesis"; +import { aminoConverters as oracle_oracle_amino } from "./oracle/oracle"; +import { aminoConverters as oracle_query_amino } from "./oracle/query"; +import { aminoConverters as tendermint_abci_types_amino } from "./tendermint/abci/types"; +import { aminoConverters as tendermint_crypto_keys_amino } from "./tendermint/crypto/keys"; +import { aminoConverters as tendermint_crypto_proof_amino } from "./tendermint/crypto/proof"; +import { aminoConverters as tendermint_libs_bits_types_amino } from "./tendermint/libs/bits/types"; +import { aminoConverters as tendermint_p2p_types_amino } from "./tendermint/p2p/types"; +import { aminoConverters as tendermint_types_block_amino } from "./tendermint/types/block"; +import { aminoConverters as tendermint_types_evidence_amino } from "./tendermint/types/evidence"; +import { aminoConverters as tendermint_types_params_amino } from "./tendermint/types/params"; +import { aminoConverters as tendermint_types_types_amino } from "./tendermint/types/types"; +import { aminoConverters as tendermint_types_validator_amino } from "./tendermint/types/validator"; +import { aminoConverters as tendermint_version_types_amino } from "./tendermint/version/types"; +import { aminoConverters as tokenfactory_genesis_amino } from "./tokenfactory/genesis"; +import { aminoConverters as tokenfactory_params_amino } from "./tokenfactory/params"; +import { aminoConverters as tokenfactory_tx_amino } from "./tokenfactory/tx"; + +export const aminoConverters: AminoConverters = { + ...epoch_epoch_amino, + ...epoch_genesis_amino, + ...epoch_params_amino, + ...epoch_query_amino, + ...confio_proofs_amino, + ...evm_config_amino, + ...evm_genesis_amino, + ...evm_receipt_amino, + ...evm_query_amino, + ...evm_types_amino, + ...evm_params_amino, + ...oracle_genesis_amino, + ...evm_tx_amino, + ...eth_tx_amino, + ...oracle_oracle_amino, + ...oracle_query_amino, + ...tokenfactory_genesis_amino, + ...tokenfactory_params_amino, + ...tokenfactory_tx_amino, + ...cosmos_accesscontrol_x_genesis_amino, + ...cosmos_accesscontrol_x_query_amino, + ...cosmos_accesscontrol_accesscontrol_amino, + ...google_api_http_amino, + ...google_protobuf_descriptor_amino, + ...google_protobuf_any_amino, + ...google_protobuf_duration_amino, + ...google_protobuf_timestamp_amino, + ...google_api_httpbody_amino, + ...mint_v1beta1_genesis_amino, + ...mint_v1beta1_gov_amino, + ...mint_v1beta1_mint_amino, + ...mint_v1beta1_query_amino, + ...tendermint_crypto_proof_amino, + ...tendermint_p2p_types_amino, + ...tendermint_crypto_keys_amino, + ...tendermint_types_validator_amino, + ...tendermint_types_types_amino, + ...tendermint_types_evidence_amino, + ...tendermint_version_types_amino, + ...tendermint_abci_types_amino, + ...cosmos_authz_v1beta1_genesis_amino, + ...cosmos_authz_v1beta1_tx_amino, + ...cosmos_authz_v1beta1_query_amino, + ...cosmos_authz_v1beta1_authz_amino, + ...tendermint_types_params_amino, + ...cosmos_capability_v1beta1_capability_amino, + ...cosmos_authz_v1beta1_event_amino, + ...cosmos_capability_v1beta1_genesis_amino, + ...tendermint_types_block_amino, + ...cosmos_auth_v1beta1_auth_amino, + ...cosmos_auth_v1beta1_genesis_amino, + ...cosmos_bank_v1beta1_genesis_amino, + ...cosmos_auth_v1beta1_query_amino, + ...cosmos_bank_v1beta1_bank_amino, + ...cosmos_bank_v1beta1_query_amino, + ...cosmos_bank_v1beta1_authz_amino, + ...cosmos_bank_v1beta1_tx_amino, + ...cosmos_base_v1beta1_coin_amino, + ...cosmos_crisis_v1beta1_genesis_amino, + ...cosmos_crisis_v1beta1_tx_amino, + ...cosmos_crypto_secp256k1_keys_amino, + ...cosmos_crypto_multisig_keys_amino, + ...cosmos_crypto_ed25519_keys_amino, + ...cosmos_crypto_secp256r1_keys_amino, + ...cosmos_evidence_v1beta1_evidence_amino, + ...cosmos_crypto_sr25519_keys_amino, + ...cosmos_evidence_v1beta1_genesis_amino, + ...cosmos_evidence_v1beta1_query_amino, + ...cosmos_evidence_v1beta1_tx_amino, + ...cosmos_distribution_v1beta1_genesis_amino, + ...cosmos_distribution_v1beta1_query_amino, + ...cosmos_distribution_v1beta1_distribution_amino, + ...cosmos_feegrant_v1beta1_genesis_amino, + ...cosmos_genutil_v1beta1_genesis_amino, + ...cosmos_feegrant_v1beta1_tx_amino, + ...cosmos_feegrant_v1beta1_feegrant_amino, + ...cosmos_slashing_v1beta1_genesis_amino, + ...cosmos_feegrant_v1beta1_query_amino, + ...cosmos_slashing_v1beta1_slashing_amino, + ...cosmos_slashing_v1beta1_query_amino, + ...cosmos_slashing_v1beta1_tx_amino, + ...cosmos_gov_v1beta1_genesis_amino, + ...cosmos_gov_v1beta1_gov_amino, + ...cosmos_gov_v1beta1_tx_amino, + ...cosmos_gov_v1beta1_query_amino, + ...cosmos_params_types_types_amino, + ...cosmos_mint_v1beta1_genesis_amino, + ...cosmos_mint_v1beta1_query_amino, + ...cosmos_mint_v1beta1_mint_amino, + ...cosmos_params_v1beta1_query_amino, + ...cosmos_staking_v1beta1_authz_amino, + ...cosmos_staking_v1beta1_genesis_amino, + ...cosmos_params_v1beta1_params_amino, + ...cosmos_staking_v1beta1_tx_amino, + ...cosmos_staking_v1beta1_staking_amino, + ...cosmos_staking_v1beta1_query_amino, + ...cosmos_upgrade_v1beta1_upgrade_amino, + ...cosmos_tx_v1beta1_service_amino, + ...cosmos_tx_v1beta1_tx_amino, + ...cosmos_vesting_v1beta1_vesting_amino, + ...tendermint_libs_bits_types_amino, + ...cosmos_base_abci_v1beta1_abci_amino, + ...cosmos_base_query_v1beta1_pagination_amino, + ...cosmos_base_snapshots_v1beta1_snapshot_amino, + ...cosmos_base_kv_v1beta1_kv_amino, + ...cosmos_base_store_v1beta1_commit_info_amino, + ...cosmos_base_reflection_v2alpha1_reflection_amino, + ...cosmos_base_store_v1beta1_listening_amino, + ...cosmos_base_tendermint_v1beta1_query_amino, + ...cosmos_crypto_multisig_v1beta1_multisig_amino, + ...cosmos_tx_signing_v1beta1_signing_amino, +}; diff --git a/packages/cosmos/generated/encoding/common.ts b/packages/cosmos/generated/encoding/common.ts new file mode 100644 index 000000000..fd8b78a35 --- /dev/null +++ b/packages/cosmos/generated/encoding/common.ts @@ -0,0 +1,27 @@ +import type { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin + ? T + : T extends globalThis.Array + ? globalThis.Array> + : T extends ReadonlyArray + ? ReadonlyArray> + : T extends {} + ? { [K in keyof T]?: DeepPartial } + : Partial; + +export type KeysOfUnion = T extends T ? keyof T : never; + +export type Exact = P extends Builtin ? P : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +export interface MessageFns { + readonly $type: V; + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/packages/cosmos/generated/encoding/confio/index.ts b/packages/cosmos/generated/encoding/confio/index.ts new file mode 100644 index 000000000..187f37b08 --- /dev/null +++ b/packages/cosmos/generated/encoding/confio/index.ts @@ -0,0 +1,3 @@ +// @ts-nocheck + +export * from './proofs'; \ No newline at end of file diff --git a/packages/cosmos/generated/encoding/confio/proofs.ts b/packages/cosmos/generated/encoding/confio/proofs.ts new file mode 100644 index 000000000..1d4142434 --- /dev/null +++ b/packages/cosmos/generated/encoding/confio/proofs.ts @@ -0,0 +1,1543 @@ +import type { GeneratedType } from "@cosmjs/proto-signing"; + +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +import type { + BatchEntry as BatchEntry_type, + BatchProof as BatchProof_type, + CommitmentProof as CommitmentProof_type, + CompressedBatchEntry as CompressedBatchEntry_type, + CompressedBatchProof as CompressedBatchProof_type, + CompressedExistenceProof as CompressedExistenceProof_type, + CompressedNonExistenceProof as CompressedNonExistenceProof_type, + ExistenceProof as ExistenceProof_type, + InnerOp as InnerOp_type, + InnerSpec as InnerSpec_type, + LeafOp as LeafOp_type, + NonExistenceProof as NonExistenceProof_type, + ProofSpec as ProofSpec_type, +} from "../../types/confio"; + +import { HashOp, LengthOp } from "../../types/confio"; + +import type { DeepPartial, Exact, MessageFns } from "../common"; + +export interface ExistenceProof extends ExistenceProof_type {} +export interface NonExistenceProof extends NonExistenceProof_type {} +export interface CommitmentProof extends CommitmentProof_type {} +export interface LeafOp extends LeafOp_type {} +export interface InnerOp extends InnerOp_type {} +export interface ProofSpec extends ProofSpec_type {} +export interface InnerSpec extends InnerSpec_type {} +export interface BatchProof extends BatchProof_type {} +export interface BatchEntry extends BatchEntry_type {} +export interface CompressedBatchProof extends CompressedBatchProof_type {} +export interface CompressedBatchEntry extends CompressedBatchEntry_type {} +export interface CompressedExistenceProof extends CompressedExistenceProof_type {} +export interface CompressedNonExistenceProof extends CompressedNonExistenceProof_type {} + +export const ExistenceProof: MessageFns = { + $type: "ics23.ExistenceProof" as const, + + encode(message: ExistenceProof, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.key.length !== 0) { + writer.uint32(10).bytes(message.key); + } + if (message.value.length !== 0) { + writer.uint32(18).bytes(message.value); + } + if (message.leaf !== undefined) { + LeafOp.encode(message.leaf, writer.uint32(26).fork()).join(); + } + for (const v of message.path) { + InnerOp.encode(v!, writer.uint32(34).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ExistenceProof { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseExistenceProof(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.key = reader.bytes(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.value = reader.bytes(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.leaf = LeafOp.decode(reader, reader.uint32()); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.path.push(InnerOp.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ExistenceProof { + return { + key: isSet(object.key) ? bytesFromBase64(object.key) : new Uint8Array(0), + value: isSet(object.value) ? bytesFromBase64(object.value) : new Uint8Array(0), + leaf: isSet(object.leaf) ? LeafOp.fromJSON(object.leaf) : undefined, + path: globalThis.Array.isArray(object?.path) ? object.path.map((e: any) => InnerOp.fromJSON(e)) : [], + }; + }, + + toJSON(message: ExistenceProof): unknown { + const obj: any = {}; + if (message.key.length !== 0) { + obj.key = base64FromBytes(message.key); + } + if (message.value.length !== 0) { + obj.value = base64FromBytes(message.value); + } + if (message.leaf !== undefined) { + obj.leaf = LeafOp.toJSON(message.leaf); + } + if (message.path?.length) { + obj.path = message.path.map((e) => InnerOp.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): ExistenceProof { + return ExistenceProof.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ExistenceProof { + const message = createBaseExistenceProof(); + message.key = object.key ?? new Uint8Array(0); + message.value = object.value ?? new Uint8Array(0); + message.leaf = object.leaf !== undefined && object.leaf !== null ? LeafOp.fromPartial(object.leaf) : undefined; + message.path = object.path?.map((e) => InnerOp.fromPartial(e)) || []; + return message; + }, +}; + +export const NonExistenceProof: MessageFns = { + $type: "ics23.NonExistenceProof" as const, + + encode(message: NonExistenceProof, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.key.length !== 0) { + writer.uint32(10).bytes(message.key); + } + if (message.left !== undefined) { + ExistenceProof.encode(message.left, writer.uint32(18).fork()).join(); + } + if (message.right !== undefined) { + ExistenceProof.encode(message.right, writer.uint32(26).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): NonExistenceProof { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseNonExistenceProof(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.key = reader.bytes(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.left = ExistenceProof.decode(reader, reader.uint32()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.right = ExistenceProof.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): NonExistenceProof { + return { + key: isSet(object.key) ? bytesFromBase64(object.key) : new Uint8Array(0), + left: isSet(object.left) ? ExistenceProof.fromJSON(object.left) : undefined, + right: isSet(object.right) ? ExistenceProof.fromJSON(object.right) : undefined, + }; + }, + + toJSON(message: NonExistenceProof): unknown { + const obj: any = {}; + if (message.key.length !== 0) { + obj.key = base64FromBytes(message.key); + } + if (message.left !== undefined) { + obj.left = ExistenceProof.toJSON(message.left); + } + if (message.right !== undefined) { + obj.right = ExistenceProof.toJSON(message.right); + } + return obj; + }, + + create, I>>(base?: I): NonExistenceProof { + return NonExistenceProof.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): NonExistenceProof { + const message = createBaseNonExistenceProof(); + message.key = object.key ?? new Uint8Array(0); + message.left = object.left !== undefined && object.left !== null ? ExistenceProof.fromPartial(object.left) : undefined; + message.right = object.right !== undefined && object.right !== null ? ExistenceProof.fromPartial(object.right) : undefined; + return message; + }, +}; + +export const CommitmentProof: MessageFns = { + $type: "ics23.CommitmentProof" as const, + + encode(message: CommitmentProof, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.exist !== undefined) { + ExistenceProof.encode(message.exist, writer.uint32(10).fork()).join(); + } + if (message.nonexist !== undefined) { + NonExistenceProof.encode(message.nonexist, writer.uint32(18).fork()).join(); + } + if (message.batch !== undefined) { + BatchProof.encode(message.batch, writer.uint32(26).fork()).join(); + } + if (message.compressed !== undefined) { + CompressedBatchProof.encode(message.compressed, writer.uint32(34).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): CommitmentProof { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseCommitmentProof(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.exist = ExistenceProof.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.nonexist = NonExistenceProof.decode(reader, reader.uint32()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.batch = BatchProof.decode(reader, reader.uint32()); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.compressed = CompressedBatchProof.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): CommitmentProof { + return { + exist: isSet(object.exist) ? ExistenceProof.fromJSON(object.exist) : undefined, + nonexist: isSet(object.nonexist) ? NonExistenceProof.fromJSON(object.nonexist) : undefined, + batch: isSet(object.batch) ? BatchProof.fromJSON(object.batch) : undefined, + compressed: isSet(object.compressed) ? CompressedBatchProof.fromJSON(object.compressed) : undefined, + }; + }, + + toJSON(message: CommitmentProof): unknown { + const obj: any = {}; + if (message.exist !== undefined) { + obj.exist = ExistenceProof.toJSON(message.exist); + } + if (message.nonexist !== undefined) { + obj.nonexist = NonExistenceProof.toJSON(message.nonexist); + } + if (message.batch !== undefined) { + obj.batch = BatchProof.toJSON(message.batch); + } + if (message.compressed !== undefined) { + obj.compressed = CompressedBatchProof.toJSON(message.compressed); + } + return obj; + }, + + create, I>>(base?: I): CommitmentProof { + return CommitmentProof.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): CommitmentProof { + const message = createBaseCommitmentProof(); + message.exist = object.exist !== undefined && object.exist !== null ? ExistenceProof.fromPartial(object.exist) : undefined; + message.nonexist = object.nonexist !== undefined && object.nonexist !== null ? NonExistenceProof.fromPartial(object.nonexist) : undefined; + message.batch = object.batch !== undefined && object.batch !== null ? BatchProof.fromPartial(object.batch) : undefined; + message.compressed = object.compressed !== undefined && object.compressed !== null ? CompressedBatchProof.fromPartial(object.compressed) : undefined; + return message; + }, +}; + +export const LeafOp: MessageFns = { + $type: "ics23.LeafOp" as const, + + encode(message: LeafOp, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.hash !== 0) { + writer.uint32(8).int32(message.hash); + } + if (message.prehash_key !== 0) { + writer.uint32(16).int32(message.prehash_key); + } + if (message.prehash_value !== 0) { + writer.uint32(24).int32(message.prehash_value); + } + if (message.length !== 0) { + writer.uint32(32).int32(message.length); + } + if (message.prefix.length !== 0) { + writer.uint32(42).bytes(message.prefix); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): LeafOp { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseLeafOp(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.hash = reader.int32() as any; + continue; + case 2: + if (tag !== 16) { + break; + } + + message.prehash_key = reader.int32() as any; + continue; + case 3: + if (tag !== 24) { + break; + } + + message.prehash_value = reader.int32() as any; + continue; + case 4: + if (tag !== 32) { + break; + } + + message.length = reader.int32() as any; + continue; + case 5: + if (tag !== 42) { + break; + } + + message.prefix = reader.bytes(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): LeafOp { + return { + hash: isSet(object.hash) ? hashOpFromJSON(object.hash) : 0, + prehash_key: isSet(object.prehash_key) ? hashOpFromJSON(object.prehash_key) : 0, + prehash_value: isSet(object.prehash_value) ? hashOpFromJSON(object.prehash_value) : 0, + length: isSet(object.length) ? lengthOpFromJSON(object.length) : 0, + prefix: isSet(object.prefix) ? bytesFromBase64(object.prefix) : new Uint8Array(0), + }; + }, + + toJSON(message: LeafOp): unknown { + const obj: any = {}; + if (message.hash !== 0) { + obj.hash = hashOpToJSON(message.hash); + } + if (message.prehash_key !== 0) { + obj.prehash_key = hashOpToJSON(message.prehash_key); + } + if (message.prehash_value !== 0) { + obj.prehash_value = hashOpToJSON(message.prehash_value); + } + if (message.length !== 0) { + obj.length = lengthOpToJSON(message.length); + } + if (message.prefix.length !== 0) { + obj.prefix = base64FromBytes(message.prefix); + } + return obj; + }, + + create, I>>(base?: I): LeafOp { + return LeafOp.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): LeafOp { + const message = createBaseLeafOp(); + message.hash = object.hash ?? 0; + message.prehash_key = object.prehash_key ?? 0; + message.prehash_value = object.prehash_value ?? 0; + message.length = object.length ?? 0; + message.prefix = object.prefix ?? new Uint8Array(0); + return message; + }, +}; + +export const InnerOp: MessageFns = { + $type: "ics23.InnerOp" as const, + + encode(message: InnerOp, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.hash !== 0) { + writer.uint32(8).int32(message.hash); + } + if (message.prefix.length !== 0) { + writer.uint32(18).bytes(message.prefix); + } + if (message.suffix.length !== 0) { + writer.uint32(26).bytes(message.suffix); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): InnerOp { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseInnerOp(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.hash = reader.int32() as any; + continue; + case 2: + if (tag !== 18) { + break; + } + + message.prefix = reader.bytes(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.suffix = reader.bytes(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): InnerOp { + return { + hash: isSet(object.hash) ? hashOpFromJSON(object.hash) : 0, + prefix: isSet(object.prefix) ? bytesFromBase64(object.prefix) : new Uint8Array(0), + suffix: isSet(object.suffix) ? bytesFromBase64(object.suffix) : new Uint8Array(0), + }; + }, + + toJSON(message: InnerOp): unknown { + const obj: any = {}; + if (message.hash !== 0) { + obj.hash = hashOpToJSON(message.hash); + } + if (message.prefix.length !== 0) { + obj.prefix = base64FromBytes(message.prefix); + } + if (message.suffix.length !== 0) { + obj.suffix = base64FromBytes(message.suffix); + } + return obj; + }, + + create, I>>(base?: I): InnerOp { + return InnerOp.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): InnerOp { + const message = createBaseInnerOp(); + message.hash = object.hash ?? 0; + message.prefix = object.prefix ?? new Uint8Array(0); + message.suffix = object.suffix ?? new Uint8Array(0); + return message; + }, +}; + +export const ProofSpec: MessageFns = { + $type: "ics23.ProofSpec" as const, + + encode(message: ProofSpec, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.leaf_spec !== undefined) { + LeafOp.encode(message.leaf_spec, writer.uint32(10).fork()).join(); + } + if (message.inner_spec !== undefined) { + InnerSpec.encode(message.inner_spec, writer.uint32(18).fork()).join(); + } + if (message.max_depth !== 0) { + writer.uint32(24).int32(message.max_depth); + } + if (message.min_depth !== 0) { + writer.uint32(32).int32(message.min_depth); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ProofSpec { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseProofSpec(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.leaf_spec = LeafOp.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.inner_spec = InnerSpec.decode(reader, reader.uint32()); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.max_depth = reader.int32(); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.min_depth = reader.int32(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ProofSpec { + return { + leaf_spec: isSet(object.leaf_spec) ? LeafOp.fromJSON(object.leaf_spec) : undefined, + inner_spec: isSet(object.inner_spec) ? InnerSpec.fromJSON(object.inner_spec) : undefined, + max_depth: isSet(object.max_depth) ? globalThis.Number(object.max_depth) : 0, + min_depth: isSet(object.min_depth) ? globalThis.Number(object.min_depth) : 0, + }; + }, + + toJSON(message: ProofSpec): unknown { + const obj: any = {}; + if (message.leaf_spec !== undefined) { + obj.leaf_spec = LeafOp.toJSON(message.leaf_spec); + } + if (message.inner_spec !== undefined) { + obj.inner_spec = InnerSpec.toJSON(message.inner_spec); + } + if (message.max_depth !== 0) { + obj.max_depth = Math.round(message.max_depth); + } + if (message.min_depth !== 0) { + obj.min_depth = Math.round(message.min_depth); + } + return obj; + }, + + create, I>>(base?: I): ProofSpec { + return ProofSpec.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ProofSpec { + const message = createBaseProofSpec(); + message.leaf_spec = object.leaf_spec !== undefined && object.leaf_spec !== null ? LeafOp.fromPartial(object.leaf_spec) : undefined; + message.inner_spec = object.inner_spec !== undefined && object.inner_spec !== null ? InnerSpec.fromPartial(object.inner_spec) : undefined; + message.max_depth = object.max_depth ?? 0; + message.min_depth = object.min_depth ?? 0; + return message; + }, +}; + +export const InnerSpec: MessageFns = { + $type: "ics23.InnerSpec" as const, + + encode(message: InnerSpec, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + writer.uint32(10).fork(); + for (const v of message.child_order) { + writer.int32(v); + } + writer.join(); + if (message.child_size !== 0) { + writer.uint32(16).int32(message.child_size); + } + if (message.min_prefix_length !== 0) { + writer.uint32(24).int32(message.min_prefix_length); + } + if (message.max_prefix_length !== 0) { + writer.uint32(32).int32(message.max_prefix_length); + } + if (message.empty_child.length !== 0) { + writer.uint32(42).bytes(message.empty_child); + } + if (message.hash !== 0) { + writer.uint32(48).int32(message.hash); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): InnerSpec { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseInnerSpec(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag === 8) { + message.child_order.push(reader.int32()); + + continue; + } + + if (tag === 10) { + const end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) { + message.child_order.push(reader.int32()); + } + + continue; + } + + break; + case 2: + if (tag !== 16) { + break; + } + + message.child_size = reader.int32(); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.min_prefix_length = reader.int32(); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.max_prefix_length = reader.int32(); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.empty_child = reader.bytes(); + continue; + case 6: + if (tag !== 48) { + break; + } + + message.hash = reader.int32() as any; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): InnerSpec { + return { + child_order: globalThis.Array.isArray(object?.child_order) ? object.child_order.map((e: any) => globalThis.Number(e)) : [], + child_size: isSet(object.child_size) ? globalThis.Number(object.child_size) : 0, + min_prefix_length: isSet(object.min_prefix_length) ? globalThis.Number(object.min_prefix_length) : 0, + max_prefix_length: isSet(object.max_prefix_length) ? globalThis.Number(object.max_prefix_length) : 0, + empty_child: isSet(object.empty_child) ? bytesFromBase64(object.empty_child) : new Uint8Array(0), + hash: isSet(object.hash) ? hashOpFromJSON(object.hash) : 0, + }; + }, + + toJSON(message: InnerSpec): unknown { + const obj: any = {}; + if (message.child_order?.length) { + obj.child_order = message.child_order.map((e) => Math.round(e)); + } + if (message.child_size !== 0) { + obj.child_size = Math.round(message.child_size); + } + if (message.min_prefix_length !== 0) { + obj.min_prefix_length = Math.round(message.min_prefix_length); + } + if (message.max_prefix_length !== 0) { + obj.max_prefix_length = Math.round(message.max_prefix_length); + } + if (message.empty_child.length !== 0) { + obj.empty_child = base64FromBytes(message.empty_child); + } + if (message.hash !== 0) { + obj.hash = hashOpToJSON(message.hash); + } + return obj; + }, + + create, I>>(base?: I): InnerSpec { + return InnerSpec.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): InnerSpec { + const message = createBaseInnerSpec(); + message.child_order = object.child_order?.map((e) => e) || []; + message.child_size = object.child_size ?? 0; + message.min_prefix_length = object.min_prefix_length ?? 0; + message.max_prefix_length = object.max_prefix_length ?? 0; + message.empty_child = object.empty_child ?? new Uint8Array(0); + message.hash = object.hash ?? 0; + return message; + }, +}; + +export const BatchProof: MessageFns = { + $type: "ics23.BatchProof" as const, + + encode(message: BatchProof, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.entries) { + BatchEntry.encode(v!, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): BatchProof { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseBatchProof(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.entries.push(BatchEntry.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): BatchProof { + return { + entries: globalThis.Array.isArray(object?.entries) ? object.entries.map((e: any) => BatchEntry.fromJSON(e)) : [], + }; + }, + + toJSON(message: BatchProof): unknown { + const obj: any = {}; + if (message.entries?.length) { + obj.entries = message.entries.map((e) => BatchEntry.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): BatchProof { + return BatchProof.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): BatchProof { + const message = createBaseBatchProof(); + message.entries = object.entries?.map((e) => BatchEntry.fromPartial(e)) || []; + return message; + }, +}; + +export const BatchEntry: MessageFns = { + $type: "ics23.BatchEntry" as const, + + encode(message: BatchEntry, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.exist !== undefined) { + ExistenceProof.encode(message.exist, writer.uint32(10).fork()).join(); + } + if (message.nonexist !== undefined) { + NonExistenceProof.encode(message.nonexist, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): BatchEntry { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseBatchEntry(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.exist = ExistenceProof.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.nonexist = NonExistenceProof.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): BatchEntry { + return { + exist: isSet(object.exist) ? ExistenceProof.fromJSON(object.exist) : undefined, + nonexist: isSet(object.nonexist) ? NonExistenceProof.fromJSON(object.nonexist) : undefined, + }; + }, + + toJSON(message: BatchEntry): unknown { + const obj: any = {}; + if (message.exist !== undefined) { + obj.exist = ExistenceProof.toJSON(message.exist); + } + if (message.nonexist !== undefined) { + obj.nonexist = NonExistenceProof.toJSON(message.nonexist); + } + return obj; + }, + + create, I>>(base?: I): BatchEntry { + return BatchEntry.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): BatchEntry { + const message = createBaseBatchEntry(); + message.exist = object.exist !== undefined && object.exist !== null ? ExistenceProof.fromPartial(object.exist) : undefined; + message.nonexist = object.nonexist !== undefined && object.nonexist !== null ? NonExistenceProof.fromPartial(object.nonexist) : undefined; + return message; + }, +}; + +export const CompressedBatchProof: MessageFns = { + $type: "ics23.CompressedBatchProof" as const, + + encode(message: CompressedBatchProof, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.entries) { + CompressedBatchEntry.encode(v!, writer.uint32(10).fork()).join(); + } + for (const v of message.lookup_inners) { + InnerOp.encode(v!, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): CompressedBatchProof { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseCompressedBatchProof(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.entries.push(CompressedBatchEntry.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.lookup_inners.push(InnerOp.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): CompressedBatchProof { + return { + entries: globalThis.Array.isArray(object?.entries) ? object.entries.map((e: any) => CompressedBatchEntry.fromJSON(e)) : [], + lookup_inners: globalThis.Array.isArray(object?.lookup_inners) ? object.lookup_inners.map((e: any) => InnerOp.fromJSON(e)) : [], + }; + }, + + toJSON(message: CompressedBatchProof): unknown { + const obj: any = {}; + if (message.entries?.length) { + obj.entries = message.entries.map((e) => CompressedBatchEntry.toJSON(e)); + } + if (message.lookup_inners?.length) { + obj.lookup_inners = message.lookup_inners.map((e) => InnerOp.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): CompressedBatchProof { + return CompressedBatchProof.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): CompressedBatchProof { + const message = createBaseCompressedBatchProof(); + message.entries = object.entries?.map((e) => CompressedBatchEntry.fromPartial(e)) || []; + message.lookup_inners = object.lookup_inners?.map((e) => InnerOp.fromPartial(e)) || []; + return message; + }, +}; + +export const CompressedBatchEntry: MessageFns = { + $type: "ics23.CompressedBatchEntry" as const, + + encode(message: CompressedBatchEntry, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.exist !== undefined) { + CompressedExistenceProof.encode(message.exist, writer.uint32(10).fork()).join(); + } + if (message.nonexist !== undefined) { + CompressedNonExistenceProof.encode(message.nonexist, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): CompressedBatchEntry { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseCompressedBatchEntry(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.exist = CompressedExistenceProof.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.nonexist = CompressedNonExistenceProof.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): CompressedBatchEntry { + return { + exist: isSet(object.exist) ? CompressedExistenceProof.fromJSON(object.exist) : undefined, + nonexist: isSet(object.nonexist) ? CompressedNonExistenceProof.fromJSON(object.nonexist) : undefined, + }; + }, + + toJSON(message: CompressedBatchEntry): unknown { + const obj: any = {}; + if (message.exist !== undefined) { + obj.exist = CompressedExistenceProof.toJSON(message.exist); + } + if (message.nonexist !== undefined) { + obj.nonexist = CompressedNonExistenceProof.toJSON(message.nonexist); + } + return obj; + }, + + create, I>>(base?: I): CompressedBatchEntry { + return CompressedBatchEntry.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): CompressedBatchEntry { + const message = createBaseCompressedBatchEntry(); + message.exist = object.exist !== undefined && object.exist !== null ? CompressedExistenceProof.fromPartial(object.exist) : undefined; + message.nonexist = object.nonexist !== undefined && object.nonexist !== null ? CompressedNonExistenceProof.fromPartial(object.nonexist) : undefined; + return message; + }, +}; + +export const CompressedExistenceProof: MessageFns = { + $type: "ics23.CompressedExistenceProof" as const, + + encode(message: CompressedExistenceProof, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.key.length !== 0) { + writer.uint32(10).bytes(message.key); + } + if (message.value.length !== 0) { + writer.uint32(18).bytes(message.value); + } + if (message.leaf !== undefined) { + LeafOp.encode(message.leaf, writer.uint32(26).fork()).join(); + } + writer.uint32(34).fork(); + for (const v of message.path) { + writer.int32(v); + } + writer.join(); + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): CompressedExistenceProof { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseCompressedExistenceProof(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.key = reader.bytes(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.value = reader.bytes(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.leaf = LeafOp.decode(reader, reader.uint32()); + continue; + case 4: + if (tag === 32) { + message.path.push(reader.int32()); + + continue; + } + + if (tag === 34) { + const end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) { + message.path.push(reader.int32()); + } + + continue; + } + + break; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): CompressedExistenceProof { + return { + key: isSet(object.key) ? bytesFromBase64(object.key) : new Uint8Array(0), + value: isSet(object.value) ? bytesFromBase64(object.value) : new Uint8Array(0), + leaf: isSet(object.leaf) ? LeafOp.fromJSON(object.leaf) : undefined, + path: globalThis.Array.isArray(object?.path) ? object.path.map((e: any) => globalThis.Number(e)) : [], + }; + }, + + toJSON(message: CompressedExistenceProof): unknown { + const obj: any = {}; + if (message.key.length !== 0) { + obj.key = base64FromBytes(message.key); + } + if (message.value.length !== 0) { + obj.value = base64FromBytes(message.value); + } + if (message.leaf !== undefined) { + obj.leaf = LeafOp.toJSON(message.leaf); + } + if (message.path?.length) { + obj.path = message.path.map((e) => Math.round(e)); + } + return obj; + }, + + create, I>>(base?: I): CompressedExistenceProof { + return CompressedExistenceProof.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): CompressedExistenceProof { + const message = createBaseCompressedExistenceProof(); + message.key = object.key ?? new Uint8Array(0); + message.value = object.value ?? new Uint8Array(0); + message.leaf = object.leaf !== undefined && object.leaf !== null ? LeafOp.fromPartial(object.leaf) : undefined; + message.path = object.path?.map((e) => e) || []; + return message; + }, +}; + +export const CompressedNonExistenceProof: MessageFns = { + $type: "ics23.CompressedNonExistenceProof" as const, + + encode(message: CompressedNonExistenceProof, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.key.length !== 0) { + writer.uint32(10).bytes(message.key); + } + if (message.left !== undefined) { + CompressedExistenceProof.encode(message.left, writer.uint32(18).fork()).join(); + } + if (message.right !== undefined) { + CompressedExistenceProof.encode(message.right, writer.uint32(26).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): CompressedNonExistenceProof { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseCompressedNonExistenceProof(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.key = reader.bytes(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.left = CompressedExistenceProof.decode(reader, reader.uint32()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.right = CompressedExistenceProof.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): CompressedNonExistenceProof { + return { + key: isSet(object.key) ? bytesFromBase64(object.key) : new Uint8Array(0), + left: isSet(object.left) ? CompressedExistenceProof.fromJSON(object.left) : undefined, + right: isSet(object.right) ? CompressedExistenceProof.fromJSON(object.right) : undefined, + }; + }, + + toJSON(message: CompressedNonExistenceProof): unknown { + const obj: any = {}; + if (message.key.length !== 0) { + obj.key = base64FromBytes(message.key); + } + if (message.left !== undefined) { + obj.left = CompressedExistenceProof.toJSON(message.left); + } + if (message.right !== undefined) { + obj.right = CompressedExistenceProof.toJSON(message.right); + } + return obj; + }, + + create, I>>(base?: I): CompressedNonExistenceProof { + return CompressedNonExistenceProof.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): CompressedNonExistenceProof { + const message = createBaseCompressedNonExistenceProof(); + message.key = object.key ?? new Uint8Array(0); + message.left = object.left !== undefined && object.left !== null ? CompressedExistenceProof.fromPartial(object.left) : undefined; + message.right = object.right !== undefined && object.right !== null ? CompressedExistenceProof.fromPartial(object.right) : undefined; + return message; + }, +}; + +export function hashOpFromJSON(object: any): HashOp { + switch (object) { + case 0: + case "NO_HASH": + return HashOp.NO_HASH; + case 1: + case "SHA256": + return HashOp.SHA256; + case 2: + case "SHA512": + return HashOp.SHA512; + case 3: + case "KECCAK": + return HashOp.KECCAK; + case 4: + case "RIPEMD160": + return HashOp.RIPEMD160; + case 5: + case "BITCOIN": + return HashOp.BITCOIN; + case -1: + case "UNRECOGNIZED": + default: + return HashOp.UNRECOGNIZED; + } +} + +export function hashOpToJSON(object: HashOp): string { + switch (object) { + case HashOp.NO_HASH: + return "NO_HASH"; + case HashOp.SHA256: + return "SHA256"; + case HashOp.SHA512: + return "SHA512"; + case HashOp.KECCAK: + return "KECCAK"; + case HashOp.RIPEMD160: + return "RIPEMD160"; + case HashOp.BITCOIN: + return "BITCOIN"; + case HashOp.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +export function lengthOpFromJSON(object: any): LengthOp { + switch (object) { + case 0: + case "NO_PREFIX": + return LengthOp.NO_PREFIX; + case 1: + case "VAR_PROTO": + return LengthOp.VAR_PROTO; + case 2: + case "VAR_RLP": + return LengthOp.VAR_RLP; + case 3: + case "FIXED32_BIG": + return LengthOp.FIXED32_BIG; + case 4: + case "FIXED32_LITTLE": + return LengthOp.FIXED32_LITTLE; + case 5: + case "FIXED64_BIG": + return LengthOp.FIXED64_BIG; + case 6: + case "FIXED64_LITTLE": + return LengthOp.FIXED64_LITTLE; + case 7: + case "REQUIRE_32_BYTES": + return LengthOp.REQUIRE_32_BYTES; + case 8: + case "REQUIRE_64_BYTES": + return LengthOp.REQUIRE_64_BYTES; + case -1: + case "UNRECOGNIZED": + default: + return LengthOp.UNRECOGNIZED; + } +} + +export function lengthOpToJSON(object: LengthOp): string { + switch (object) { + case LengthOp.NO_PREFIX: + return "NO_PREFIX"; + case LengthOp.VAR_PROTO: + return "VAR_PROTO"; + case LengthOp.VAR_RLP: + return "VAR_RLP"; + case LengthOp.FIXED32_BIG: + return "FIXED32_BIG"; + case LengthOp.FIXED32_LITTLE: + return "FIXED32_LITTLE"; + case LengthOp.FIXED64_BIG: + return "FIXED64_BIG"; + case LengthOp.FIXED64_LITTLE: + return "FIXED64_LITTLE"; + case LengthOp.REQUIRE_32_BYTES: + return "REQUIRE_32_BYTES"; + case LengthOp.REQUIRE_64_BYTES: + return "REQUIRE_64_BYTES"; + case LengthOp.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +function createBaseExistenceProof(): ExistenceProof { + return { key: new Uint8Array(0), value: new Uint8Array(0), leaf: undefined, path: [] }; +} + +function createBaseNonExistenceProof(): NonExistenceProof { + return { key: new Uint8Array(0), left: undefined, right: undefined }; +} + +function createBaseCommitmentProof(): CommitmentProof { + return { exist: undefined, nonexist: undefined, batch: undefined, compressed: undefined }; +} + +function createBaseLeafOp(): LeafOp { + return { hash: 0, prehash_key: 0, prehash_value: 0, length: 0, prefix: new Uint8Array(0) }; +} + +function createBaseInnerOp(): InnerOp { + return { hash: 0, prefix: new Uint8Array(0), suffix: new Uint8Array(0) }; +} + +function createBaseProofSpec(): ProofSpec { + return { leaf_spec: undefined, inner_spec: undefined, max_depth: 0, min_depth: 0 }; +} + +function createBaseInnerSpec(): InnerSpec { + return { + child_order: [], + child_size: 0, + min_prefix_length: 0, + max_prefix_length: 0, + empty_child: new Uint8Array(0), + hash: 0, + }; +} + +function createBaseBatchProof(): BatchProof { + return { entries: [] }; +} + +function createBaseBatchEntry(): BatchEntry { + return { exist: undefined, nonexist: undefined }; +} + +function createBaseCompressedBatchProof(): CompressedBatchProof { + return { entries: [], lookup_inners: [] }; +} + +function createBaseCompressedBatchEntry(): CompressedBatchEntry { + return { exist: undefined, nonexist: undefined }; +} + +function createBaseCompressedExistenceProof(): CompressedExistenceProof { + return { key: new Uint8Array(0), value: new Uint8Array(0), leaf: undefined, path: [] }; +} + +function createBaseCompressedNonExistenceProof(): CompressedNonExistenceProof { + return { key: new Uint8Array(0), left: undefined, right: undefined }; +} + +function bytesFromBase64(b64: string): Uint8Array { + if ((globalThis as any).Buffer) { + return Uint8Array.from(globalThis.Buffer.from(b64, "base64")); + } else { + const bin = globalThis.atob(b64); + const arr = new Uint8Array(bin.length); + for (let i = 0; i < bin.length; ++i) { + arr[i] = bin.charCodeAt(i); + } + return arr; + } +} + +function base64FromBytes(arr: Uint8Array): string { + if ((globalThis as any).Buffer) { + return globalThis.Buffer.from(arr).toString("base64"); + } else { + const bin: string[] = []; + arr.forEach((byte) => { + bin.push(globalThis.String.fromCharCode(byte)); + }); + return globalThis.btoa(bin.join("")); + } +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} +export const registry: Array<[string, GeneratedType]> = [ + ["/ics23.ExistenceProof", ExistenceProof as never], + ["/ics23.NonExistenceProof", NonExistenceProof as never], + ["/ics23.CommitmentProof", CommitmentProof as never], + ["/ics23.LeafOp", LeafOp as never], + ["/ics23.InnerOp", InnerOp as never], + ["/ics23.ProofSpec", ProofSpec as never], + ["/ics23.InnerSpec", InnerSpec as never], + ["/ics23.BatchProof", BatchProof as never], + ["/ics23.BatchEntry", BatchEntry as never], + ["/ics23.CompressedBatchProof", CompressedBatchProof as never], + ["/ics23.CompressedBatchEntry", CompressedBatchEntry as never], + ["/ics23.CompressedExistenceProof", CompressedExistenceProof as never], + ["/ics23.CompressedNonExistenceProof", CompressedNonExistenceProof as never], +]; +export const aminoConverters = { + "/ics23.ExistenceProof": { + aminoType: "ics23.ExistenceProof", + toAmino: (message: ExistenceProof) => ({ ...message }), + fromAmino: (object: ExistenceProof) => ({ ...object }), + }, + + "/ics23.NonExistenceProof": { + aminoType: "ics23.NonExistenceProof", + toAmino: (message: NonExistenceProof) => ({ ...message }), + fromAmino: (object: NonExistenceProof) => ({ ...object }), + }, + + "/ics23.CommitmentProof": { + aminoType: "ics23.CommitmentProof", + toAmino: (message: CommitmentProof) => ({ ...message }), + fromAmino: (object: CommitmentProof) => ({ ...object }), + }, + + "/ics23.LeafOp": { + aminoType: "ics23.LeafOp", + toAmino: (message: LeafOp) => ({ ...message }), + fromAmino: (object: LeafOp) => ({ ...object }), + }, + + "/ics23.InnerOp": { + aminoType: "ics23.InnerOp", + toAmino: (message: InnerOp) => ({ ...message }), + fromAmino: (object: InnerOp) => ({ ...object }), + }, + + "/ics23.ProofSpec": { + aminoType: "ics23.ProofSpec", + toAmino: (message: ProofSpec) => ({ ...message }), + fromAmino: (object: ProofSpec) => ({ ...object }), + }, + + "/ics23.InnerSpec": { + aminoType: "ics23.InnerSpec", + toAmino: (message: InnerSpec) => ({ ...message }), + fromAmino: (object: InnerSpec) => ({ ...object }), + }, + + "/ics23.BatchProof": { + aminoType: "ics23.BatchProof", + toAmino: (message: BatchProof) => ({ ...message }), + fromAmino: (object: BatchProof) => ({ ...object }), + }, + + "/ics23.BatchEntry": { + aminoType: "ics23.BatchEntry", + toAmino: (message: BatchEntry) => ({ ...message }), + fromAmino: (object: BatchEntry) => ({ ...object }), + }, + + "/ics23.CompressedBatchProof": { + aminoType: "ics23.CompressedBatchProof", + toAmino: (message: CompressedBatchProof) => ({ ...message }), + fromAmino: (object: CompressedBatchProof) => ({ ...object }), + }, + + "/ics23.CompressedBatchEntry": { + aminoType: "ics23.CompressedBatchEntry", + toAmino: (message: CompressedBatchEntry) => ({ ...message }), + fromAmino: (object: CompressedBatchEntry) => ({ ...object }), + }, + + "/ics23.CompressedExistenceProof": { + aminoType: "ics23.CompressedExistenceProof", + toAmino: (message: CompressedExistenceProof) => ({ ...message }), + fromAmino: (object: CompressedExistenceProof) => ({ ...object }), + }, + + "/ics23.CompressedNonExistenceProof": { + aminoType: "ics23.CompressedNonExistenceProof", + toAmino: (message: CompressedNonExistenceProof) => ({ ...message }), + fromAmino: (object: CompressedNonExistenceProof) => ({ ...object }), + }, +}; diff --git a/packages/cosmos/generated/encoding/cosmos/accesscontrol/accesscontrol.ts b/packages/cosmos/generated/encoding/cosmos/accesscontrol/accesscontrol.ts new file mode 100644 index 000000000..a416fe36a --- /dev/null +++ b/packages/cosmos/generated/encoding/cosmos/accesscontrol/accesscontrol.ts @@ -0,0 +1,771 @@ +import type { GeneratedType } from "@cosmjs/proto-signing"; + +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +import { + accessOperationSelectorTypeFromJSON, + accessOperationSelectorTypeToJSON, + accessTypeFromJSON, + accessTypeToJSON, + resourceTypeFromJSON, + resourceTypeToJSON, + wasmMessageSubtypeFromJSON, + wasmMessageSubtypeToJSON, +} from "./constants"; + +import type { + AccessOperation as AccessOperation_type, + MessageDependencyMapping as MessageDependencyMapping_type, + WasmAccessOperation as WasmAccessOperation_type, + WasmAccessOperations as WasmAccessOperations_type, + WasmContractReference as WasmContractReference_type, + WasmContractReferences as WasmContractReferences_type, + WasmDependencyMapping as WasmDependencyMapping_type, +} from "../../../types/cosmos/accesscontrol"; + +import type { DeepPartial, Exact, MessageFns } from "../../common"; + +export interface AccessOperation extends AccessOperation_type {} +export interface WasmAccessOperation extends WasmAccessOperation_type {} +export interface WasmContractReference extends WasmContractReference_type {} +export interface WasmContractReferences extends WasmContractReferences_type {} +export interface WasmAccessOperations extends WasmAccessOperations_type {} +export interface MessageDependencyMapping extends MessageDependencyMapping_type {} +export interface WasmDependencyMapping extends WasmDependencyMapping_type {} + +export const AccessOperation: MessageFns = { + $type: "cosmos.accesscontrol.v1beta1.AccessOperation" as const, + + encode(message: AccessOperation, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.access_type !== 0) { + writer.uint32(8).int32(message.access_type); + } + if (message.resource_type !== 0) { + writer.uint32(16).int32(message.resource_type); + } + if (message.identifier_template !== "") { + writer.uint32(26).string(message.identifier_template); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): AccessOperation { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseAccessOperation(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.access_type = reader.int32() as any; + continue; + case 2: + if (tag !== 16) { + break; + } + + message.resource_type = reader.int32() as any; + continue; + case 3: + if (tag !== 26) { + break; + } + + message.identifier_template = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): AccessOperation { + return { + access_type: isSet(object.access_type) ? accessTypeFromJSON(object.access_type) : 0, + resource_type: isSet(object.resource_type) ? resourceTypeFromJSON(object.resource_type) : 0, + identifier_template: isSet(object.identifier_template) ? globalThis.String(object.identifier_template) : "", + }; + }, + + toJSON(message: AccessOperation): unknown { + const obj: any = {}; + if (message.access_type !== 0) { + obj.access_type = accessTypeToJSON(message.access_type); + } + if (message.resource_type !== 0) { + obj.resource_type = resourceTypeToJSON(message.resource_type); + } + if (message.identifier_template !== "") { + obj.identifier_template = message.identifier_template; + } + return obj; + }, + + create, I>>(base?: I): AccessOperation { + return AccessOperation.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): AccessOperation { + const message = createBaseAccessOperation(); + message.access_type = object.access_type ?? 0; + message.resource_type = object.resource_type ?? 0; + message.identifier_template = object.identifier_template ?? ""; + return message; + }, +}; + +export const WasmAccessOperation: MessageFns = { + $type: "cosmos.accesscontrol.v1beta1.WasmAccessOperation" as const, + + encode(message: WasmAccessOperation, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.operation !== undefined) { + AccessOperation.encode(message.operation, writer.uint32(10).fork()).join(); + } + if (message.selector_type !== 0) { + writer.uint32(16).int32(message.selector_type); + } + if (message.selector !== "") { + writer.uint32(26).string(message.selector); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): WasmAccessOperation { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseWasmAccessOperation(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.operation = AccessOperation.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.selector_type = reader.int32() as any; + continue; + case 3: + if (tag !== 26) { + break; + } + + message.selector = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): WasmAccessOperation { + return { + operation: isSet(object.operation) ? AccessOperation.fromJSON(object.operation) : undefined, + selector_type: isSet(object.selector_type) ? accessOperationSelectorTypeFromJSON(object.selector_type) : 0, + selector: isSet(object.selector) ? globalThis.String(object.selector) : "", + }; + }, + + toJSON(message: WasmAccessOperation): unknown { + const obj: any = {}; + if (message.operation !== undefined) { + obj.operation = AccessOperation.toJSON(message.operation); + } + if (message.selector_type !== 0) { + obj.selector_type = accessOperationSelectorTypeToJSON(message.selector_type); + } + if (message.selector !== "") { + obj.selector = message.selector; + } + return obj; + }, + + create, I>>(base?: I): WasmAccessOperation { + return WasmAccessOperation.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): WasmAccessOperation { + const message = createBaseWasmAccessOperation(); + message.operation = object.operation !== undefined && object.operation !== null ? AccessOperation.fromPartial(object.operation) : undefined; + message.selector_type = object.selector_type ?? 0; + message.selector = object.selector ?? ""; + return message; + }, +}; + +export const WasmContractReference: MessageFns = { + $type: "cosmos.accesscontrol.v1beta1.WasmContractReference" as const, + + encode(message: WasmContractReference, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.contract_address !== "") { + writer.uint32(10).string(message.contract_address); + } + if (message.message_type !== 0) { + writer.uint32(16).int32(message.message_type); + } + if (message.message_name !== "") { + writer.uint32(26).string(message.message_name); + } + if (message.json_translation_template !== "") { + writer.uint32(34).string(message.json_translation_template); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): WasmContractReference { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseWasmContractReference(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.contract_address = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.message_type = reader.int32() as any; + continue; + case 3: + if (tag !== 26) { + break; + } + + message.message_name = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.json_translation_template = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): WasmContractReference { + return { + contract_address: isSet(object.contract_address) ? globalThis.String(object.contract_address) : "", + message_type: isSet(object.message_type) ? wasmMessageSubtypeFromJSON(object.message_type) : 0, + message_name: isSet(object.message_name) ? globalThis.String(object.message_name) : "", + json_translation_template: isSet(object.json_translation_template) ? globalThis.String(object.json_translation_template) : "", + }; + }, + + toJSON(message: WasmContractReference): unknown { + const obj: any = {}; + if (message.contract_address !== "") { + obj.contract_address = message.contract_address; + } + if (message.message_type !== 0) { + obj.message_type = wasmMessageSubtypeToJSON(message.message_type); + } + if (message.message_name !== "") { + obj.message_name = message.message_name; + } + if (message.json_translation_template !== "") { + obj.json_translation_template = message.json_translation_template; + } + return obj; + }, + + create, I>>(base?: I): WasmContractReference { + return WasmContractReference.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): WasmContractReference { + const message = createBaseWasmContractReference(); + message.contract_address = object.contract_address ?? ""; + message.message_type = object.message_type ?? 0; + message.message_name = object.message_name ?? ""; + message.json_translation_template = object.json_translation_template ?? ""; + return message; + }, +}; + +export const WasmContractReferences: MessageFns = { + $type: "cosmos.accesscontrol.v1beta1.WasmContractReferences" as const, + + encode(message: WasmContractReferences, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.message_name !== "") { + writer.uint32(10).string(message.message_name); + } + for (const v of message.contract_references) { + WasmContractReference.encode(v!, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): WasmContractReferences { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseWasmContractReferences(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.message_name = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.contract_references.push(WasmContractReference.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): WasmContractReferences { + return { + message_name: isSet(object.message_name) ? globalThis.String(object.message_name) : "", + contract_references: globalThis.Array.isArray(object?.contract_references) + ? object.contract_references.map((e: any) => WasmContractReference.fromJSON(e)) + : [], + }; + }, + + toJSON(message: WasmContractReferences): unknown { + const obj: any = {}; + if (message.message_name !== "") { + obj.message_name = message.message_name; + } + if (message.contract_references?.length) { + obj.contract_references = message.contract_references.map((e) => WasmContractReference.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): WasmContractReferences { + return WasmContractReferences.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): WasmContractReferences { + const message = createBaseWasmContractReferences(); + message.message_name = object.message_name ?? ""; + message.contract_references = object.contract_references?.map((e) => WasmContractReference.fromPartial(e)) || []; + return message; + }, +}; + +export const WasmAccessOperations: MessageFns = { + $type: "cosmos.accesscontrol.v1beta1.WasmAccessOperations" as const, + + encode(message: WasmAccessOperations, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.message_name !== "") { + writer.uint32(10).string(message.message_name); + } + for (const v of message.wasm_operations) { + WasmAccessOperation.encode(v!, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): WasmAccessOperations { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseWasmAccessOperations(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.message_name = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.wasm_operations.push(WasmAccessOperation.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): WasmAccessOperations { + return { + message_name: isSet(object.message_name) ? globalThis.String(object.message_name) : "", + wasm_operations: globalThis.Array.isArray(object?.wasm_operations) ? object.wasm_operations.map((e: any) => WasmAccessOperation.fromJSON(e)) : [], + }; + }, + + toJSON(message: WasmAccessOperations): unknown { + const obj: any = {}; + if (message.message_name !== "") { + obj.message_name = message.message_name; + } + if (message.wasm_operations?.length) { + obj.wasm_operations = message.wasm_operations.map((e) => WasmAccessOperation.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): WasmAccessOperations { + return WasmAccessOperations.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): WasmAccessOperations { + const message = createBaseWasmAccessOperations(); + message.message_name = object.message_name ?? ""; + message.wasm_operations = object.wasm_operations?.map((e) => WasmAccessOperation.fromPartial(e)) || []; + return message; + }, +}; + +export const MessageDependencyMapping: MessageFns = { + $type: "cosmos.accesscontrol.v1beta1.MessageDependencyMapping" as const, + + encode(message: MessageDependencyMapping, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.message_key !== "") { + writer.uint32(10).string(message.message_key); + } + for (const v of message.access_ops) { + AccessOperation.encode(v!, writer.uint32(18).fork()).join(); + } + if (message.dynamic_enabled !== false) { + writer.uint32(24).bool(message.dynamic_enabled); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MessageDependencyMapping { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMessageDependencyMapping(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.message_key = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.access_ops.push(AccessOperation.decode(reader, reader.uint32())); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.dynamic_enabled = reader.bool(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MessageDependencyMapping { + return { + message_key: isSet(object.message_key) ? globalThis.String(object.message_key) : "", + access_ops: globalThis.Array.isArray(object?.access_ops) ? object.access_ops.map((e: any) => AccessOperation.fromJSON(e)) : [], + dynamic_enabled: isSet(object.dynamic_enabled) ? globalThis.Boolean(object.dynamic_enabled) : false, + }; + }, + + toJSON(message: MessageDependencyMapping): unknown { + const obj: any = {}; + if (message.message_key !== "") { + obj.message_key = message.message_key; + } + if (message.access_ops?.length) { + obj.access_ops = message.access_ops.map((e) => AccessOperation.toJSON(e)); + } + if (message.dynamic_enabled !== false) { + obj.dynamic_enabled = message.dynamic_enabled; + } + return obj; + }, + + create, I>>(base?: I): MessageDependencyMapping { + return MessageDependencyMapping.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MessageDependencyMapping { + const message = createBaseMessageDependencyMapping(); + message.message_key = object.message_key ?? ""; + message.access_ops = object.access_ops?.map((e) => AccessOperation.fromPartial(e)) || []; + message.dynamic_enabled = object.dynamic_enabled ?? false; + return message; + }, +}; + +export const WasmDependencyMapping: MessageFns = { + $type: "cosmos.accesscontrol.v1beta1.WasmDependencyMapping" as const, + + encode(message: WasmDependencyMapping, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.base_access_ops) { + WasmAccessOperation.encode(v!, writer.uint32(10).fork()).join(); + } + for (const v of message.query_access_ops) { + WasmAccessOperations.encode(v!, writer.uint32(18).fork()).join(); + } + for (const v of message.execute_access_ops) { + WasmAccessOperations.encode(v!, writer.uint32(26).fork()).join(); + } + for (const v of message.base_contract_references) { + WasmContractReference.encode(v!, writer.uint32(34).fork()).join(); + } + for (const v of message.query_contract_references) { + WasmContractReferences.encode(v!, writer.uint32(42).fork()).join(); + } + for (const v of message.execute_contract_references) { + WasmContractReferences.encode(v!, writer.uint32(50).fork()).join(); + } + if (message.reset_reason !== "") { + writer.uint32(58).string(message.reset_reason); + } + if (message.contract_address !== "") { + writer.uint32(66).string(message.contract_address); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): WasmDependencyMapping { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseWasmDependencyMapping(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.base_access_ops.push(WasmAccessOperation.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.query_access_ops.push(WasmAccessOperations.decode(reader, reader.uint32())); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.execute_access_ops.push(WasmAccessOperations.decode(reader, reader.uint32())); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.base_contract_references.push(WasmContractReference.decode(reader, reader.uint32())); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.query_contract_references.push(WasmContractReferences.decode(reader, reader.uint32())); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.execute_contract_references.push(WasmContractReferences.decode(reader, reader.uint32())); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.reset_reason = reader.string(); + continue; + case 8: + if (tag !== 66) { + break; + } + + message.contract_address = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): WasmDependencyMapping { + return { + base_access_ops: globalThis.Array.isArray(object?.base_access_ops) ? object.base_access_ops.map((e: any) => WasmAccessOperation.fromJSON(e)) : [], + query_access_ops: globalThis.Array.isArray(object?.query_access_ops) ? object.query_access_ops.map((e: any) => WasmAccessOperations.fromJSON(e)) : [], + execute_access_ops: globalThis.Array.isArray(object?.execute_access_ops) + ? object.execute_access_ops.map((e: any) => WasmAccessOperations.fromJSON(e)) + : [], + base_contract_references: globalThis.Array.isArray(object?.base_contract_references) + ? object.base_contract_references.map((e: any) => WasmContractReference.fromJSON(e)) + : [], + query_contract_references: globalThis.Array.isArray(object?.query_contract_references) + ? object.query_contract_references.map((e: any) => WasmContractReferences.fromJSON(e)) + : [], + execute_contract_references: globalThis.Array.isArray(object?.execute_contract_references) + ? object.execute_contract_references.map((e: any) => WasmContractReferences.fromJSON(e)) + : [], + reset_reason: isSet(object.reset_reason) ? globalThis.String(object.reset_reason) : "", + contract_address: isSet(object.contract_address) ? globalThis.String(object.contract_address) : "", + }; + }, + + toJSON(message: WasmDependencyMapping): unknown { + const obj: any = {}; + if (message.base_access_ops?.length) { + obj.base_access_ops = message.base_access_ops.map((e) => WasmAccessOperation.toJSON(e)); + } + if (message.query_access_ops?.length) { + obj.query_access_ops = message.query_access_ops.map((e) => WasmAccessOperations.toJSON(e)); + } + if (message.execute_access_ops?.length) { + obj.execute_access_ops = message.execute_access_ops.map((e) => WasmAccessOperations.toJSON(e)); + } + if (message.base_contract_references?.length) { + obj.base_contract_references = message.base_contract_references.map((e) => WasmContractReference.toJSON(e)); + } + if (message.query_contract_references?.length) { + obj.query_contract_references = message.query_contract_references.map((e) => WasmContractReferences.toJSON(e)); + } + if (message.execute_contract_references?.length) { + obj.execute_contract_references = message.execute_contract_references.map((e) => WasmContractReferences.toJSON(e)); + } + if (message.reset_reason !== "") { + obj.reset_reason = message.reset_reason; + } + if (message.contract_address !== "") { + obj.contract_address = message.contract_address; + } + return obj; + }, + + create, I>>(base?: I): WasmDependencyMapping { + return WasmDependencyMapping.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): WasmDependencyMapping { + const message = createBaseWasmDependencyMapping(); + message.base_access_ops = object.base_access_ops?.map((e) => WasmAccessOperation.fromPartial(e)) || []; + message.query_access_ops = object.query_access_ops?.map((e) => WasmAccessOperations.fromPartial(e)) || []; + message.execute_access_ops = object.execute_access_ops?.map((e) => WasmAccessOperations.fromPartial(e)) || []; + message.base_contract_references = object.base_contract_references?.map((e) => WasmContractReference.fromPartial(e)) || []; + message.query_contract_references = object.query_contract_references?.map((e) => WasmContractReferences.fromPartial(e)) || []; + message.execute_contract_references = object.execute_contract_references?.map((e) => WasmContractReferences.fromPartial(e)) || []; + message.reset_reason = object.reset_reason ?? ""; + message.contract_address = object.contract_address ?? ""; + return message; + }, +}; + +function createBaseAccessOperation(): AccessOperation { + return { access_type: 0, resource_type: 0, identifier_template: "" }; +} + +function createBaseWasmAccessOperation(): WasmAccessOperation { + return { operation: undefined, selector_type: 0, selector: "" }; +} + +function createBaseWasmContractReference(): WasmContractReference { + return { contract_address: "", message_type: 0, message_name: "", json_translation_template: "" }; +} + +function createBaseWasmContractReferences(): WasmContractReferences { + return { message_name: "", contract_references: [] }; +} + +function createBaseWasmAccessOperations(): WasmAccessOperations { + return { message_name: "", wasm_operations: [] }; +} + +function createBaseMessageDependencyMapping(): MessageDependencyMapping { + return { message_key: "", access_ops: [], dynamic_enabled: false }; +} + +function createBaseWasmDependencyMapping(): WasmDependencyMapping { + return { + base_access_ops: [], + query_access_ops: [], + execute_access_ops: [], + base_contract_references: [], + query_contract_references: [], + execute_contract_references: [], + reset_reason: "", + contract_address: "", + }; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} +export const registry: Array<[string, GeneratedType]> = [ + ["/cosmos.accesscontrol.v1beta1.AccessOperation", AccessOperation as never], + ["/cosmos.accesscontrol.v1beta1.WasmAccessOperation", WasmAccessOperation as never], +]; +export const aminoConverters = { + "/cosmos.accesscontrol.v1beta1.AccessOperation": { + aminoType: "cosmos-sdk/AccessOperation", + toAmino: (message: AccessOperation) => ({ ...message }), + fromAmino: (object: AccessOperation) => ({ ...object }), + }, + + "/cosmos.accesscontrol.v1beta1.WasmAccessOperation": { + aminoType: "cosmos-sdk/WasmAccessOperation", + toAmino: (message: WasmAccessOperation) => ({ ...message }), + fromAmino: (object: WasmAccessOperation) => ({ ...object }), + }, +}; diff --git a/packages/cosmos/generated/encoding/cosmos/accesscontrol/constants.ts b/packages/cosmos/generated/encoding/cosmos/accesscontrol/constants.ts new file mode 100644 index 000000000..95532930c --- /dev/null +++ b/packages/cosmos/generated/encoding/cosmos/accesscontrol/constants.ts @@ -0,0 +1,549 @@ +import { AccessOperationSelectorType, AccessType, ResourceType, WasmMessageSubtype } from "../../../types/cosmos/accesscontrol"; + +export function accessTypeFromJSON(object: any): AccessType { + switch (object) { + case 0: + case "UNKNOWN": + return AccessType.UNKNOWN; + case 1: + case "READ": + return AccessType.READ; + case 2: + case "WRITE": + return AccessType.WRITE; + case 3: + case "COMMIT": + return AccessType.COMMIT; + case -1: + case "UNRECOGNIZED": + default: + return AccessType.UNRECOGNIZED; + } +} + +export function accessTypeToJSON(object: AccessType): string { + switch (object) { + case AccessType.UNKNOWN: + return "UNKNOWN"; + case AccessType.READ: + return "READ"; + case AccessType.WRITE: + return "WRITE"; + case AccessType.COMMIT: + return "COMMIT"; + case AccessType.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +export function accessOperationSelectorTypeFromJSON(object: any): AccessOperationSelectorType { + switch (object) { + case 0: + case "NONE": + return AccessOperationSelectorType.NONE; + case 1: + case "JQ": + return AccessOperationSelectorType.JQ; + case 2: + case "JQ_BECH32_ADDRESS": + return AccessOperationSelectorType.JQ_BECH32_ADDRESS; + case 3: + case "JQ_LENGTH_PREFIXED_ADDRESS": + return AccessOperationSelectorType.JQ_LENGTH_PREFIXED_ADDRESS; + case 4: + case "SENDER_BECH32_ADDRESS": + return AccessOperationSelectorType.SENDER_BECH32_ADDRESS; + case 5: + case "SENDER_LENGTH_PREFIXED_ADDRESS": + return AccessOperationSelectorType.SENDER_LENGTH_PREFIXED_ADDRESS; + case 6: + case "CONTRACT_ADDRESS": + return AccessOperationSelectorType.CONTRACT_ADDRESS; + case 7: + case "JQ_MESSAGE_CONDITIONAL": + return AccessOperationSelectorType.JQ_MESSAGE_CONDITIONAL; + case 8: + case "CONSTANT_STRING_TO_HEX": + return AccessOperationSelectorType.CONSTANT_STRING_TO_HEX; + case 9: + case "CONTRACT_REFERENCE": + return AccessOperationSelectorType.CONTRACT_REFERENCE; + case -1: + case "UNRECOGNIZED": + default: + return AccessOperationSelectorType.UNRECOGNIZED; + } +} + +export function accessOperationSelectorTypeToJSON(object: AccessOperationSelectorType): string { + switch (object) { + case AccessOperationSelectorType.NONE: + return "NONE"; + case AccessOperationSelectorType.JQ: + return "JQ"; + case AccessOperationSelectorType.JQ_BECH32_ADDRESS: + return "JQ_BECH32_ADDRESS"; + case AccessOperationSelectorType.JQ_LENGTH_PREFIXED_ADDRESS: + return "JQ_LENGTH_PREFIXED_ADDRESS"; + case AccessOperationSelectorType.SENDER_BECH32_ADDRESS: + return "SENDER_BECH32_ADDRESS"; + case AccessOperationSelectorType.SENDER_LENGTH_PREFIXED_ADDRESS: + return "SENDER_LENGTH_PREFIXED_ADDRESS"; + case AccessOperationSelectorType.CONTRACT_ADDRESS: + return "CONTRACT_ADDRESS"; + case AccessOperationSelectorType.JQ_MESSAGE_CONDITIONAL: + return "JQ_MESSAGE_CONDITIONAL"; + case AccessOperationSelectorType.CONSTANT_STRING_TO_HEX: + return "CONSTANT_STRING_TO_HEX"; + case AccessOperationSelectorType.CONTRACT_REFERENCE: + return "CONTRACT_REFERENCE"; + case AccessOperationSelectorType.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +export function resourceTypeFromJSON(object: any): ResourceType { + switch (object) { + case 0: + case "ANY": + return ResourceType.ANY; + case 1: + case "KV": + return ResourceType.KV; + case 2: + case "Mem": + return ResourceType.Mem; + case 4: + case "KV_BANK": + return ResourceType.KV_BANK; + case 5: + case "KV_STAKING": + return ResourceType.KV_STAKING; + case 6: + case "KV_WASM": + return ResourceType.KV_WASM; + case 7: + case "KV_ORACLE": + return ResourceType.KV_ORACLE; + case 9: + case "KV_EPOCH": + return ResourceType.KV_EPOCH; + case 10: + case "KV_TOKENFACTORY": + return ResourceType.KV_TOKENFACTORY; + case 11: + case "KV_ORACLE_VOTE_TARGETS": + return ResourceType.KV_ORACLE_VOTE_TARGETS; + case 12: + case "KV_ORACLE_AGGREGATE_VOTES": + return ResourceType.KV_ORACLE_AGGREGATE_VOTES; + case 13: + case "KV_ORACLE_FEEDERS": + return ResourceType.KV_ORACLE_FEEDERS; + case 14: + case "KV_STAKING_DELEGATION": + return ResourceType.KV_STAKING_DELEGATION; + case 15: + case "KV_STAKING_VALIDATOR": + return ResourceType.KV_STAKING_VALIDATOR; + case 16: + case "KV_AUTH": + return ResourceType.KV_AUTH; + case 17: + case "KV_AUTH_ADDRESS_STORE": + return ResourceType.KV_AUTH_ADDRESS_STORE; + case 18: + case "KV_BANK_SUPPLY": + return ResourceType.KV_BANK_SUPPLY; + case 19: + case "KV_BANK_DENOM": + return ResourceType.KV_BANK_DENOM; + case 20: + case "KV_BANK_BALANCES": + return ResourceType.KV_BANK_BALANCES; + case 21: + case "KV_TOKENFACTORY_DENOM": + return ResourceType.KV_TOKENFACTORY_DENOM; + case 22: + case "KV_TOKENFACTORY_METADATA": + return ResourceType.KV_TOKENFACTORY_METADATA; + case 23: + case "KV_TOKENFACTORY_ADMIN": + return ResourceType.KV_TOKENFACTORY_ADMIN; + case 24: + case "KV_TOKENFACTORY_CREATOR": + return ResourceType.KV_TOKENFACTORY_CREATOR; + case 25: + case "KV_ORACLE_EXCHANGE_RATE": + return ResourceType.KV_ORACLE_EXCHANGE_RATE; + case 26: + case "KV_ORACLE_VOTE_PENALTY_COUNTER": + return ResourceType.KV_ORACLE_VOTE_PENALTY_COUNTER; + case 27: + case "KV_ORACLE_PRICE_SNAPSHOT": + return ResourceType.KV_ORACLE_PRICE_SNAPSHOT; + case 28: + case "KV_STAKING_VALIDATION_POWER": + return ResourceType.KV_STAKING_VALIDATION_POWER; + case 29: + case "KV_STAKING_TOTAL_POWER": + return ResourceType.KV_STAKING_TOTAL_POWER; + case 30: + case "KV_STAKING_VALIDATORS_CON_ADDR": + return ResourceType.KV_STAKING_VALIDATORS_CON_ADDR; + case 31: + case "KV_STAKING_UNBONDING_DELEGATION": + return ResourceType.KV_STAKING_UNBONDING_DELEGATION; + case 32: + case "KV_STAKING_UNBONDING_DELEGATION_VAL": + return ResourceType.KV_STAKING_UNBONDING_DELEGATION_VAL; + case 33: + case "KV_STAKING_REDELEGATION": + return ResourceType.KV_STAKING_REDELEGATION; + case 34: + case "KV_STAKING_REDELEGATION_VAL_SRC": + return ResourceType.KV_STAKING_REDELEGATION_VAL_SRC; + case 35: + case "KV_STAKING_REDELEGATION_VAL_DST": + return ResourceType.KV_STAKING_REDELEGATION_VAL_DST; + case 36: + case "KV_STAKING_REDELEGATION_QUEUE": + return ResourceType.KV_STAKING_REDELEGATION_QUEUE; + case 37: + case "KV_STAKING_VALIDATOR_QUEUE": + return ResourceType.KV_STAKING_VALIDATOR_QUEUE; + case 38: + case "KV_STAKING_HISTORICAL_INFO": + return ResourceType.KV_STAKING_HISTORICAL_INFO; + case 39: + case "KV_STAKING_UNBONDING": + return ResourceType.KV_STAKING_UNBONDING; + case 41: + case "KV_STAKING_VALIDATORS_BY_POWER": + return ResourceType.KV_STAKING_VALIDATORS_BY_POWER; + case 40: + case "KV_DISTRIBUTION": + return ResourceType.KV_DISTRIBUTION; + case 42: + case "KV_DISTRIBUTION_FEE_POOL": + return ResourceType.KV_DISTRIBUTION_FEE_POOL; + case 43: + case "KV_DISTRIBUTION_PROPOSER_KEY": + return ResourceType.KV_DISTRIBUTION_PROPOSER_KEY; + case 44: + case "KV_DISTRIBUTION_OUTSTANDING_REWARDS": + return ResourceType.KV_DISTRIBUTION_OUTSTANDING_REWARDS; + case 45: + case "KV_DISTRIBUTION_DELEGATOR_WITHDRAW_ADDR": + return ResourceType.KV_DISTRIBUTION_DELEGATOR_WITHDRAW_ADDR; + case 46: + case "KV_DISTRIBUTION_DELEGATOR_STARTING_INFO": + return ResourceType.KV_DISTRIBUTION_DELEGATOR_STARTING_INFO; + case 47: + case "KV_DISTRIBUTION_VAL_HISTORICAL_REWARDS": + return ResourceType.KV_DISTRIBUTION_VAL_HISTORICAL_REWARDS; + case 48: + case "KV_DISTRIBUTION_VAL_CURRENT_REWARDS": + return ResourceType.KV_DISTRIBUTION_VAL_CURRENT_REWARDS; + case 49: + case "KV_DISTRIBUTION_VAL_ACCUM_COMMISSION": + return ResourceType.KV_DISTRIBUTION_VAL_ACCUM_COMMISSION; + case 50: + case "KV_DISTRIBUTION_SLASH_EVENT": + return ResourceType.KV_DISTRIBUTION_SLASH_EVENT; + case 71: + case "KV_ACCESSCONTROL": + return ResourceType.KV_ACCESSCONTROL; + case 72: + case "KV_ACCESSCONTROL_WASM_DEPENDENCY_MAPPING": + return ResourceType.KV_ACCESSCONTROL_WASM_DEPENDENCY_MAPPING; + case 73: + case "KV_WASM_CODE": + return ResourceType.KV_WASM_CODE; + case 74: + case "KV_WASM_CONTRACT_ADDRESS": + return ResourceType.KV_WASM_CONTRACT_ADDRESS; + case 75: + case "KV_WASM_CONTRACT_STORE": + return ResourceType.KV_WASM_CONTRACT_STORE; + case 76: + case "KV_WASM_SEQUENCE_KEY": + return ResourceType.KV_WASM_SEQUENCE_KEY; + case 77: + case "KV_WASM_CONTRACT_CODE_HISTORY": + return ResourceType.KV_WASM_CONTRACT_CODE_HISTORY; + case 78: + case "KV_WASM_CONTRACT_BY_CODE_ID": + return ResourceType.KV_WASM_CONTRACT_BY_CODE_ID; + case 79: + case "KV_WASM_PINNED_CODE_INDEX": + return ResourceType.KV_WASM_PINNED_CODE_INDEX; + case 80: + case "KV_AUTH_GLOBAL_ACCOUNT_NUMBER": + return ResourceType.KV_AUTH_GLOBAL_ACCOUNT_NUMBER; + case 81: + case "KV_AUTHZ": + return ResourceType.KV_AUTHZ; + case 82: + case "KV_FEEGRANT": + return ResourceType.KV_FEEGRANT; + case 83: + case "KV_FEEGRANT_ALLOWANCE": + return ResourceType.KV_FEEGRANT_ALLOWANCE; + case 84: + case "KV_SLASHING": + return ResourceType.KV_SLASHING; + case 85: + case "KV_SLASHING_VAL_SIGNING_INFO": + return ResourceType.KV_SLASHING_VAL_SIGNING_INFO; + case 86: + case "KV_SLASHING_ADDR_PUBKEY_RELATION_KEY": + return ResourceType.KV_SLASHING_ADDR_PUBKEY_RELATION_KEY; + case 93: + case "KV_BANK_DEFERRED": + return ResourceType.KV_BANK_DEFERRED; + case 95: + case "KV_BANK_DEFERRED_MODULE_TX_INDEX": + return ResourceType.KV_BANK_DEFERRED_MODULE_TX_INDEX; + case 96: + case "KV_EVM": + return ResourceType.KV_EVM; + case 97: + case "KV_EVM_BALANCE": + return ResourceType.KV_EVM_BALANCE; + case 98: + case "KV_EVM_TRANSIENT": + return ResourceType.KV_EVM_TRANSIENT; + case 99: + case "KV_EVM_ACCOUNT_TRANSIENT": + return ResourceType.KV_EVM_ACCOUNT_TRANSIENT; + case 100: + case "KV_EVM_MODULE_TRANSIENT": + return ResourceType.KV_EVM_MODULE_TRANSIENT; + case 101: + case "KV_EVM_NONCE": + return ResourceType.KV_EVM_NONCE; + case 102: + case "KV_EVM_RECEIPT": + return ResourceType.KV_EVM_RECEIPT; + case 103: + case "KV_EVM_S2E": + return ResourceType.KV_EVM_S2E; + case 104: + case "KV_EVM_E2S": + return ResourceType.KV_EVM_E2S; + case 105: + case "KV_EVM_CODE_HASH": + return ResourceType.KV_EVM_CODE_HASH; + case 106: + case "KV_EVM_CODE": + return ResourceType.KV_EVM_CODE; + case 107: + case "KV_EVM_CODE_SIZE": + return ResourceType.KV_EVM_CODE_SIZE; + case 108: + case "KV_BANK_WEI_BALANCE": + return ResourceType.KV_BANK_WEI_BALANCE; + case -1: + case "UNRECOGNIZED": + default: + return ResourceType.UNRECOGNIZED; + } +} + +export function resourceTypeToJSON(object: ResourceType): string { + switch (object) { + case ResourceType.ANY: + return "ANY"; + case ResourceType.KV: + return "KV"; + case ResourceType.Mem: + return "Mem"; + case ResourceType.KV_BANK: + return "KV_BANK"; + case ResourceType.KV_STAKING: + return "KV_STAKING"; + case ResourceType.KV_WASM: + return "KV_WASM"; + case ResourceType.KV_ORACLE: + return "KV_ORACLE"; + case ResourceType.KV_EPOCH: + return "KV_EPOCH"; + case ResourceType.KV_TOKENFACTORY: + return "KV_TOKENFACTORY"; + case ResourceType.KV_ORACLE_VOTE_TARGETS: + return "KV_ORACLE_VOTE_TARGETS"; + case ResourceType.KV_ORACLE_AGGREGATE_VOTES: + return "KV_ORACLE_AGGREGATE_VOTES"; + case ResourceType.KV_ORACLE_FEEDERS: + return "KV_ORACLE_FEEDERS"; + case ResourceType.KV_STAKING_DELEGATION: + return "KV_STAKING_DELEGATION"; + case ResourceType.KV_STAKING_VALIDATOR: + return "KV_STAKING_VALIDATOR"; + case ResourceType.KV_AUTH: + return "KV_AUTH"; + case ResourceType.KV_AUTH_ADDRESS_STORE: + return "KV_AUTH_ADDRESS_STORE"; + case ResourceType.KV_BANK_SUPPLY: + return "KV_BANK_SUPPLY"; + case ResourceType.KV_BANK_DENOM: + return "KV_BANK_DENOM"; + case ResourceType.KV_BANK_BALANCES: + return "KV_BANK_BALANCES"; + case ResourceType.KV_TOKENFACTORY_DENOM: + return "KV_TOKENFACTORY_DENOM"; + case ResourceType.KV_TOKENFACTORY_METADATA: + return "KV_TOKENFACTORY_METADATA"; + case ResourceType.KV_TOKENFACTORY_ADMIN: + return "KV_TOKENFACTORY_ADMIN"; + case ResourceType.KV_TOKENFACTORY_CREATOR: + return "KV_TOKENFACTORY_CREATOR"; + case ResourceType.KV_ORACLE_EXCHANGE_RATE: + return "KV_ORACLE_EXCHANGE_RATE"; + case ResourceType.KV_ORACLE_VOTE_PENALTY_COUNTER: + return "KV_ORACLE_VOTE_PENALTY_COUNTER"; + case ResourceType.KV_ORACLE_PRICE_SNAPSHOT: + return "KV_ORACLE_PRICE_SNAPSHOT"; + case ResourceType.KV_STAKING_VALIDATION_POWER: + return "KV_STAKING_VALIDATION_POWER"; + case ResourceType.KV_STAKING_TOTAL_POWER: + return "KV_STAKING_TOTAL_POWER"; + case ResourceType.KV_STAKING_VALIDATORS_CON_ADDR: + return "KV_STAKING_VALIDATORS_CON_ADDR"; + case ResourceType.KV_STAKING_UNBONDING_DELEGATION: + return "KV_STAKING_UNBONDING_DELEGATION"; + case ResourceType.KV_STAKING_UNBONDING_DELEGATION_VAL: + return "KV_STAKING_UNBONDING_DELEGATION_VAL"; + case ResourceType.KV_STAKING_REDELEGATION: + return "KV_STAKING_REDELEGATION"; + case ResourceType.KV_STAKING_REDELEGATION_VAL_SRC: + return "KV_STAKING_REDELEGATION_VAL_SRC"; + case ResourceType.KV_STAKING_REDELEGATION_VAL_DST: + return "KV_STAKING_REDELEGATION_VAL_DST"; + case ResourceType.KV_STAKING_REDELEGATION_QUEUE: + return "KV_STAKING_REDELEGATION_QUEUE"; + case ResourceType.KV_STAKING_VALIDATOR_QUEUE: + return "KV_STAKING_VALIDATOR_QUEUE"; + case ResourceType.KV_STAKING_HISTORICAL_INFO: + return "KV_STAKING_HISTORICAL_INFO"; + case ResourceType.KV_STAKING_UNBONDING: + return "KV_STAKING_UNBONDING"; + case ResourceType.KV_STAKING_VALIDATORS_BY_POWER: + return "KV_STAKING_VALIDATORS_BY_POWER"; + case ResourceType.KV_DISTRIBUTION: + return "KV_DISTRIBUTION"; + case ResourceType.KV_DISTRIBUTION_FEE_POOL: + return "KV_DISTRIBUTION_FEE_POOL"; + case ResourceType.KV_DISTRIBUTION_PROPOSER_KEY: + return "KV_DISTRIBUTION_PROPOSER_KEY"; + case ResourceType.KV_DISTRIBUTION_OUTSTANDING_REWARDS: + return "KV_DISTRIBUTION_OUTSTANDING_REWARDS"; + case ResourceType.KV_DISTRIBUTION_DELEGATOR_WITHDRAW_ADDR: + return "KV_DISTRIBUTION_DELEGATOR_WITHDRAW_ADDR"; + case ResourceType.KV_DISTRIBUTION_DELEGATOR_STARTING_INFO: + return "KV_DISTRIBUTION_DELEGATOR_STARTING_INFO"; + case ResourceType.KV_DISTRIBUTION_VAL_HISTORICAL_REWARDS: + return "KV_DISTRIBUTION_VAL_HISTORICAL_REWARDS"; + case ResourceType.KV_DISTRIBUTION_VAL_CURRENT_REWARDS: + return "KV_DISTRIBUTION_VAL_CURRENT_REWARDS"; + case ResourceType.KV_DISTRIBUTION_VAL_ACCUM_COMMISSION: + return "KV_DISTRIBUTION_VAL_ACCUM_COMMISSION"; + case ResourceType.KV_DISTRIBUTION_SLASH_EVENT: + return "KV_DISTRIBUTION_SLASH_EVENT"; + case ResourceType.KV_ACCESSCONTROL: + return "KV_ACCESSCONTROL"; + case ResourceType.KV_ACCESSCONTROL_WASM_DEPENDENCY_MAPPING: + return "KV_ACCESSCONTROL_WASM_DEPENDENCY_MAPPING"; + case ResourceType.KV_WASM_CODE: + return "KV_WASM_CODE"; + case ResourceType.KV_WASM_CONTRACT_ADDRESS: + return "KV_WASM_CONTRACT_ADDRESS"; + case ResourceType.KV_WASM_CONTRACT_STORE: + return "KV_WASM_CONTRACT_STORE"; + case ResourceType.KV_WASM_SEQUENCE_KEY: + return "KV_WASM_SEQUENCE_KEY"; + case ResourceType.KV_WASM_CONTRACT_CODE_HISTORY: + return "KV_WASM_CONTRACT_CODE_HISTORY"; + case ResourceType.KV_WASM_CONTRACT_BY_CODE_ID: + return "KV_WASM_CONTRACT_BY_CODE_ID"; + case ResourceType.KV_WASM_PINNED_CODE_INDEX: + return "KV_WASM_PINNED_CODE_INDEX"; + case ResourceType.KV_AUTH_GLOBAL_ACCOUNT_NUMBER: + return "KV_AUTH_GLOBAL_ACCOUNT_NUMBER"; + case ResourceType.KV_AUTHZ: + return "KV_AUTHZ"; + case ResourceType.KV_FEEGRANT: + return "KV_FEEGRANT"; + case ResourceType.KV_FEEGRANT_ALLOWANCE: + return "KV_FEEGRANT_ALLOWANCE"; + case ResourceType.KV_SLASHING: + return "KV_SLASHING"; + case ResourceType.KV_SLASHING_VAL_SIGNING_INFO: + return "KV_SLASHING_VAL_SIGNING_INFO"; + case ResourceType.KV_SLASHING_ADDR_PUBKEY_RELATION_KEY: + return "KV_SLASHING_ADDR_PUBKEY_RELATION_KEY"; + case ResourceType.KV_BANK_DEFERRED: + return "KV_BANK_DEFERRED"; + case ResourceType.KV_BANK_DEFERRED_MODULE_TX_INDEX: + return "KV_BANK_DEFERRED_MODULE_TX_INDEX"; + case ResourceType.KV_EVM: + return "KV_EVM"; + case ResourceType.KV_EVM_BALANCE: + return "KV_EVM_BALANCE"; + case ResourceType.KV_EVM_TRANSIENT: + return "KV_EVM_TRANSIENT"; + case ResourceType.KV_EVM_ACCOUNT_TRANSIENT: + return "KV_EVM_ACCOUNT_TRANSIENT"; + case ResourceType.KV_EVM_MODULE_TRANSIENT: + return "KV_EVM_MODULE_TRANSIENT"; + case ResourceType.KV_EVM_NONCE: + return "KV_EVM_NONCE"; + case ResourceType.KV_EVM_RECEIPT: + return "KV_EVM_RECEIPT"; + case ResourceType.KV_EVM_S2E: + return "KV_EVM_S2E"; + case ResourceType.KV_EVM_E2S: + return "KV_EVM_E2S"; + case ResourceType.KV_EVM_CODE_HASH: + return "KV_EVM_CODE_HASH"; + case ResourceType.KV_EVM_CODE: + return "KV_EVM_CODE"; + case ResourceType.KV_EVM_CODE_SIZE: + return "KV_EVM_CODE_SIZE"; + case ResourceType.KV_BANK_WEI_BALANCE: + return "KV_BANK_WEI_BALANCE"; + case ResourceType.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +export function wasmMessageSubtypeFromJSON(object: any): WasmMessageSubtype { + switch (object) { + case 0: + case "QUERY": + return WasmMessageSubtype.QUERY; + case 1: + case "EXECUTE": + return WasmMessageSubtype.EXECUTE; + case -1: + case "UNRECOGNIZED": + default: + return WasmMessageSubtype.UNRECOGNIZED; + } +} + +export function wasmMessageSubtypeToJSON(object: WasmMessageSubtype): string { + switch (object) { + case WasmMessageSubtype.QUERY: + return "QUERY"; + case WasmMessageSubtype.EXECUTE: + return "EXECUTE"; + case WasmMessageSubtype.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} diff --git a/packages/cosmos/generated/encoding/cosmos/accesscontrol/index.ts b/packages/cosmos/generated/encoding/cosmos/accesscontrol/index.ts new file mode 100644 index 000000000..26c6e4f62 --- /dev/null +++ b/packages/cosmos/generated/encoding/cosmos/accesscontrol/index.ts @@ -0,0 +1,5 @@ +// @ts-nocheck + +export * from './accesscontrol'; +export * from './constants'; +export * from './legacy'; \ No newline at end of file diff --git a/packages/cosmos/generated/encoding/cosmos/accesscontrol/legacy.ts b/packages/cosmos/generated/encoding/cosmos/accesscontrol/legacy.ts new file mode 100644 index 000000000..5daa12b9b --- /dev/null +++ b/packages/cosmos/generated/encoding/cosmos/accesscontrol/legacy.ts @@ -0,0 +1,219 @@ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +import { AccessOperation } from "./accesscontrol"; + +import { accessOperationSelectorTypeFromJSON, accessOperationSelectorTypeToJSON } from "./constants"; + +import type { + LegacyAccessOperationWithSelector as LegacyAccessOperationWithSelector_type, + LegacyWasmDependencyMapping as LegacyWasmDependencyMapping_type, +} from "../../../types/cosmos/accesscontrol"; + +import type { DeepPartial, Exact, MessageFns } from "../../common"; + +export interface LegacyAccessOperationWithSelector extends LegacyAccessOperationWithSelector_type {} +export interface LegacyWasmDependencyMapping extends LegacyWasmDependencyMapping_type {} + +export const LegacyAccessOperationWithSelector: MessageFns< + LegacyAccessOperationWithSelector, + "cosmos.accesscontrol.v1beta1.LegacyAccessOperationWithSelector" +> = { + $type: "cosmos.accesscontrol.v1beta1.LegacyAccessOperationWithSelector" as const, + + encode(message: LegacyAccessOperationWithSelector, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.operation !== undefined) { + AccessOperation.encode(message.operation, writer.uint32(10).fork()).join(); + } + if (message.selector_type !== 0) { + writer.uint32(16).int32(message.selector_type); + } + if (message.selector !== "") { + writer.uint32(26).string(message.selector); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): LegacyAccessOperationWithSelector { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseLegacyAccessOperationWithSelector(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.operation = AccessOperation.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.selector_type = reader.int32() as any; + continue; + case 3: + if (tag !== 26) { + break; + } + + message.selector = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): LegacyAccessOperationWithSelector { + return { + operation: isSet(object.operation) ? AccessOperation.fromJSON(object.operation) : undefined, + selector_type: isSet(object.selector_type) ? accessOperationSelectorTypeFromJSON(object.selector_type) : 0, + selector: isSet(object.selector) ? globalThis.String(object.selector) : "", + }; + }, + + toJSON(message: LegacyAccessOperationWithSelector): unknown { + const obj: any = {}; + if (message.operation !== undefined) { + obj.operation = AccessOperation.toJSON(message.operation); + } + if (message.selector_type !== 0) { + obj.selector_type = accessOperationSelectorTypeToJSON(message.selector_type); + } + if (message.selector !== "") { + obj.selector = message.selector; + } + return obj; + }, + + create, I>>(base?: I): LegacyAccessOperationWithSelector { + return LegacyAccessOperationWithSelector.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): LegacyAccessOperationWithSelector { + const message = createBaseLegacyAccessOperationWithSelector(); + message.operation = object.operation !== undefined && object.operation !== null ? AccessOperation.fromPartial(object.operation) : undefined; + message.selector_type = object.selector_type ?? 0; + message.selector = object.selector ?? ""; + return message; + }, +}; + +export const LegacyWasmDependencyMapping: MessageFns = { + $type: "cosmos.accesscontrol.v1beta1.LegacyWasmDependencyMapping" as const, + + encode(message: LegacyWasmDependencyMapping, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.enabled !== false) { + writer.uint32(8).bool(message.enabled); + } + for (const v of message.access_ops) { + LegacyAccessOperationWithSelector.encode(v!, writer.uint32(18).fork()).join(); + } + if (message.reset_reason !== "") { + writer.uint32(26).string(message.reset_reason); + } + if (message.contract_address !== "") { + writer.uint32(34).string(message.contract_address); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): LegacyWasmDependencyMapping { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseLegacyWasmDependencyMapping(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.enabled = reader.bool(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.access_ops.push(LegacyAccessOperationWithSelector.decode(reader, reader.uint32())); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.reset_reason = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.contract_address = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): LegacyWasmDependencyMapping { + return { + enabled: isSet(object.enabled) ? globalThis.Boolean(object.enabled) : false, + access_ops: globalThis.Array.isArray(object?.access_ops) ? object.access_ops.map((e: any) => LegacyAccessOperationWithSelector.fromJSON(e)) : [], + reset_reason: isSet(object.reset_reason) ? globalThis.String(object.reset_reason) : "", + contract_address: isSet(object.contract_address) ? globalThis.String(object.contract_address) : "", + }; + }, + + toJSON(message: LegacyWasmDependencyMapping): unknown { + const obj: any = {}; + if (message.enabled !== false) { + obj.enabled = message.enabled; + } + if (message.access_ops?.length) { + obj.access_ops = message.access_ops.map((e) => LegacyAccessOperationWithSelector.toJSON(e)); + } + if (message.reset_reason !== "") { + obj.reset_reason = message.reset_reason; + } + if (message.contract_address !== "") { + obj.contract_address = message.contract_address; + } + return obj; + }, + + create, I>>(base?: I): LegacyWasmDependencyMapping { + return LegacyWasmDependencyMapping.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): LegacyWasmDependencyMapping { + const message = createBaseLegacyWasmDependencyMapping(); + message.enabled = object.enabled ?? false; + message.access_ops = object.access_ops?.map((e) => LegacyAccessOperationWithSelector.fromPartial(e)) || []; + message.reset_reason = object.reset_reason ?? ""; + message.contract_address = object.contract_address ?? ""; + return message; + }, +}; + +function createBaseLegacyAccessOperationWithSelector(): LegacyAccessOperationWithSelector { + return { operation: undefined, selector_type: 0, selector: "" }; +} + +function createBaseLegacyWasmDependencyMapping(): LegacyWasmDependencyMapping { + return { enabled: false, access_ops: [], reset_reason: "", contract_address: "" }; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} diff --git a/packages/cosmos/generated/encoding/cosmos/accesscontrol_x/genesis.ts b/packages/cosmos/generated/encoding/cosmos/accesscontrol_x/genesis.ts new file mode 100644 index 000000000..03629c052 --- /dev/null +++ b/packages/cosmos/generated/encoding/cosmos/accesscontrol_x/genesis.ts @@ -0,0 +1,173 @@ +import type { GeneratedType } from "@cosmjs/proto-signing"; + +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +import { MessageDependencyMapping, WasmDependencyMapping } from "../accesscontrol/accesscontrol"; + +import type { GenesisState as GenesisState_type, Params as Params_type } from "../../../types/cosmos/accesscontrol_x"; + +import type { DeepPartial, Exact, MessageFns } from "../../common"; + +export interface GenesisState extends GenesisState_type {} +export interface Params extends Params_type {} + +export const GenesisState: MessageFns = { + $type: "cosmos.accesscontrol_x.v1beta1.GenesisState" as const, + + encode(message: GenesisState, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(10).fork()).join(); + } + for (const v of message.message_dependency_mapping) { + MessageDependencyMapping.encode(v!, writer.uint32(18).fork()).join(); + } + for (const v of message.wasm_dependency_mappings) { + WasmDependencyMapping.encode(v!, writer.uint32(26).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GenesisState { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGenesisState(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.params = Params.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.message_dependency_mapping.push(MessageDependencyMapping.decode(reader, reader.uint32())); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.wasm_dependency_mappings.push(WasmDependencyMapping.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GenesisState { + return { + params: isSet(object.params) ? Params.fromJSON(object.params) : undefined, + message_dependency_mapping: globalThis.Array.isArray(object?.message_dependency_mapping) + ? object.message_dependency_mapping.map((e: any) => MessageDependencyMapping.fromJSON(e)) + : [], + wasm_dependency_mappings: globalThis.Array.isArray(object?.wasm_dependency_mappings) + ? object.wasm_dependency_mappings.map((e: any) => WasmDependencyMapping.fromJSON(e)) + : [], + }; + }, + + toJSON(message: GenesisState): unknown { + const obj: any = {}; + if (message.params !== undefined) { + obj.params = Params.toJSON(message.params); + } + if (message.message_dependency_mapping?.length) { + obj.message_dependency_mapping = message.message_dependency_mapping.map((e) => MessageDependencyMapping.toJSON(e)); + } + if (message.wasm_dependency_mappings?.length) { + obj.wasm_dependency_mappings = message.wasm_dependency_mappings.map((e) => WasmDependencyMapping.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): GenesisState { + return GenesisState.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): GenesisState { + const message = createBaseGenesisState(); + message.params = object.params !== undefined && object.params !== null ? Params.fromPartial(object.params) : undefined; + message.message_dependency_mapping = object.message_dependency_mapping?.map((e) => MessageDependencyMapping.fromPartial(e)) || []; + message.wasm_dependency_mappings = object.wasm_dependency_mappings?.map((e) => WasmDependencyMapping.fromPartial(e)) || []; + return message; + }, +}; + +export const Params: MessageFns = { + $type: "cosmos.accesscontrol_x.v1beta1.Params" as const, + + encode(_: Params, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Params { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): Params { + return {}; + }, + + toJSON(_: Params): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): Params { + return Params.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): Params { + const message = createBaseParams(); + return message; + }, +}; + +function createBaseGenesisState(): GenesisState { + return { params: undefined, message_dependency_mapping: [], wasm_dependency_mappings: [] }; +} + +function createBaseParams(): Params { + return {}; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} +export const registry: Array<[string, GeneratedType]> = [ + ["/cosmos.accesscontrol_x.v1beta1.GenesisState", GenesisState as never], + ["/cosmos.accesscontrol_x.v1beta1.Params", Params as never], +]; +export const aminoConverters = { + "/cosmos.accesscontrol_x.v1beta1.GenesisState": { + aminoType: "cosmos-sdk/GenesisState", + toAmino: (message: GenesisState) => ({ ...message }), + fromAmino: (object: GenesisState) => ({ ...object }), + }, + + "/cosmos.accesscontrol_x.v1beta1.Params": { + aminoType: "cosmos-sdk/Params", + toAmino: (message: Params) => ({ ...message }), + fromAmino: (object: Params) => ({ ...object }), + }, +}; diff --git a/packages/cosmos/generated/encoding/cosmos/accesscontrol_x/gov.ts b/packages/cosmos/generated/encoding/cosmos/accesscontrol_x/gov.ts new file mode 100644 index 000000000..21ef46b19 --- /dev/null +++ b/packages/cosmos/generated/encoding/cosmos/accesscontrol_x/gov.ts @@ -0,0 +1,519 @@ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +import { MessageDependencyMapping, WasmDependencyMapping } from "../accesscontrol/accesscontrol"; + +import type { + MsgUpdateResourceDependencyMappingProposalJsonFile as MsgUpdateResourceDependencyMappingProposalJsonFile_type, + MsgUpdateResourceDependencyMappingProposalResponse as MsgUpdateResourceDependencyMappingProposalResponse_type, + MsgUpdateResourceDependencyMappingProposal as MsgUpdateResourceDependencyMappingProposal_type, + MsgUpdateWasmDependencyMappingProposalJsonFile as MsgUpdateWasmDependencyMappingProposalJsonFile_type, + MsgUpdateWasmDependencyMappingProposal as MsgUpdateWasmDependencyMappingProposal_type, +} from "../../../types/cosmos/accesscontrol_x"; + +import type { DeepPartial, Exact, MessageFns } from "../../common"; + +export interface MsgUpdateResourceDependencyMappingProposal extends MsgUpdateResourceDependencyMappingProposal_type {} +export interface MsgUpdateResourceDependencyMappingProposalJsonFile extends MsgUpdateResourceDependencyMappingProposalJsonFile_type {} +export interface MsgUpdateResourceDependencyMappingProposalResponse extends MsgUpdateResourceDependencyMappingProposalResponse_type {} +export interface MsgUpdateWasmDependencyMappingProposal extends MsgUpdateWasmDependencyMappingProposal_type {} +export interface MsgUpdateWasmDependencyMappingProposalJsonFile extends MsgUpdateWasmDependencyMappingProposalJsonFile_type {} + +export const MsgUpdateResourceDependencyMappingProposal: MessageFns< + MsgUpdateResourceDependencyMappingProposal, + "cosmos.accesscontrol.v1beta1.MsgUpdateResourceDependencyMappingProposal" +> = { + $type: "cosmos.accesscontrol.v1beta1.MsgUpdateResourceDependencyMappingProposal" as const, + + encode(message: MsgUpdateResourceDependencyMappingProposal, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.title !== "") { + writer.uint32(10).string(message.title); + } + if (message.description !== "") { + writer.uint32(18).string(message.description); + } + for (const v of message.message_dependency_mapping) { + MessageDependencyMapping.encode(v!, writer.uint32(26).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateResourceDependencyMappingProposal { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateResourceDependencyMappingProposal(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.title = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.description = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.message_dependency_mapping.push(MessageDependencyMapping.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgUpdateResourceDependencyMappingProposal { + return { + title: isSet(object.title) ? globalThis.String(object.title) : "", + description: isSet(object.description) ? globalThis.String(object.description) : "", + message_dependency_mapping: globalThis.Array.isArray(object?.message_dependency_mapping) + ? object.message_dependency_mapping.map((e: any) => MessageDependencyMapping.fromJSON(e)) + : [], + }; + }, + + toJSON(message: MsgUpdateResourceDependencyMappingProposal): unknown { + const obj: any = {}; + if (message.title !== "") { + obj.title = message.title; + } + if (message.description !== "") { + obj.description = message.description; + } + if (message.message_dependency_mapping?.length) { + obj.message_dependency_mapping = message.message_dependency_mapping.map((e) => MessageDependencyMapping.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): MsgUpdateResourceDependencyMappingProposal { + return MsgUpdateResourceDependencyMappingProposal.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgUpdateResourceDependencyMappingProposal { + const message = createBaseMsgUpdateResourceDependencyMappingProposal(); + message.title = object.title ?? ""; + message.description = object.description ?? ""; + message.message_dependency_mapping = object.message_dependency_mapping?.map((e) => MessageDependencyMapping.fromPartial(e)) || []; + return message; + }, +}; + +export const MsgUpdateResourceDependencyMappingProposalJsonFile: MessageFns< + MsgUpdateResourceDependencyMappingProposalJsonFile, + "cosmos.accesscontrol.v1beta1.MsgUpdateResourceDependencyMappingProposalJsonFile" +> = { + $type: "cosmos.accesscontrol.v1beta1.MsgUpdateResourceDependencyMappingProposalJsonFile" as const, + + encode(message: MsgUpdateResourceDependencyMappingProposalJsonFile, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.title !== "") { + writer.uint32(10).string(message.title); + } + if (message.description !== "") { + writer.uint32(18).string(message.description); + } + if (message.deposit !== "") { + writer.uint32(26).string(message.deposit); + } + for (const v of message.message_dependency_mapping) { + MessageDependencyMapping.encode(v!, writer.uint32(34).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateResourceDependencyMappingProposalJsonFile { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateResourceDependencyMappingProposalJsonFile(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.title = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.description = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.deposit = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.message_dependency_mapping.push(MessageDependencyMapping.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgUpdateResourceDependencyMappingProposalJsonFile { + return { + title: isSet(object.title) ? globalThis.String(object.title) : "", + description: isSet(object.description) ? globalThis.String(object.description) : "", + deposit: isSet(object.deposit) ? globalThis.String(object.deposit) : "", + message_dependency_mapping: globalThis.Array.isArray(object?.message_dependency_mapping) + ? object.message_dependency_mapping.map((e: any) => MessageDependencyMapping.fromJSON(e)) + : [], + }; + }, + + toJSON(message: MsgUpdateResourceDependencyMappingProposalJsonFile): unknown { + const obj: any = {}; + if (message.title !== "") { + obj.title = message.title; + } + if (message.description !== "") { + obj.description = message.description; + } + if (message.deposit !== "") { + obj.deposit = message.deposit; + } + if (message.message_dependency_mapping?.length) { + obj.message_dependency_mapping = message.message_dependency_mapping.map((e) => MessageDependencyMapping.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): MsgUpdateResourceDependencyMappingProposalJsonFile { + return MsgUpdateResourceDependencyMappingProposalJsonFile.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>( + object: I, + ): MsgUpdateResourceDependencyMappingProposalJsonFile { + const message = createBaseMsgUpdateResourceDependencyMappingProposalJsonFile(); + message.title = object.title ?? ""; + message.description = object.description ?? ""; + message.deposit = object.deposit ?? ""; + message.message_dependency_mapping = object.message_dependency_mapping?.map((e) => MessageDependencyMapping.fromPartial(e)) || []; + return message; + }, +}; + +export const MsgUpdateResourceDependencyMappingProposalResponse: MessageFns< + MsgUpdateResourceDependencyMappingProposalResponse, + "cosmos.accesscontrol.v1beta1.MsgUpdateResourceDependencyMappingProposalResponse" +> = { + $type: "cosmos.accesscontrol.v1beta1.MsgUpdateResourceDependencyMappingProposalResponse" as const, + + encode(_: MsgUpdateResourceDependencyMappingProposalResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateResourceDependencyMappingProposalResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateResourceDependencyMappingProposalResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgUpdateResourceDependencyMappingProposalResponse { + return {}; + }, + + toJSON(_: MsgUpdateResourceDependencyMappingProposalResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgUpdateResourceDependencyMappingProposalResponse { + return MsgUpdateResourceDependencyMappingProposalResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgUpdateResourceDependencyMappingProposalResponse { + const message = createBaseMsgUpdateResourceDependencyMappingProposalResponse(); + return message; + }, +}; + +export const MsgUpdateWasmDependencyMappingProposal: MessageFns< + MsgUpdateWasmDependencyMappingProposal, + "cosmos.accesscontrol.v1beta1.MsgUpdateWasmDependencyMappingProposal" +> = { + $type: "cosmos.accesscontrol.v1beta1.MsgUpdateWasmDependencyMappingProposal" as const, + + encode(message: MsgUpdateWasmDependencyMappingProposal, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.title !== "") { + writer.uint32(10).string(message.title); + } + if (message.description !== "") { + writer.uint32(18).string(message.description); + } + if (message.contract_address !== "") { + writer.uint32(26).string(message.contract_address); + } + if (message.wasm_dependency_mapping !== undefined) { + WasmDependencyMapping.encode(message.wasm_dependency_mapping, writer.uint32(34).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateWasmDependencyMappingProposal { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateWasmDependencyMappingProposal(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.title = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.description = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.contract_address = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.wasm_dependency_mapping = WasmDependencyMapping.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgUpdateWasmDependencyMappingProposal { + return { + title: isSet(object.title) ? globalThis.String(object.title) : "", + description: isSet(object.description) ? globalThis.String(object.description) : "", + contract_address: isSet(object.contract_address) ? globalThis.String(object.contract_address) : "", + wasm_dependency_mapping: isSet(object.wasm_dependency_mapping) ? WasmDependencyMapping.fromJSON(object.wasm_dependency_mapping) : undefined, + }; + }, + + toJSON(message: MsgUpdateWasmDependencyMappingProposal): unknown { + const obj: any = {}; + if (message.title !== "") { + obj.title = message.title; + } + if (message.description !== "") { + obj.description = message.description; + } + if (message.contract_address !== "") { + obj.contract_address = message.contract_address; + } + if (message.wasm_dependency_mapping !== undefined) { + obj.wasm_dependency_mapping = WasmDependencyMapping.toJSON(message.wasm_dependency_mapping); + } + return obj; + }, + + create, I>>(base?: I): MsgUpdateWasmDependencyMappingProposal { + return MsgUpdateWasmDependencyMappingProposal.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgUpdateWasmDependencyMappingProposal { + const message = createBaseMsgUpdateWasmDependencyMappingProposal(); + message.title = object.title ?? ""; + message.description = object.description ?? ""; + message.contract_address = object.contract_address ?? ""; + message.wasm_dependency_mapping = + object.wasm_dependency_mapping !== undefined && object.wasm_dependency_mapping !== null + ? WasmDependencyMapping.fromPartial(object.wasm_dependency_mapping) + : undefined; + return message; + }, +}; + +export const MsgUpdateWasmDependencyMappingProposalJsonFile: MessageFns< + MsgUpdateWasmDependencyMappingProposalJsonFile, + "cosmos.accesscontrol.v1beta1.MsgUpdateWasmDependencyMappingProposalJsonFile" +> = { + $type: "cosmos.accesscontrol.v1beta1.MsgUpdateWasmDependencyMappingProposalJsonFile" as const, + + encode(message: MsgUpdateWasmDependencyMappingProposalJsonFile, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.title !== "") { + writer.uint32(10).string(message.title); + } + if (message.description !== "") { + writer.uint32(18).string(message.description); + } + if (message.deposit !== "") { + writer.uint32(26).string(message.deposit); + } + if (message.contract_address !== "") { + writer.uint32(34).string(message.contract_address); + } + if (message.wasm_dependency_mapping !== undefined) { + WasmDependencyMapping.encode(message.wasm_dependency_mapping, writer.uint32(42).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateWasmDependencyMappingProposalJsonFile { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateWasmDependencyMappingProposalJsonFile(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.title = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.description = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.deposit = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.contract_address = reader.string(); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.wasm_dependency_mapping = WasmDependencyMapping.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgUpdateWasmDependencyMappingProposalJsonFile { + return { + title: isSet(object.title) ? globalThis.String(object.title) : "", + description: isSet(object.description) ? globalThis.String(object.description) : "", + deposit: isSet(object.deposit) ? globalThis.String(object.deposit) : "", + contract_address: isSet(object.contract_address) ? globalThis.String(object.contract_address) : "", + wasm_dependency_mapping: isSet(object.wasm_dependency_mapping) ? WasmDependencyMapping.fromJSON(object.wasm_dependency_mapping) : undefined, + }; + }, + + toJSON(message: MsgUpdateWasmDependencyMappingProposalJsonFile): unknown { + const obj: any = {}; + if (message.title !== "") { + obj.title = message.title; + } + if (message.description !== "") { + obj.description = message.description; + } + if (message.deposit !== "") { + obj.deposit = message.deposit; + } + if (message.contract_address !== "") { + obj.contract_address = message.contract_address; + } + if (message.wasm_dependency_mapping !== undefined) { + obj.wasm_dependency_mapping = WasmDependencyMapping.toJSON(message.wasm_dependency_mapping); + } + return obj; + }, + + create, I>>(base?: I): MsgUpdateWasmDependencyMappingProposalJsonFile { + return MsgUpdateWasmDependencyMappingProposalJsonFile.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgUpdateWasmDependencyMappingProposalJsonFile { + const message = createBaseMsgUpdateWasmDependencyMappingProposalJsonFile(); + message.title = object.title ?? ""; + message.description = object.description ?? ""; + message.deposit = object.deposit ?? ""; + message.contract_address = object.contract_address ?? ""; + message.wasm_dependency_mapping = + object.wasm_dependency_mapping !== undefined && object.wasm_dependency_mapping !== null + ? WasmDependencyMapping.fromPartial(object.wasm_dependency_mapping) + : undefined; + return message; + }, +}; + +function createBaseMsgUpdateResourceDependencyMappingProposal(): MsgUpdateResourceDependencyMappingProposal { + return { title: "", description: "", message_dependency_mapping: [] }; +} + +function createBaseMsgUpdateResourceDependencyMappingProposalJsonFile(): MsgUpdateResourceDependencyMappingProposalJsonFile { + return { title: "", description: "", deposit: "", message_dependency_mapping: [] }; +} + +function createBaseMsgUpdateResourceDependencyMappingProposalResponse(): MsgUpdateResourceDependencyMappingProposalResponse { + return {}; +} + +function createBaseMsgUpdateWasmDependencyMappingProposal(): MsgUpdateWasmDependencyMappingProposal { + return { title: "", description: "", contract_address: "", wasm_dependency_mapping: undefined }; +} + +function createBaseMsgUpdateWasmDependencyMappingProposalJsonFile(): MsgUpdateWasmDependencyMappingProposalJsonFile { + return { title: "", description: "", deposit: "", contract_address: "", wasm_dependency_mapping: undefined }; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} diff --git a/packages/cosmos/generated/encoding/cosmos/accesscontrol_x/index.ts b/packages/cosmos/generated/encoding/cosmos/accesscontrol_x/index.ts new file mode 100644 index 000000000..57dc0904c --- /dev/null +++ b/packages/cosmos/generated/encoding/cosmos/accesscontrol_x/index.ts @@ -0,0 +1,6 @@ +// @ts-nocheck + +export * from './genesis'; +export * from './gov'; +export * from './query'; +export * from './tx'; \ No newline at end of file diff --git a/packages/cosmos/generated/encoding/cosmos/accesscontrol_x/query.ts b/packages/cosmos/generated/encoding/cosmos/accesscontrol_x/query.ts new file mode 100644 index 000000000..ad539ac51 --- /dev/null +++ b/packages/cosmos/generated/encoding/cosmos/accesscontrol_x/query.ts @@ -0,0 +1,627 @@ +import type { GeneratedType } from "@cosmjs/proto-signing"; + +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +import { MessageDependencyMapping, WasmDependencyMapping } from "../accesscontrol/accesscontrol"; + +import { Params } from "./genesis"; + +import type { + ListResourceDependencyMappingRequest as ListResourceDependencyMappingRequest_type, + ListResourceDependencyMappingResponse as ListResourceDependencyMappingResponse_type, + ListWasmDependencyMappingRequest as ListWasmDependencyMappingRequest_type, + ListWasmDependencyMappingResponse as ListWasmDependencyMappingResponse_type, + QueryParamsRequest as QueryParamsRequest_type, + QueryParamsResponse as QueryParamsResponse_type, + ResourceDependencyMappingFromMessageKeyRequest as ResourceDependencyMappingFromMessageKeyRequest_type, + ResourceDependencyMappingFromMessageKeyResponse as ResourceDependencyMappingFromMessageKeyResponse_type, + WasmDependencyMappingRequest as WasmDependencyMappingRequest_type, + WasmDependencyMappingResponse as WasmDependencyMappingResponse_type, +} from "../../../types/cosmos/accesscontrol_x"; + +import type { DeepPartial, Exact, MessageFns } from "../../common"; + +export interface QueryParamsRequest extends QueryParamsRequest_type {} +export interface QueryParamsResponse extends QueryParamsResponse_type {} +export interface ResourceDependencyMappingFromMessageKeyRequest extends ResourceDependencyMappingFromMessageKeyRequest_type {} +export interface ResourceDependencyMappingFromMessageKeyResponse extends ResourceDependencyMappingFromMessageKeyResponse_type {} +export interface WasmDependencyMappingRequest extends WasmDependencyMappingRequest_type {} +export interface WasmDependencyMappingResponse extends WasmDependencyMappingResponse_type {} +export interface ListResourceDependencyMappingRequest extends ListResourceDependencyMappingRequest_type {} +export interface ListResourceDependencyMappingResponse extends ListResourceDependencyMappingResponse_type {} +export interface ListWasmDependencyMappingRequest extends ListWasmDependencyMappingRequest_type {} +export interface ListWasmDependencyMappingResponse extends ListWasmDependencyMappingResponse_type {} + +export const QueryParamsRequest: MessageFns = { + $type: "cosmos.accesscontrol_x.v1beta1.QueryParamsRequest" as const, + + encode(_: QueryParamsRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryParamsRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryParamsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): QueryParamsRequest { + return {}; + }, + + toJSON(_: QueryParamsRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): QueryParamsRequest { + return QueryParamsRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): QueryParamsRequest { + const message = createBaseQueryParamsRequest(); + return message; + }, +}; + +export const QueryParamsResponse: MessageFns = { + $type: "cosmos.accesscontrol_x.v1beta1.QueryParamsResponse" as const, + + encode(message: QueryParamsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryParamsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryParamsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.params = Params.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryParamsResponse { + return { params: isSet(object.params) ? Params.fromJSON(object.params) : undefined }; + }, + + toJSON(message: QueryParamsResponse): unknown { + const obj: any = {}; + if (message.params !== undefined) { + obj.params = Params.toJSON(message.params); + } + return obj; + }, + + create, I>>(base?: I): QueryParamsResponse { + return QueryParamsResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryParamsResponse { + const message = createBaseQueryParamsResponse(); + message.params = object.params !== undefined && object.params !== null ? Params.fromPartial(object.params) : undefined; + return message; + }, +}; + +export const ResourceDependencyMappingFromMessageKeyRequest: MessageFns< + ResourceDependencyMappingFromMessageKeyRequest, + "cosmos.accesscontrol_x.v1beta1.ResourceDependencyMappingFromMessageKeyRequest" +> = { + $type: "cosmos.accesscontrol_x.v1beta1.ResourceDependencyMappingFromMessageKeyRequest" as const, + + encode(message: ResourceDependencyMappingFromMessageKeyRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.message_key !== "") { + writer.uint32(10).string(message.message_key); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ResourceDependencyMappingFromMessageKeyRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseResourceDependencyMappingFromMessageKeyRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.message_key = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ResourceDependencyMappingFromMessageKeyRequest { + return { message_key: isSet(object.message_key) ? globalThis.String(object.message_key) : "" }; + }, + + toJSON(message: ResourceDependencyMappingFromMessageKeyRequest): unknown { + const obj: any = {}; + if (message.message_key !== "") { + obj.message_key = message.message_key; + } + return obj; + }, + + create, I>>(base?: I): ResourceDependencyMappingFromMessageKeyRequest { + return ResourceDependencyMappingFromMessageKeyRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ResourceDependencyMappingFromMessageKeyRequest { + const message = createBaseResourceDependencyMappingFromMessageKeyRequest(); + message.message_key = object.message_key ?? ""; + return message; + }, +}; + +export const ResourceDependencyMappingFromMessageKeyResponse: MessageFns< + ResourceDependencyMappingFromMessageKeyResponse, + "cosmos.accesscontrol_x.v1beta1.ResourceDependencyMappingFromMessageKeyResponse" +> = { + $type: "cosmos.accesscontrol_x.v1beta1.ResourceDependencyMappingFromMessageKeyResponse" as const, + + encode(message: ResourceDependencyMappingFromMessageKeyResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.message_dependency_mapping !== undefined) { + MessageDependencyMapping.encode(message.message_dependency_mapping, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ResourceDependencyMappingFromMessageKeyResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseResourceDependencyMappingFromMessageKeyResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.message_dependency_mapping = MessageDependencyMapping.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ResourceDependencyMappingFromMessageKeyResponse { + return { + message_dependency_mapping: isSet(object.message_dependency_mapping) ? MessageDependencyMapping.fromJSON(object.message_dependency_mapping) : undefined, + }; + }, + + toJSON(message: ResourceDependencyMappingFromMessageKeyResponse): unknown { + const obj: any = {}; + if (message.message_dependency_mapping !== undefined) { + obj.message_dependency_mapping = MessageDependencyMapping.toJSON(message.message_dependency_mapping); + } + return obj; + }, + + create, I>>(base?: I): ResourceDependencyMappingFromMessageKeyResponse { + return ResourceDependencyMappingFromMessageKeyResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ResourceDependencyMappingFromMessageKeyResponse { + const message = createBaseResourceDependencyMappingFromMessageKeyResponse(); + message.message_dependency_mapping = + object.message_dependency_mapping !== undefined && object.message_dependency_mapping !== null + ? MessageDependencyMapping.fromPartial(object.message_dependency_mapping) + : undefined; + return message; + }, +}; + +export const WasmDependencyMappingRequest: MessageFns = { + $type: "cosmos.accesscontrol_x.v1beta1.WasmDependencyMappingRequest" as const, + + encode(message: WasmDependencyMappingRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.contract_address !== "") { + writer.uint32(10).string(message.contract_address); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): WasmDependencyMappingRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseWasmDependencyMappingRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.contract_address = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): WasmDependencyMappingRequest { + return { contract_address: isSet(object.contract_address) ? globalThis.String(object.contract_address) : "" }; + }, + + toJSON(message: WasmDependencyMappingRequest): unknown { + const obj: any = {}; + if (message.contract_address !== "") { + obj.contract_address = message.contract_address; + } + return obj; + }, + + create, I>>(base?: I): WasmDependencyMappingRequest { + return WasmDependencyMappingRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): WasmDependencyMappingRequest { + const message = createBaseWasmDependencyMappingRequest(); + message.contract_address = object.contract_address ?? ""; + return message; + }, +}; + +export const WasmDependencyMappingResponse: MessageFns = { + $type: "cosmos.accesscontrol_x.v1beta1.WasmDependencyMappingResponse" as const, + + encode(message: WasmDependencyMappingResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.wasm_dependency_mapping !== undefined) { + WasmDependencyMapping.encode(message.wasm_dependency_mapping, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): WasmDependencyMappingResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseWasmDependencyMappingResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.wasm_dependency_mapping = WasmDependencyMapping.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): WasmDependencyMappingResponse { + return { + wasm_dependency_mapping: isSet(object.wasm_dependency_mapping) ? WasmDependencyMapping.fromJSON(object.wasm_dependency_mapping) : undefined, + }; + }, + + toJSON(message: WasmDependencyMappingResponse): unknown { + const obj: any = {}; + if (message.wasm_dependency_mapping !== undefined) { + obj.wasm_dependency_mapping = WasmDependencyMapping.toJSON(message.wasm_dependency_mapping); + } + return obj; + }, + + create, I>>(base?: I): WasmDependencyMappingResponse { + return WasmDependencyMappingResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): WasmDependencyMappingResponse { + const message = createBaseWasmDependencyMappingResponse(); + message.wasm_dependency_mapping = + object.wasm_dependency_mapping !== undefined && object.wasm_dependency_mapping !== null + ? WasmDependencyMapping.fromPartial(object.wasm_dependency_mapping) + : undefined; + return message; + }, +}; + +export const ListResourceDependencyMappingRequest: MessageFns< + ListResourceDependencyMappingRequest, + "cosmos.accesscontrol_x.v1beta1.ListResourceDependencyMappingRequest" +> = { + $type: "cosmos.accesscontrol_x.v1beta1.ListResourceDependencyMappingRequest" as const, + + encode(_: ListResourceDependencyMappingRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ListResourceDependencyMappingRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseListResourceDependencyMappingRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): ListResourceDependencyMappingRequest { + return {}; + }, + + toJSON(_: ListResourceDependencyMappingRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): ListResourceDependencyMappingRequest { + return ListResourceDependencyMappingRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): ListResourceDependencyMappingRequest { + const message = createBaseListResourceDependencyMappingRequest(); + return message; + }, +}; + +export const ListResourceDependencyMappingResponse: MessageFns< + ListResourceDependencyMappingResponse, + "cosmos.accesscontrol_x.v1beta1.ListResourceDependencyMappingResponse" +> = { + $type: "cosmos.accesscontrol_x.v1beta1.ListResourceDependencyMappingResponse" as const, + + encode(message: ListResourceDependencyMappingResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.message_dependency_mapping_list) { + MessageDependencyMapping.encode(v!, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ListResourceDependencyMappingResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseListResourceDependencyMappingResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.message_dependency_mapping_list.push(MessageDependencyMapping.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ListResourceDependencyMappingResponse { + return { + message_dependency_mapping_list: globalThis.Array.isArray(object?.message_dependency_mapping_list) + ? object.message_dependency_mapping_list.map((e: any) => MessageDependencyMapping.fromJSON(e)) + : [], + }; + }, + + toJSON(message: ListResourceDependencyMappingResponse): unknown { + const obj: any = {}; + if (message.message_dependency_mapping_list?.length) { + obj.message_dependency_mapping_list = message.message_dependency_mapping_list.map((e) => MessageDependencyMapping.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): ListResourceDependencyMappingResponse { + return ListResourceDependencyMappingResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ListResourceDependencyMappingResponse { + const message = createBaseListResourceDependencyMappingResponse(); + message.message_dependency_mapping_list = object.message_dependency_mapping_list?.map((e) => MessageDependencyMapping.fromPartial(e)) || []; + return message; + }, +}; + +export const ListWasmDependencyMappingRequest: MessageFns = + { + $type: "cosmos.accesscontrol_x.v1beta1.ListWasmDependencyMappingRequest" as const, + + encode(_: ListWasmDependencyMappingRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ListWasmDependencyMappingRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseListWasmDependencyMappingRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): ListWasmDependencyMappingRequest { + return {}; + }, + + toJSON(_: ListWasmDependencyMappingRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): ListWasmDependencyMappingRequest { + return ListWasmDependencyMappingRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): ListWasmDependencyMappingRequest { + const message = createBaseListWasmDependencyMappingRequest(); + return message; + }, + }; + +export const ListWasmDependencyMappingResponse: MessageFns< + ListWasmDependencyMappingResponse, + "cosmos.accesscontrol_x.v1beta1.ListWasmDependencyMappingResponse" +> = { + $type: "cosmos.accesscontrol_x.v1beta1.ListWasmDependencyMappingResponse" as const, + + encode(message: ListWasmDependencyMappingResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.wasm_dependency_mapping_list) { + WasmDependencyMapping.encode(v!, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ListWasmDependencyMappingResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseListWasmDependencyMappingResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.wasm_dependency_mapping_list.push(WasmDependencyMapping.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ListWasmDependencyMappingResponse { + return { + wasm_dependency_mapping_list: globalThis.Array.isArray(object?.wasm_dependency_mapping_list) + ? object.wasm_dependency_mapping_list.map((e: any) => WasmDependencyMapping.fromJSON(e)) + : [], + }; + }, + + toJSON(message: ListWasmDependencyMappingResponse): unknown { + const obj: any = {}; + if (message.wasm_dependency_mapping_list?.length) { + obj.wasm_dependency_mapping_list = message.wasm_dependency_mapping_list.map((e) => WasmDependencyMapping.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): ListWasmDependencyMappingResponse { + return ListWasmDependencyMappingResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ListWasmDependencyMappingResponse { + const message = createBaseListWasmDependencyMappingResponse(); + message.wasm_dependency_mapping_list = object.wasm_dependency_mapping_list?.map((e) => WasmDependencyMapping.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseQueryParamsRequest(): QueryParamsRequest { + return {}; +} + +function createBaseQueryParamsResponse(): QueryParamsResponse { + return { params: undefined }; +} + +function createBaseResourceDependencyMappingFromMessageKeyRequest(): ResourceDependencyMappingFromMessageKeyRequest { + return { message_key: "" }; +} + +function createBaseResourceDependencyMappingFromMessageKeyResponse(): ResourceDependencyMappingFromMessageKeyResponse { + return { message_dependency_mapping: undefined }; +} + +function createBaseWasmDependencyMappingRequest(): WasmDependencyMappingRequest { + return { contract_address: "" }; +} + +function createBaseWasmDependencyMappingResponse(): WasmDependencyMappingResponse { + return { wasm_dependency_mapping: undefined }; +} + +function createBaseListResourceDependencyMappingRequest(): ListResourceDependencyMappingRequest { + return {}; +} + +function createBaseListResourceDependencyMappingResponse(): ListResourceDependencyMappingResponse { + return { message_dependency_mapping_list: [] }; +} + +function createBaseListWasmDependencyMappingRequest(): ListWasmDependencyMappingRequest { + return {}; +} + +function createBaseListWasmDependencyMappingResponse(): ListWasmDependencyMappingResponse { + return { wasm_dependency_mapping_list: [] }; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} +export const registry: Array<[string, GeneratedType]> = [["/cosmos.accesscontrol_x.v1beta1.QueryParamsRequest", QueryParamsRequest as never]]; +export const aminoConverters = { + "/cosmos.accesscontrol_x.v1beta1.QueryParamsRequest": { + aminoType: "cosmos-sdk/QueryParamsRequest", + toAmino: (message: QueryParamsRequest) => ({ ...message }), + fromAmino: (object: QueryParamsRequest) => ({ ...object }), + }, +}; diff --git a/packages/cosmos/generated/encoding/cosmos/accesscontrol_x/tx.ts b/packages/cosmos/generated/encoding/cosmos/accesscontrol_x/tx.ts new file mode 100644 index 000000000..d670fff84 --- /dev/null +++ b/packages/cosmos/generated/encoding/cosmos/accesscontrol_x/tx.ts @@ -0,0 +1,210 @@ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +import { WasmDependencyMapping } from "../accesscontrol/accesscontrol"; + +import type { + MsgRegisterWasmDependencyResponse as MsgRegisterWasmDependencyResponse_type, + MsgRegisterWasmDependency as MsgRegisterWasmDependency_type, + RegisterWasmDependencyJSONFile as RegisterWasmDependencyJSONFile_type, +} from "../../../types/cosmos/accesscontrol_x"; + +import type { DeepPartial, Exact, MessageFns } from "../../common"; + +export interface RegisterWasmDependencyJSONFile extends RegisterWasmDependencyJSONFile_type {} +export interface MsgRegisterWasmDependency extends MsgRegisterWasmDependency_type {} +export interface MsgRegisterWasmDependencyResponse extends MsgRegisterWasmDependencyResponse_type {} + +export const RegisterWasmDependencyJSONFile: MessageFns = { + $type: "cosmos.accesscontrol_x.v1beta1.RegisterWasmDependencyJSONFile" as const, + + encode(message: RegisterWasmDependencyJSONFile, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.wasm_dependency_mapping !== undefined) { + WasmDependencyMapping.encode(message.wasm_dependency_mapping, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): RegisterWasmDependencyJSONFile { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRegisterWasmDependencyJSONFile(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.wasm_dependency_mapping = WasmDependencyMapping.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): RegisterWasmDependencyJSONFile { + return { + wasm_dependency_mapping: isSet(object.wasm_dependency_mapping) ? WasmDependencyMapping.fromJSON(object.wasm_dependency_mapping) : undefined, + }; + }, + + toJSON(message: RegisterWasmDependencyJSONFile): unknown { + const obj: any = {}; + if (message.wasm_dependency_mapping !== undefined) { + obj.wasm_dependency_mapping = WasmDependencyMapping.toJSON(message.wasm_dependency_mapping); + } + return obj; + }, + + create, I>>(base?: I): RegisterWasmDependencyJSONFile { + return RegisterWasmDependencyJSONFile.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): RegisterWasmDependencyJSONFile { + const message = createBaseRegisterWasmDependencyJSONFile(); + message.wasm_dependency_mapping = + object.wasm_dependency_mapping !== undefined && object.wasm_dependency_mapping !== null + ? WasmDependencyMapping.fromPartial(object.wasm_dependency_mapping) + : undefined; + return message; + }, +}; + +export const MsgRegisterWasmDependency: MessageFns = { + $type: "cosmos.accesscontrol_x.v1beta1.MsgRegisterWasmDependency" as const, + + encode(message: MsgRegisterWasmDependency, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.from_address !== "") { + writer.uint32(10).string(message.from_address); + } + if (message.wasm_dependency_mapping !== undefined) { + WasmDependencyMapping.encode(message.wasm_dependency_mapping, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgRegisterWasmDependency { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgRegisterWasmDependency(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.from_address = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.wasm_dependency_mapping = WasmDependencyMapping.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgRegisterWasmDependency { + return { + from_address: isSet(object.from_address) ? globalThis.String(object.from_address) : "", + wasm_dependency_mapping: isSet(object.wasm_dependency_mapping) ? WasmDependencyMapping.fromJSON(object.wasm_dependency_mapping) : undefined, + }; + }, + + toJSON(message: MsgRegisterWasmDependency): unknown { + const obj: any = {}; + if (message.from_address !== "") { + obj.from_address = message.from_address; + } + if (message.wasm_dependency_mapping !== undefined) { + obj.wasm_dependency_mapping = WasmDependencyMapping.toJSON(message.wasm_dependency_mapping); + } + return obj; + }, + + create, I>>(base?: I): MsgRegisterWasmDependency { + return MsgRegisterWasmDependency.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgRegisterWasmDependency { + const message = createBaseMsgRegisterWasmDependency(); + message.from_address = object.from_address ?? ""; + message.wasm_dependency_mapping = + object.wasm_dependency_mapping !== undefined && object.wasm_dependency_mapping !== null + ? WasmDependencyMapping.fromPartial(object.wasm_dependency_mapping) + : undefined; + return message; + }, +}; + +export const MsgRegisterWasmDependencyResponse: MessageFns< + MsgRegisterWasmDependencyResponse, + "cosmos.accesscontrol_x.v1beta1.MsgRegisterWasmDependencyResponse" +> = { + $type: "cosmos.accesscontrol_x.v1beta1.MsgRegisterWasmDependencyResponse" as const, + + encode(_: MsgRegisterWasmDependencyResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgRegisterWasmDependencyResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgRegisterWasmDependencyResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgRegisterWasmDependencyResponse { + return {}; + }, + + toJSON(_: MsgRegisterWasmDependencyResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgRegisterWasmDependencyResponse { + return MsgRegisterWasmDependencyResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgRegisterWasmDependencyResponse { + const message = createBaseMsgRegisterWasmDependencyResponse(); + return message; + }, +}; + +function createBaseRegisterWasmDependencyJSONFile(): RegisterWasmDependencyJSONFile { + return { wasm_dependency_mapping: undefined }; +} + +function createBaseMsgRegisterWasmDependency(): MsgRegisterWasmDependency { + return { from_address: "", wasm_dependency_mapping: undefined }; +} + +function createBaseMsgRegisterWasmDependencyResponse(): MsgRegisterWasmDependencyResponse { + return {}; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} diff --git a/packages/cosmos/generated/encoding/cosmos/auth/v1beta1/auth.ts b/packages/cosmos/generated/encoding/cosmos/auth/v1beta1/auth.ts new file mode 100644 index 000000000..f8f933f57 --- /dev/null +++ b/packages/cosmos/generated/encoding/cosmos/auth/v1beta1/auth.ts @@ -0,0 +1,392 @@ +import type { GeneratedType } from "@cosmjs/proto-signing"; + +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +import { Any } from "../../../google/protobuf/any"; + +import type { BaseAccount as BaseAccount_type, ModuleAccount as ModuleAccount_type, Params as Params_type } from "../../../../types/cosmos/auth/v1beta1"; + +import type { DeepPartial, Exact, MessageFns } from "../../../common"; + +export interface BaseAccount extends BaseAccount_type {} +export interface ModuleAccount extends ModuleAccount_type {} +export interface Params extends Params_type {} + +export const BaseAccount: MessageFns = { + $type: "cosmos.auth.v1beta1.BaseAccount" as const, + + encode(message: BaseAccount, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.address !== "") { + writer.uint32(10).string(message.address); + } + if (message.pub_key !== undefined) { + Any.encode(message.pub_key, writer.uint32(18).fork()).join(); + } + if (message.account_number !== 0) { + writer.uint32(24).uint64(message.account_number); + } + if (message.sequence !== 0) { + writer.uint32(32).uint64(message.sequence); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): BaseAccount { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseBaseAccount(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.address = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pub_key = Any.decode(reader, reader.uint32()); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.account_number = longToNumber(reader.uint64()); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.sequence = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): BaseAccount { + return { + address: isSet(object.address) ? globalThis.String(object.address) : "", + pub_key: isSet(object.pub_key) ? Any.fromJSON(object.pub_key) : undefined, + account_number: isSet(object.account_number) ? globalThis.Number(object.account_number) : 0, + sequence: isSet(object.sequence) ? globalThis.Number(object.sequence) : 0, + }; + }, + + toJSON(message: BaseAccount): unknown { + const obj: any = {}; + if (message.address !== "") { + obj.address = message.address; + } + if (message.pub_key !== undefined) { + obj.pub_key = Any.toJSON(message.pub_key); + } + if (message.account_number !== 0) { + obj.account_number = Math.round(message.account_number); + } + if (message.sequence !== 0) { + obj.sequence = Math.round(message.sequence); + } + return obj; + }, + + create, I>>(base?: I): BaseAccount { + return BaseAccount.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): BaseAccount { + const message = createBaseBaseAccount(); + message.address = object.address ?? ""; + message.pub_key = object.pub_key !== undefined && object.pub_key !== null ? Any.fromPartial(object.pub_key) : undefined; + message.account_number = object.account_number ?? 0; + message.sequence = object.sequence ?? 0; + return message; + }, +}; + +export const ModuleAccount: MessageFns = { + $type: "cosmos.auth.v1beta1.ModuleAccount" as const, + + encode(message: ModuleAccount, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.base_account !== undefined) { + BaseAccount.encode(message.base_account, writer.uint32(10).fork()).join(); + } + if (message.name !== "") { + writer.uint32(18).string(message.name); + } + for (const v of message.permissions) { + writer.uint32(26).string(v!); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ModuleAccount { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseModuleAccount(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.base_account = BaseAccount.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.name = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.permissions.push(reader.string()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ModuleAccount { + return { + base_account: isSet(object.base_account) ? BaseAccount.fromJSON(object.base_account) : undefined, + name: isSet(object.name) ? globalThis.String(object.name) : "", + permissions: globalThis.Array.isArray(object?.permissions) ? object.permissions.map((e: any) => globalThis.String(e)) : [], + }; + }, + + toJSON(message: ModuleAccount): unknown { + const obj: any = {}; + if (message.base_account !== undefined) { + obj.base_account = BaseAccount.toJSON(message.base_account); + } + if (message.name !== "") { + obj.name = message.name; + } + if (message.permissions?.length) { + obj.permissions = message.permissions; + } + return obj; + }, + + create, I>>(base?: I): ModuleAccount { + return ModuleAccount.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ModuleAccount { + const message = createBaseModuleAccount(); + message.base_account = object.base_account !== undefined && object.base_account !== null ? BaseAccount.fromPartial(object.base_account) : undefined; + message.name = object.name ?? ""; + message.permissions = object.permissions?.map((e) => e) || []; + return message; + }, +}; + +export const Params: MessageFns = { + $type: "cosmos.auth.v1beta1.Params" as const, + + encode(message: Params, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.max_memo_characters !== 0) { + writer.uint32(8).uint64(message.max_memo_characters); + } + if (message.tx_sig_limit !== 0) { + writer.uint32(16).uint64(message.tx_sig_limit); + } + if (message.tx_size_cost_per_byte !== 0) { + writer.uint32(24).uint64(message.tx_size_cost_per_byte); + } + if (message.sig_verify_cost_ed25519 !== 0) { + writer.uint32(32).uint64(message.sig_verify_cost_ed25519); + } + if (message.sig_verify_cost_secp256k1 !== 0) { + writer.uint32(40).uint64(message.sig_verify_cost_secp256k1); + } + if (message.disable_seqno_check !== false) { + writer.uint32(48).bool(message.disable_seqno_check); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Params { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.max_memo_characters = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.tx_sig_limit = longToNumber(reader.uint64()); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.tx_size_cost_per_byte = longToNumber(reader.uint64()); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.sig_verify_cost_ed25519 = longToNumber(reader.uint64()); + continue; + case 5: + if (tag !== 40) { + break; + } + + message.sig_verify_cost_secp256k1 = longToNumber(reader.uint64()); + continue; + case 6: + if (tag !== 48) { + break; + } + + message.disable_seqno_check = reader.bool(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Params { + return { + max_memo_characters: isSet(object.max_memo_characters) ? globalThis.Number(object.max_memo_characters) : 0, + tx_sig_limit: isSet(object.tx_sig_limit) ? globalThis.Number(object.tx_sig_limit) : 0, + tx_size_cost_per_byte: isSet(object.tx_size_cost_per_byte) ? globalThis.Number(object.tx_size_cost_per_byte) : 0, + sig_verify_cost_ed25519: isSet(object.sig_verify_cost_ed25519) ? globalThis.Number(object.sig_verify_cost_ed25519) : 0, + sig_verify_cost_secp256k1: isSet(object.sig_verify_cost_secp256k1) ? globalThis.Number(object.sig_verify_cost_secp256k1) : 0, + disable_seqno_check: isSet(object.disable_seqno_check) ? globalThis.Boolean(object.disable_seqno_check) : false, + }; + }, + + toJSON(message: Params): unknown { + const obj: any = {}; + if (message.max_memo_characters !== 0) { + obj.max_memo_characters = Math.round(message.max_memo_characters); + } + if (message.tx_sig_limit !== 0) { + obj.tx_sig_limit = Math.round(message.tx_sig_limit); + } + if (message.tx_size_cost_per_byte !== 0) { + obj.tx_size_cost_per_byte = Math.round(message.tx_size_cost_per_byte); + } + if (message.sig_verify_cost_ed25519 !== 0) { + obj.sig_verify_cost_ed25519 = Math.round(message.sig_verify_cost_ed25519); + } + if (message.sig_verify_cost_secp256k1 !== 0) { + obj.sig_verify_cost_secp256k1 = Math.round(message.sig_verify_cost_secp256k1); + } + if (message.disable_seqno_check !== false) { + obj.disable_seqno_check = message.disable_seqno_check; + } + return obj; + }, + + create, I>>(base?: I): Params { + return Params.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Params { + const message = createBaseParams(); + message.max_memo_characters = object.max_memo_characters ?? 0; + message.tx_sig_limit = object.tx_sig_limit ?? 0; + message.tx_size_cost_per_byte = object.tx_size_cost_per_byte ?? 0; + message.sig_verify_cost_ed25519 = object.sig_verify_cost_ed25519 ?? 0; + message.sig_verify_cost_secp256k1 = object.sig_verify_cost_secp256k1 ?? 0; + message.disable_seqno_check = object.disable_seqno_check ?? false; + return message; + }, +}; + +function createBaseBaseAccount(): BaseAccount { + return { address: "", pub_key: undefined, account_number: 0, sequence: 0 }; +} + +function createBaseModuleAccount(): ModuleAccount { + return { base_account: undefined, name: "", permissions: [] }; +} + +function createBaseParams(): Params { + return { + max_memo_characters: 0, + tx_sig_limit: 0, + tx_size_cost_per_byte: 0, + sig_verify_cost_ed25519: 0, + sig_verify_cost_secp256k1: 0, + disable_seqno_check: false, + }; +} + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} +export const registry: Array<[string, GeneratedType]> = [ + ["/cosmos.auth.v1beta1.BaseAccount", BaseAccount as never], + ["/cosmos.auth.v1beta1.ModuleAccount", ModuleAccount as never], + ["/cosmos.auth.v1beta1.Params", Params as never], +]; +export const aminoConverters = { + "/cosmos.auth.v1beta1.BaseAccount": { + aminoType: "cosmos-sdk/BaseAccount", + toAmino: (message: BaseAccount) => ({ ...message }), + fromAmino: (object: BaseAccount) => ({ ...object }), + }, + + "/cosmos.auth.v1beta1.ModuleAccount": { + aminoType: "cosmos-sdk/ModuleAccount", + toAmino: (message: ModuleAccount) => ({ ...message }), + fromAmino: (object: ModuleAccount) => ({ ...object }), + }, + + "/cosmos.auth.v1beta1.Params": { + aminoType: "cosmos-sdk/Params", + toAmino: (message: Params) => ({ ...message }), + fromAmino: (object: Params) => ({ ...object }), + }, +}; diff --git a/packages/cosmos/generated/encoding/cosmos/auth/v1beta1/genesis.ts b/packages/cosmos/generated/encoding/cosmos/auth/v1beta1/genesis.ts new file mode 100644 index 000000000..571cec184 --- /dev/null +++ b/packages/cosmos/generated/encoding/cosmos/auth/v1beta1/genesis.ts @@ -0,0 +1,101 @@ +import type { GeneratedType } from "@cosmjs/proto-signing"; + +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +import { Any } from "../../../google/protobuf/any"; + +import { Params } from "./auth"; + +import type { GenesisState as GenesisState_type } from "../../../../types/cosmos/auth/v1beta1"; + +import type { DeepPartial, Exact, MessageFns } from "../../../common"; + +export interface GenesisState extends GenesisState_type {} + +export const GenesisState: MessageFns = { + $type: "cosmos.auth.v1beta1.GenesisState" as const, + + encode(message: GenesisState, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(10).fork()).join(); + } + for (const v of message.accounts) { + Any.encode(v!, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GenesisState { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGenesisState(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.params = Params.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.accounts.push(Any.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GenesisState { + return { + params: isSet(object.params) ? Params.fromJSON(object.params) : undefined, + accounts: globalThis.Array.isArray(object?.accounts) ? object.accounts.map((e: any) => Any.fromJSON(e)) : [], + }; + }, + + toJSON(message: GenesisState): unknown { + const obj: any = {}; + if (message.params !== undefined) { + obj.params = Params.toJSON(message.params); + } + if (message.accounts?.length) { + obj.accounts = message.accounts.map((e) => Any.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): GenesisState { + return GenesisState.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): GenesisState { + const message = createBaseGenesisState(); + message.params = object.params !== undefined && object.params !== null ? Params.fromPartial(object.params) : undefined; + message.accounts = object.accounts?.map((e) => Any.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseGenesisState(): GenesisState { + return { params: undefined, accounts: [] }; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} +export const registry: Array<[string, GeneratedType]> = [["/cosmos.auth.v1beta1.GenesisState", GenesisState as never]]; +export const aminoConverters = { + "/cosmos.auth.v1beta1.GenesisState": { + aminoType: "cosmos-sdk/GenesisState", + toAmino: (message: GenesisState) => ({ ...message }), + fromAmino: (object: GenesisState) => ({ ...object }), + }, +}; diff --git a/packages/cosmos/generated/encoding/cosmos/auth/v1beta1/index.ts b/packages/cosmos/generated/encoding/cosmos/auth/v1beta1/index.ts new file mode 100644 index 000000000..975890188 --- /dev/null +++ b/packages/cosmos/generated/encoding/cosmos/auth/v1beta1/index.ts @@ -0,0 +1,5 @@ +// @ts-nocheck + +export * from './auth'; +export * from './genesis'; +export * from './query'; \ No newline at end of file diff --git a/packages/cosmos/generated/encoding/cosmos/auth/v1beta1/query.ts b/packages/cosmos/generated/encoding/cosmos/auth/v1beta1/query.ts new file mode 100644 index 000000000..3c7f15cc3 --- /dev/null +++ b/packages/cosmos/generated/encoding/cosmos/auth/v1beta1/query.ts @@ -0,0 +1,552 @@ +import type { GeneratedType } from "@cosmjs/proto-signing"; + +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +import { Any } from "../../../google/protobuf/any"; + +import { PageRequest, PageResponse } from "../../base/query/v1beta1/pagination"; + +import { Params } from "./auth"; + +import type { + QueryAccountRequest as QueryAccountRequest_type, + QueryAccountResponse as QueryAccountResponse_type, + QueryAccountsRequest as QueryAccountsRequest_type, + QueryAccountsResponse as QueryAccountsResponse_type, + QueryNextAccountNumberRequest as QueryNextAccountNumberRequest_type, + QueryNextAccountNumberResponse as QueryNextAccountNumberResponse_type, + QueryParamsRequest as QueryParamsRequest_type, + QueryParamsResponse as QueryParamsResponse_type, +} from "../../../../types/cosmos/auth/v1beta1"; + +import type { DeepPartial, Exact, MessageFns } from "../../../common"; + +export interface QueryAccountsRequest extends QueryAccountsRequest_type {} +export interface QueryAccountsResponse extends QueryAccountsResponse_type {} +export interface QueryAccountRequest extends QueryAccountRequest_type {} +export interface QueryAccountResponse extends QueryAccountResponse_type {} +export interface QueryParamsRequest extends QueryParamsRequest_type {} +export interface QueryParamsResponse extends QueryParamsResponse_type {} +export interface QueryNextAccountNumberRequest extends QueryNextAccountNumberRequest_type {} +export interface QueryNextAccountNumberResponse extends QueryNextAccountNumberResponse_type {} + +export const QueryAccountsRequest: MessageFns = { + $type: "cosmos.auth.v1beta1.QueryAccountsRequest" as const, + + encode(message: QueryAccountsRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryAccountsRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryAccountsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryAccountsRequest { + return { pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined }; + }, + + toJSON(message: QueryAccountsRequest): unknown { + const obj: any = {}; + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryAccountsRequest { + return QueryAccountsRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryAccountsRequest { + const message = createBaseQueryAccountsRequest(); + message.pagination = object.pagination !== undefined && object.pagination !== null ? PageRequest.fromPartial(object.pagination) : undefined; + return message; + }, +}; + +export const QueryAccountsResponse: MessageFns = { + $type: "cosmos.auth.v1beta1.QueryAccountsResponse" as const, + + encode(message: QueryAccountsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.accounts) { + Any.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryAccountsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryAccountsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.accounts.push(Any.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryAccountsResponse { + return { + accounts: globalThis.Array.isArray(object?.accounts) ? object.accounts.map((e: any) => Any.fromJSON(e)) : [], + pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryAccountsResponse): unknown { + const obj: any = {}; + if (message.accounts?.length) { + obj.accounts = message.accounts.map((e) => Any.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryAccountsResponse { + return QueryAccountsResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryAccountsResponse { + const message = createBaseQueryAccountsResponse(); + message.accounts = object.accounts?.map((e) => Any.fromPartial(e)) || []; + message.pagination = object.pagination !== undefined && object.pagination !== null ? PageResponse.fromPartial(object.pagination) : undefined; + return message; + }, +}; + +export const QueryAccountRequest: MessageFns = { + $type: "cosmos.auth.v1beta1.QueryAccountRequest" as const, + + encode(message: QueryAccountRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.address !== "") { + writer.uint32(10).string(message.address); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryAccountRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryAccountRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.address = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryAccountRequest { + return { address: isSet(object.address) ? globalThis.String(object.address) : "" }; + }, + + toJSON(message: QueryAccountRequest): unknown { + const obj: any = {}; + if (message.address !== "") { + obj.address = message.address; + } + return obj; + }, + + create, I>>(base?: I): QueryAccountRequest { + return QueryAccountRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryAccountRequest { + const message = createBaseQueryAccountRequest(); + message.address = object.address ?? ""; + return message; + }, +}; + +export const QueryAccountResponse: MessageFns = { + $type: "cosmos.auth.v1beta1.QueryAccountResponse" as const, + + encode(message: QueryAccountResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.account !== undefined) { + Any.encode(message.account, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryAccountResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryAccountResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.account = Any.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryAccountResponse { + return { account: isSet(object.account) ? Any.fromJSON(object.account) : undefined }; + }, + + toJSON(message: QueryAccountResponse): unknown { + const obj: any = {}; + if (message.account !== undefined) { + obj.account = Any.toJSON(message.account); + } + return obj; + }, + + create, I>>(base?: I): QueryAccountResponse { + return QueryAccountResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryAccountResponse { + const message = createBaseQueryAccountResponse(); + message.account = object.account !== undefined && object.account !== null ? Any.fromPartial(object.account) : undefined; + return message; + }, +}; + +export const QueryParamsRequest: MessageFns = { + $type: "cosmos.auth.v1beta1.QueryParamsRequest" as const, + + encode(_: QueryParamsRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryParamsRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryParamsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): QueryParamsRequest { + return {}; + }, + + toJSON(_: QueryParamsRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): QueryParamsRequest { + return QueryParamsRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): QueryParamsRequest { + const message = createBaseQueryParamsRequest(); + return message; + }, +}; + +export const QueryParamsResponse: MessageFns = { + $type: "cosmos.auth.v1beta1.QueryParamsResponse" as const, + + encode(message: QueryParamsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryParamsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryParamsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.params = Params.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryParamsResponse { + return { params: isSet(object.params) ? Params.fromJSON(object.params) : undefined }; + }, + + toJSON(message: QueryParamsResponse): unknown { + const obj: any = {}; + if (message.params !== undefined) { + obj.params = Params.toJSON(message.params); + } + return obj; + }, + + create, I>>(base?: I): QueryParamsResponse { + return QueryParamsResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryParamsResponse { + const message = createBaseQueryParamsResponse(); + message.params = object.params !== undefined && object.params !== null ? Params.fromPartial(object.params) : undefined; + return message; + }, +}; + +export const QueryNextAccountNumberRequest: MessageFns = { + $type: "cosmos.auth.v1beta1.QueryNextAccountNumberRequest" as const, + + encode(_: QueryNextAccountNumberRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryNextAccountNumberRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryNextAccountNumberRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): QueryNextAccountNumberRequest { + return {}; + }, + + toJSON(_: QueryNextAccountNumberRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): QueryNextAccountNumberRequest { + return QueryNextAccountNumberRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): QueryNextAccountNumberRequest { + const message = createBaseQueryNextAccountNumberRequest(); + return message; + }, +}; + +export const QueryNextAccountNumberResponse: MessageFns = { + $type: "cosmos.auth.v1beta1.QueryNextAccountNumberResponse" as const, + + encode(message: QueryNextAccountNumberResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.count !== 0) { + writer.uint32(8).uint64(message.count); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryNextAccountNumberResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryNextAccountNumberResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.count = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryNextAccountNumberResponse { + return { count: isSet(object.count) ? globalThis.Number(object.count) : 0 }; + }, + + toJSON(message: QueryNextAccountNumberResponse): unknown { + const obj: any = {}; + if (message.count !== 0) { + obj.count = Math.round(message.count); + } + return obj; + }, + + create, I>>(base?: I): QueryNextAccountNumberResponse { + return QueryNextAccountNumberResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryNextAccountNumberResponse { + const message = createBaseQueryNextAccountNumberResponse(); + message.count = object.count ?? 0; + return message; + }, +}; + +function createBaseQueryAccountsRequest(): QueryAccountsRequest { + return { pagination: undefined }; +} + +function createBaseQueryAccountsResponse(): QueryAccountsResponse { + return { accounts: [], pagination: undefined }; +} + +function createBaseQueryAccountRequest(): QueryAccountRequest { + return { address: "" }; +} + +function createBaseQueryAccountResponse(): QueryAccountResponse { + return { account: undefined }; +} + +function createBaseQueryParamsRequest(): QueryParamsRequest { + return {}; +} + +function createBaseQueryParamsResponse(): QueryParamsResponse { + return { params: undefined }; +} + +function createBaseQueryNextAccountNumberRequest(): QueryNextAccountNumberRequest { + return {}; +} + +function createBaseQueryNextAccountNumberResponse(): QueryNextAccountNumberResponse { + return { count: 0 }; +} + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} +export const registry: Array<[string, GeneratedType]> = [ + ["/cosmos.auth.v1beta1.QueryAccountsRequest", QueryAccountsRequest as never], + ["/cosmos.auth.v1beta1.QueryAccountsResponse", QueryAccountsResponse as never], + ["/cosmos.auth.v1beta1.QueryAccountRequest", QueryAccountRequest as never], + ["/cosmos.auth.v1beta1.QueryAccountResponse", QueryAccountResponse as never], + ["/cosmos.auth.v1beta1.QueryParamsRequest", QueryParamsRequest as never], + ["/cosmos.auth.v1beta1.QueryParamsResponse", QueryParamsResponse as never], +]; +export const aminoConverters = { + "/cosmos.auth.v1beta1.QueryAccountsRequest": { + aminoType: "cosmos-sdk/QueryAccountsRequest", + toAmino: (message: QueryAccountsRequest) => ({ ...message }), + fromAmino: (object: QueryAccountsRequest) => ({ ...object }), + }, + + "/cosmos.auth.v1beta1.QueryAccountsResponse": { + aminoType: "cosmos-sdk/QueryAccountsResponse", + toAmino: (message: QueryAccountsResponse) => ({ ...message }), + fromAmino: (object: QueryAccountsResponse) => ({ ...object }), + }, + + "/cosmos.auth.v1beta1.QueryAccountRequest": { + aminoType: "cosmos-sdk/QueryAccountRequest", + toAmino: (message: QueryAccountRequest) => ({ ...message }), + fromAmino: (object: QueryAccountRequest) => ({ ...object }), + }, + + "/cosmos.auth.v1beta1.QueryAccountResponse": { + aminoType: "cosmos-sdk/QueryAccountResponse", + toAmino: (message: QueryAccountResponse) => ({ ...message }), + fromAmino: (object: QueryAccountResponse) => ({ ...object }), + }, + + "/cosmos.auth.v1beta1.QueryParamsRequest": { + aminoType: "cosmos-sdk/QueryParamsRequest", + toAmino: (message: QueryParamsRequest) => ({ ...message }), + fromAmino: (object: QueryParamsRequest) => ({ ...object }), + }, + + "/cosmos.auth.v1beta1.QueryParamsResponse": { + aminoType: "cosmos-sdk/QueryParamsResponse", + toAmino: (message: QueryParamsResponse) => ({ ...message }), + fromAmino: (object: QueryParamsResponse) => ({ ...object }), + }, +}; diff --git a/packages/cosmos/generated/encoding/cosmos/authz/v1beta1/authz.ts b/packages/cosmos/generated/encoding/cosmos/authz/v1beta1/authz.ts new file mode 100644 index 000000000..c71fe2dcf --- /dev/null +++ b/packages/cosmos/generated/encoding/cosmos/authz/v1beta1/authz.ts @@ -0,0 +1,310 @@ +import type { GeneratedType } from "@cosmjs/proto-signing"; + +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +import { Any } from "../../../google/protobuf/any"; + +import { Timestamp } from "../../../google/protobuf/timestamp"; + +import type { + GenericAuthorization as GenericAuthorization_type, + GrantAuthorization as GrantAuthorization_type, + Grant as Grant_type, +} from "../../../../types/cosmos/authz/v1beta1"; + +import type { DeepPartial, Exact, MessageFns } from "../../../common"; + +export interface GenericAuthorization extends GenericAuthorization_type {} +export interface Grant extends Grant_type {} +export interface GrantAuthorization extends GrantAuthorization_type {} + +export const GenericAuthorization: MessageFns = { + $type: "cosmos.authz.v1beta1.GenericAuthorization" as const, + + encode(message: GenericAuthorization, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.msg !== "") { + writer.uint32(10).string(message.msg); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GenericAuthorization { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGenericAuthorization(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.msg = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GenericAuthorization { + return { msg: isSet(object.msg) ? globalThis.String(object.msg) : "" }; + }, + + toJSON(message: GenericAuthorization): unknown { + const obj: any = {}; + if (message.msg !== "") { + obj.msg = message.msg; + } + return obj; + }, + + create, I>>(base?: I): GenericAuthorization { + return GenericAuthorization.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): GenericAuthorization { + const message = createBaseGenericAuthorization(); + message.msg = object.msg ?? ""; + return message; + }, +}; + +export const Grant: MessageFns = { + $type: "cosmos.authz.v1beta1.Grant" as const, + + encode(message: Grant, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.authorization !== undefined) { + Any.encode(message.authorization, writer.uint32(10).fork()).join(); + } + if (message.expiration !== undefined) { + Timestamp.encode(toTimestamp(message.expiration), writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Grant { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGrant(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.authorization = Any.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.expiration = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Grant { + return { + authorization: isSet(object.authorization) ? Any.fromJSON(object.authorization) : undefined, + expiration: isSet(object.expiration) ? fromJsonTimestamp(object.expiration) : undefined, + }; + }, + + toJSON(message: Grant): unknown { + const obj: any = {}; + if (message.authorization !== undefined) { + obj.authorization = Any.toJSON(message.authorization); + } + if (message.expiration !== undefined) { + obj.expiration = message.expiration.toISOString(); + } + return obj; + }, + + create, I>>(base?: I): Grant { + return Grant.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Grant { + const message = createBaseGrant(); + message.authorization = object.authorization !== undefined && object.authorization !== null ? Any.fromPartial(object.authorization) : undefined; + message.expiration = object.expiration ?? undefined; + return message; + }, +}; + +export const GrantAuthorization: MessageFns = { + $type: "cosmos.authz.v1beta1.GrantAuthorization" as const, + + encode(message: GrantAuthorization, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.granter !== "") { + writer.uint32(10).string(message.granter); + } + if (message.grantee !== "") { + writer.uint32(18).string(message.grantee); + } + if (message.authorization !== undefined) { + Any.encode(message.authorization, writer.uint32(26).fork()).join(); + } + if (message.expiration !== undefined) { + Timestamp.encode(toTimestamp(message.expiration), writer.uint32(34).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GrantAuthorization { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGrantAuthorization(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.granter = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.grantee = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.authorization = Any.decode(reader, reader.uint32()); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.expiration = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GrantAuthorization { + return { + granter: isSet(object.granter) ? globalThis.String(object.granter) : "", + grantee: isSet(object.grantee) ? globalThis.String(object.grantee) : "", + authorization: isSet(object.authorization) ? Any.fromJSON(object.authorization) : undefined, + expiration: isSet(object.expiration) ? fromJsonTimestamp(object.expiration) : undefined, + }; + }, + + toJSON(message: GrantAuthorization): unknown { + const obj: any = {}; + if (message.granter !== "") { + obj.granter = message.granter; + } + if (message.grantee !== "") { + obj.grantee = message.grantee; + } + if (message.authorization !== undefined) { + obj.authorization = Any.toJSON(message.authorization); + } + if (message.expiration !== undefined) { + obj.expiration = message.expiration.toISOString(); + } + return obj; + }, + + create, I>>(base?: I): GrantAuthorization { + return GrantAuthorization.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): GrantAuthorization { + const message = createBaseGrantAuthorization(); + message.granter = object.granter ?? ""; + message.grantee = object.grantee ?? ""; + message.authorization = object.authorization !== undefined && object.authorization !== null ? Any.fromPartial(object.authorization) : undefined; + message.expiration = object.expiration ?? undefined; + return message; + }, +}; + +function createBaseGenericAuthorization(): GenericAuthorization { + return { msg: "" }; +} + +function createBaseGrant(): Grant { + return { authorization: undefined, expiration: undefined }; +} + +function createBaseGrantAuthorization(): GrantAuthorization { + return { granter: "", grantee: "", authorization: undefined, expiration: undefined }; +} + +function toTimestamp(date: Date): Timestamp { + const seconds = Math.trunc(date.getTime() / 1_000); + const nanos = (date.getTime() % 1_000) * 1_000_000; + return { seconds, nanos }; +} + +function fromTimestamp(t: Timestamp): Date { + let millis = (t.seconds || 0) * 1_000; + millis += (t.nanos || 0) / 1_000_000; + return new globalThis.Date(millis); +} + +function fromJsonTimestamp(o: any): Date { + if (o instanceof globalThis.Date) { + return o; + } else if (typeof o === "string") { + return new globalThis.Date(o); + } else { + return fromTimestamp(Timestamp.fromJSON(o)); + } +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} +export const registry: Array<[string, GeneratedType]> = [ + ["/cosmos.authz.v1beta1.GenericAuthorization", GenericAuthorization as never], + ["/cosmos.authz.v1beta1.Grant", Grant as never], + ["/cosmos.authz.v1beta1.GrantAuthorization", GrantAuthorization as never], +]; +export const aminoConverters = { + "/cosmos.authz.v1beta1.GenericAuthorization": { + aminoType: "cosmos-sdk/GenericAuthorization", + toAmino: (message: GenericAuthorization) => ({ ...message }), + fromAmino: (object: GenericAuthorization) => ({ ...object }), + }, + + "/cosmos.authz.v1beta1.Grant": { + aminoType: "cosmos-sdk/Grant", + toAmino: (message: Grant) => ({ ...message }), + fromAmino: (object: Grant) => ({ ...object }), + }, + + "/cosmos.authz.v1beta1.GrantAuthorization": { + aminoType: "cosmos-sdk/GrantAuthorization", + toAmino: (message: GrantAuthorization) => ({ ...message }), + fromAmino: (object: GrantAuthorization) => ({ ...object }), + }, +}; diff --git a/packages/cosmos/generated/encoding/cosmos/authz/v1beta1/event.ts b/packages/cosmos/generated/encoding/cosmos/authz/v1beta1/event.ts new file mode 100644 index 000000000..d286f19e5 --- /dev/null +++ b/packages/cosmos/generated/encoding/cosmos/authz/v1beta1/event.ts @@ -0,0 +1,213 @@ +import type { GeneratedType } from "@cosmjs/proto-signing"; + +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +import type { EventGrant as EventGrant_type, EventRevoke as EventRevoke_type } from "../../../../types/cosmos/authz/v1beta1"; + +import type { DeepPartial, Exact, MessageFns } from "../../../common"; + +export interface EventGrant extends EventGrant_type {} +export interface EventRevoke extends EventRevoke_type {} + +export const EventGrant: MessageFns = { + $type: "cosmos.authz.v1beta1.EventGrant" as const, + + encode(message: EventGrant, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.msg_type_url !== "") { + writer.uint32(18).string(message.msg_type_url); + } + if (message.granter !== "") { + writer.uint32(26).string(message.granter); + } + if (message.grantee !== "") { + writer.uint32(34).string(message.grantee); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): EventGrant { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEventGrant(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 2: + if (tag !== 18) { + break; + } + + message.msg_type_url = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.granter = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.grantee = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): EventGrant { + return { + msg_type_url: isSet(object.msg_type_url) ? globalThis.String(object.msg_type_url) : "", + granter: isSet(object.granter) ? globalThis.String(object.granter) : "", + grantee: isSet(object.grantee) ? globalThis.String(object.grantee) : "", + }; + }, + + toJSON(message: EventGrant): unknown { + const obj: any = {}; + if (message.msg_type_url !== "") { + obj.msg_type_url = message.msg_type_url; + } + if (message.granter !== "") { + obj.granter = message.granter; + } + if (message.grantee !== "") { + obj.grantee = message.grantee; + } + return obj; + }, + + create, I>>(base?: I): EventGrant { + return EventGrant.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): EventGrant { + const message = createBaseEventGrant(); + message.msg_type_url = object.msg_type_url ?? ""; + message.granter = object.granter ?? ""; + message.grantee = object.grantee ?? ""; + return message; + }, +}; + +export const EventRevoke: MessageFns = { + $type: "cosmos.authz.v1beta1.EventRevoke" as const, + + encode(message: EventRevoke, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.msg_type_url !== "") { + writer.uint32(18).string(message.msg_type_url); + } + if (message.granter !== "") { + writer.uint32(26).string(message.granter); + } + if (message.grantee !== "") { + writer.uint32(34).string(message.grantee); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): EventRevoke { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEventRevoke(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 2: + if (tag !== 18) { + break; + } + + message.msg_type_url = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.granter = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.grantee = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): EventRevoke { + return { + msg_type_url: isSet(object.msg_type_url) ? globalThis.String(object.msg_type_url) : "", + granter: isSet(object.granter) ? globalThis.String(object.granter) : "", + grantee: isSet(object.grantee) ? globalThis.String(object.grantee) : "", + }; + }, + + toJSON(message: EventRevoke): unknown { + const obj: any = {}; + if (message.msg_type_url !== "") { + obj.msg_type_url = message.msg_type_url; + } + if (message.granter !== "") { + obj.granter = message.granter; + } + if (message.grantee !== "") { + obj.grantee = message.grantee; + } + return obj; + }, + + create, I>>(base?: I): EventRevoke { + return EventRevoke.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): EventRevoke { + const message = createBaseEventRevoke(); + message.msg_type_url = object.msg_type_url ?? ""; + message.granter = object.granter ?? ""; + message.grantee = object.grantee ?? ""; + return message; + }, +}; + +function createBaseEventGrant(): EventGrant { + return { msg_type_url: "", granter: "", grantee: "" }; +} + +function createBaseEventRevoke(): EventRevoke { + return { msg_type_url: "", granter: "", grantee: "" }; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} +export const registry: Array<[string, GeneratedType]> = [ + ["/cosmos.authz.v1beta1.EventGrant", EventGrant as never], + ["/cosmos.authz.v1beta1.EventRevoke", EventRevoke as never], +]; +export const aminoConverters = { + "/cosmos.authz.v1beta1.EventGrant": { + aminoType: "cosmos-sdk/EventGrant", + toAmino: (message: EventGrant) => ({ ...message }), + fromAmino: (object: EventGrant) => ({ ...object }), + }, + + "/cosmos.authz.v1beta1.EventRevoke": { + aminoType: "cosmos-sdk/EventRevoke", + toAmino: (message: EventRevoke) => ({ ...message }), + fromAmino: (object: EventRevoke) => ({ ...object }), + }, +}; diff --git a/packages/cosmos/generated/encoding/cosmos/authz/v1beta1/genesis.ts b/packages/cosmos/generated/encoding/cosmos/authz/v1beta1/genesis.ts new file mode 100644 index 000000000..8bc82f01d --- /dev/null +++ b/packages/cosmos/generated/encoding/cosmos/authz/v1beta1/genesis.ts @@ -0,0 +1,80 @@ +import type { GeneratedType } from "@cosmjs/proto-signing"; + +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +import { GrantAuthorization } from "./authz"; + +import type { GenesisState as GenesisState_type } from "../../../../types/cosmos/authz/v1beta1"; + +import type { DeepPartial, Exact, MessageFns } from "../../../common"; + +export interface GenesisState extends GenesisState_type {} + +export const GenesisState: MessageFns = { + $type: "cosmos.authz.v1beta1.GenesisState" as const, + + encode(message: GenesisState, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.authorization) { + GrantAuthorization.encode(v!, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GenesisState { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGenesisState(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.authorization.push(GrantAuthorization.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GenesisState { + return { + authorization: globalThis.Array.isArray(object?.authorization) ? object.authorization.map((e: any) => GrantAuthorization.fromJSON(e)) : [], + }; + }, + + toJSON(message: GenesisState): unknown { + const obj: any = {}; + if (message.authorization?.length) { + obj.authorization = message.authorization.map((e) => GrantAuthorization.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): GenesisState { + return GenesisState.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): GenesisState { + const message = createBaseGenesisState(); + message.authorization = object.authorization?.map((e) => GrantAuthorization.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseGenesisState(): GenesisState { + return { authorization: [] }; +} +export const registry: Array<[string, GeneratedType]> = [["/cosmos.authz.v1beta1.GenesisState", GenesisState as never]]; +export const aminoConverters = { + "/cosmos.authz.v1beta1.GenesisState": { + aminoType: "cosmos-sdk/GenesisState", + toAmino: (message: GenesisState) => ({ ...message }), + fromAmino: (object: GenesisState) => ({ ...object }), + }, +}; diff --git a/packages/cosmos/generated/encoding/cosmos/authz/v1beta1/index.ts b/packages/cosmos/generated/encoding/cosmos/authz/v1beta1/index.ts new file mode 100644 index 000000000..4014c93a4 --- /dev/null +++ b/packages/cosmos/generated/encoding/cosmos/authz/v1beta1/index.ts @@ -0,0 +1,7 @@ +// @ts-nocheck + +export * from './authz'; +export * from './event'; +export * from './genesis'; +export * from './query'; +export * from './tx'; \ No newline at end of file diff --git a/packages/cosmos/generated/encoding/cosmos/authz/v1beta1/query.ts b/packages/cosmos/generated/encoding/cosmos/authz/v1beta1/query.ts new file mode 100644 index 000000000..5fe30e7ea --- /dev/null +++ b/packages/cosmos/generated/encoding/cosmos/authz/v1beta1/query.ts @@ -0,0 +1,532 @@ +import type { GeneratedType } from "@cosmjs/proto-signing"; + +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +import { PageRequest, PageResponse } from "../../base/query/v1beta1/pagination"; + +import { Grant, GrantAuthorization } from "./authz"; + +import type { + QueryGranteeGrantsRequest as QueryGranteeGrantsRequest_type, + QueryGranteeGrantsResponse as QueryGranteeGrantsResponse_type, + QueryGranterGrantsRequest as QueryGranterGrantsRequest_type, + QueryGranterGrantsResponse as QueryGranterGrantsResponse_type, + QueryGrantsRequest as QueryGrantsRequest_type, + QueryGrantsResponse as QueryGrantsResponse_type, +} from "../../../../types/cosmos/authz/v1beta1"; + +import type { DeepPartial, Exact, MessageFns } from "../../../common"; + +export interface QueryGrantsRequest extends QueryGrantsRequest_type {} +export interface QueryGrantsResponse extends QueryGrantsResponse_type {} +export interface QueryGranterGrantsRequest extends QueryGranterGrantsRequest_type {} +export interface QueryGranterGrantsResponse extends QueryGranterGrantsResponse_type {} +export interface QueryGranteeGrantsRequest extends QueryGranteeGrantsRequest_type {} +export interface QueryGranteeGrantsResponse extends QueryGranteeGrantsResponse_type {} + +export const QueryGrantsRequest: MessageFns = { + $type: "cosmos.authz.v1beta1.QueryGrantsRequest" as const, + + encode(message: QueryGrantsRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.granter !== "") { + writer.uint32(10).string(message.granter); + } + if (message.grantee !== "") { + writer.uint32(18).string(message.grantee); + } + if (message.msg_type_url !== "") { + writer.uint32(26).string(message.msg_type_url); + } + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(34).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryGrantsRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryGrantsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.granter = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.grantee = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.msg_type_url = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryGrantsRequest { + return { + granter: isSet(object.granter) ? globalThis.String(object.granter) : "", + grantee: isSet(object.grantee) ? globalThis.String(object.grantee) : "", + msg_type_url: isSet(object.msg_type_url) ? globalThis.String(object.msg_type_url) : "", + pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryGrantsRequest): unknown { + const obj: any = {}; + if (message.granter !== "") { + obj.granter = message.granter; + } + if (message.grantee !== "") { + obj.grantee = message.grantee; + } + if (message.msg_type_url !== "") { + obj.msg_type_url = message.msg_type_url; + } + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryGrantsRequest { + return QueryGrantsRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryGrantsRequest { + const message = createBaseQueryGrantsRequest(); + message.granter = object.granter ?? ""; + message.grantee = object.grantee ?? ""; + message.msg_type_url = object.msg_type_url ?? ""; + message.pagination = object.pagination !== undefined && object.pagination !== null ? PageRequest.fromPartial(object.pagination) : undefined; + return message; + }, +}; + +export const QueryGrantsResponse: MessageFns = { + $type: "cosmos.authz.v1beta1.QueryGrantsResponse" as const, + + encode(message: QueryGrantsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.grants) { + Grant.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryGrantsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryGrantsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.grants.push(Grant.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryGrantsResponse { + return { + grants: globalThis.Array.isArray(object?.grants) ? object.grants.map((e: any) => Grant.fromJSON(e)) : [], + pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryGrantsResponse): unknown { + const obj: any = {}; + if (message.grants?.length) { + obj.grants = message.grants.map((e) => Grant.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryGrantsResponse { + return QueryGrantsResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryGrantsResponse { + const message = createBaseQueryGrantsResponse(); + message.grants = object.grants?.map((e) => Grant.fromPartial(e)) || []; + message.pagination = object.pagination !== undefined && object.pagination !== null ? PageResponse.fromPartial(object.pagination) : undefined; + return message; + }, +}; + +export const QueryGranterGrantsRequest: MessageFns = { + $type: "cosmos.authz.v1beta1.QueryGranterGrantsRequest" as const, + + encode(message: QueryGranterGrantsRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.granter !== "") { + writer.uint32(10).string(message.granter); + } + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryGranterGrantsRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryGranterGrantsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.granter = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryGranterGrantsRequest { + return { + granter: isSet(object.granter) ? globalThis.String(object.granter) : "", + pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryGranterGrantsRequest): unknown { + const obj: any = {}; + if (message.granter !== "") { + obj.granter = message.granter; + } + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryGranterGrantsRequest { + return QueryGranterGrantsRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryGranterGrantsRequest { + const message = createBaseQueryGranterGrantsRequest(); + message.granter = object.granter ?? ""; + message.pagination = object.pagination !== undefined && object.pagination !== null ? PageRequest.fromPartial(object.pagination) : undefined; + return message; + }, +}; + +export const QueryGranterGrantsResponse: MessageFns = { + $type: "cosmos.authz.v1beta1.QueryGranterGrantsResponse" as const, + + encode(message: QueryGranterGrantsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.grants) { + GrantAuthorization.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryGranterGrantsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryGranterGrantsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.grants.push(GrantAuthorization.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryGranterGrantsResponse { + return { + grants: globalThis.Array.isArray(object?.grants) ? object.grants.map((e: any) => GrantAuthorization.fromJSON(e)) : [], + pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryGranterGrantsResponse): unknown { + const obj: any = {}; + if (message.grants?.length) { + obj.grants = message.grants.map((e) => GrantAuthorization.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryGranterGrantsResponse { + return QueryGranterGrantsResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryGranterGrantsResponse { + const message = createBaseQueryGranterGrantsResponse(); + message.grants = object.grants?.map((e) => GrantAuthorization.fromPartial(e)) || []; + message.pagination = object.pagination !== undefined && object.pagination !== null ? PageResponse.fromPartial(object.pagination) : undefined; + return message; + }, +}; + +export const QueryGranteeGrantsRequest: MessageFns = { + $type: "cosmos.authz.v1beta1.QueryGranteeGrantsRequest" as const, + + encode(message: QueryGranteeGrantsRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.grantee !== "") { + writer.uint32(10).string(message.grantee); + } + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryGranteeGrantsRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryGranteeGrantsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.grantee = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryGranteeGrantsRequest { + return { + grantee: isSet(object.grantee) ? globalThis.String(object.grantee) : "", + pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryGranteeGrantsRequest): unknown { + const obj: any = {}; + if (message.grantee !== "") { + obj.grantee = message.grantee; + } + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryGranteeGrantsRequest { + return QueryGranteeGrantsRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryGranteeGrantsRequest { + const message = createBaseQueryGranteeGrantsRequest(); + message.grantee = object.grantee ?? ""; + message.pagination = object.pagination !== undefined && object.pagination !== null ? PageRequest.fromPartial(object.pagination) : undefined; + return message; + }, +}; + +export const QueryGranteeGrantsResponse: MessageFns = { + $type: "cosmos.authz.v1beta1.QueryGranteeGrantsResponse" as const, + + encode(message: QueryGranteeGrantsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.grants) { + GrantAuthorization.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryGranteeGrantsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryGranteeGrantsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.grants.push(GrantAuthorization.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryGranteeGrantsResponse { + return { + grants: globalThis.Array.isArray(object?.grants) ? object.grants.map((e: any) => GrantAuthorization.fromJSON(e)) : [], + pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryGranteeGrantsResponse): unknown { + const obj: any = {}; + if (message.grants?.length) { + obj.grants = message.grants.map((e) => GrantAuthorization.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryGranteeGrantsResponse { + return QueryGranteeGrantsResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryGranteeGrantsResponse { + const message = createBaseQueryGranteeGrantsResponse(); + message.grants = object.grants?.map((e) => GrantAuthorization.fromPartial(e)) || []; + message.pagination = object.pagination !== undefined && object.pagination !== null ? PageResponse.fromPartial(object.pagination) : undefined; + return message; + }, +}; + +function createBaseQueryGrantsRequest(): QueryGrantsRequest { + return { granter: "", grantee: "", msg_type_url: "", pagination: undefined }; +} + +function createBaseQueryGrantsResponse(): QueryGrantsResponse { + return { grants: [], pagination: undefined }; +} + +function createBaseQueryGranterGrantsRequest(): QueryGranterGrantsRequest { + return { granter: "", pagination: undefined }; +} + +function createBaseQueryGranterGrantsResponse(): QueryGranterGrantsResponse { + return { grants: [], pagination: undefined }; +} + +function createBaseQueryGranteeGrantsRequest(): QueryGranteeGrantsRequest { + return { grantee: "", pagination: undefined }; +} + +function createBaseQueryGranteeGrantsResponse(): QueryGranteeGrantsResponse { + return { grants: [], pagination: undefined }; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} +export const registry: Array<[string, GeneratedType]> = [ + ["/cosmos.authz.v1beta1.QueryGrantsRequest", QueryGrantsRequest as never], + ["/cosmos.authz.v1beta1.QueryGrantsResponse", QueryGrantsResponse as never], +]; +export const aminoConverters = { + "/cosmos.authz.v1beta1.QueryGrantsRequest": { + aminoType: "cosmos-sdk/QueryGrantsRequest", + toAmino: (message: QueryGrantsRequest) => ({ ...message }), + fromAmino: (object: QueryGrantsRequest) => ({ ...object }), + }, + + "/cosmos.authz.v1beta1.QueryGrantsResponse": { + aminoType: "cosmos-sdk/QueryGrantsResponse", + toAmino: (message: QueryGrantsResponse) => ({ ...message }), + fromAmino: (object: QueryGrantsResponse) => ({ ...object }), + }, +}; diff --git a/packages/cosmos/generated/encoding/cosmos/authz/v1beta1/tx.ts b/packages/cosmos/generated/encoding/cosmos/authz/v1beta1/tx.ts new file mode 100644 index 000000000..5bde960b6 --- /dev/null +++ b/packages/cosmos/generated/encoding/cosmos/authz/v1beta1/tx.ts @@ -0,0 +1,508 @@ +import type { GeneratedType } from "@cosmjs/proto-signing"; + +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +import { Any } from "../../../google/protobuf/any"; + +import { Grant } from "./authz"; + +import type { + MsgExecResponse as MsgExecResponse_type, + MsgExec as MsgExec_type, + MsgGrantResponse as MsgGrantResponse_type, + MsgGrant as MsgGrant_type, + MsgRevokeResponse as MsgRevokeResponse_type, + MsgRevoke as MsgRevoke_type, +} from "../../../../types/cosmos/authz/v1beta1"; + +import type { DeepPartial, Exact, MessageFns } from "../../../common"; + +export interface MsgGrant extends MsgGrant_type {} +export interface MsgExecResponse extends MsgExecResponse_type {} +export interface MsgExec extends MsgExec_type {} +export interface MsgGrantResponse extends MsgGrantResponse_type {} +export interface MsgRevoke extends MsgRevoke_type {} +export interface MsgRevokeResponse extends MsgRevokeResponse_type {} + +export const MsgGrant: MessageFns = { + $type: "cosmos.authz.v1beta1.MsgGrant" as const, + + encode(message: MsgGrant, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.granter !== "") { + writer.uint32(10).string(message.granter); + } + if (message.grantee !== "") { + writer.uint32(18).string(message.grantee); + } + if (message.grant !== undefined) { + Grant.encode(message.grant, writer.uint32(26).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgGrant { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgGrant(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.granter = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.grantee = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.grant = Grant.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgGrant { + return { + granter: isSet(object.granter) ? globalThis.String(object.granter) : "", + grantee: isSet(object.grantee) ? globalThis.String(object.grantee) : "", + grant: isSet(object.grant) ? Grant.fromJSON(object.grant) : undefined, + }; + }, + + toJSON(message: MsgGrant): unknown { + const obj: any = {}; + if (message.granter !== "") { + obj.granter = message.granter; + } + if (message.grantee !== "") { + obj.grantee = message.grantee; + } + if (message.grant !== undefined) { + obj.grant = Grant.toJSON(message.grant); + } + return obj; + }, + + create, I>>(base?: I): MsgGrant { + return MsgGrant.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgGrant { + const message = createBaseMsgGrant(); + message.granter = object.granter ?? ""; + message.grantee = object.grantee ?? ""; + message.grant = object.grant !== undefined && object.grant !== null ? Grant.fromPartial(object.grant) : undefined; + return message; + }, +}; + +export const MsgExecResponse: MessageFns = { + $type: "cosmos.authz.v1beta1.MsgExecResponse" as const, + + encode(message: MsgExecResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.results) { + writer.uint32(10).bytes(v!); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgExecResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgExecResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.results.push(reader.bytes()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgExecResponse { + return { + results: globalThis.Array.isArray(object?.results) ? object.results.map((e: any) => bytesFromBase64(e)) : [], + }; + }, + + toJSON(message: MsgExecResponse): unknown { + const obj: any = {}; + if (message.results?.length) { + obj.results = message.results.map((e) => base64FromBytes(e)); + } + return obj; + }, + + create, I>>(base?: I): MsgExecResponse { + return MsgExecResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgExecResponse { + const message = createBaseMsgExecResponse(); + message.results = object.results?.map((e) => e) || []; + return message; + }, +}; + +export const MsgExec: MessageFns = { + $type: "cosmos.authz.v1beta1.MsgExec" as const, + + encode(message: MsgExec, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.grantee !== "") { + writer.uint32(10).string(message.grantee); + } + for (const v of message.msgs) { + Any.encode(v!, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgExec { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgExec(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.grantee = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.msgs.push(Any.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgExec { + return { + grantee: isSet(object.grantee) ? globalThis.String(object.grantee) : "", + msgs: globalThis.Array.isArray(object?.msgs) ? object.msgs.map((e: any) => Any.fromJSON(e)) : [], + }; + }, + + toJSON(message: MsgExec): unknown { + const obj: any = {}; + if (message.grantee !== "") { + obj.grantee = message.grantee; + } + if (message.msgs?.length) { + obj.msgs = message.msgs.map((e) => Any.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): MsgExec { + return MsgExec.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgExec { + const message = createBaseMsgExec(); + message.grantee = object.grantee ?? ""; + message.msgs = object.msgs?.map((e) => Any.fromPartial(e)) || []; + return message; + }, +}; + +export const MsgGrantResponse: MessageFns = { + $type: "cosmos.authz.v1beta1.MsgGrantResponse" as const, + + encode(_: MsgGrantResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgGrantResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgGrantResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgGrantResponse { + return {}; + }, + + toJSON(_: MsgGrantResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgGrantResponse { + return MsgGrantResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgGrantResponse { + const message = createBaseMsgGrantResponse(); + return message; + }, +}; + +export const MsgRevoke: MessageFns = { + $type: "cosmos.authz.v1beta1.MsgRevoke" as const, + + encode(message: MsgRevoke, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.granter !== "") { + writer.uint32(10).string(message.granter); + } + if (message.grantee !== "") { + writer.uint32(18).string(message.grantee); + } + if (message.msg_type_url !== "") { + writer.uint32(26).string(message.msg_type_url); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgRevoke { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgRevoke(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.granter = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.grantee = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.msg_type_url = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgRevoke { + return { + granter: isSet(object.granter) ? globalThis.String(object.granter) : "", + grantee: isSet(object.grantee) ? globalThis.String(object.grantee) : "", + msg_type_url: isSet(object.msg_type_url) ? globalThis.String(object.msg_type_url) : "", + }; + }, + + toJSON(message: MsgRevoke): unknown { + const obj: any = {}; + if (message.granter !== "") { + obj.granter = message.granter; + } + if (message.grantee !== "") { + obj.grantee = message.grantee; + } + if (message.msg_type_url !== "") { + obj.msg_type_url = message.msg_type_url; + } + return obj; + }, + + create, I>>(base?: I): MsgRevoke { + return MsgRevoke.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgRevoke { + const message = createBaseMsgRevoke(); + message.granter = object.granter ?? ""; + message.grantee = object.grantee ?? ""; + message.msg_type_url = object.msg_type_url ?? ""; + return message; + }, +}; + +export const MsgRevokeResponse: MessageFns = { + $type: "cosmos.authz.v1beta1.MsgRevokeResponse" as const, + + encode(_: MsgRevokeResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgRevokeResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgRevokeResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgRevokeResponse { + return {}; + }, + + toJSON(_: MsgRevokeResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgRevokeResponse { + return MsgRevokeResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgRevokeResponse { + const message = createBaseMsgRevokeResponse(); + return message; + }, +}; + +function createBaseMsgGrant(): MsgGrant { + return { granter: "", grantee: "", grant: undefined }; +} + +function createBaseMsgExecResponse(): MsgExecResponse { + return { results: [] }; +} + +function createBaseMsgExec(): MsgExec { + return { grantee: "", msgs: [] }; +} + +function createBaseMsgGrantResponse(): MsgGrantResponse { + return {}; +} + +function createBaseMsgRevoke(): MsgRevoke { + return { granter: "", grantee: "", msg_type_url: "" }; +} + +function createBaseMsgRevokeResponse(): MsgRevokeResponse { + return {}; +} + +function bytesFromBase64(b64: string): Uint8Array { + if ((globalThis as any).Buffer) { + return Uint8Array.from(globalThis.Buffer.from(b64, "base64")); + } else { + const bin = globalThis.atob(b64); + const arr = new Uint8Array(bin.length); + for (let i = 0; i < bin.length; ++i) { + arr[i] = bin.charCodeAt(i); + } + return arr; + } +} + +function base64FromBytes(arr: Uint8Array): string { + if ((globalThis as any).Buffer) { + return globalThis.Buffer.from(arr).toString("base64"); + } else { + const bin: string[] = []; + arr.forEach((byte) => { + bin.push(globalThis.String.fromCharCode(byte)); + }); + return globalThis.btoa(bin.join("")); + } +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} +export const registry: Array<[string, GeneratedType]> = [ + ["/cosmos.authz.v1beta1.MsgGrant", MsgGrant as never], + ["/cosmos.authz.v1beta1.MsgExecResponse", MsgExecResponse as never], + ["/cosmos.authz.v1beta1.MsgExec", MsgExec as never], + ["/cosmos.authz.v1beta1.MsgGrantResponse", MsgGrantResponse as never], + ["/cosmos.authz.v1beta1.MsgRevoke", MsgRevoke as never], + ["/cosmos.authz.v1beta1.MsgRevokeResponse", MsgRevokeResponse as never], +]; +export const aminoConverters = { + "/cosmos.authz.v1beta1.MsgGrant": { + aminoType: "cosmos-sdk/MsgGrant", + toAmino: (message: MsgGrant) => ({ ...message }), + fromAmino: (object: MsgGrant) => ({ ...object }), + }, + + "/cosmos.authz.v1beta1.MsgExecResponse": { + aminoType: "cosmos-sdk/MsgExecResponse", + toAmino: (message: MsgExecResponse) => ({ ...message }), + fromAmino: (object: MsgExecResponse) => ({ ...object }), + }, + + "/cosmos.authz.v1beta1.MsgExec": { + aminoType: "cosmos-sdk/MsgExec", + toAmino: (message: MsgExec) => ({ ...message }), + fromAmino: (object: MsgExec) => ({ ...object }), + }, + + "/cosmos.authz.v1beta1.MsgGrantResponse": { + aminoType: "cosmos-sdk/MsgGrantResponse", + toAmino: (message: MsgGrantResponse) => ({ ...message }), + fromAmino: (object: MsgGrantResponse) => ({ ...object }), + }, + + "/cosmos.authz.v1beta1.MsgRevoke": { + aminoType: "cosmos-sdk/MsgRevoke", + toAmino: (message: MsgRevoke) => ({ ...message }), + fromAmino: (object: MsgRevoke) => ({ ...object }), + }, + + "/cosmos.authz.v1beta1.MsgRevokeResponse": { + aminoType: "cosmos-sdk/MsgRevokeResponse", + toAmino: (message: MsgRevokeResponse) => ({ ...message }), + fromAmino: (object: MsgRevokeResponse) => ({ ...object }), + }, +}; diff --git a/packages/cosmos/generated/encoding/cosmos/bank/v1beta1/authz.ts b/packages/cosmos/generated/encoding/cosmos/bank/v1beta1/authz.ts new file mode 100644 index 000000000..e6ca33c75 --- /dev/null +++ b/packages/cosmos/generated/encoding/cosmos/bank/v1beta1/authz.ts @@ -0,0 +1,80 @@ +import type { GeneratedType } from "@cosmjs/proto-signing"; + +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +import { Coin } from "../../base/v1beta1/coin"; + +import type { SendAuthorization as SendAuthorization_type } from "../../../../types/cosmos/bank/v1beta1"; + +import type { DeepPartial, Exact, MessageFns } from "../../../common"; + +export interface SendAuthorization extends SendAuthorization_type {} + +export const SendAuthorization: MessageFns = { + $type: "cosmos.bank.v1beta1.SendAuthorization" as const, + + encode(message: SendAuthorization, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.spend_limit) { + Coin.encode(v!, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): SendAuthorization { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseSendAuthorization(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.spend_limit.push(Coin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): SendAuthorization { + return { + spend_limit: globalThis.Array.isArray(object?.spend_limit) ? object.spend_limit.map((e: any) => Coin.fromJSON(e)) : [], + }; + }, + + toJSON(message: SendAuthorization): unknown { + const obj: any = {}; + if (message.spend_limit?.length) { + obj.spend_limit = message.spend_limit.map((e) => Coin.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): SendAuthorization { + return SendAuthorization.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): SendAuthorization { + const message = createBaseSendAuthorization(); + message.spend_limit = object.spend_limit?.map((e) => Coin.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseSendAuthorization(): SendAuthorization { + return { spend_limit: [] }; +} +export const registry: Array<[string, GeneratedType]> = [["/cosmos.bank.v1beta1.SendAuthorization", SendAuthorization as never]]; +export const aminoConverters = { + "/cosmos.bank.v1beta1.SendAuthorization": { + aminoType: "cosmos-sdk/SendAuthorization", + toAmino: (message: SendAuthorization) => ({ ...message }), + fromAmino: (object: SendAuthorization) => ({ ...object }), + }, +}; diff --git a/packages/cosmos/generated/encoding/cosmos/bank/v1beta1/bank.ts b/packages/cosmos/generated/encoding/cosmos/bank/v1beta1/bank.ts new file mode 100644 index 000000000..211040f9b --- /dev/null +++ b/packages/cosmos/generated/encoding/cosmos/bank/v1beta1/bank.ts @@ -0,0 +1,741 @@ +import type { GeneratedType } from "@cosmjs/proto-signing"; + +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +import { Coin } from "../../base/v1beta1/coin"; + +import type { + AllowList as AllowList_type, + DenomUnit as DenomUnit_type, + Input as Input_type, + Metadata as Metadata_type, + Output as Output_type, + Params as Params_type, + SendEnabled as SendEnabled_type, + Supply as Supply_type, +} from "../../../../types/cosmos/bank/v1beta1"; + +import type { DeepPartial, Exact, MessageFns } from "../../../common"; + +export interface Params extends Params_type {} +export interface SendEnabled extends SendEnabled_type {} +export interface Input extends Input_type {} +export interface Output extends Output_type {} +export interface Supply extends Supply_type {} +export interface DenomUnit extends DenomUnit_type {} +export interface Metadata extends Metadata_type {} +export interface AllowList extends AllowList_type {} + +export const Params: MessageFns = { + $type: "cosmos.bank.v1beta1.Params" as const, + + encode(message: Params, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.send_enabled) { + SendEnabled.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.default_send_enabled !== false) { + writer.uint32(16).bool(message.default_send_enabled); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Params { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.send_enabled.push(SendEnabled.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.default_send_enabled = reader.bool(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Params { + return { + send_enabled: globalThis.Array.isArray(object?.send_enabled) ? object.send_enabled.map((e: any) => SendEnabled.fromJSON(e)) : [], + default_send_enabled: isSet(object.default_send_enabled) ? globalThis.Boolean(object.default_send_enabled) : false, + }; + }, + + toJSON(message: Params): unknown { + const obj: any = {}; + if (message.send_enabled?.length) { + obj.send_enabled = message.send_enabled.map((e) => SendEnabled.toJSON(e)); + } + if (message.default_send_enabled !== false) { + obj.default_send_enabled = message.default_send_enabled; + } + return obj; + }, + + create, I>>(base?: I): Params { + return Params.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Params { + const message = createBaseParams(); + message.send_enabled = object.send_enabled?.map((e) => SendEnabled.fromPartial(e)) || []; + message.default_send_enabled = object.default_send_enabled ?? false; + return message; + }, +}; + +export const SendEnabled: MessageFns = { + $type: "cosmos.bank.v1beta1.SendEnabled" as const, + + encode(message: SendEnabled, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.denom !== "") { + writer.uint32(10).string(message.denom); + } + if (message.enabled !== false) { + writer.uint32(16).bool(message.enabled); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): SendEnabled { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseSendEnabled(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.denom = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.enabled = reader.bool(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): SendEnabled { + return { + denom: isSet(object.denom) ? globalThis.String(object.denom) : "", + enabled: isSet(object.enabled) ? globalThis.Boolean(object.enabled) : false, + }; + }, + + toJSON(message: SendEnabled): unknown { + const obj: any = {}; + if (message.denom !== "") { + obj.denom = message.denom; + } + if (message.enabled !== false) { + obj.enabled = message.enabled; + } + return obj; + }, + + create, I>>(base?: I): SendEnabled { + return SendEnabled.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): SendEnabled { + const message = createBaseSendEnabled(); + message.denom = object.denom ?? ""; + message.enabled = object.enabled ?? false; + return message; + }, +}; + +export const Input: MessageFns = { + $type: "cosmos.bank.v1beta1.Input" as const, + + encode(message: Input, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.address !== "") { + writer.uint32(10).string(message.address); + } + for (const v of message.coins) { + Coin.encode(v!, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Input { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseInput(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.address = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.coins.push(Coin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Input { + return { + address: isSet(object.address) ? globalThis.String(object.address) : "", + coins: globalThis.Array.isArray(object?.coins) ? object.coins.map((e: any) => Coin.fromJSON(e)) : [], + }; + }, + + toJSON(message: Input): unknown { + const obj: any = {}; + if (message.address !== "") { + obj.address = message.address; + } + if (message.coins?.length) { + obj.coins = message.coins.map((e) => Coin.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): Input { + return Input.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Input { + const message = createBaseInput(); + message.address = object.address ?? ""; + message.coins = object.coins?.map((e) => Coin.fromPartial(e)) || []; + return message; + }, +}; + +export const Output: MessageFns = { + $type: "cosmos.bank.v1beta1.Output" as const, + + encode(message: Output, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.address !== "") { + writer.uint32(10).string(message.address); + } + for (const v of message.coins) { + Coin.encode(v!, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Output { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseOutput(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.address = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.coins.push(Coin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Output { + return { + address: isSet(object.address) ? globalThis.String(object.address) : "", + coins: globalThis.Array.isArray(object?.coins) ? object.coins.map((e: any) => Coin.fromJSON(e)) : [], + }; + }, + + toJSON(message: Output): unknown { + const obj: any = {}; + if (message.address !== "") { + obj.address = message.address; + } + if (message.coins?.length) { + obj.coins = message.coins.map((e) => Coin.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): Output { + return Output.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Output { + const message = createBaseOutput(); + message.address = object.address ?? ""; + message.coins = object.coins?.map((e) => Coin.fromPartial(e)) || []; + return message; + }, +}; + +export const Supply: MessageFns = { + $type: "cosmos.bank.v1beta1.Supply" as const, + + encode(message: Supply, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.total) { + Coin.encode(v!, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Supply { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseSupply(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.total.push(Coin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Supply { + return { total: globalThis.Array.isArray(object?.total) ? object.total.map((e: any) => Coin.fromJSON(e)) : [] }; + }, + + toJSON(message: Supply): unknown { + const obj: any = {}; + if (message.total?.length) { + obj.total = message.total.map((e) => Coin.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): Supply { + return Supply.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Supply { + const message = createBaseSupply(); + message.total = object.total?.map((e) => Coin.fromPartial(e)) || []; + return message; + }, +}; + +export const DenomUnit: MessageFns = { + $type: "cosmos.bank.v1beta1.DenomUnit" as const, + + encode(message: DenomUnit, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.denom !== "") { + writer.uint32(10).string(message.denom); + } + if (message.exponent !== 0) { + writer.uint32(16).uint32(message.exponent); + } + for (const v of message.aliases) { + writer.uint32(26).string(v!); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): DenomUnit { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDenomUnit(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.denom = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.exponent = reader.uint32(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.aliases.push(reader.string()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): DenomUnit { + return { + denom: isSet(object.denom) ? globalThis.String(object.denom) : "", + exponent: isSet(object.exponent) ? globalThis.Number(object.exponent) : 0, + aliases: globalThis.Array.isArray(object?.aliases) ? object.aliases.map((e: any) => globalThis.String(e)) : [], + }; + }, + + toJSON(message: DenomUnit): unknown { + const obj: any = {}; + if (message.denom !== "") { + obj.denom = message.denom; + } + if (message.exponent !== 0) { + obj.exponent = Math.round(message.exponent); + } + if (message.aliases?.length) { + obj.aliases = message.aliases; + } + return obj; + }, + + create, I>>(base?: I): DenomUnit { + return DenomUnit.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): DenomUnit { + const message = createBaseDenomUnit(); + message.denom = object.denom ?? ""; + message.exponent = object.exponent ?? 0; + message.aliases = object.aliases?.map((e) => e) || []; + return message; + }, +}; + +export const Metadata: MessageFns = { + $type: "cosmos.bank.v1beta1.Metadata" as const, + + encode(message: Metadata, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.description !== "") { + writer.uint32(10).string(message.description); + } + for (const v of message.denom_units) { + DenomUnit.encode(v!, writer.uint32(18).fork()).join(); + } + if (message.base !== "") { + writer.uint32(26).string(message.base); + } + if (message.display !== "") { + writer.uint32(34).string(message.display); + } + if (message.name !== "") { + writer.uint32(42).string(message.name); + } + if (message.symbol !== "") { + writer.uint32(50).string(message.symbol); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Metadata { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMetadata(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.description = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.denom_units.push(DenomUnit.decode(reader, reader.uint32())); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.base = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.display = reader.string(); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.name = reader.string(); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.symbol = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Metadata { + return { + description: isSet(object.description) ? globalThis.String(object.description) : "", + denom_units: globalThis.Array.isArray(object?.denom_units) ? object.denom_units.map((e: any) => DenomUnit.fromJSON(e)) : [], + base: isSet(object.base) ? globalThis.String(object.base) : "", + display: isSet(object.display) ? globalThis.String(object.display) : "", + name: isSet(object.name) ? globalThis.String(object.name) : "", + symbol: isSet(object.symbol) ? globalThis.String(object.symbol) : "", + }; + }, + + toJSON(message: Metadata): unknown { + const obj: any = {}; + if (message.description !== "") { + obj.description = message.description; + } + if (message.denom_units?.length) { + obj.denom_units = message.denom_units.map((e) => DenomUnit.toJSON(e)); + } + if (message.base !== "") { + obj.base = message.base; + } + if (message.display !== "") { + obj.display = message.display; + } + if (message.name !== "") { + obj.name = message.name; + } + if (message.symbol !== "") { + obj.symbol = message.symbol; + } + return obj; + }, + + create, I>>(base?: I): Metadata { + return Metadata.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Metadata { + const message = createBaseMetadata(); + message.description = object.description ?? ""; + message.denom_units = object.denom_units?.map((e) => DenomUnit.fromPartial(e)) || []; + message.base = object.base ?? ""; + message.display = object.display ?? ""; + message.name = object.name ?? ""; + message.symbol = object.symbol ?? ""; + return message; + }, +}; + +export const AllowList: MessageFns = { + $type: "cosmos.bank.v1beta1.AllowList" as const, + + encode(message: AllowList, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.addresses) { + writer.uint32(10).string(v!); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): AllowList { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseAllowList(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.addresses.push(reader.string()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): AllowList { + return { + addresses: globalThis.Array.isArray(object?.addresses) ? object.addresses.map((e: any) => globalThis.String(e)) : [], + }; + }, + + toJSON(message: AllowList): unknown { + const obj: any = {}; + if (message.addresses?.length) { + obj.addresses = message.addresses; + } + return obj; + }, + + create, I>>(base?: I): AllowList { + return AllowList.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): AllowList { + const message = createBaseAllowList(); + message.addresses = object.addresses?.map((e) => e) || []; + return message; + }, +}; + +function createBaseParams(): Params { + return { send_enabled: [], default_send_enabled: false }; +} + +function createBaseSendEnabled(): SendEnabled { + return { denom: "", enabled: false }; +} + +function createBaseInput(): Input { + return { address: "", coins: [] }; +} + +function createBaseOutput(): Output { + return { address: "", coins: [] }; +} + +function createBaseSupply(): Supply { + return { total: [] }; +} + +function createBaseDenomUnit(): DenomUnit { + return { denom: "", exponent: 0, aliases: [] }; +} + +function createBaseMetadata(): Metadata { + return { description: "", denom_units: [], base: "", display: "", name: "", symbol: "" }; +} + +function createBaseAllowList(): AllowList { + return { addresses: [] }; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} +export const registry: Array<[string, GeneratedType]> = [ + ["/cosmos.bank.v1beta1.Params", Params as never], + ["/cosmos.bank.v1beta1.SendEnabled", SendEnabled as never], + ["/cosmos.bank.v1beta1.Input", Input as never], + ["/cosmos.bank.v1beta1.Output", Output as never], + ["/cosmos.bank.v1beta1.Supply", Supply as never], + ["/cosmos.bank.v1beta1.DenomUnit", DenomUnit as never], + ["/cosmos.bank.v1beta1.Metadata", Metadata as never], + ["/cosmos.bank.v1beta1.AllowList", AllowList as never], +]; +export const aminoConverters = { + "/cosmos.bank.v1beta1.Params": { + aminoType: "cosmos-sdk/Params", + toAmino: (message: Params) => ({ ...message }), + fromAmino: (object: Params) => ({ ...object }), + }, + + "/cosmos.bank.v1beta1.SendEnabled": { + aminoType: "cosmos-sdk/SendEnabled", + toAmino: (message: SendEnabled) => ({ ...message }), + fromAmino: (object: SendEnabled) => ({ ...object }), + }, + + "/cosmos.bank.v1beta1.Input": { + aminoType: "cosmos-sdk/Input", + toAmino: (message: Input) => ({ ...message }), + fromAmino: (object: Input) => ({ ...object }), + }, + + "/cosmos.bank.v1beta1.Output": { + aminoType: "cosmos-sdk/Output", + toAmino: (message: Output) => ({ ...message }), + fromAmino: (object: Output) => ({ ...object }), + }, + + "/cosmos.bank.v1beta1.Supply": { + aminoType: "cosmos-sdk/Supply", + toAmino: (message: Supply) => ({ ...message }), + fromAmino: (object: Supply) => ({ ...object }), + }, + + "/cosmos.bank.v1beta1.DenomUnit": { + aminoType: "cosmos-sdk/DenomUnit", + toAmino: (message: DenomUnit) => ({ ...message }), + fromAmino: (object: DenomUnit) => ({ ...object }), + }, + + "/cosmos.bank.v1beta1.Metadata": { + aminoType: "cosmos-sdk/Metadata", + toAmino: (message: Metadata) => ({ ...message }), + fromAmino: (object: Metadata) => ({ ...object }), + }, + + "/cosmos.bank.v1beta1.AllowList": { + aminoType: "cosmos-sdk/AllowList", + toAmino: (message: AllowList) => ({ ...message }), + fromAmino: (object: AllowList) => ({ ...object }), + }, +}; diff --git a/packages/cosmos/generated/encoding/cosmos/bank/v1beta1/genesis.ts b/packages/cosmos/generated/encoding/cosmos/bank/v1beta1/genesis.ts new file mode 100644 index 000000000..95afa6cbe --- /dev/null +++ b/packages/cosmos/generated/encoding/cosmos/bank/v1beta1/genesis.ts @@ -0,0 +1,316 @@ +import type { GeneratedType } from "@cosmjs/proto-signing"; + +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +import { Coin } from "../../base/v1beta1/coin"; + +import { Metadata, Params } from "./bank"; + +import type { Balance as Balance_type, GenesisState as GenesisState_type, WeiBalance as WeiBalance_type } from "../../../../types/cosmos/bank/v1beta1"; + +import type { DeepPartial, Exact, MessageFns } from "../../../common"; + +export interface GenesisState extends GenesisState_type {} +export interface Balance extends Balance_type {} +export interface WeiBalance extends WeiBalance_type {} + +export const GenesisState: MessageFns = { + $type: "cosmos.bank.v1beta1.GenesisState" as const, + + encode(message: GenesisState, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(10).fork()).join(); + } + for (const v of message.balances) { + Balance.encode(v!, writer.uint32(18).fork()).join(); + } + for (const v of message.supply) { + Coin.encode(v!, writer.uint32(26).fork()).join(); + } + for (const v of message.denom_metadata) { + Metadata.encode(v!, writer.uint32(34).fork()).join(); + } + for (const v of message.wei_balances) { + WeiBalance.encode(v!, writer.uint32(42).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GenesisState { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGenesisState(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.params = Params.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.balances.push(Balance.decode(reader, reader.uint32())); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.supply.push(Coin.decode(reader, reader.uint32())); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.denom_metadata.push(Metadata.decode(reader, reader.uint32())); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.wei_balances.push(WeiBalance.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GenesisState { + return { + params: isSet(object.params) ? Params.fromJSON(object.params) : undefined, + balances: globalThis.Array.isArray(object?.balances) ? object.balances.map((e: any) => Balance.fromJSON(e)) : [], + supply: globalThis.Array.isArray(object?.supply) ? object.supply.map((e: any) => Coin.fromJSON(e)) : [], + denom_metadata: globalThis.Array.isArray(object?.denom_metadata) ? object.denom_metadata.map((e: any) => Metadata.fromJSON(e)) : [], + wei_balances: globalThis.Array.isArray(object?.wei_balances) ? object.wei_balances.map((e: any) => WeiBalance.fromJSON(e)) : [], + }; + }, + + toJSON(message: GenesisState): unknown { + const obj: any = {}; + if (message.params !== undefined) { + obj.params = Params.toJSON(message.params); + } + if (message.balances?.length) { + obj.balances = message.balances.map((e) => Balance.toJSON(e)); + } + if (message.supply?.length) { + obj.supply = message.supply.map((e) => Coin.toJSON(e)); + } + if (message.denom_metadata?.length) { + obj.denom_metadata = message.denom_metadata.map((e) => Metadata.toJSON(e)); + } + if (message.wei_balances?.length) { + obj.wei_balances = message.wei_balances.map((e) => WeiBalance.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): GenesisState { + return GenesisState.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): GenesisState { + const message = createBaseGenesisState(); + message.params = object.params !== undefined && object.params !== null ? Params.fromPartial(object.params) : undefined; + message.balances = object.balances?.map((e) => Balance.fromPartial(e)) || []; + message.supply = object.supply?.map((e) => Coin.fromPartial(e)) || []; + message.denom_metadata = object.denom_metadata?.map((e) => Metadata.fromPartial(e)) || []; + message.wei_balances = object.wei_balances?.map((e) => WeiBalance.fromPartial(e)) || []; + return message; + }, +}; + +export const Balance: MessageFns = { + $type: "cosmos.bank.v1beta1.Balance" as const, + + encode(message: Balance, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.address !== "") { + writer.uint32(10).string(message.address); + } + for (const v of message.coins) { + Coin.encode(v!, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Balance { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseBalance(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.address = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.coins.push(Coin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Balance { + return { + address: isSet(object.address) ? globalThis.String(object.address) : "", + coins: globalThis.Array.isArray(object?.coins) ? object.coins.map((e: any) => Coin.fromJSON(e)) : [], + }; + }, + + toJSON(message: Balance): unknown { + const obj: any = {}; + if (message.address !== "") { + obj.address = message.address; + } + if (message.coins?.length) { + obj.coins = message.coins.map((e) => Coin.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): Balance { + return Balance.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Balance { + const message = createBaseBalance(); + message.address = object.address ?? ""; + message.coins = object.coins?.map((e) => Coin.fromPartial(e)) || []; + return message; + }, +}; + +export const WeiBalance: MessageFns = { + $type: "cosmos.bank.v1beta1.WeiBalance" as const, + + encode(message: WeiBalance, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.address !== "") { + writer.uint32(10).string(message.address); + } + if (message.amount !== "") { + writer.uint32(18).string(message.amount); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): WeiBalance { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseWeiBalance(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.address = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.amount = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): WeiBalance { + return { + address: isSet(object.address) ? globalThis.String(object.address) : "", + amount: isSet(object.amount) ? globalThis.String(object.amount) : "", + }; + }, + + toJSON(message: WeiBalance): unknown { + const obj: any = {}; + if (message.address !== "") { + obj.address = message.address; + } + if (message.amount !== "") { + obj.amount = message.amount; + } + return obj; + }, + + create, I>>(base?: I): WeiBalance { + return WeiBalance.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): WeiBalance { + const message = createBaseWeiBalance(); + message.address = object.address ?? ""; + message.amount = object.amount ?? ""; + return message; + }, +}; + +function createBaseGenesisState(): GenesisState { + return { params: undefined, balances: [], supply: [], denom_metadata: [], wei_balances: [] }; +} + +function createBaseBalance(): Balance { + return { address: "", coins: [] }; +} + +function createBaseWeiBalance(): WeiBalance { + return { address: "", amount: "" }; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} +export const registry: Array<[string, GeneratedType]> = [ + ["/cosmos.bank.v1beta1.GenesisState", GenesisState as never], + ["/cosmos.bank.v1beta1.Balance", Balance as never], + ["/cosmos.bank.v1beta1.WeiBalance", WeiBalance as never], +]; +export const aminoConverters = { + "/cosmos.bank.v1beta1.GenesisState": { + aminoType: "cosmos-sdk/GenesisState", + toAmino: (message: GenesisState) => ({ ...message }), + fromAmino: (object: GenesisState) => ({ ...object }), + }, + + "/cosmos.bank.v1beta1.Balance": { + aminoType: "cosmos-sdk/Balance", + toAmino: (message: Balance) => ({ ...message }), + fromAmino: (object: Balance) => ({ ...object }), + }, + + "/cosmos.bank.v1beta1.WeiBalance": { + aminoType: "cosmos-sdk/WeiBalance", + toAmino: (message: WeiBalance) => ({ ...message }), + fromAmino: (object: WeiBalance) => ({ ...object }), + }, +}; diff --git a/packages/cosmos/generated/encoding/cosmos/bank/v1beta1/index.ts b/packages/cosmos/generated/encoding/cosmos/bank/v1beta1/index.ts new file mode 100644 index 000000000..8036441bb --- /dev/null +++ b/packages/cosmos/generated/encoding/cosmos/bank/v1beta1/index.ts @@ -0,0 +1,7 @@ +// @ts-nocheck + +export * from './authz'; +export * from './bank'; +export * from './genesis'; +export * from './query'; +export * from './tx'; \ No newline at end of file diff --git a/packages/cosmos/generated/encoding/cosmos/bank/v1beta1/query.ts b/packages/cosmos/generated/encoding/cosmos/bank/v1beta1/query.ts new file mode 100644 index 000000000..e73e29080 --- /dev/null +++ b/packages/cosmos/generated/encoding/cosmos/bank/v1beta1/query.ts @@ -0,0 +1,1145 @@ +import type { GeneratedType } from "@cosmjs/proto-signing"; + +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +import { PageRequest, PageResponse } from "../../base/query/v1beta1/pagination"; + +import { Coin } from "../../base/v1beta1/coin"; + +import { Metadata, Params } from "./bank"; + +import type { + QueryAllBalancesRequest as QueryAllBalancesRequest_type, + QueryAllBalancesResponse as QueryAllBalancesResponse_type, + QueryBalanceRequest as QueryBalanceRequest_type, + QueryBalanceResponse as QueryBalanceResponse_type, + QueryDenomMetadataRequest as QueryDenomMetadataRequest_type, + QueryDenomMetadataResponse as QueryDenomMetadataResponse_type, + QueryDenomsMetadataRequest as QueryDenomsMetadataRequest_type, + QueryDenomsMetadataResponse as QueryDenomsMetadataResponse_type, + QueryParamsRequest as QueryParamsRequest_type, + QueryParamsResponse as QueryParamsResponse_type, + QuerySpendableBalancesRequest as QuerySpendableBalancesRequest_type, + QuerySpendableBalancesResponse as QuerySpendableBalancesResponse_type, + QuerySupplyOfRequest as QuerySupplyOfRequest_type, + QuerySupplyOfResponse as QuerySupplyOfResponse_type, + QueryTotalSupplyRequest as QueryTotalSupplyRequest_type, + QueryTotalSupplyResponse as QueryTotalSupplyResponse_type, +} from "../../../../types/cosmos/bank/v1beta1"; + +import type { DeepPartial, Exact, MessageFns } from "../../../common"; + +export interface QueryBalanceRequest extends QueryBalanceRequest_type {} +export interface QueryBalanceResponse extends QueryBalanceResponse_type {} +export interface QueryAllBalancesRequest extends QueryAllBalancesRequest_type {} +export interface QueryAllBalancesResponse extends QueryAllBalancesResponse_type {} +export interface QuerySpendableBalancesRequest extends QuerySpendableBalancesRequest_type {} +export interface QuerySpendableBalancesResponse extends QuerySpendableBalancesResponse_type {} +export interface QueryTotalSupplyRequest extends QueryTotalSupplyRequest_type {} +export interface QueryTotalSupplyResponse extends QueryTotalSupplyResponse_type {} +export interface QuerySupplyOfRequest extends QuerySupplyOfRequest_type {} +export interface QuerySupplyOfResponse extends QuerySupplyOfResponse_type {} +export interface QueryParamsRequest extends QueryParamsRequest_type {} +export interface QueryParamsResponse extends QueryParamsResponse_type {} +export interface QueryDenomsMetadataRequest extends QueryDenomsMetadataRequest_type {} +export interface QueryDenomsMetadataResponse extends QueryDenomsMetadataResponse_type {} +export interface QueryDenomMetadataRequest extends QueryDenomMetadataRequest_type {} +export interface QueryDenomMetadataResponse extends QueryDenomMetadataResponse_type {} + +export const QueryBalanceRequest: MessageFns = { + $type: "cosmos.bank.v1beta1.QueryBalanceRequest" as const, + + encode(message: QueryBalanceRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.address !== "") { + writer.uint32(10).string(message.address); + } + if (message.denom !== "") { + writer.uint32(18).string(message.denom); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryBalanceRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryBalanceRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.address = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.denom = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryBalanceRequest { + return { + address: isSet(object.address) ? globalThis.String(object.address) : "", + denom: isSet(object.denom) ? globalThis.String(object.denom) : "", + }; + }, + + toJSON(message: QueryBalanceRequest): unknown { + const obj: any = {}; + if (message.address !== "") { + obj.address = message.address; + } + if (message.denom !== "") { + obj.denom = message.denom; + } + return obj; + }, + + create, I>>(base?: I): QueryBalanceRequest { + return QueryBalanceRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryBalanceRequest { + const message = createBaseQueryBalanceRequest(); + message.address = object.address ?? ""; + message.denom = object.denom ?? ""; + return message; + }, +}; + +export const QueryBalanceResponse: MessageFns = { + $type: "cosmos.bank.v1beta1.QueryBalanceResponse" as const, + + encode(message: QueryBalanceResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.balance !== undefined) { + Coin.encode(message.balance, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryBalanceResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryBalanceResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.balance = Coin.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryBalanceResponse { + return { balance: isSet(object.balance) ? Coin.fromJSON(object.balance) : undefined }; + }, + + toJSON(message: QueryBalanceResponse): unknown { + const obj: any = {}; + if (message.balance !== undefined) { + obj.balance = Coin.toJSON(message.balance); + } + return obj; + }, + + create, I>>(base?: I): QueryBalanceResponse { + return QueryBalanceResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryBalanceResponse { + const message = createBaseQueryBalanceResponse(); + message.balance = object.balance !== undefined && object.balance !== null ? Coin.fromPartial(object.balance) : undefined; + return message; + }, +}; + +export const QueryAllBalancesRequest: MessageFns = { + $type: "cosmos.bank.v1beta1.QueryAllBalancesRequest" as const, + + encode(message: QueryAllBalancesRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.address !== "") { + writer.uint32(10).string(message.address); + } + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryAllBalancesRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryAllBalancesRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.address = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryAllBalancesRequest { + return { + address: isSet(object.address) ? globalThis.String(object.address) : "", + pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryAllBalancesRequest): unknown { + const obj: any = {}; + if (message.address !== "") { + obj.address = message.address; + } + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryAllBalancesRequest { + return QueryAllBalancesRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryAllBalancesRequest { + const message = createBaseQueryAllBalancesRequest(); + message.address = object.address ?? ""; + message.pagination = object.pagination !== undefined && object.pagination !== null ? PageRequest.fromPartial(object.pagination) : undefined; + return message; + }, +}; + +export const QueryAllBalancesResponse: MessageFns = { + $type: "cosmos.bank.v1beta1.QueryAllBalancesResponse" as const, + + encode(message: QueryAllBalancesResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.balances) { + Coin.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryAllBalancesResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryAllBalancesResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.balances.push(Coin.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryAllBalancesResponse { + return { + balances: globalThis.Array.isArray(object?.balances) ? object.balances.map((e: any) => Coin.fromJSON(e)) : [], + pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryAllBalancesResponse): unknown { + const obj: any = {}; + if (message.balances?.length) { + obj.balances = message.balances.map((e) => Coin.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryAllBalancesResponse { + return QueryAllBalancesResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryAllBalancesResponse { + const message = createBaseQueryAllBalancesResponse(); + message.balances = object.balances?.map((e) => Coin.fromPartial(e)) || []; + message.pagination = object.pagination !== undefined && object.pagination !== null ? PageResponse.fromPartial(object.pagination) : undefined; + return message; + }, +}; + +export const QuerySpendableBalancesRequest: MessageFns = { + $type: "cosmos.bank.v1beta1.QuerySpendableBalancesRequest" as const, + + encode(message: QuerySpendableBalancesRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.address !== "") { + writer.uint32(10).string(message.address); + } + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QuerySpendableBalancesRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQuerySpendableBalancesRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.address = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QuerySpendableBalancesRequest { + return { + address: isSet(object.address) ? globalThis.String(object.address) : "", + pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QuerySpendableBalancesRequest): unknown { + const obj: any = {}; + if (message.address !== "") { + obj.address = message.address; + } + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QuerySpendableBalancesRequest { + return QuerySpendableBalancesRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QuerySpendableBalancesRequest { + const message = createBaseQuerySpendableBalancesRequest(); + message.address = object.address ?? ""; + message.pagination = object.pagination !== undefined && object.pagination !== null ? PageRequest.fromPartial(object.pagination) : undefined; + return message; + }, +}; + +export const QuerySpendableBalancesResponse: MessageFns = { + $type: "cosmos.bank.v1beta1.QuerySpendableBalancesResponse" as const, + + encode(message: QuerySpendableBalancesResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.balances) { + Coin.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QuerySpendableBalancesResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQuerySpendableBalancesResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.balances.push(Coin.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QuerySpendableBalancesResponse { + return { + balances: globalThis.Array.isArray(object?.balances) ? object.balances.map((e: any) => Coin.fromJSON(e)) : [], + pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QuerySpendableBalancesResponse): unknown { + const obj: any = {}; + if (message.balances?.length) { + obj.balances = message.balances.map((e) => Coin.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QuerySpendableBalancesResponse { + return QuerySpendableBalancesResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QuerySpendableBalancesResponse { + const message = createBaseQuerySpendableBalancesResponse(); + message.balances = object.balances?.map((e) => Coin.fromPartial(e)) || []; + message.pagination = object.pagination !== undefined && object.pagination !== null ? PageResponse.fromPartial(object.pagination) : undefined; + return message; + }, +}; + +export const QueryTotalSupplyRequest: MessageFns = { + $type: "cosmos.bank.v1beta1.QueryTotalSupplyRequest" as const, + + encode(message: QueryTotalSupplyRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryTotalSupplyRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryTotalSupplyRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryTotalSupplyRequest { + return { pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined }; + }, + + toJSON(message: QueryTotalSupplyRequest): unknown { + const obj: any = {}; + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryTotalSupplyRequest { + return QueryTotalSupplyRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryTotalSupplyRequest { + const message = createBaseQueryTotalSupplyRequest(); + message.pagination = object.pagination !== undefined && object.pagination !== null ? PageRequest.fromPartial(object.pagination) : undefined; + return message; + }, +}; + +export const QueryTotalSupplyResponse: MessageFns = { + $type: "cosmos.bank.v1beta1.QueryTotalSupplyResponse" as const, + + encode(message: QueryTotalSupplyResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.supply) { + Coin.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryTotalSupplyResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryTotalSupplyResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.supply.push(Coin.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryTotalSupplyResponse { + return { + supply: globalThis.Array.isArray(object?.supply) ? object.supply.map((e: any) => Coin.fromJSON(e)) : [], + pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryTotalSupplyResponse): unknown { + const obj: any = {}; + if (message.supply?.length) { + obj.supply = message.supply.map((e) => Coin.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryTotalSupplyResponse { + return QueryTotalSupplyResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryTotalSupplyResponse { + const message = createBaseQueryTotalSupplyResponse(); + message.supply = object.supply?.map((e) => Coin.fromPartial(e)) || []; + message.pagination = object.pagination !== undefined && object.pagination !== null ? PageResponse.fromPartial(object.pagination) : undefined; + return message; + }, +}; + +export const QuerySupplyOfRequest: MessageFns = { + $type: "cosmos.bank.v1beta1.QuerySupplyOfRequest" as const, + + encode(message: QuerySupplyOfRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.denom !== "") { + writer.uint32(10).string(message.denom); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QuerySupplyOfRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQuerySupplyOfRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.denom = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QuerySupplyOfRequest { + return { denom: isSet(object.denom) ? globalThis.String(object.denom) : "" }; + }, + + toJSON(message: QuerySupplyOfRequest): unknown { + const obj: any = {}; + if (message.denom !== "") { + obj.denom = message.denom; + } + return obj; + }, + + create, I>>(base?: I): QuerySupplyOfRequest { + return QuerySupplyOfRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QuerySupplyOfRequest { + const message = createBaseQuerySupplyOfRequest(); + message.denom = object.denom ?? ""; + return message; + }, +}; + +export const QuerySupplyOfResponse: MessageFns = { + $type: "cosmos.bank.v1beta1.QuerySupplyOfResponse" as const, + + encode(message: QuerySupplyOfResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.amount !== undefined) { + Coin.encode(message.amount, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QuerySupplyOfResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQuerySupplyOfResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.amount = Coin.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QuerySupplyOfResponse { + return { amount: isSet(object.amount) ? Coin.fromJSON(object.amount) : undefined }; + }, + + toJSON(message: QuerySupplyOfResponse): unknown { + const obj: any = {}; + if (message.amount !== undefined) { + obj.amount = Coin.toJSON(message.amount); + } + return obj; + }, + + create, I>>(base?: I): QuerySupplyOfResponse { + return QuerySupplyOfResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QuerySupplyOfResponse { + const message = createBaseQuerySupplyOfResponse(); + message.amount = object.amount !== undefined && object.amount !== null ? Coin.fromPartial(object.amount) : undefined; + return message; + }, +}; + +export const QueryParamsRequest: MessageFns = { + $type: "cosmos.bank.v1beta1.QueryParamsRequest" as const, + + encode(_: QueryParamsRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryParamsRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryParamsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): QueryParamsRequest { + return {}; + }, + + toJSON(_: QueryParamsRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): QueryParamsRequest { + return QueryParamsRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): QueryParamsRequest { + const message = createBaseQueryParamsRequest(); + return message; + }, +}; + +export const QueryParamsResponse: MessageFns = { + $type: "cosmos.bank.v1beta1.QueryParamsResponse" as const, + + encode(message: QueryParamsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryParamsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryParamsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.params = Params.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryParamsResponse { + return { params: isSet(object.params) ? Params.fromJSON(object.params) : undefined }; + }, + + toJSON(message: QueryParamsResponse): unknown { + const obj: any = {}; + if (message.params !== undefined) { + obj.params = Params.toJSON(message.params); + } + return obj; + }, + + create, I>>(base?: I): QueryParamsResponse { + return QueryParamsResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryParamsResponse { + const message = createBaseQueryParamsResponse(); + message.params = object.params !== undefined && object.params !== null ? Params.fromPartial(object.params) : undefined; + return message; + }, +}; + +export const QueryDenomsMetadataRequest: MessageFns = { + $type: "cosmos.bank.v1beta1.QueryDenomsMetadataRequest" as const, + + encode(message: QueryDenomsMetadataRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryDenomsMetadataRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDenomsMetadataRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDenomsMetadataRequest { + return { pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined }; + }, + + toJSON(message: QueryDenomsMetadataRequest): unknown { + const obj: any = {}; + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryDenomsMetadataRequest { + return QueryDenomsMetadataRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryDenomsMetadataRequest { + const message = createBaseQueryDenomsMetadataRequest(); + message.pagination = object.pagination !== undefined && object.pagination !== null ? PageRequest.fromPartial(object.pagination) : undefined; + return message; + }, +}; + +export const QueryDenomsMetadataResponse: MessageFns = { + $type: "cosmos.bank.v1beta1.QueryDenomsMetadataResponse" as const, + + encode(message: QueryDenomsMetadataResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.metadatas) { + Metadata.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryDenomsMetadataResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDenomsMetadataResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.metadatas.push(Metadata.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDenomsMetadataResponse { + return { + metadatas: globalThis.Array.isArray(object?.metadatas) ? object.metadatas.map((e: any) => Metadata.fromJSON(e)) : [], + pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryDenomsMetadataResponse): unknown { + const obj: any = {}; + if (message.metadatas?.length) { + obj.metadatas = message.metadatas.map((e) => Metadata.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryDenomsMetadataResponse { + return QueryDenomsMetadataResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryDenomsMetadataResponse { + const message = createBaseQueryDenomsMetadataResponse(); + message.metadatas = object.metadatas?.map((e) => Metadata.fromPartial(e)) || []; + message.pagination = object.pagination !== undefined && object.pagination !== null ? PageResponse.fromPartial(object.pagination) : undefined; + return message; + }, +}; + +export const QueryDenomMetadataRequest: MessageFns = { + $type: "cosmos.bank.v1beta1.QueryDenomMetadataRequest" as const, + + encode(message: QueryDenomMetadataRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.denom !== "") { + writer.uint32(10).string(message.denom); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryDenomMetadataRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDenomMetadataRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.denom = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDenomMetadataRequest { + return { denom: isSet(object.denom) ? globalThis.String(object.denom) : "" }; + }, + + toJSON(message: QueryDenomMetadataRequest): unknown { + const obj: any = {}; + if (message.denom !== "") { + obj.denom = message.denom; + } + return obj; + }, + + create, I>>(base?: I): QueryDenomMetadataRequest { + return QueryDenomMetadataRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryDenomMetadataRequest { + const message = createBaseQueryDenomMetadataRequest(); + message.denom = object.denom ?? ""; + return message; + }, +}; + +export const QueryDenomMetadataResponse: MessageFns = { + $type: "cosmos.bank.v1beta1.QueryDenomMetadataResponse" as const, + + encode(message: QueryDenomMetadataResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.metadata !== undefined) { + Metadata.encode(message.metadata, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryDenomMetadataResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDenomMetadataResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.metadata = Metadata.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDenomMetadataResponse { + return { metadata: isSet(object.metadata) ? Metadata.fromJSON(object.metadata) : undefined }; + }, + + toJSON(message: QueryDenomMetadataResponse): unknown { + const obj: any = {}; + if (message.metadata !== undefined) { + obj.metadata = Metadata.toJSON(message.metadata); + } + return obj; + }, + + create, I>>(base?: I): QueryDenomMetadataResponse { + return QueryDenomMetadataResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryDenomMetadataResponse { + const message = createBaseQueryDenomMetadataResponse(); + message.metadata = object.metadata !== undefined && object.metadata !== null ? Metadata.fromPartial(object.metadata) : undefined; + return message; + }, +}; + +function createBaseQueryBalanceRequest(): QueryBalanceRequest { + return { address: "", denom: "" }; +} + +function createBaseQueryBalanceResponse(): QueryBalanceResponse { + return { balance: undefined }; +} + +function createBaseQueryAllBalancesRequest(): QueryAllBalancesRequest { + return { address: "", pagination: undefined }; +} + +function createBaseQueryAllBalancesResponse(): QueryAllBalancesResponse { + return { balances: [], pagination: undefined }; +} + +function createBaseQuerySpendableBalancesRequest(): QuerySpendableBalancesRequest { + return { address: "", pagination: undefined }; +} + +function createBaseQuerySpendableBalancesResponse(): QuerySpendableBalancesResponse { + return { balances: [], pagination: undefined }; +} + +function createBaseQueryTotalSupplyRequest(): QueryTotalSupplyRequest { + return { pagination: undefined }; +} + +function createBaseQueryTotalSupplyResponse(): QueryTotalSupplyResponse { + return { supply: [], pagination: undefined }; +} + +function createBaseQuerySupplyOfRequest(): QuerySupplyOfRequest { + return { denom: "" }; +} + +function createBaseQuerySupplyOfResponse(): QuerySupplyOfResponse { + return { amount: undefined }; +} + +function createBaseQueryParamsRequest(): QueryParamsRequest { + return {}; +} + +function createBaseQueryParamsResponse(): QueryParamsResponse { + return { params: undefined }; +} + +function createBaseQueryDenomsMetadataRequest(): QueryDenomsMetadataRequest { + return { pagination: undefined }; +} + +function createBaseQueryDenomsMetadataResponse(): QueryDenomsMetadataResponse { + return { metadatas: [], pagination: undefined }; +} + +function createBaseQueryDenomMetadataRequest(): QueryDenomMetadataRequest { + return { denom: "" }; +} + +function createBaseQueryDenomMetadataResponse(): QueryDenomMetadataResponse { + return { metadata: undefined }; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} +export const registry: Array<[string, GeneratedType]> = [ + ["/cosmos.bank.v1beta1.QueryBalanceRequest", QueryBalanceRequest as never], + ["/cosmos.bank.v1beta1.QueryBalanceResponse", QueryBalanceResponse as never], + ["/cosmos.bank.v1beta1.QuerySupplyOfRequest", QuerySupplyOfRequest as never], + ["/cosmos.bank.v1beta1.QuerySupplyOfResponse", QuerySupplyOfResponse as never], + ["/cosmos.bank.v1beta1.QueryParamsRequest", QueryParamsRequest as never], + ["/cosmos.bank.v1beta1.QueryParamsResponse", QueryParamsResponse as never], +]; +export const aminoConverters = { + "/cosmos.bank.v1beta1.QueryBalanceRequest": { + aminoType: "cosmos-sdk/QueryBalanceRequest", + toAmino: (message: QueryBalanceRequest) => ({ ...message }), + fromAmino: (object: QueryBalanceRequest) => ({ ...object }), + }, + + "/cosmos.bank.v1beta1.QueryBalanceResponse": { + aminoType: "cosmos-sdk/QueryBalanceResponse", + toAmino: (message: QueryBalanceResponse) => ({ ...message }), + fromAmino: (object: QueryBalanceResponse) => ({ ...object }), + }, + + "/cosmos.bank.v1beta1.QuerySupplyOfRequest": { + aminoType: "cosmos-sdk/QuerySupplyOfRequest", + toAmino: (message: QuerySupplyOfRequest) => ({ ...message }), + fromAmino: (object: QuerySupplyOfRequest) => ({ ...object }), + }, + + "/cosmos.bank.v1beta1.QuerySupplyOfResponse": { + aminoType: "cosmos-sdk/QuerySupplyOfResponse", + toAmino: (message: QuerySupplyOfResponse) => ({ ...message }), + fromAmino: (object: QuerySupplyOfResponse) => ({ ...object }), + }, + + "/cosmos.bank.v1beta1.QueryParamsRequest": { + aminoType: "cosmos-sdk/QueryParamsRequest", + toAmino: (message: QueryParamsRequest) => ({ ...message }), + fromAmino: (object: QueryParamsRequest) => ({ ...object }), + }, + + "/cosmos.bank.v1beta1.QueryParamsResponse": { + aminoType: "cosmos-sdk/QueryParamsResponse", + toAmino: (message: QueryParamsResponse) => ({ ...message }), + fromAmino: (object: QueryParamsResponse) => ({ ...object }), + }, +}; diff --git a/packages/cosmos/generated/encoding/cosmos/bank/v1beta1/tx.ts b/packages/cosmos/generated/encoding/cosmos/bank/v1beta1/tx.ts new file mode 100644 index 000000000..b3d90bca8 --- /dev/null +++ b/packages/cosmos/generated/encoding/cosmos/bank/v1beta1/tx.ts @@ -0,0 +1,313 @@ +import type { GeneratedType } from "@cosmjs/proto-signing"; + +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +import { Coin } from "../../base/v1beta1/coin"; + +import { Input, Output } from "./bank"; + +import type { + MsgMultiSendResponse as MsgMultiSendResponse_type, + MsgMultiSend as MsgMultiSend_type, + MsgSendResponse as MsgSendResponse_type, + MsgSend as MsgSend_type, +} from "../../../../types/cosmos/bank/v1beta1"; + +import type { DeepPartial, Exact, MessageFns } from "../../../common"; + +export interface MsgSend extends MsgSend_type {} +export interface MsgSendResponse extends MsgSendResponse_type {} +export interface MsgMultiSend extends MsgMultiSend_type {} +export interface MsgMultiSendResponse extends MsgMultiSendResponse_type {} + +export const MsgSend: MessageFns = { + $type: "cosmos.bank.v1beta1.MsgSend" as const, + + encode(message: MsgSend, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.from_address !== "") { + writer.uint32(10).string(message.from_address); + } + if (message.to_address !== "") { + writer.uint32(18).string(message.to_address); + } + for (const v of message.amount) { + Coin.encode(v!, writer.uint32(26).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgSend { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSend(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.from_address = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.to_address = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.amount.push(Coin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgSend { + return { + from_address: isSet(object.from_address) ? globalThis.String(object.from_address) : "", + to_address: isSet(object.to_address) ? globalThis.String(object.to_address) : "", + amount: globalThis.Array.isArray(object?.amount) ? object.amount.map((e: any) => Coin.fromJSON(e)) : [], + }; + }, + + toJSON(message: MsgSend): unknown { + const obj: any = {}; + if (message.from_address !== "") { + obj.from_address = message.from_address; + } + if (message.to_address !== "") { + obj.to_address = message.to_address; + } + if (message.amount?.length) { + obj.amount = message.amount.map((e) => Coin.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): MsgSend { + return MsgSend.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgSend { + const message = createBaseMsgSend(); + message.from_address = object.from_address ?? ""; + message.to_address = object.to_address ?? ""; + message.amount = object.amount?.map((e) => Coin.fromPartial(e)) || []; + return message; + }, +}; + +export const MsgSendResponse: MessageFns = { + $type: "cosmos.bank.v1beta1.MsgSendResponse" as const, + + encode(_: MsgSendResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgSendResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSendResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgSendResponse { + return {}; + }, + + toJSON(_: MsgSendResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgSendResponse { + return MsgSendResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgSendResponse { + const message = createBaseMsgSendResponse(); + return message; + }, +}; + +export const MsgMultiSend: MessageFns = { + $type: "cosmos.bank.v1beta1.MsgMultiSend" as const, + + encode(message: MsgMultiSend, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.inputs) { + Input.encode(v!, writer.uint32(10).fork()).join(); + } + for (const v of message.outputs) { + Output.encode(v!, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgMultiSend { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgMultiSend(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.inputs.push(Input.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.outputs.push(Output.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgMultiSend { + return { + inputs: globalThis.Array.isArray(object?.inputs) ? object.inputs.map((e: any) => Input.fromJSON(e)) : [], + outputs: globalThis.Array.isArray(object?.outputs) ? object.outputs.map((e: any) => Output.fromJSON(e)) : [], + }; + }, + + toJSON(message: MsgMultiSend): unknown { + const obj: any = {}; + if (message.inputs?.length) { + obj.inputs = message.inputs.map((e) => Input.toJSON(e)); + } + if (message.outputs?.length) { + obj.outputs = message.outputs.map((e) => Output.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): MsgMultiSend { + return MsgMultiSend.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgMultiSend { + const message = createBaseMsgMultiSend(); + message.inputs = object.inputs?.map((e) => Input.fromPartial(e)) || []; + message.outputs = object.outputs?.map((e) => Output.fromPartial(e)) || []; + return message; + }, +}; + +export const MsgMultiSendResponse: MessageFns = { + $type: "cosmos.bank.v1beta1.MsgMultiSendResponse" as const, + + encode(_: MsgMultiSendResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgMultiSendResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgMultiSendResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgMultiSendResponse { + return {}; + }, + + toJSON(_: MsgMultiSendResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgMultiSendResponse { + return MsgMultiSendResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgMultiSendResponse { + const message = createBaseMsgMultiSendResponse(); + return message; + }, +}; + +function createBaseMsgSend(): MsgSend { + return { from_address: "", to_address: "", amount: [] }; +} + +function createBaseMsgSendResponse(): MsgSendResponse { + return {}; +} + +function createBaseMsgMultiSend(): MsgMultiSend { + return { inputs: [], outputs: [] }; +} + +function createBaseMsgMultiSendResponse(): MsgMultiSendResponse { + return {}; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} +export const registry: Array<[string, GeneratedType]> = [ + ["/cosmos.bank.v1beta1.MsgSend", MsgSend as never], + ["/cosmos.bank.v1beta1.MsgSendResponse", MsgSendResponse as never], + ["/cosmos.bank.v1beta1.MsgMultiSend", MsgMultiSend as never], + ["/cosmos.bank.v1beta1.MsgMultiSendResponse", MsgMultiSendResponse as never], +]; +export const aminoConverters = { + "/cosmos.bank.v1beta1.MsgSend": { + aminoType: "cosmos-sdk/MsgSend", + toAmino: (message: MsgSend) => ({ ...message }), + fromAmino: (object: MsgSend) => ({ ...object }), + }, + + "/cosmos.bank.v1beta1.MsgSendResponse": { + aminoType: "cosmos-sdk/MsgSendResponse", + toAmino: (message: MsgSendResponse) => ({ ...message }), + fromAmino: (object: MsgSendResponse) => ({ ...object }), + }, + + "/cosmos.bank.v1beta1.MsgMultiSend": { + aminoType: "cosmos-sdk/MsgMultiSend", + toAmino: (message: MsgMultiSend) => ({ ...message }), + fromAmino: (object: MsgMultiSend) => ({ ...object }), + }, + + "/cosmos.bank.v1beta1.MsgMultiSendResponse": { + aminoType: "cosmos-sdk/MsgMultiSendResponse", + toAmino: (message: MsgMultiSendResponse) => ({ ...message }), + fromAmino: (object: MsgMultiSendResponse) => ({ ...object }), + }, +}; diff --git a/packages/cosmos/generated/encoding/cosmos/base/abci/v1beta1/abci.ts b/packages/cosmos/generated/encoding/cosmos/base/abci/v1beta1/abci.ts new file mode 100644 index 000000000..787278807 --- /dev/null +++ b/packages/cosmos/generated/encoding/cosmos/base/abci/v1beta1/abci.ts @@ -0,0 +1,1173 @@ +import type { GeneratedType } from "@cosmjs/proto-signing"; + +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +import { Any } from "../../../../google/protobuf/any"; + +import { Event } from "../../../../tendermint/abci/types"; + +import type { + ABCIMessageLog as ABCIMessageLog_type, + Attribute as Attribute_type, + GasInfo as GasInfo_type, + MsgData as MsgData_type, + Result as Result_type, + SearchTxsResult as SearchTxsResult_type, + SimulationResponse as SimulationResponse_type, + StringEvent as StringEvent_type, + TxMsgData as TxMsgData_type, + TxResponse as TxResponse_type, +} from "../../../../../types/cosmos/base/abci/v1beta1"; + +import type { DeepPartial, Exact, MessageFns } from "../../../../common"; + +export interface TxResponse extends TxResponse_type {} +export interface ABCIMessageLog extends ABCIMessageLog_type {} +export interface StringEvent extends StringEvent_type {} +export interface Attribute extends Attribute_type {} +export interface GasInfo extends GasInfo_type {} +export interface Result extends Result_type {} +export interface SimulationResponse extends SimulationResponse_type {} +export interface MsgData extends MsgData_type {} +export interface TxMsgData extends TxMsgData_type {} +export interface SearchTxsResult extends SearchTxsResult_type {} + +export const TxResponse: MessageFns = { + $type: "cosmos.base.abci.v1beta1.TxResponse" as const, + + encode(message: TxResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.height !== 0) { + writer.uint32(8).int64(message.height); + } + if (message.txhash !== "") { + writer.uint32(18).string(message.txhash); + } + if (message.codespace !== "") { + writer.uint32(26).string(message.codespace); + } + if (message.code !== 0) { + writer.uint32(32).uint32(message.code); + } + if (message.data !== "") { + writer.uint32(42).string(message.data); + } + if (message.raw_log !== "") { + writer.uint32(50).string(message.raw_log); + } + for (const v of message.logs) { + ABCIMessageLog.encode(v!, writer.uint32(58).fork()).join(); + } + if (message.info !== "") { + writer.uint32(66).string(message.info); + } + if (message.gas_wanted !== 0) { + writer.uint32(72).int64(message.gas_wanted); + } + if (message.gas_used !== 0) { + writer.uint32(80).int64(message.gas_used); + } + if (message.tx !== undefined) { + Any.encode(message.tx, writer.uint32(90).fork()).join(); + } + if (message.timestamp !== "") { + writer.uint32(98).string(message.timestamp); + } + for (const v of message.events) { + Event.encode(v!, writer.uint32(106).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): TxResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseTxResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.height = longToNumber(reader.int64()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.txhash = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.codespace = reader.string(); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.code = reader.uint32(); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.data = reader.string(); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.raw_log = reader.string(); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.logs.push(ABCIMessageLog.decode(reader, reader.uint32())); + continue; + case 8: + if (tag !== 66) { + break; + } + + message.info = reader.string(); + continue; + case 9: + if (tag !== 72) { + break; + } + + message.gas_wanted = longToNumber(reader.int64()); + continue; + case 10: + if (tag !== 80) { + break; + } + + message.gas_used = longToNumber(reader.int64()); + continue; + case 11: + if (tag !== 90) { + break; + } + + message.tx = Any.decode(reader, reader.uint32()); + continue; + case 12: + if (tag !== 98) { + break; + } + + message.timestamp = reader.string(); + continue; + case 13: + if (tag !== 106) { + break; + } + + message.events.push(Event.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): TxResponse { + return { + height: isSet(object.height) ? globalThis.Number(object.height) : 0, + txhash: isSet(object.txhash) ? globalThis.String(object.txhash) : "", + codespace: isSet(object.codespace) ? globalThis.String(object.codespace) : "", + code: isSet(object.code) ? globalThis.Number(object.code) : 0, + data: isSet(object.data) ? globalThis.String(object.data) : "", + raw_log: isSet(object.raw_log) ? globalThis.String(object.raw_log) : "", + logs: globalThis.Array.isArray(object?.logs) ? object.logs.map((e: any) => ABCIMessageLog.fromJSON(e)) : [], + info: isSet(object.info) ? globalThis.String(object.info) : "", + gas_wanted: isSet(object.gas_wanted) ? globalThis.Number(object.gas_wanted) : 0, + gas_used: isSet(object.gas_used) ? globalThis.Number(object.gas_used) : 0, + tx: isSet(object.tx) ? Any.fromJSON(object.tx) : undefined, + timestamp: isSet(object.timestamp) ? globalThis.String(object.timestamp) : "", + events: globalThis.Array.isArray(object?.events) ? object.events.map((e: any) => Event.fromJSON(e)) : [], + }; + }, + + toJSON(message: TxResponse): unknown { + const obj: any = {}; + if (message.height !== 0) { + obj.height = Math.round(message.height); + } + if (message.txhash !== "") { + obj.txhash = message.txhash; + } + if (message.codespace !== "") { + obj.codespace = message.codespace; + } + if (message.code !== 0) { + obj.code = Math.round(message.code); + } + if (message.data !== "") { + obj.data = message.data; + } + if (message.raw_log !== "") { + obj.raw_log = message.raw_log; + } + if (message.logs?.length) { + obj.logs = message.logs.map((e) => ABCIMessageLog.toJSON(e)); + } + if (message.info !== "") { + obj.info = message.info; + } + if (message.gas_wanted !== 0) { + obj.gas_wanted = Math.round(message.gas_wanted); + } + if (message.gas_used !== 0) { + obj.gas_used = Math.round(message.gas_used); + } + if (message.tx !== undefined) { + obj.tx = Any.toJSON(message.tx); + } + if (message.timestamp !== "") { + obj.timestamp = message.timestamp; + } + if (message.events?.length) { + obj.events = message.events.map((e) => Event.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): TxResponse { + return TxResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): TxResponse { + const message = createBaseTxResponse(); + message.height = object.height ?? 0; + message.txhash = object.txhash ?? ""; + message.codespace = object.codespace ?? ""; + message.code = object.code ?? 0; + message.data = object.data ?? ""; + message.raw_log = object.raw_log ?? ""; + message.logs = object.logs?.map((e) => ABCIMessageLog.fromPartial(e)) || []; + message.info = object.info ?? ""; + message.gas_wanted = object.gas_wanted ?? 0; + message.gas_used = object.gas_used ?? 0; + message.tx = object.tx !== undefined && object.tx !== null ? Any.fromPartial(object.tx) : undefined; + message.timestamp = object.timestamp ?? ""; + message.events = object.events?.map((e) => Event.fromPartial(e)) || []; + return message; + }, +}; + +export const ABCIMessageLog: MessageFns = { + $type: "cosmos.base.abci.v1beta1.ABCIMessageLog" as const, + + encode(message: ABCIMessageLog, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.msg_index !== 0) { + writer.uint32(8).uint32(message.msg_index); + } + if (message.log !== "") { + writer.uint32(18).string(message.log); + } + for (const v of message.events) { + StringEvent.encode(v!, writer.uint32(26).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ABCIMessageLog { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseABCIMessageLog(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.msg_index = reader.uint32(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.log = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.events.push(StringEvent.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ABCIMessageLog { + return { + msg_index: isSet(object.msg_index) ? globalThis.Number(object.msg_index) : 0, + log: isSet(object.log) ? globalThis.String(object.log) : "", + events: globalThis.Array.isArray(object?.events) ? object.events.map((e: any) => StringEvent.fromJSON(e)) : [], + }; + }, + + toJSON(message: ABCIMessageLog): unknown { + const obj: any = {}; + if (message.msg_index !== 0) { + obj.msg_index = Math.round(message.msg_index); + } + if (message.log !== "") { + obj.log = message.log; + } + if (message.events?.length) { + obj.events = message.events.map((e) => StringEvent.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): ABCIMessageLog { + return ABCIMessageLog.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ABCIMessageLog { + const message = createBaseABCIMessageLog(); + message.msg_index = object.msg_index ?? 0; + message.log = object.log ?? ""; + message.events = object.events?.map((e) => StringEvent.fromPartial(e)) || []; + return message; + }, +}; + +export const StringEvent: MessageFns = { + $type: "cosmos.base.abci.v1beta1.StringEvent" as const, + + encode(message: StringEvent, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.type !== "") { + writer.uint32(10).string(message.type); + } + for (const v of message.attributes) { + Attribute.encode(v!, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): StringEvent { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseStringEvent(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.type = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.attributes.push(Attribute.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): StringEvent { + return { + type: isSet(object.type) ? globalThis.String(object.type) : "", + attributes: globalThis.Array.isArray(object?.attributes) ? object.attributes.map((e: any) => Attribute.fromJSON(e)) : [], + }; + }, + + toJSON(message: StringEvent): unknown { + const obj: any = {}; + if (message.type !== "") { + obj.type = message.type; + } + if (message.attributes?.length) { + obj.attributes = message.attributes.map((e) => Attribute.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): StringEvent { + return StringEvent.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): StringEvent { + const message = createBaseStringEvent(); + message.type = object.type ?? ""; + message.attributes = object.attributes?.map((e) => Attribute.fromPartial(e)) || []; + return message; + }, +}; + +export const Attribute: MessageFns = { + $type: "cosmos.base.abci.v1beta1.Attribute" as const, + + encode(message: Attribute, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.key !== "") { + writer.uint32(10).string(message.key); + } + if (message.value !== "") { + writer.uint32(18).string(message.value); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Attribute { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseAttribute(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.key = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.value = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Attribute { + return { + key: isSet(object.key) ? globalThis.String(object.key) : "", + value: isSet(object.value) ? globalThis.String(object.value) : "", + }; + }, + + toJSON(message: Attribute): unknown { + const obj: any = {}; + if (message.key !== "") { + obj.key = message.key; + } + if (message.value !== "") { + obj.value = message.value; + } + return obj; + }, + + create, I>>(base?: I): Attribute { + return Attribute.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Attribute { + const message = createBaseAttribute(); + message.key = object.key ?? ""; + message.value = object.value ?? ""; + return message; + }, +}; + +export const GasInfo: MessageFns = { + $type: "cosmos.base.abci.v1beta1.GasInfo" as const, + + encode(message: GasInfo, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.gas_wanted !== 0) { + writer.uint32(8).uint64(message.gas_wanted); + } + if (message.gas_used !== 0) { + writer.uint32(16).uint64(message.gas_used); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GasInfo { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGasInfo(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.gas_wanted = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.gas_used = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GasInfo { + return { + gas_wanted: isSet(object.gas_wanted) ? globalThis.Number(object.gas_wanted) : 0, + gas_used: isSet(object.gas_used) ? globalThis.Number(object.gas_used) : 0, + }; + }, + + toJSON(message: GasInfo): unknown { + const obj: any = {}; + if (message.gas_wanted !== 0) { + obj.gas_wanted = Math.round(message.gas_wanted); + } + if (message.gas_used !== 0) { + obj.gas_used = Math.round(message.gas_used); + } + return obj; + }, + + create, I>>(base?: I): GasInfo { + return GasInfo.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): GasInfo { + const message = createBaseGasInfo(); + message.gas_wanted = object.gas_wanted ?? 0; + message.gas_used = object.gas_used ?? 0; + return message; + }, +}; + +export const Result: MessageFns = { + $type: "cosmos.base.abci.v1beta1.Result" as const, + + encode(message: Result, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.data.length !== 0) { + writer.uint32(10).bytes(message.data); + } + if (message.log !== "") { + writer.uint32(18).string(message.log); + } + for (const v of message.events) { + Event.encode(v!, writer.uint32(26).fork()).join(); + } + if (message.evmError !== "") { + writer.uint32(34).string(message.evmError); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Result { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseResult(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.data = reader.bytes(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.log = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.events.push(Event.decode(reader, reader.uint32())); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.evmError = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Result { + return { + data: isSet(object.data) ? bytesFromBase64(object.data) : new Uint8Array(0), + log: isSet(object.log) ? globalThis.String(object.log) : "", + events: globalThis.Array.isArray(object?.events) ? object.events.map((e: any) => Event.fromJSON(e)) : [], + evmError: isSet(object.evmError) ? globalThis.String(object.evmError) : "", + }; + }, + + toJSON(message: Result): unknown { + const obj: any = {}; + if (message.data.length !== 0) { + obj.data = base64FromBytes(message.data); + } + if (message.log !== "") { + obj.log = message.log; + } + if (message.events?.length) { + obj.events = message.events.map((e) => Event.toJSON(e)); + } + if (message.evmError !== "") { + obj.evmError = message.evmError; + } + return obj; + }, + + create, I>>(base?: I): Result { + return Result.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Result { + const message = createBaseResult(); + message.data = object.data ?? new Uint8Array(0); + message.log = object.log ?? ""; + message.events = object.events?.map((e) => Event.fromPartial(e)) || []; + message.evmError = object.evmError ?? ""; + return message; + }, +}; + +export const SimulationResponse: MessageFns = { + $type: "cosmos.base.abci.v1beta1.SimulationResponse" as const, + + encode(message: SimulationResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.gas_info !== undefined) { + GasInfo.encode(message.gas_info, writer.uint32(10).fork()).join(); + } + if (message.result !== undefined) { + Result.encode(message.result, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): SimulationResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseSimulationResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.gas_info = GasInfo.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.result = Result.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): SimulationResponse { + return { + gas_info: isSet(object.gas_info) ? GasInfo.fromJSON(object.gas_info) : undefined, + result: isSet(object.result) ? Result.fromJSON(object.result) : undefined, + }; + }, + + toJSON(message: SimulationResponse): unknown { + const obj: any = {}; + if (message.gas_info !== undefined) { + obj.gas_info = GasInfo.toJSON(message.gas_info); + } + if (message.result !== undefined) { + obj.result = Result.toJSON(message.result); + } + return obj; + }, + + create, I>>(base?: I): SimulationResponse { + return SimulationResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): SimulationResponse { + const message = createBaseSimulationResponse(); + message.gas_info = object.gas_info !== undefined && object.gas_info !== null ? GasInfo.fromPartial(object.gas_info) : undefined; + message.result = object.result !== undefined && object.result !== null ? Result.fromPartial(object.result) : undefined; + return message; + }, +}; + +export const MsgData: MessageFns = { + $type: "cosmos.base.abci.v1beta1.MsgData" as const, + + encode(message: MsgData, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.msg_type !== "") { + writer.uint32(10).string(message.msg_type); + } + if (message.data.length !== 0) { + writer.uint32(18).bytes(message.data); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgData { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgData(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.msg_type = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.data = reader.bytes(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgData { + return { + msg_type: isSet(object.msg_type) ? globalThis.String(object.msg_type) : "", + data: isSet(object.data) ? bytesFromBase64(object.data) : new Uint8Array(0), + }; + }, + + toJSON(message: MsgData): unknown { + const obj: any = {}; + if (message.msg_type !== "") { + obj.msg_type = message.msg_type; + } + if (message.data.length !== 0) { + obj.data = base64FromBytes(message.data); + } + return obj; + }, + + create, I>>(base?: I): MsgData { + return MsgData.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgData { + const message = createBaseMsgData(); + message.msg_type = object.msg_type ?? ""; + message.data = object.data ?? new Uint8Array(0); + return message; + }, +}; + +export const TxMsgData: MessageFns = { + $type: "cosmos.base.abci.v1beta1.TxMsgData" as const, + + encode(message: TxMsgData, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.data) { + MsgData.encode(v!, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): TxMsgData { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseTxMsgData(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.data.push(MsgData.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): TxMsgData { + return { data: globalThis.Array.isArray(object?.data) ? object.data.map((e: any) => MsgData.fromJSON(e)) : [] }; + }, + + toJSON(message: TxMsgData): unknown { + const obj: any = {}; + if (message.data?.length) { + obj.data = message.data.map((e) => MsgData.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): TxMsgData { + return TxMsgData.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): TxMsgData { + const message = createBaseTxMsgData(); + message.data = object.data?.map((e) => MsgData.fromPartial(e)) || []; + return message; + }, +}; + +export const SearchTxsResult: MessageFns = { + $type: "cosmos.base.abci.v1beta1.SearchTxsResult" as const, + + encode(message: SearchTxsResult, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.total_count !== 0) { + writer.uint32(8).uint64(message.total_count); + } + if (message.count !== 0) { + writer.uint32(16).uint64(message.count); + } + if (message.page_number !== 0) { + writer.uint32(24).uint64(message.page_number); + } + if (message.page_total !== 0) { + writer.uint32(32).uint64(message.page_total); + } + if (message.limit !== 0) { + writer.uint32(40).uint64(message.limit); + } + for (const v of message.txs) { + TxResponse.encode(v!, writer.uint32(50).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): SearchTxsResult { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseSearchTxsResult(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.total_count = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.count = longToNumber(reader.uint64()); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.page_number = longToNumber(reader.uint64()); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.page_total = longToNumber(reader.uint64()); + continue; + case 5: + if (tag !== 40) { + break; + } + + message.limit = longToNumber(reader.uint64()); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.txs.push(TxResponse.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): SearchTxsResult { + return { + total_count: isSet(object.total_count) ? globalThis.Number(object.total_count) : 0, + count: isSet(object.count) ? globalThis.Number(object.count) : 0, + page_number: isSet(object.page_number) ? globalThis.Number(object.page_number) : 0, + page_total: isSet(object.page_total) ? globalThis.Number(object.page_total) : 0, + limit: isSet(object.limit) ? globalThis.Number(object.limit) : 0, + txs: globalThis.Array.isArray(object?.txs) ? object.txs.map((e: any) => TxResponse.fromJSON(e)) : [], + }; + }, + + toJSON(message: SearchTxsResult): unknown { + const obj: any = {}; + if (message.total_count !== 0) { + obj.total_count = Math.round(message.total_count); + } + if (message.count !== 0) { + obj.count = Math.round(message.count); + } + if (message.page_number !== 0) { + obj.page_number = Math.round(message.page_number); + } + if (message.page_total !== 0) { + obj.page_total = Math.round(message.page_total); + } + if (message.limit !== 0) { + obj.limit = Math.round(message.limit); + } + if (message.txs?.length) { + obj.txs = message.txs.map((e) => TxResponse.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): SearchTxsResult { + return SearchTxsResult.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): SearchTxsResult { + const message = createBaseSearchTxsResult(); + message.total_count = object.total_count ?? 0; + message.count = object.count ?? 0; + message.page_number = object.page_number ?? 0; + message.page_total = object.page_total ?? 0; + message.limit = object.limit ?? 0; + message.txs = object.txs?.map((e) => TxResponse.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseTxResponse(): TxResponse { + return { + height: 0, + txhash: "", + codespace: "", + code: 0, + data: "", + raw_log: "", + logs: [], + info: "", + gas_wanted: 0, + gas_used: 0, + tx: undefined, + timestamp: "", + events: [], + }; +} + +function createBaseABCIMessageLog(): ABCIMessageLog { + return { msg_index: 0, log: "", events: [] }; +} + +function createBaseStringEvent(): StringEvent { + return { type: "", attributes: [] }; +} + +function createBaseAttribute(): Attribute { + return { key: "", value: "" }; +} + +function createBaseGasInfo(): GasInfo { + return { gas_wanted: 0, gas_used: 0 }; +} + +function createBaseResult(): Result { + return { data: new Uint8Array(0), log: "", events: [], evmError: "" }; +} + +function createBaseSimulationResponse(): SimulationResponse { + return { gas_info: undefined, result: undefined }; +} + +function createBaseMsgData(): MsgData { + return { msg_type: "", data: new Uint8Array(0) }; +} + +function createBaseTxMsgData(): TxMsgData { + return { data: [] }; +} + +function createBaseSearchTxsResult(): SearchTxsResult { + return { total_count: 0, count: 0, page_number: 0, page_total: 0, limit: 0, txs: [] }; +} + +function bytesFromBase64(b64: string): Uint8Array { + if ((globalThis as any).Buffer) { + return Uint8Array.from(globalThis.Buffer.from(b64, "base64")); + } else { + const bin = globalThis.atob(b64); + const arr = new Uint8Array(bin.length); + for (let i = 0; i < bin.length; ++i) { + arr[i] = bin.charCodeAt(i); + } + return arr; + } +} + +function base64FromBytes(arr: Uint8Array): string { + if ((globalThis as any).Buffer) { + return globalThis.Buffer.from(arr).toString("base64"); + } else { + const bin: string[] = []; + arr.forEach((byte) => { + bin.push(globalThis.String.fromCharCode(byte)); + }); + return globalThis.btoa(bin.join("")); + } +} + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} +export const registry: Array<[string, GeneratedType]> = [ + ["/cosmos.base.abci.v1beta1.TxResponse", TxResponse as never], + ["/cosmos.base.abci.v1beta1.ABCIMessageLog", ABCIMessageLog as never], + ["/cosmos.base.abci.v1beta1.StringEvent", StringEvent as never], + ["/cosmos.base.abci.v1beta1.Attribute", Attribute as never], + ["/cosmos.base.abci.v1beta1.GasInfo", GasInfo as never], + ["/cosmos.base.abci.v1beta1.Result", Result as never], + ["/cosmos.base.abci.v1beta1.SimulationResponse", SimulationResponse as never], + ["/cosmos.base.abci.v1beta1.MsgData", MsgData as never], + ["/cosmos.base.abci.v1beta1.TxMsgData", TxMsgData as never], + ["/cosmos.base.abci.v1beta1.SearchTxsResult", SearchTxsResult as never], +]; +export const aminoConverters = { + "/cosmos.base.abci.v1beta1.TxResponse": { + aminoType: "cosmos-sdk/TxResponse", + toAmino: (message: TxResponse) => ({ ...message }), + fromAmino: (object: TxResponse) => ({ ...object }), + }, + + "/cosmos.base.abci.v1beta1.ABCIMessageLog": { + aminoType: "cosmos-sdk/ABCIMessageLog", + toAmino: (message: ABCIMessageLog) => ({ ...message }), + fromAmino: (object: ABCIMessageLog) => ({ ...object }), + }, + + "/cosmos.base.abci.v1beta1.StringEvent": { + aminoType: "cosmos-sdk/StringEvent", + toAmino: (message: StringEvent) => ({ ...message }), + fromAmino: (object: StringEvent) => ({ ...object }), + }, + + "/cosmos.base.abci.v1beta1.Attribute": { + aminoType: "cosmos-sdk/Attribute", + toAmino: (message: Attribute) => ({ ...message }), + fromAmino: (object: Attribute) => ({ ...object }), + }, + + "/cosmos.base.abci.v1beta1.GasInfo": { + aminoType: "cosmos-sdk/GasInfo", + toAmino: (message: GasInfo) => ({ ...message }), + fromAmino: (object: GasInfo) => ({ ...object }), + }, + + "/cosmos.base.abci.v1beta1.Result": { + aminoType: "cosmos-sdk/Result", + toAmino: (message: Result) => ({ ...message }), + fromAmino: (object: Result) => ({ ...object }), + }, + + "/cosmos.base.abci.v1beta1.SimulationResponse": { + aminoType: "cosmos-sdk/SimulationResponse", + toAmino: (message: SimulationResponse) => ({ ...message }), + fromAmino: (object: SimulationResponse) => ({ ...object }), + }, + + "/cosmos.base.abci.v1beta1.MsgData": { + aminoType: "cosmos-sdk/MsgData", + toAmino: (message: MsgData) => ({ ...message }), + fromAmino: (object: MsgData) => ({ ...object }), + }, + + "/cosmos.base.abci.v1beta1.TxMsgData": { + aminoType: "cosmos-sdk/TxMsgData", + toAmino: (message: TxMsgData) => ({ ...message }), + fromAmino: (object: TxMsgData) => ({ ...object }), + }, + + "/cosmos.base.abci.v1beta1.SearchTxsResult": { + aminoType: "cosmos-sdk/SearchTxsResult", + toAmino: (message: SearchTxsResult) => ({ ...message }), + fromAmino: (object: SearchTxsResult) => ({ ...object }), + }, +}; diff --git a/packages/cosmos/generated/encoding/cosmos/base/abci/v1beta1/index.ts b/packages/cosmos/generated/encoding/cosmos/base/abci/v1beta1/index.ts new file mode 100644 index 000000000..1f0a750cf --- /dev/null +++ b/packages/cosmos/generated/encoding/cosmos/base/abci/v1beta1/index.ts @@ -0,0 +1,3 @@ +// @ts-nocheck + +export * from './abci'; \ No newline at end of file diff --git a/packages/cosmos/generated/encoding/cosmos/base/kv/v1beta1/index.ts b/packages/cosmos/generated/encoding/cosmos/base/kv/v1beta1/index.ts new file mode 100644 index 000000000..c55d060f5 --- /dev/null +++ b/packages/cosmos/generated/encoding/cosmos/base/kv/v1beta1/index.ts @@ -0,0 +1,3 @@ +// @ts-nocheck + +export * from './kv'; \ No newline at end of file diff --git a/packages/cosmos/generated/encoding/cosmos/base/kv/v1beta1/kv.ts b/packages/cosmos/generated/encoding/cosmos/base/kv/v1beta1/kv.ts new file mode 100644 index 000000000..ede0376ee --- /dev/null +++ b/packages/cosmos/generated/encoding/cosmos/base/kv/v1beta1/kv.ts @@ -0,0 +1,191 @@ +import type { GeneratedType } from "@cosmjs/proto-signing"; + +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +import type { Pair as Pair_type, Pairs as Pairs_type } from "../../../../../types/cosmos/base/kv/v1beta1"; + +import type { DeepPartial, Exact, MessageFns } from "../../../../common"; + +export interface Pairs extends Pairs_type {} +export interface Pair extends Pair_type {} + +export const Pairs: MessageFns = { + $type: "cosmos.base.kv.v1beta1.Pairs" as const, + + encode(message: Pairs, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.pairs) { + Pair.encode(v!, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Pairs { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePairs(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.pairs.push(Pair.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Pairs { + return { pairs: globalThis.Array.isArray(object?.pairs) ? object.pairs.map((e: any) => Pair.fromJSON(e)) : [] }; + }, + + toJSON(message: Pairs): unknown { + const obj: any = {}; + if (message.pairs?.length) { + obj.pairs = message.pairs.map((e) => Pair.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): Pairs { + return Pairs.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Pairs { + const message = createBasePairs(); + message.pairs = object.pairs?.map((e) => Pair.fromPartial(e)) || []; + return message; + }, +}; + +export const Pair: MessageFns = { + $type: "cosmos.base.kv.v1beta1.Pair" as const, + + encode(message: Pair, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.key.length !== 0) { + writer.uint32(10).bytes(message.key); + } + if (message.value.length !== 0) { + writer.uint32(18).bytes(message.value); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Pair { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePair(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.key = reader.bytes(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.value = reader.bytes(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Pair { + return { + key: isSet(object.key) ? bytesFromBase64(object.key) : new Uint8Array(0), + value: isSet(object.value) ? bytesFromBase64(object.value) : new Uint8Array(0), + }; + }, + + toJSON(message: Pair): unknown { + const obj: any = {}; + if (message.key.length !== 0) { + obj.key = base64FromBytes(message.key); + } + if (message.value.length !== 0) { + obj.value = base64FromBytes(message.value); + } + return obj; + }, + + create, I>>(base?: I): Pair { + return Pair.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Pair { + const message = createBasePair(); + message.key = object.key ?? new Uint8Array(0); + message.value = object.value ?? new Uint8Array(0); + return message; + }, +}; + +function createBasePairs(): Pairs { + return { pairs: [] }; +} + +function createBasePair(): Pair { + return { key: new Uint8Array(0), value: new Uint8Array(0) }; +} + +function bytesFromBase64(b64: string): Uint8Array { + if ((globalThis as any).Buffer) { + return Uint8Array.from(globalThis.Buffer.from(b64, "base64")); + } else { + const bin = globalThis.atob(b64); + const arr = new Uint8Array(bin.length); + for (let i = 0; i < bin.length; ++i) { + arr[i] = bin.charCodeAt(i); + } + return arr; + } +} + +function base64FromBytes(arr: Uint8Array): string { + if ((globalThis as any).Buffer) { + return globalThis.Buffer.from(arr).toString("base64"); + } else { + const bin: string[] = []; + arr.forEach((byte) => { + bin.push(globalThis.String.fromCharCode(byte)); + }); + return globalThis.btoa(bin.join("")); + } +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} +export const registry: Array<[string, GeneratedType]> = [ + ["/cosmos.base.kv.v1beta1.Pairs", Pairs as never], + ["/cosmos.base.kv.v1beta1.Pair", Pair as never], +]; +export const aminoConverters = { + "/cosmos.base.kv.v1beta1.Pairs": { + aminoType: "cosmos-sdk/Pairs", + toAmino: (message: Pairs) => ({ ...message }), + fromAmino: (object: Pairs) => ({ ...object }), + }, + + "/cosmos.base.kv.v1beta1.Pair": { + aminoType: "cosmos-sdk/Pair", + toAmino: (message: Pair) => ({ ...message }), + fromAmino: (object: Pair) => ({ ...object }), + }, +}; diff --git a/packages/cosmos/generated/encoding/cosmos/base/query/v1beta1/index.ts b/packages/cosmos/generated/encoding/cosmos/base/query/v1beta1/index.ts new file mode 100644 index 000000000..2fb8b1947 --- /dev/null +++ b/packages/cosmos/generated/encoding/cosmos/base/query/v1beta1/index.ts @@ -0,0 +1,3 @@ +// @ts-nocheck + +export * from './pagination'; \ No newline at end of file diff --git a/packages/cosmos/generated/encoding/cosmos/base/query/v1beta1/pagination.ts b/packages/cosmos/generated/encoding/cosmos/base/query/v1beta1/pagination.ts new file mode 100644 index 000000000..b44887a14 --- /dev/null +++ b/packages/cosmos/generated/encoding/cosmos/base/query/v1beta1/pagination.ts @@ -0,0 +1,264 @@ +import type { GeneratedType } from "@cosmjs/proto-signing"; + +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +import type { PageRequest as PageRequest_type, PageResponse as PageResponse_type } from "../../../../../types/cosmos/base/query/v1beta1"; + +import type { DeepPartial, Exact, MessageFns } from "../../../../common"; + +export interface PageRequest extends PageRequest_type {} +export interface PageResponse extends PageResponse_type {} + +export const PageRequest: MessageFns = { + $type: "cosmos.base.query.v1beta1.PageRequest" as const, + + encode(message: PageRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.key.length !== 0) { + writer.uint32(10).bytes(message.key); + } + if (message.offset !== 0) { + writer.uint32(16).uint64(message.offset); + } + if (message.limit !== 0) { + writer.uint32(24).uint64(message.limit); + } + if (message.count_total !== false) { + writer.uint32(32).bool(message.count_total); + } + if (message.reverse !== false) { + writer.uint32(40).bool(message.reverse); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): PageRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePageRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.key = reader.bytes(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.offset = longToNumber(reader.uint64()); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.limit = longToNumber(reader.uint64()); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.count_total = reader.bool(); + continue; + case 5: + if (tag !== 40) { + break; + } + + message.reverse = reader.bool(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): PageRequest { + return { + key: isSet(object.key) ? bytesFromBase64(object.key) : new Uint8Array(0), + offset: isSet(object.offset) ? globalThis.Number(object.offset) : 0, + limit: isSet(object.limit) ? globalThis.Number(object.limit) : 0, + count_total: isSet(object.count_total) ? globalThis.Boolean(object.count_total) : false, + reverse: isSet(object.reverse) ? globalThis.Boolean(object.reverse) : false, + }; + }, + + toJSON(message: PageRequest): unknown { + const obj: any = {}; + if (message.key.length !== 0) { + obj.key = base64FromBytes(message.key); + } + if (message.offset !== 0) { + obj.offset = Math.round(message.offset); + } + if (message.limit !== 0) { + obj.limit = Math.round(message.limit); + } + if (message.count_total !== false) { + obj.count_total = message.count_total; + } + if (message.reverse !== false) { + obj.reverse = message.reverse; + } + return obj; + }, + + create, I>>(base?: I): PageRequest { + return PageRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): PageRequest { + const message = createBasePageRequest(); + message.key = object.key ?? new Uint8Array(0); + message.offset = object.offset ?? 0; + message.limit = object.limit ?? 0; + message.count_total = object.count_total ?? false; + message.reverse = object.reverse ?? false; + return message; + }, +}; + +export const PageResponse: MessageFns = { + $type: "cosmos.base.query.v1beta1.PageResponse" as const, + + encode(message: PageResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.next_key.length !== 0) { + writer.uint32(10).bytes(message.next_key); + } + if (message.total !== 0) { + writer.uint32(16).uint64(message.total); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): PageResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePageResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.next_key = reader.bytes(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.total = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): PageResponse { + return { + next_key: isSet(object.next_key) ? bytesFromBase64(object.next_key) : new Uint8Array(0), + total: isSet(object.total) ? globalThis.Number(object.total) : 0, + }; + }, + + toJSON(message: PageResponse): unknown { + const obj: any = {}; + if (message.next_key.length !== 0) { + obj.next_key = base64FromBytes(message.next_key); + } + if (message.total !== 0) { + obj.total = Math.round(message.total); + } + return obj; + }, + + create, I>>(base?: I): PageResponse { + return PageResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): PageResponse { + const message = createBasePageResponse(); + message.next_key = object.next_key ?? new Uint8Array(0); + message.total = object.total ?? 0; + return message; + }, +}; + +function createBasePageRequest(): PageRequest { + return { key: new Uint8Array(0), offset: 0, limit: 0, count_total: false, reverse: false }; +} + +function createBasePageResponse(): PageResponse { + return { next_key: new Uint8Array(0), total: 0 }; +} + +function bytesFromBase64(b64: string): Uint8Array { + if ((globalThis as any).Buffer) { + return Uint8Array.from(globalThis.Buffer.from(b64, "base64")); + } else { + const bin = globalThis.atob(b64); + const arr = new Uint8Array(bin.length); + for (let i = 0; i < bin.length; ++i) { + arr[i] = bin.charCodeAt(i); + } + return arr; + } +} + +function base64FromBytes(arr: Uint8Array): string { + if ((globalThis as any).Buffer) { + return globalThis.Buffer.from(arr).toString("base64"); + } else { + const bin: string[] = []; + arr.forEach((byte) => { + bin.push(globalThis.String.fromCharCode(byte)); + }); + return globalThis.btoa(bin.join("")); + } +} + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} +export const registry: Array<[string, GeneratedType]> = [ + ["/cosmos.base.query.v1beta1.PageRequest", PageRequest as never], + ["/cosmos.base.query.v1beta1.PageResponse", PageResponse as never], +]; +export const aminoConverters = { + "/cosmos.base.query.v1beta1.PageRequest": { + aminoType: "cosmos-sdk/PageRequest", + toAmino: (message: PageRequest) => ({ ...message }), + fromAmino: (object: PageRequest) => ({ ...object }), + }, + + "/cosmos.base.query.v1beta1.PageResponse": { + aminoType: "cosmos-sdk/PageResponse", + toAmino: (message: PageResponse) => ({ ...message }), + fromAmino: (object: PageResponse) => ({ ...object }), + }, +}; diff --git a/packages/cosmos/generated/encoding/cosmos/base/reflection/v1beta1/index.ts b/packages/cosmos/generated/encoding/cosmos/base/reflection/v1beta1/index.ts new file mode 100644 index 000000000..c8c4801a7 --- /dev/null +++ b/packages/cosmos/generated/encoding/cosmos/base/reflection/v1beta1/index.ts @@ -0,0 +1,3 @@ +// @ts-nocheck + +export * from './reflection'; \ No newline at end of file diff --git a/packages/cosmos/generated/encoding/cosmos/base/reflection/v1beta1/reflection.ts b/packages/cosmos/generated/encoding/cosmos/base/reflection/v1beta1/reflection.ts new file mode 100644 index 000000000..0b0d8e641 --- /dev/null +++ b/packages/cosmos/generated/encoding/cosmos/base/reflection/v1beta1/reflection.ts @@ -0,0 +1,247 @@ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +import type { + ListAllInterfacesRequest as ListAllInterfacesRequest_type, + ListAllInterfacesResponse as ListAllInterfacesResponse_type, + ListImplementationsRequest as ListImplementationsRequest_type, + ListImplementationsResponse as ListImplementationsResponse_type, +} from "../../../../../types/cosmos/base/reflection/v1beta1"; + +import type { DeepPartial, Exact, MessageFns } from "../../../../common"; + +export interface ListAllInterfacesRequest extends ListAllInterfacesRequest_type {} +export interface ListAllInterfacesResponse extends ListAllInterfacesResponse_type {} +export interface ListImplementationsRequest extends ListImplementationsRequest_type {} +export interface ListImplementationsResponse extends ListImplementationsResponse_type {} + +export const ListAllInterfacesRequest: MessageFns = { + $type: "cosmos.base.reflection.v1beta1.ListAllInterfacesRequest" as const, + + encode(_: ListAllInterfacesRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ListAllInterfacesRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseListAllInterfacesRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): ListAllInterfacesRequest { + return {}; + }, + + toJSON(_: ListAllInterfacesRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): ListAllInterfacesRequest { + return ListAllInterfacesRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): ListAllInterfacesRequest { + const message = createBaseListAllInterfacesRequest(); + return message; + }, +}; + +export const ListAllInterfacesResponse: MessageFns = { + $type: "cosmos.base.reflection.v1beta1.ListAllInterfacesResponse" as const, + + encode(message: ListAllInterfacesResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.interface_names) { + writer.uint32(10).string(v!); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ListAllInterfacesResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseListAllInterfacesResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.interface_names.push(reader.string()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ListAllInterfacesResponse { + return { + interface_names: globalThis.Array.isArray(object?.interface_names) ? object.interface_names.map((e: any) => globalThis.String(e)) : [], + }; + }, + + toJSON(message: ListAllInterfacesResponse): unknown { + const obj: any = {}; + if (message.interface_names?.length) { + obj.interface_names = message.interface_names; + } + return obj; + }, + + create, I>>(base?: I): ListAllInterfacesResponse { + return ListAllInterfacesResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ListAllInterfacesResponse { + const message = createBaseListAllInterfacesResponse(); + message.interface_names = object.interface_names?.map((e) => e) || []; + return message; + }, +}; + +export const ListImplementationsRequest: MessageFns = { + $type: "cosmos.base.reflection.v1beta1.ListImplementationsRequest" as const, + + encode(message: ListImplementationsRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.interface_name !== "") { + writer.uint32(10).string(message.interface_name); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ListImplementationsRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseListImplementationsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.interface_name = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ListImplementationsRequest { + return { interface_name: isSet(object.interface_name) ? globalThis.String(object.interface_name) : "" }; + }, + + toJSON(message: ListImplementationsRequest): unknown { + const obj: any = {}; + if (message.interface_name !== "") { + obj.interface_name = message.interface_name; + } + return obj; + }, + + create, I>>(base?: I): ListImplementationsRequest { + return ListImplementationsRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ListImplementationsRequest { + const message = createBaseListImplementationsRequest(); + message.interface_name = object.interface_name ?? ""; + return message; + }, +}; + +export const ListImplementationsResponse: MessageFns = { + $type: "cosmos.base.reflection.v1beta1.ListImplementationsResponse" as const, + + encode(message: ListImplementationsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.implementation_message_names) { + writer.uint32(10).string(v!); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ListImplementationsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseListImplementationsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.implementation_message_names.push(reader.string()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ListImplementationsResponse { + return { + implementation_message_names: globalThis.Array.isArray(object?.implementation_message_names) + ? object.implementation_message_names.map((e: any) => globalThis.String(e)) + : [], + }; + }, + + toJSON(message: ListImplementationsResponse): unknown { + const obj: any = {}; + if (message.implementation_message_names?.length) { + obj.implementation_message_names = message.implementation_message_names; + } + return obj; + }, + + create, I>>(base?: I): ListImplementationsResponse { + return ListImplementationsResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ListImplementationsResponse { + const message = createBaseListImplementationsResponse(); + message.implementation_message_names = object.implementation_message_names?.map((e) => e) || []; + return message; + }, +}; + +function createBaseListAllInterfacesRequest(): ListAllInterfacesRequest { + return {}; +} + +function createBaseListAllInterfacesResponse(): ListAllInterfacesResponse { + return { interface_names: [] }; +} + +function createBaseListImplementationsRequest(): ListImplementationsRequest { + return { interface_name: "" }; +} + +function createBaseListImplementationsResponse(): ListImplementationsResponse { + return { implementation_message_names: [] }; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} diff --git a/packages/cosmos/generated/encoding/cosmos/base/reflection/v2alpha1/index.ts b/packages/cosmos/generated/encoding/cosmos/base/reflection/v2alpha1/index.ts new file mode 100644 index 000000000..c8c4801a7 --- /dev/null +++ b/packages/cosmos/generated/encoding/cosmos/base/reflection/v2alpha1/index.ts @@ -0,0 +1,3 @@ +// @ts-nocheck + +export * from './reflection'; \ No newline at end of file diff --git a/packages/cosmos/generated/encoding/cosmos/base/reflection/v2alpha1/reflection.ts b/packages/cosmos/generated/encoding/cosmos/base/reflection/v2alpha1/reflection.ts new file mode 100644 index 000000000..8ac5a3ced --- /dev/null +++ b/packages/cosmos/generated/encoding/cosmos/base/reflection/v2alpha1/reflection.ts @@ -0,0 +1,1841 @@ +import type { GeneratedType } from "@cosmjs/proto-signing"; + +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +import type { + AppDescriptor as AppDescriptor_type, + AuthnDescriptor as AuthnDescriptor_type, + ChainDescriptor as ChainDescriptor_type, + CodecDescriptor as CodecDescriptor_type, + ConfigurationDescriptor as ConfigurationDescriptor_type, + GetAuthnDescriptorRequest as GetAuthnDescriptorRequest_type, + GetAuthnDescriptorResponse as GetAuthnDescriptorResponse_type, + GetChainDescriptorRequest as GetChainDescriptorRequest_type, + GetChainDescriptorResponse as GetChainDescriptorResponse_type, + GetCodecDescriptorRequest as GetCodecDescriptorRequest_type, + GetCodecDescriptorResponse as GetCodecDescriptorResponse_type, + GetConfigurationDescriptorRequest as GetConfigurationDescriptorRequest_type, + GetConfigurationDescriptorResponse as GetConfigurationDescriptorResponse_type, + GetQueryServicesDescriptorRequest as GetQueryServicesDescriptorRequest_type, + GetQueryServicesDescriptorResponse as GetQueryServicesDescriptorResponse_type, + GetTxDescriptorRequest as GetTxDescriptorRequest_type, + GetTxDescriptorResponse as GetTxDescriptorResponse_type, + InterfaceAcceptingMessageDescriptor as InterfaceAcceptingMessageDescriptor_type, + InterfaceDescriptor as InterfaceDescriptor_type, + InterfaceImplementerDescriptor as InterfaceImplementerDescriptor_type, + MsgDescriptor as MsgDescriptor_type, + QueryMethodDescriptor as QueryMethodDescriptor_type, + QueryServiceDescriptor as QueryServiceDescriptor_type, + QueryServicesDescriptor as QueryServicesDescriptor_type, + SigningModeDescriptor as SigningModeDescriptor_type, + TxDescriptor as TxDescriptor_type, +} from "../../../../../types/cosmos/base/reflection/v2alpha1"; + +import type { DeepPartial, Exact, MessageFns } from "../../../../common"; + +export interface AppDescriptor extends AppDescriptor_type {} +export interface TxDescriptor extends TxDescriptor_type {} +export interface AuthnDescriptor extends AuthnDescriptor_type {} +export interface SigningModeDescriptor extends SigningModeDescriptor_type {} +export interface ChainDescriptor extends ChainDescriptor_type {} +export interface CodecDescriptor extends CodecDescriptor_type {} +export interface InterfaceDescriptor extends InterfaceDescriptor_type {} +export interface InterfaceImplementerDescriptor extends InterfaceImplementerDescriptor_type {} +export interface InterfaceAcceptingMessageDescriptor extends InterfaceAcceptingMessageDescriptor_type {} +export interface ConfigurationDescriptor extends ConfigurationDescriptor_type {} +export interface MsgDescriptor extends MsgDescriptor_type {} +export interface GetAuthnDescriptorRequest extends GetAuthnDescriptorRequest_type {} +export interface GetAuthnDescriptorResponse extends GetAuthnDescriptorResponse_type {} +export interface GetChainDescriptorRequest extends GetChainDescriptorRequest_type {} +export interface GetChainDescriptorResponse extends GetChainDescriptorResponse_type {} +export interface GetCodecDescriptorRequest extends GetCodecDescriptorRequest_type {} +export interface GetCodecDescriptorResponse extends GetCodecDescriptorResponse_type {} +export interface GetConfigurationDescriptorRequest extends GetConfigurationDescriptorRequest_type {} +export interface GetConfigurationDescriptorResponse extends GetConfigurationDescriptorResponse_type {} +export interface GetQueryServicesDescriptorRequest extends GetQueryServicesDescriptorRequest_type {} +export interface GetQueryServicesDescriptorResponse extends GetQueryServicesDescriptorResponse_type {} +export interface GetTxDescriptorRequest extends GetTxDescriptorRequest_type {} +export interface GetTxDescriptorResponse extends GetTxDescriptorResponse_type {} +export interface QueryServicesDescriptor extends QueryServicesDescriptor_type {} +export interface QueryServiceDescriptor extends QueryServiceDescriptor_type {} +export interface QueryMethodDescriptor extends QueryMethodDescriptor_type {} + +export const AppDescriptor: MessageFns = { + $type: "cosmos.base.reflection.v2alpha1.AppDescriptor" as const, + + encode(message: AppDescriptor, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.authn !== undefined) { + AuthnDescriptor.encode(message.authn, writer.uint32(10).fork()).join(); + } + if (message.chain !== undefined) { + ChainDescriptor.encode(message.chain, writer.uint32(18).fork()).join(); + } + if (message.codec !== undefined) { + CodecDescriptor.encode(message.codec, writer.uint32(26).fork()).join(); + } + if (message.configuration !== undefined) { + ConfigurationDescriptor.encode(message.configuration, writer.uint32(34).fork()).join(); + } + if (message.query_services !== undefined) { + QueryServicesDescriptor.encode(message.query_services, writer.uint32(42).fork()).join(); + } + if (message.tx !== undefined) { + TxDescriptor.encode(message.tx, writer.uint32(50).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): AppDescriptor { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseAppDescriptor(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.authn = AuthnDescriptor.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.chain = ChainDescriptor.decode(reader, reader.uint32()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.codec = CodecDescriptor.decode(reader, reader.uint32()); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.configuration = ConfigurationDescriptor.decode(reader, reader.uint32()); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.query_services = QueryServicesDescriptor.decode(reader, reader.uint32()); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.tx = TxDescriptor.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): AppDescriptor { + return { + authn: isSet(object.authn) ? AuthnDescriptor.fromJSON(object.authn) : undefined, + chain: isSet(object.chain) ? ChainDescriptor.fromJSON(object.chain) : undefined, + codec: isSet(object.codec) ? CodecDescriptor.fromJSON(object.codec) : undefined, + configuration: isSet(object.configuration) ? ConfigurationDescriptor.fromJSON(object.configuration) : undefined, + query_services: isSet(object.query_services) ? QueryServicesDescriptor.fromJSON(object.query_services) : undefined, + tx: isSet(object.tx) ? TxDescriptor.fromJSON(object.tx) : undefined, + }; + }, + + toJSON(message: AppDescriptor): unknown { + const obj: any = {}; + if (message.authn !== undefined) { + obj.authn = AuthnDescriptor.toJSON(message.authn); + } + if (message.chain !== undefined) { + obj.chain = ChainDescriptor.toJSON(message.chain); + } + if (message.codec !== undefined) { + obj.codec = CodecDescriptor.toJSON(message.codec); + } + if (message.configuration !== undefined) { + obj.configuration = ConfigurationDescriptor.toJSON(message.configuration); + } + if (message.query_services !== undefined) { + obj.query_services = QueryServicesDescriptor.toJSON(message.query_services); + } + if (message.tx !== undefined) { + obj.tx = TxDescriptor.toJSON(message.tx); + } + return obj; + }, + + create, I>>(base?: I): AppDescriptor { + return AppDescriptor.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): AppDescriptor { + const message = createBaseAppDescriptor(); + message.authn = object.authn !== undefined && object.authn !== null ? AuthnDescriptor.fromPartial(object.authn) : undefined; + message.chain = object.chain !== undefined && object.chain !== null ? ChainDescriptor.fromPartial(object.chain) : undefined; + message.codec = object.codec !== undefined && object.codec !== null ? CodecDescriptor.fromPartial(object.codec) : undefined; + message.configuration = + object.configuration !== undefined && object.configuration !== null ? ConfigurationDescriptor.fromPartial(object.configuration) : undefined; + message.query_services = + object.query_services !== undefined && object.query_services !== null ? QueryServicesDescriptor.fromPartial(object.query_services) : undefined; + message.tx = object.tx !== undefined && object.tx !== null ? TxDescriptor.fromPartial(object.tx) : undefined; + return message; + }, +}; + +export const TxDescriptor: MessageFns = { + $type: "cosmos.base.reflection.v2alpha1.TxDescriptor" as const, + + encode(message: TxDescriptor, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.fullname !== "") { + writer.uint32(10).string(message.fullname); + } + for (const v of message.msgs) { + MsgDescriptor.encode(v!, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): TxDescriptor { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseTxDescriptor(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.fullname = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.msgs.push(MsgDescriptor.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): TxDescriptor { + return { + fullname: isSet(object.fullname) ? globalThis.String(object.fullname) : "", + msgs: globalThis.Array.isArray(object?.msgs) ? object.msgs.map((e: any) => MsgDescriptor.fromJSON(e)) : [], + }; + }, + + toJSON(message: TxDescriptor): unknown { + const obj: any = {}; + if (message.fullname !== "") { + obj.fullname = message.fullname; + } + if (message.msgs?.length) { + obj.msgs = message.msgs.map((e) => MsgDescriptor.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): TxDescriptor { + return TxDescriptor.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): TxDescriptor { + const message = createBaseTxDescriptor(); + message.fullname = object.fullname ?? ""; + message.msgs = object.msgs?.map((e) => MsgDescriptor.fromPartial(e)) || []; + return message; + }, +}; + +export const AuthnDescriptor: MessageFns = { + $type: "cosmos.base.reflection.v2alpha1.AuthnDescriptor" as const, + + encode(message: AuthnDescriptor, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.sign_modes) { + SigningModeDescriptor.encode(v!, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): AuthnDescriptor { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseAuthnDescriptor(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.sign_modes.push(SigningModeDescriptor.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): AuthnDescriptor { + return { + sign_modes: globalThis.Array.isArray(object?.sign_modes) ? object.sign_modes.map((e: any) => SigningModeDescriptor.fromJSON(e)) : [], + }; + }, + + toJSON(message: AuthnDescriptor): unknown { + const obj: any = {}; + if (message.sign_modes?.length) { + obj.sign_modes = message.sign_modes.map((e) => SigningModeDescriptor.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): AuthnDescriptor { + return AuthnDescriptor.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): AuthnDescriptor { + const message = createBaseAuthnDescriptor(); + message.sign_modes = object.sign_modes?.map((e) => SigningModeDescriptor.fromPartial(e)) || []; + return message; + }, +}; + +export const SigningModeDescriptor: MessageFns = { + $type: "cosmos.base.reflection.v2alpha1.SigningModeDescriptor" as const, + + encode(message: SigningModeDescriptor, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== "") { + writer.uint32(10).string(message.name); + } + if (message.number !== 0) { + writer.uint32(16).int32(message.number); + } + if (message.authn_info_provider_method_fullname !== "") { + writer.uint32(26).string(message.authn_info_provider_method_fullname); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): SigningModeDescriptor { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseSigningModeDescriptor(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.name = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.number = reader.int32(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.authn_info_provider_method_fullname = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): SigningModeDescriptor { + return { + name: isSet(object.name) ? globalThis.String(object.name) : "", + number: isSet(object.number) ? globalThis.Number(object.number) : 0, + authn_info_provider_method_fullname: isSet(object.authn_info_provider_method_fullname) + ? globalThis.String(object.authn_info_provider_method_fullname) + : "", + }; + }, + + toJSON(message: SigningModeDescriptor): unknown { + const obj: any = {}; + if (message.name !== "") { + obj.name = message.name; + } + if (message.number !== 0) { + obj.number = Math.round(message.number); + } + if (message.authn_info_provider_method_fullname !== "") { + obj.authn_info_provider_method_fullname = message.authn_info_provider_method_fullname; + } + return obj; + }, + + create, I>>(base?: I): SigningModeDescriptor { + return SigningModeDescriptor.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): SigningModeDescriptor { + const message = createBaseSigningModeDescriptor(); + message.name = object.name ?? ""; + message.number = object.number ?? 0; + message.authn_info_provider_method_fullname = object.authn_info_provider_method_fullname ?? ""; + return message; + }, +}; + +export const ChainDescriptor: MessageFns = { + $type: "cosmos.base.reflection.v2alpha1.ChainDescriptor" as const, + + encode(message: ChainDescriptor, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.id !== "") { + writer.uint32(10).string(message.id); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ChainDescriptor { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseChainDescriptor(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.id = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ChainDescriptor { + return { id: isSet(object.id) ? globalThis.String(object.id) : "" }; + }, + + toJSON(message: ChainDescriptor): unknown { + const obj: any = {}; + if (message.id !== "") { + obj.id = message.id; + } + return obj; + }, + + create, I>>(base?: I): ChainDescriptor { + return ChainDescriptor.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ChainDescriptor { + const message = createBaseChainDescriptor(); + message.id = object.id ?? ""; + return message; + }, +}; + +export const CodecDescriptor: MessageFns = { + $type: "cosmos.base.reflection.v2alpha1.CodecDescriptor" as const, + + encode(message: CodecDescriptor, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.interfaces) { + InterfaceDescriptor.encode(v!, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): CodecDescriptor { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseCodecDescriptor(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.interfaces.push(InterfaceDescriptor.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): CodecDescriptor { + return { + interfaces: globalThis.Array.isArray(object?.interfaces) ? object.interfaces.map((e: any) => InterfaceDescriptor.fromJSON(e)) : [], + }; + }, + + toJSON(message: CodecDescriptor): unknown { + const obj: any = {}; + if (message.interfaces?.length) { + obj.interfaces = message.interfaces.map((e) => InterfaceDescriptor.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): CodecDescriptor { + return CodecDescriptor.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): CodecDescriptor { + const message = createBaseCodecDescriptor(); + message.interfaces = object.interfaces?.map((e) => InterfaceDescriptor.fromPartial(e)) || []; + return message; + }, +}; + +export const InterfaceDescriptor: MessageFns = { + $type: "cosmos.base.reflection.v2alpha1.InterfaceDescriptor" as const, + + encode(message: InterfaceDescriptor, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.fullname !== "") { + writer.uint32(10).string(message.fullname); + } + for (const v of message.interface_accepting_messages) { + InterfaceAcceptingMessageDescriptor.encode(v!, writer.uint32(18).fork()).join(); + } + for (const v of message.interface_implementers) { + InterfaceImplementerDescriptor.encode(v!, writer.uint32(26).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): InterfaceDescriptor { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseInterfaceDescriptor(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.fullname = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.interface_accepting_messages.push(InterfaceAcceptingMessageDescriptor.decode(reader, reader.uint32())); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.interface_implementers.push(InterfaceImplementerDescriptor.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): InterfaceDescriptor { + return { + fullname: isSet(object.fullname) ? globalThis.String(object.fullname) : "", + interface_accepting_messages: globalThis.Array.isArray(object?.interface_accepting_messages) + ? object.interface_accepting_messages.map((e: any) => InterfaceAcceptingMessageDescriptor.fromJSON(e)) + : [], + interface_implementers: globalThis.Array.isArray(object?.interface_implementers) + ? object.interface_implementers.map((e: any) => InterfaceImplementerDescriptor.fromJSON(e)) + : [], + }; + }, + + toJSON(message: InterfaceDescriptor): unknown { + const obj: any = {}; + if (message.fullname !== "") { + obj.fullname = message.fullname; + } + if (message.interface_accepting_messages?.length) { + obj.interface_accepting_messages = message.interface_accepting_messages.map((e) => InterfaceAcceptingMessageDescriptor.toJSON(e)); + } + if (message.interface_implementers?.length) { + obj.interface_implementers = message.interface_implementers.map((e) => InterfaceImplementerDescriptor.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): InterfaceDescriptor { + return InterfaceDescriptor.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): InterfaceDescriptor { + const message = createBaseInterfaceDescriptor(); + message.fullname = object.fullname ?? ""; + message.interface_accepting_messages = object.interface_accepting_messages?.map((e) => InterfaceAcceptingMessageDescriptor.fromPartial(e)) || []; + message.interface_implementers = object.interface_implementers?.map((e) => InterfaceImplementerDescriptor.fromPartial(e)) || []; + return message; + }, +}; + +export const InterfaceImplementerDescriptor: MessageFns = { + $type: "cosmos.base.reflection.v2alpha1.InterfaceImplementerDescriptor" as const, + + encode(message: InterfaceImplementerDescriptor, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.fullname !== "") { + writer.uint32(10).string(message.fullname); + } + if (message.type_url !== "") { + writer.uint32(18).string(message.type_url); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): InterfaceImplementerDescriptor { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseInterfaceImplementerDescriptor(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.fullname = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.type_url = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): InterfaceImplementerDescriptor { + return { + fullname: isSet(object.fullname) ? globalThis.String(object.fullname) : "", + type_url: isSet(object.type_url) ? globalThis.String(object.type_url) : "", + }; + }, + + toJSON(message: InterfaceImplementerDescriptor): unknown { + const obj: any = {}; + if (message.fullname !== "") { + obj.fullname = message.fullname; + } + if (message.type_url !== "") { + obj.type_url = message.type_url; + } + return obj; + }, + + create, I>>(base?: I): InterfaceImplementerDescriptor { + return InterfaceImplementerDescriptor.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): InterfaceImplementerDescriptor { + const message = createBaseInterfaceImplementerDescriptor(); + message.fullname = object.fullname ?? ""; + message.type_url = object.type_url ?? ""; + return message; + }, +}; + +export const InterfaceAcceptingMessageDescriptor: MessageFns< + InterfaceAcceptingMessageDescriptor, + "cosmos.base.reflection.v2alpha1.InterfaceAcceptingMessageDescriptor" +> = { + $type: "cosmos.base.reflection.v2alpha1.InterfaceAcceptingMessageDescriptor" as const, + + encode(message: InterfaceAcceptingMessageDescriptor, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.fullname !== "") { + writer.uint32(10).string(message.fullname); + } + for (const v of message.field_descriptor_names) { + writer.uint32(18).string(v!); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): InterfaceAcceptingMessageDescriptor { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseInterfaceAcceptingMessageDescriptor(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.fullname = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.field_descriptor_names.push(reader.string()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): InterfaceAcceptingMessageDescriptor { + return { + fullname: isSet(object.fullname) ? globalThis.String(object.fullname) : "", + field_descriptor_names: globalThis.Array.isArray(object?.field_descriptor_names) + ? object.field_descriptor_names.map((e: any) => globalThis.String(e)) + : [], + }; + }, + + toJSON(message: InterfaceAcceptingMessageDescriptor): unknown { + const obj: any = {}; + if (message.fullname !== "") { + obj.fullname = message.fullname; + } + if (message.field_descriptor_names?.length) { + obj.field_descriptor_names = message.field_descriptor_names; + } + return obj; + }, + + create, I>>(base?: I): InterfaceAcceptingMessageDescriptor { + return InterfaceAcceptingMessageDescriptor.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): InterfaceAcceptingMessageDescriptor { + const message = createBaseInterfaceAcceptingMessageDescriptor(); + message.fullname = object.fullname ?? ""; + message.field_descriptor_names = object.field_descriptor_names?.map((e) => e) || []; + return message; + }, +}; + +export const ConfigurationDescriptor: MessageFns = { + $type: "cosmos.base.reflection.v2alpha1.ConfigurationDescriptor" as const, + + encode(message: ConfigurationDescriptor, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.bech32_account_address_prefix !== "") { + writer.uint32(10).string(message.bech32_account_address_prefix); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ConfigurationDescriptor { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseConfigurationDescriptor(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.bech32_account_address_prefix = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ConfigurationDescriptor { + return { + bech32_account_address_prefix: isSet(object.bech32_account_address_prefix) ? globalThis.String(object.bech32_account_address_prefix) : "", + }; + }, + + toJSON(message: ConfigurationDescriptor): unknown { + const obj: any = {}; + if (message.bech32_account_address_prefix !== "") { + obj.bech32_account_address_prefix = message.bech32_account_address_prefix; + } + return obj; + }, + + create, I>>(base?: I): ConfigurationDescriptor { + return ConfigurationDescriptor.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ConfigurationDescriptor { + const message = createBaseConfigurationDescriptor(); + message.bech32_account_address_prefix = object.bech32_account_address_prefix ?? ""; + return message; + }, +}; + +export const MsgDescriptor: MessageFns = { + $type: "cosmos.base.reflection.v2alpha1.MsgDescriptor" as const, + + encode(message: MsgDescriptor, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.msg_type_url !== "") { + writer.uint32(10).string(message.msg_type_url); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgDescriptor { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgDescriptor(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.msg_type_url = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgDescriptor { + return { msg_type_url: isSet(object.msg_type_url) ? globalThis.String(object.msg_type_url) : "" }; + }, + + toJSON(message: MsgDescriptor): unknown { + const obj: any = {}; + if (message.msg_type_url !== "") { + obj.msg_type_url = message.msg_type_url; + } + return obj; + }, + + create, I>>(base?: I): MsgDescriptor { + return MsgDescriptor.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgDescriptor { + const message = createBaseMsgDescriptor(); + message.msg_type_url = object.msg_type_url ?? ""; + return message; + }, +}; + +export const GetAuthnDescriptorRequest: MessageFns = { + $type: "cosmos.base.reflection.v2alpha1.GetAuthnDescriptorRequest" as const, + + encode(_: GetAuthnDescriptorRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetAuthnDescriptorRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetAuthnDescriptorRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): GetAuthnDescriptorRequest { + return {}; + }, + + toJSON(_: GetAuthnDescriptorRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): GetAuthnDescriptorRequest { + return GetAuthnDescriptorRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): GetAuthnDescriptorRequest { + const message = createBaseGetAuthnDescriptorRequest(); + return message; + }, +}; + +export const GetAuthnDescriptorResponse: MessageFns = { + $type: "cosmos.base.reflection.v2alpha1.GetAuthnDescriptorResponse" as const, + + encode(message: GetAuthnDescriptorResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.authn !== undefined) { + AuthnDescriptor.encode(message.authn, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetAuthnDescriptorResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetAuthnDescriptorResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.authn = AuthnDescriptor.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GetAuthnDescriptorResponse { + return { authn: isSet(object.authn) ? AuthnDescriptor.fromJSON(object.authn) : undefined }; + }, + + toJSON(message: GetAuthnDescriptorResponse): unknown { + const obj: any = {}; + if (message.authn !== undefined) { + obj.authn = AuthnDescriptor.toJSON(message.authn); + } + return obj; + }, + + create, I>>(base?: I): GetAuthnDescriptorResponse { + return GetAuthnDescriptorResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): GetAuthnDescriptorResponse { + const message = createBaseGetAuthnDescriptorResponse(); + message.authn = object.authn !== undefined && object.authn !== null ? AuthnDescriptor.fromPartial(object.authn) : undefined; + return message; + }, +}; + +export const GetChainDescriptorRequest: MessageFns = { + $type: "cosmos.base.reflection.v2alpha1.GetChainDescriptorRequest" as const, + + encode(_: GetChainDescriptorRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetChainDescriptorRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetChainDescriptorRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): GetChainDescriptorRequest { + return {}; + }, + + toJSON(_: GetChainDescriptorRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): GetChainDescriptorRequest { + return GetChainDescriptorRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): GetChainDescriptorRequest { + const message = createBaseGetChainDescriptorRequest(); + return message; + }, +}; + +export const GetChainDescriptorResponse: MessageFns = { + $type: "cosmos.base.reflection.v2alpha1.GetChainDescriptorResponse" as const, + + encode(message: GetChainDescriptorResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.chain !== undefined) { + ChainDescriptor.encode(message.chain, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetChainDescriptorResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetChainDescriptorResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.chain = ChainDescriptor.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GetChainDescriptorResponse { + return { chain: isSet(object.chain) ? ChainDescriptor.fromJSON(object.chain) : undefined }; + }, + + toJSON(message: GetChainDescriptorResponse): unknown { + const obj: any = {}; + if (message.chain !== undefined) { + obj.chain = ChainDescriptor.toJSON(message.chain); + } + return obj; + }, + + create, I>>(base?: I): GetChainDescriptorResponse { + return GetChainDescriptorResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): GetChainDescriptorResponse { + const message = createBaseGetChainDescriptorResponse(); + message.chain = object.chain !== undefined && object.chain !== null ? ChainDescriptor.fromPartial(object.chain) : undefined; + return message; + }, +}; + +export const GetCodecDescriptorRequest: MessageFns = { + $type: "cosmos.base.reflection.v2alpha1.GetCodecDescriptorRequest" as const, + + encode(_: GetCodecDescriptorRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetCodecDescriptorRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetCodecDescriptorRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): GetCodecDescriptorRequest { + return {}; + }, + + toJSON(_: GetCodecDescriptorRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): GetCodecDescriptorRequest { + return GetCodecDescriptorRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): GetCodecDescriptorRequest { + const message = createBaseGetCodecDescriptorRequest(); + return message; + }, +}; + +export const GetCodecDescriptorResponse: MessageFns = { + $type: "cosmos.base.reflection.v2alpha1.GetCodecDescriptorResponse" as const, + + encode(message: GetCodecDescriptorResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.codec !== undefined) { + CodecDescriptor.encode(message.codec, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetCodecDescriptorResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetCodecDescriptorResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.codec = CodecDescriptor.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GetCodecDescriptorResponse { + return { codec: isSet(object.codec) ? CodecDescriptor.fromJSON(object.codec) : undefined }; + }, + + toJSON(message: GetCodecDescriptorResponse): unknown { + const obj: any = {}; + if (message.codec !== undefined) { + obj.codec = CodecDescriptor.toJSON(message.codec); + } + return obj; + }, + + create, I>>(base?: I): GetCodecDescriptorResponse { + return GetCodecDescriptorResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): GetCodecDescriptorResponse { + const message = createBaseGetCodecDescriptorResponse(); + message.codec = object.codec !== undefined && object.codec !== null ? CodecDescriptor.fromPartial(object.codec) : undefined; + return message; + }, +}; + +export const GetConfigurationDescriptorRequest: MessageFns< + GetConfigurationDescriptorRequest, + "cosmos.base.reflection.v2alpha1.GetConfigurationDescriptorRequest" +> = { + $type: "cosmos.base.reflection.v2alpha1.GetConfigurationDescriptorRequest" as const, + + encode(_: GetConfigurationDescriptorRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetConfigurationDescriptorRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetConfigurationDescriptorRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): GetConfigurationDescriptorRequest { + return {}; + }, + + toJSON(_: GetConfigurationDescriptorRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): GetConfigurationDescriptorRequest { + return GetConfigurationDescriptorRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): GetConfigurationDescriptorRequest { + const message = createBaseGetConfigurationDescriptorRequest(); + return message; + }, +}; + +export const GetConfigurationDescriptorResponse: MessageFns< + GetConfigurationDescriptorResponse, + "cosmos.base.reflection.v2alpha1.GetConfigurationDescriptorResponse" +> = { + $type: "cosmos.base.reflection.v2alpha1.GetConfigurationDescriptorResponse" as const, + + encode(message: GetConfigurationDescriptorResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.config !== undefined) { + ConfigurationDescriptor.encode(message.config, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetConfigurationDescriptorResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetConfigurationDescriptorResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.config = ConfigurationDescriptor.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GetConfigurationDescriptorResponse { + return { config: isSet(object.config) ? ConfigurationDescriptor.fromJSON(object.config) : undefined }; + }, + + toJSON(message: GetConfigurationDescriptorResponse): unknown { + const obj: any = {}; + if (message.config !== undefined) { + obj.config = ConfigurationDescriptor.toJSON(message.config); + } + return obj; + }, + + create, I>>(base?: I): GetConfigurationDescriptorResponse { + return GetConfigurationDescriptorResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): GetConfigurationDescriptorResponse { + const message = createBaseGetConfigurationDescriptorResponse(); + message.config = object.config !== undefined && object.config !== null ? ConfigurationDescriptor.fromPartial(object.config) : undefined; + return message; + }, +}; + +export const GetQueryServicesDescriptorRequest: MessageFns< + GetQueryServicesDescriptorRequest, + "cosmos.base.reflection.v2alpha1.GetQueryServicesDescriptorRequest" +> = { + $type: "cosmos.base.reflection.v2alpha1.GetQueryServicesDescriptorRequest" as const, + + encode(_: GetQueryServicesDescriptorRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetQueryServicesDescriptorRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetQueryServicesDescriptorRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): GetQueryServicesDescriptorRequest { + return {}; + }, + + toJSON(_: GetQueryServicesDescriptorRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): GetQueryServicesDescriptorRequest { + return GetQueryServicesDescriptorRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): GetQueryServicesDescriptorRequest { + const message = createBaseGetQueryServicesDescriptorRequest(); + return message; + }, +}; + +export const GetQueryServicesDescriptorResponse: MessageFns< + GetQueryServicesDescriptorResponse, + "cosmos.base.reflection.v2alpha1.GetQueryServicesDescriptorResponse" +> = { + $type: "cosmos.base.reflection.v2alpha1.GetQueryServicesDescriptorResponse" as const, + + encode(message: GetQueryServicesDescriptorResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.queries !== undefined) { + QueryServicesDescriptor.encode(message.queries, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetQueryServicesDescriptorResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetQueryServicesDescriptorResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.queries = QueryServicesDescriptor.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GetQueryServicesDescriptorResponse { + return { queries: isSet(object.queries) ? QueryServicesDescriptor.fromJSON(object.queries) : undefined }; + }, + + toJSON(message: GetQueryServicesDescriptorResponse): unknown { + const obj: any = {}; + if (message.queries !== undefined) { + obj.queries = QueryServicesDescriptor.toJSON(message.queries); + } + return obj; + }, + + create, I>>(base?: I): GetQueryServicesDescriptorResponse { + return GetQueryServicesDescriptorResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): GetQueryServicesDescriptorResponse { + const message = createBaseGetQueryServicesDescriptorResponse(); + message.queries = object.queries !== undefined && object.queries !== null ? QueryServicesDescriptor.fromPartial(object.queries) : undefined; + return message; + }, +}; + +export const GetTxDescriptorRequest: MessageFns = { + $type: "cosmos.base.reflection.v2alpha1.GetTxDescriptorRequest" as const, + + encode(_: GetTxDescriptorRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetTxDescriptorRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetTxDescriptorRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): GetTxDescriptorRequest { + return {}; + }, + + toJSON(_: GetTxDescriptorRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): GetTxDescriptorRequest { + return GetTxDescriptorRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): GetTxDescriptorRequest { + const message = createBaseGetTxDescriptorRequest(); + return message; + }, +}; + +export const GetTxDescriptorResponse: MessageFns = { + $type: "cosmos.base.reflection.v2alpha1.GetTxDescriptorResponse" as const, + + encode(message: GetTxDescriptorResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.tx !== undefined) { + TxDescriptor.encode(message.tx, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetTxDescriptorResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetTxDescriptorResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.tx = TxDescriptor.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GetTxDescriptorResponse { + return { tx: isSet(object.tx) ? TxDescriptor.fromJSON(object.tx) : undefined }; + }, + + toJSON(message: GetTxDescriptorResponse): unknown { + const obj: any = {}; + if (message.tx !== undefined) { + obj.tx = TxDescriptor.toJSON(message.tx); + } + return obj; + }, + + create, I>>(base?: I): GetTxDescriptorResponse { + return GetTxDescriptorResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): GetTxDescriptorResponse { + const message = createBaseGetTxDescriptorResponse(); + message.tx = object.tx !== undefined && object.tx !== null ? TxDescriptor.fromPartial(object.tx) : undefined; + return message; + }, +}; + +export const QueryServicesDescriptor: MessageFns = { + $type: "cosmos.base.reflection.v2alpha1.QueryServicesDescriptor" as const, + + encode(message: QueryServicesDescriptor, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.query_services) { + QueryServiceDescriptor.encode(v!, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryServicesDescriptor { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryServicesDescriptor(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.query_services.push(QueryServiceDescriptor.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryServicesDescriptor { + return { + query_services: globalThis.Array.isArray(object?.query_services) ? object.query_services.map((e: any) => QueryServiceDescriptor.fromJSON(e)) : [], + }; + }, + + toJSON(message: QueryServicesDescriptor): unknown { + const obj: any = {}; + if (message.query_services?.length) { + obj.query_services = message.query_services.map((e) => QueryServiceDescriptor.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): QueryServicesDescriptor { + return QueryServicesDescriptor.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryServicesDescriptor { + const message = createBaseQueryServicesDescriptor(); + message.query_services = object.query_services?.map((e) => QueryServiceDescriptor.fromPartial(e)) || []; + return message; + }, +}; + +export const QueryServiceDescriptor: MessageFns = { + $type: "cosmos.base.reflection.v2alpha1.QueryServiceDescriptor" as const, + + encode(message: QueryServiceDescriptor, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.fullname !== "") { + writer.uint32(10).string(message.fullname); + } + if (message.is_module !== false) { + writer.uint32(16).bool(message.is_module); + } + for (const v of message.methods) { + QueryMethodDescriptor.encode(v!, writer.uint32(26).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryServiceDescriptor { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryServiceDescriptor(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.fullname = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.is_module = reader.bool(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.methods.push(QueryMethodDescriptor.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryServiceDescriptor { + return { + fullname: isSet(object.fullname) ? globalThis.String(object.fullname) : "", + is_module: isSet(object.is_module) ? globalThis.Boolean(object.is_module) : false, + methods: globalThis.Array.isArray(object?.methods) ? object.methods.map((e: any) => QueryMethodDescriptor.fromJSON(e)) : [], + }; + }, + + toJSON(message: QueryServiceDescriptor): unknown { + const obj: any = {}; + if (message.fullname !== "") { + obj.fullname = message.fullname; + } + if (message.is_module !== false) { + obj.is_module = message.is_module; + } + if (message.methods?.length) { + obj.methods = message.methods.map((e) => QueryMethodDescriptor.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): QueryServiceDescriptor { + return QueryServiceDescriptor.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryServiceDescriptor { + const message = createBaseQueryServiceDescriptor(); + message.fullname = object.fullname ?? ""; + message.is_module = object.is_module ?? false; + message.methods = object.methods?.map((e) => QueryMethodDescriptor.fromPartial(e)) || []; + return message; + }, +}; + +export const QueryMethodDescriptor: MessageFns = { + $type: "cosmos.base.reflection.v2alpha1.QueryMethodDescriptor" as const, + + encode(message: QueryMethodDescriptor, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== "") { + writer.uint32(10).string(message.name); + } + if (message.full_query_path !== "") { + writer.uint32(18).string(message.full_query_path); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryMethodDescriptor { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryMethodDescriptor(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.name = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.full_query_path = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryMethodDescriptor { + return { + name: isSet(object.name) ? globalThis.String(object.name) : "", + full_query_path: isSet(object.full_query_path) ? globalThis.String(object.full_query_path) : "", + }; + }, + + toJSON(message: QueryMethodDescriptor): unknown { + const obj: any = {}; + if (message.name !== "") { + obj.name = message.name; + } + if (message.full_query_path !== "") { + obj.full_query_path = message.full_query_path; + } + return obj; + }, + + create, I>>(base?: I): QueryMethodDescriptor { + return QueryMethodDescriptor.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryMethodDescriptor { + const message = createBaseQueryMethodDescriptor(); + message.name = object.name ?? ""; + message.full_query_path = object.full_query_path ?? ""; + return message; + }, +}; + +function createBaseAppDescriptor(): AppDescriptor { + return { + authn: undefined, + chain: undefined, + codec: undefined, + configuration: undefined, + query_services: undefined, + tx: undefined, + }; +} + +function createBaseTxDescriptor(): TxDescriptor { + return { fullname: "", msgs: [] }; +} + +function createBaseAuthnDescriptor(): AuthnDescriptor { + return { sign_modes: [] }; +} + +function createBaseSigningModeDescriptor(): SigningModeDescriptor { + return { name: "", number: 0, authn_info_provider_method_fullname: "" }; +} + +function createBaseChainDescriptor(): ChainDescriptor { + return { id: "" }; +} + +function createBaseCodecDescriptor(): CodecDescriptor { + return { interfaces: [] }; +} + +function createBaseInterfaceDescriptor(): InterfaceDescriptor { + return { fullname: "", interface_accepting_messages: [], interface_implementers: [] }; +} + +function createBaseInterfaceImplementerDescriptor(): InterfaceImplementerDescriptor { + return { fullname: "", type_url: "" }; +} + +function createBaseInterfaceAcceptingMessageDescriptor(): InterfaceAcceptingMessageDescriptor { + return { fullname: "", field_descriptor_names: [] }; +} + +function createBaseConfigurationDescriptor(): ConfigurationDescriptor { + return { bech32_account_address_prefix: "" }; +} + +function createBaseMsgDescriptor(): MsgDescriptor { + return { msg_type_url: "" }; +} + +function createBaseGetAuthnDescriptorRequest(): GetAuthnDescriptorRequest { + return {}; +} + +function createBaseGetAuthnDescriptorResponse(): GetAuthnDescriptorResponse { + return { authn: undefined }; +} + +function createBaseGetChainDescriptorRequest(): GetChainDescriptorRequest { + return {}; +} + +function createBaseGetChainDescriptorResponse(): GetChainDescriptorResponse { + return { chain: undefined }; +} + +function createBaseGetCodecDescriptorRequest(): GetCodecDescriptorRequest { + return {}; +} + +function createBaseGetCodecDescriptorResponse(): GetCodecDescriptorResponse { + return { codec: undefined }; +} + +function createBaseGetConfigurationDescriptorRequest(): GetConfigurationDescriptorRequest { + return {}; +} + +function createBaseGetConfigurationDescriptorResponse(): GetConfigurationDescriptorResponse { + return { config: undefined }; +} + +function createBaseGetQueryServicesDescriptorRequest(): GetQueryServicesDescriptorRequest { + return {}; +} + +function createBaseGetQueryServicesDescriptorResponse(): GetQueryServicesDescriptorResponse { + return { queries: undefined }; +} + +function createBaseGetTxDescriptorRequest(): GetTxDescriptorRequest { + return {}; +} + +function createBaseGetTxDescriptorResponse(): GetTxDescriptorResponse { + return { tx: undefined }; +} + +function createBaseQueryServicesDescriptor(): QueryServicesDescriptor { + return { query_services: [] }; +} + +function createBaseQueryServiceDescriptor(): QueryServiceDescriptor { + return { fullname: "", is_module: false, methods: [] }; +} + +function createBaseQueryMethodDescriptor(): QueryMethodDescriptor { + return { name: "", full_query_path: "" }; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} +export const registry: Array<[string, GeneratedType]> = [ + ["/cosmos.base.reflection.v2alpha1.AppDescriptor", AppDescriptor as never], + ["/cosmos.base.reflection.v2alpha1.TxDescriptor", TxDescriptor as never], + ["/cosmos.base.reflection.v2alpha1.AuthnDescriptor", AuthnDescriptor as never], + ["/cosmos.base.reflection.v2alpha1.ChainDescriptor", ChainDescriptor as never], + ["/cosmos.base.reflection.v2alpha1.CodecDescriptor", CodecDescriptor as never], + ["/cosmos.base.reflection.v2alpha1.MsgDescriptor", MsgDescriptor as never], +]; +export const aminoConverters = { + "/cosmos.base.reflection.v2alpha1.AppDescriptor": { + aminoType: "cosmos-sdk/AppDescriptor", + toAmino: (message: AppDescriptor) => ({ ...message }), + fromAmino: (object: AppDescriptor) => ({ ...object }), + }, + + "/cosmos.base.reflection.v2alpha1.TxDescriptor": { + aminoType: "cosmos-sdk/TxDescriptor", + toAmino: (message: TxDescriptor) => ({ ...message }), + fromAmino: (object: TxDescriptor) => ({ ...object }), + }, + + "/cosmos.base.reflection.v2alpha1.AuthnDescriptor": { + aminoType: "cosmos-sdk/AuthnDescriptor", + toAmino: (message: AuthnDescriptor) => ({ ...message }), + fromAmino: (object: AuthnDescriptor) => ({ ...object }), + }, + + "/cosmos.base.reflection.v2alpha1.ChainDescriptor": { + aminoType: "cosmos-sdk/ChainDescriptor", + toAmino: (message: ChainDescriptor) => ({ ...message }), + fromAmino: (object: ChainDescriptor) => ({ ...object }), + }, + + "/cosmos.base.reflection.v2alpha1.CodecDescriptor": { + aminoType: "cosmos-sdk/CodecDescriptor", + toAmino: (message: CodecDescriptor) => ({ ...message }), + fromAmino: (object: CodecDescriptor) => ({ ...object }), + }, + + "/cosmos.base.reflection.v2alpha1.MsgDescriptor": { + aminoType: "cosmos-sdk/MsgDescriptor", + toAmino: (message: MsgDescriptor) => ({ ...message }), + fromAmino: (object: MsgDescriptor) => ({ ...object }), + }, +}; diff --git a/packages/cosmos/generated/encoding/cosmos/base/snapshots/v1beta1/index.ts b/packages/cosmos/generated/encoding/cosmos/base/snapshots/v1beta1/index.ts new file mode 100644 index 000000000..51d895881 --- /dev/null +++ b/packages/cosmos/generated/encoding/cosmos/base/snapshots/v1beta1/index.ts @@ -0,0 +1,3 @@ +// @ts-nocheck + +export * from './snapshot'; \ No newline at end of file diff --git a/packages/cosmos/generated/encoding/cosmos/base/snapshots/v1beta1/snapshot.ts b/packages/cosmos/generated/encoding/cosmos/base/snapshots/v1beta1/snapshot.ts new file mode 100644 index 000000000..cb642a2dd --- /dev/null +++ b/packages/cosmos/generated/encoding/cosmos/base/snapshots/v1beta1/snapshot.ts @@ -0,0 +1,690 @@ +import type { GeneratedType } from "@cosmjs/proto-signing"; + +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +import type { + Metadata as Metadata_type, + SnapshotExtensionMeta as SnapshotExtensionMeta_type, + SnapshotExtensionPayload as SnapshotExtensionPayload_type, + SnapshotIAVLItem as SnapshotIAVLItem_type, + SnapshotItem as SnapshotItem_type, + SnapshotStoreItem as SnapshotStoreItem_type, + Snapshot as Snapshot_type, +} from "../../../../../types/cosmos/base/snapshots/v1beta1"; + +import type { DeepPartial, Exact, MessageFns } from "../../../../common"; + +export interface Snapshot extends Snapshot_type {} +export interface Metadata extends Metadata_type {} +export interface SnapshotItem extends SnapshotItem_type {} +export interface SnapshotStoreItem extends SnapshotStoreItem_type {} +export interface SnapshotIAVLItem extends SnapshotIAVLItem_type {} +export interface SnapshotExtensionMeta extends SnapshotExtensionMeta_type {} +export interface SnapshotExtensionPayload extends SnapshotExtensionPayload_type {} + +export const Snapshot: MessageFns = { + $type: "cosmos.base.snapshots.v1beta1.Snapshot" as const, + + encode(message: Snapshot, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.height !== 0) { + writer.uint32(8).uint64(message.height); + } + if (message.format !== 0) { + writer.uint32(16).uint32(message.format); + } + if (message.chunks !== 0) { + writer.uint32(24).uint32(message.chunks); + } + if (message.hash.length !== 0) { + writer.uint32(34).bytes(message.hash); + } + if (message.metadata !== undefined) { + Metadata.encode(message.metadata, writer.uint32(42).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Snapshot { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseSnapshot(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.height = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.format = reader.uint32(); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.chunks = reader.uint32(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.hash = reader.bytes(); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.metadata = Metadata.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Snapshot { + return { + height: isSet(object.height) ? globalThis.Number(object.height) : 0, + format: isSet(object.format) ? globalThis.Number(object.format) : 0, + chunks: isSet(object.chunks) ? globalThis.Number(object.chunks) : 0, + hash: isSet(object.hash) ? bytesFromBase64(object.hash) : new Uint8Array(0), + metadata: isSet(object.metadata) ? Metadata.fromJSON(object.metadata) : undefined, + }; + }, + + toJSON(message: Snapshot): unknown { + const obj: any = {}; + if (message.height !== 0) { + obj.height = Math.round(message.height); + } + if (message.format !== 0) { + obj.format = Math.round(message.format); + } + if (message.chunks !== 0) { + obj.chunks = Math.round(message.chunks); + } + if (message.hash.length !== 0) { + obj.hash = base64FromBytes(message.hash); + } + if (message.metadata !== undefined) { + obj.metadata = Metadata.toJSON(message.metadata); + } + return obj; + }, + + create, I>>(base?: I): Snapshot { + return Snapshot.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Snapshot { + const message = createBaseSnapshot(); + message.height = object.height ?? 0; + message.format = object.format ?? 0; + message.chunks = object.chunks ?? 0; + message.hash = object.hash ?? new Uint8Array(0); + message.metadata = object.metadata !== undefined && object.metadata !== null ? Metadata.fromPartial(object.metadata) : undefined; + return message; + }, +}; + +export const Metadata: MessageFns = { + $type: "cosmos.base.snapshots.v1beta1.Metadata" as const, + + encode(message: Metadata, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.chunk_hashes) { + writer.uint32(10).bytes(v!); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Metadata { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMetadata(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.chunk_hashes.push(reader.bytes()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Metadata { + return { + chunk_hashes: globalThis.Array.isArray(object?.chunk_hashes) ? object.chunk_hashes.map((e: any) => bytesFromBase64(e)) : [], + }; + }, + + toJSON(message: Metadata): unknown { + const obj: any = {}; + if (message.chunk_hashes?.length) { + obj.chunk_hashes = message.chunk_hashes.map((e) => base64FromBytes(e)); + } + return obj; + }, + + create, I>>(base?: I): Metadata { + return Metadata.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Metadata { + const message = createBaseMetadata(); + message.chunk_hashes = object.chunk_hashes?.map((e) => e) || []; + return message; + }, +}; + +export const SnapshotItem: MessageFns = { + $type: "cosmos.base.snapshots.v1beta1.SnapshotItem" as const, + + encode(message: SnapshotItem, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.store !== undefined) { + SnapshotStoreItem.encode(message.store, writer.uint32(10).fork()).join(); + } + if (message.iavl !== undefined) { + SnapshotIAVLItem.encode(message.iavl, writer.uint32(18).fork()).join(); + } + if (message.extension !== undefined) { + SnapshotExtensionMeta.encode(message.extension, writer.uint32(26).fork()).join(); + } + if (message.extension_payload !== undefined) { + SnapshotExtensionPayload.encode(message.extension_payload, writer.uint32(34).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): SnapshotItem { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseSnapshotItem(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.store = SnapshotStoreItem.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.iavl = SnapshotIAVLItem.decode(reader, reader.uint32()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.extension = SnapshotExtensionMeta.decode(reader, reader.uint32()); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.extension_payload = SnapshotExtensionPayload.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): SnapshotItem { + return { + store: isSet(object.store) ? SnapshotStoreItem.fromJSON(object.store) : undefined, + iavl: isSet(object.iavl) ? SnapshotIAVLItem.fromJSON(object.iavl) : undefined, + extension: isSet(object.extension) ? SnapshotExtensionMeta.fromJSON(object.extension) : undefined, + extension_payload: isSet(object.extension_payload) ? SnapshotExtensionPayload.fromJSON(object.extension_payload) : undefined, + }; + }, + + toJSON(message: SnapshotItem): unknown { + const obj: any = {}; + if (message.store !== undefined) { + obj.store = SnapshotStoreItem.toJSON(message.store); + } + if (message.iavl !== undefined) { + obj.iavl = SnapshotIAVLItem.toJSON(message.iavl); + } + if (message.extension !== undefined) { + obj.extension = SnapshotExtensionMeta.toJSON(message.extension); + } + if (message.extension_payload !== undefined) { + obj.extension_payload = SnapshotExtensionPayload.toJSON(message.extension_payload); + } + return obj; + }, + + create, I>>(base?: I): SnapshotItem { + return SnapshotItem.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): SnapshotItem { + const message = createBaseSnapshotItem(); + message.store = object.store !== undefined && object.store !== null ? SnapshotStoreItem.fromPartial(object.store) : undefined; + message.iavl = object.iavl !== undefined && object.iavl !== null ? SnapshotIAVLItem.fromPartial(object.iavl) : undefined; + message.extension = object.extension !== undefined && object.extension !== null ? SnapshotExtensionMeta.fromPartial(object.extension) : undefined; + message.extension_payload = + object.extension_payload !== undefined && object.extension_payload !== null ? SnapshotExtensionPayload.fromPartial(object.extension_payload) : undefined; + return message; + }, +}; + +export const SnapshotStoreItem: MessageFns = { + $type: "cosmos.base.snapshots.v1beta1.SnapshotStoreItem" as const, + + encode(message: SnapshotStoreItem, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== "") { + writer.uint32(10).string(message.name); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): SnapshotStoreItem { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseSnapshotStoreItem(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.name = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): SnapshotStoreItem { + return { name: isSet(object.name) ? globalThis.String(object.name) : "" }; + }, + + toJSON(message: SnapshotStoreItem): unknown { + const obj: any = {}; + if (message.name !== "") { + obj.name = message.name; + } + return obj; + }, + + create, I>>(base?: I): SnapshotStoreItem { + return SnapshotStoreItem.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): SnapshotStoreItem { + const message = createBaseSnapshotStoreItem(); + message.name = object.name ?? ""; + return message; + }, +}; + +export const SnapshotIAVLItem: MessageFns = { + $type: "cosmos.base.snapshots.v1beta1.SnapshotIAVLItem" as const, + + encode(message: SnapshotIAVLItem, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.key.length !== 0) { + writer.uint32(10).bytes(message.key); + } + if (message.value.length !== 0) { + writer.uint32(18).bytes(message.value); + } + if (message.version !== 0) { + writer.uint32(24).int64(message.version); + } + if (message.height !== 0) { + writer.uint32(32).int32(message.height); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): SnapshotIAVLItem { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseSnapshotIAVLItem(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.key = reader.bytes(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.value = reader.bytes(); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.version = longToNumber(reader.int64()); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.height = reader.int32(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): SnapshotIAVLItem { + return { + key: isSet(object.key) ? bytesFromBase64(object.key) : new Uint8Array(0), + value: isSet(object.value) ? bytesFromBase64(object.value) : new Uint8Array(0), + version: isSet(object.version) ? globalThis.Number(object.version) : 0, + height: isSet(object.height) ? globalThis.Number(object.height) : 0, + }; + }, + + toJSON(message: SnapshotIAVLItem): unknown { + const obj: any = {}; + if (message.key.length !== 0) { + obj.key = base64FromBytes(message.key); + } + if (message.value.length !== 0) { + obj.value = base64FromBytes(message.value); + } + if (message.version !== 0) { + obj.version = Math.round(message.version); + } + if (message.height !== 0) { + obj.height = Math.round(message.height); + } + return obj; + }, + + create, I>>(base?: I): SnapshotIAVLItem { + return SnapshotIAVLItem.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): SnapshotIAVLItem { + const message = createBaseSnapshotIAVLItem(); + message.key = object.key ?? new Uint8Array(0); + message.value = object.value ?? new Uint8Array(0); + message.version = object.version ?? 0; + message.height = object.height ?? 0; + return message; + }, +}; + +export const SnapshotExtensionMeta: MessageFns = { + $type: "cosmos.base.snapshots.v1beta1.SnapshotExtensionMeta" as const, + + encode(message: SnapshotExtensionMeta, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== "") { + writer.uint32(10).string(message.name); + } + if (message.format !== 0) { + writer.uint32(16).uint32(message.format); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): SnapshotExtensionMeta { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseSnapshotExtensionMeta(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.name = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.format = reader.uint32(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): SnapshotExtensionMeta { + return { + name: isSet(object.name) ? globalThis.String(object.name) : "", + format: isSet(object.format) ? globalThis.Number(object.format) : 0, + }; + }, + + toJSON(message: SnapshotExtensionMeta): unknown { + const obj: any = {}; + if (message.name !== "") { + obj.name = message.name; + } + if (message.format !== 0) { + obj.format = Math.round(message.format); + } + return obj; + }, + + create, I>>(base?: I): SnapshotExtensionMeta { + return SnapshotExtensionMeta.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): SnapshotExtensionMeta { + const message = createBaseSnapshotExtensionMeta(); + message.name = object.name ?? ""; + message.format = object.format ?? 0; + return message; + }, +}; + +export const SnapshotExtensionPayload: MessageFns = { + $type: "cosmos.base.snapshots.v1beta1.SnapshotExtensionPayload" as const, + + encode(message: SnapshotExtensionPayload, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.payload.length !== 0) { + writer.uint32(10).bytes(message.payload); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): SnapshotExtensionPayload { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseSnapshotExtensionPayload(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.payload = reader.bytes(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): SnapshotExtensionPayload { + return { payload: isSet(object.payload) ? bytesFromBase64(object.payload) : new Uint8Array(0) }; + }, + + toJSON(message: SnapshotExtensionPayload): unknown { + const obj: any = {}; + if (message.payload.length !== 0) { + obj.payload = base64FromBytes(message.payload); + } + return obj; + }, + + create, I>>(base?: I): SnapshotExtensionPayload { + return SnapshotExtensionPayload.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): SnapshotExtensionPayload { + const message = createBaseSnapshotExtensionPayload(); + message.payload = object.payload ?? new Uint8Array(0); + return message; + }, +}; + +function createBaseSnapshot(): Snapshot { + return { height: 0, format: 0, chunks: 0, hash: new Uint8Array(0), metadata: undefined }; +} + +function createBaseMetadata(): Metadata { + return { chunk_hashes: [] }; +} + +function createBaseSnapshotItem(): SnapshotItem { + return { store: undefined, iavl: undefined, extension: undefined, extension_payload: undefined }; +} + +function createBaseSnapshotStoreItem(): SnapshotStoreItem { + return { name: "" }; +} + +function createBaseSnapshotIAVLItem(): SnapshotIAVLItem { + return { key: new Uint8Array(0), value: new Uint8Array(0), version: 0, height: 0 }; +} + +function createBaseSnapshotExtensionMeta(): SnapshotExtensionMeta { + return { name: "", format: 0 }; +} + +function createBaseSnapshotExtensionPayload(): SnapshotExtensionPayload { + return { payload: new Uint8Array(0) }; +} + +function bytesFromBase64(b64: string): Uint8Array { + if ((globalThis as any).Buffer) { + return Uint8Array.from(globalThis.Buffer.from(b64, "base64")); + } else { + const bin = globalThis.atob(b64); + const arr = new Uint8Array(bin.length); + for (let i = 0; i < bin.length; ++i) { + arr[i] = bin.charCodeAt(i); + } + return arr; + } +} + +function base64FromBytes(arr: Uint8Array): string { + if ((globalThis as any).Buffer) { + return globalThis.Buffer.from(arr).toString("base64"); + } else { + const bin: string[] = []; + arr.forEach((byte) => { + bin.push(globalThis.String.fromCharCode(byte)); + }); + return globalThis.btoa(bin.join("")); + } +} + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} +export const registry: Array<[string, GeneratedType]> = [ + ["/cosmos.base.snapshots.v1beta1.Snapshot", Snapshot as never], + ["/cosmos.base.snapshots.v1beta1.Metadata", Metadata as never], + ["/cosmos.base.snapshots.v1beta1.SnapshotItem", SnapshotItem as never], + ["/cosmos.base.snapshots.v1beta1.SnapshotStoreItem", SnapshotStoreItem as never], + ["/cosmos.base.snapshots.v1beta1.SnapshotIAVLItem", SnapshotIAVLItem as never], +]; +export const aminoConverters = { + "/cosmos.base.snapshots.v1beta1.Snapshot": { + aminoType: "cosmos-sdk/Snapshot", + toAmino: (message: Snapshot) => ({ ...message }), + fromAmino: (object: Snapshot) => ({ ...object }), + }, + + "/cosmos.base.snapshots.v1beta1.Metadata": { + aminoType: "cosmos-sdk/Metadata", + toAmino: (message: Metadata) => ({ ...message }), + fromAmino: (object: Metadata) => ({ ...object }), + }, + + "/cosmos.base.snapshots.v1beta1.SnapshotItem": { + aminoType: "cosmos-sdk/SnapshotItem", + toAmino: (message: SnapshotItem) => ({ ...message }), + fromAmino: (object: SnapshotItem) => ({ ...object }), + }, + + "/cosmos.base.snapshots.v1beta1.SnapshotStoreItem": { + aminoType: "cosmos-sdk/SnapshotStoreItem", + toAmino: (message: SnapshotStoreItem) => ({ ...message }), + fromAmino: (object: SnapshotStoreItem) => ({ ...object }), + }, + + "/cosmos.base.snapshots.v1beta1.SnapshotIAVLItem": { + aminoType: "cosmos-sdk/SnapshotIAVLItem", + toAmino: (message: SnapshotIAVLItem) => ({ ...message }), + fromAmino: (object: SnapshotIAVLItem) => ({ ...object }), + }, +}; diff --git a/packages/cosmos/generated/encoding/cosmos/base/store/v1beta1/commit_info.ts b/packages/cosmos/generated/encoding/cosmos/base/store/v1beta1/commit_info.ts new file mode 100644 index 000000000..1b61162f1 --- /dev/null +++ b/packages/cosmos/generated/encoding/cosmos/base/store/v1beta1/commit_info.ts @@ -0,0 +1,303 @@ +import type { GeneratedType } from "@cosmjs/proto-signing"; + +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +import type { CommitID as CommitID_type, CommitInfo as CommitInfo_type, StoreInfo as StoreInfo_type } from "../../../../../types/cosmos/base/store/v1beta1"; + +import type { DeepPartial, Exact, MessageFns } from "../../../../common"; + +export interface CommitInfo extends CommitInfo_type {} +export interface StoreInfo extends StoreInfo_type {} +export interface CommitID extends CommitID_type {} + +export const CommitInfo: MessageFns = { + $type: "cosmos.base.store.v1beta1.CommitInfo" as const, + + encode(message: CommitInfo, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.version !== 0) { + writer.uint32(8).int64(message.version); + } + for (const v of message.store_infos) { + StoreInfo.encode(v!, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): CommitInfo { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseCommitInfo(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.version = longToNumber(reader.int64()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.store_infos.push(StoreInfo.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): CommitInfo { + return { + version: isSet(object.version) ? globalThis.Number(object.version) : 0, + store_infos: globalThis.Array.isArray(object?.store_infos) ? object.store_infos.map((e: any) => StoreInfo.fromJSON(e)) : [], + }; + }, + + toJSON(message: CommitInfo): unknown { + const obj: any = {}; + if (message.version !== 0) { + obj.version = Math.round(message.version); + } + if (message.store_infos?.length) { + obj.store_infos = message.store_infos.map((e) => StoreInfo.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): CommitInfo { + return CommitInfo.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): CommitInfo { + const message = createBaseCommitInfo(); + message.version = object.version ?? 0; + message.store_infos = object.store_infos?.map((e) => StoreInfo.fromPartial(e)) || []; + return message; + }, +}; + +export const StoreInfo: MessageFns = { + $type: "cosmos.base.store.v1beta1.StoreInfo" as const, + + encode(message: StoreInfo, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== "") { + writer.uint32(10).string(message.name); + } + if (message.commit_id !== undefined) { + CommitID.encode(message.commit_id, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): StoreInfo { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseStoreInfo(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.name = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.commit_id = CommitID.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): StoreInfo { + return { + name: isSet(object.name) ? globalThis.String(object.name) : "", + commit_id: isSet(object.commit_id) ? CommitID.fromJSON(object.commit_id) : undefined, + }; + }, + + toJSON(message: StoreInfo): unknown { + const obj: any = {}; + if (message.name !== "") { + obj.name = message.name; + } + if (message.commit_id !== undefined) { + obj.commit_id = CommitID.toJSON(message.commit_id); + } + return obj; + }, + + create, I>>(base?: I): StoreInfo { + return StoreInfo.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): StoreInfo { + const message = createBaseStoreInfo(); + message.name = object.name ?? ""; + message.commit_id = object.commit_id !== undefined && object.commit_id !== null ? CommitID.fromPartial(object.commit_id) : undefined; + return message; + }, +}; + +export const CommitID: MessageFns = { + $type: "cosmos.base.store.v1beta1.CommitID" as const, + + encode(message: CommitID, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.version !== 0) { + writer.uint32(8).int64(message.version); + } + if (message.hash.length !== 0) { + writer.uint32(18).bytes(message.hash); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): CommitID { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseCommitID(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.version = longToNumber(reader.int64()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.hash = reader.bytes(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): CommitID { + return { + version: isSet(object.version) ? globalThis.Number(object.version) : 0, + hash: isSet(object.hash) ? bytesFromBase64(object.hash) : new Uint8Array(0), + }; + }, + + toJSON(message: CommitID): unknown { + const obj: any = {}; + if (message.version !== 0) { + obj.version = Math.round(message.version); + } + if (message.hash.length !== 0) { + obj.hash = base64FromBytes(message.hash); + } + return obj; + }, + + create, I>>(base?: I): CommitID { + return CommitID.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): CommitID { + const message = createBaseCommitID(); + message.version = object.version ?? 0; + message.hash = object.hash ?? new Uint8Array(0); + return message; + }, +}; + +function createBaseCommitInfo(): CommitInfo { + return { version: 0, store_infos: [] }; +} + +function createBaseStoreInfo(): StoreInfo { + return { name: "", commit_id: undefined }; +} + +function createBaseCommitID(): CommitID { + return { version: 0, hash: new Uint8Array(0) }; +} + +function bytesFromBase64(b64: string): Uint8Array { + if ((globalThis as any).Buffer) { + return Uint8Array.from(globalThis.Buffer.from(b64, "base64")); + } else { + const bin = globalThis.atob(b64); + const arr = new Uint8Array(bin.length); + for (let i = 0; i < bin.length; ++i) { + arr[i] = bin.charCodeAt(i); + } + return arr; + } +} + +function base64FromBytes(arr: Uint8Array): string { + if ((globalThis as any).Buffer) { + return globalThis.Buffer.from(arr).toString("base64"); + } else { + const bin: string[] = []; + arr.forEach((byte) => { + bin.push(globalThis.String.fromCharCode(byte)); + }); + return globalThis.btoa(bin.join("")); + } +} + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} +export const registry: Array<[string, GeneratedType]> = [ + ["/cosmos.base.store.v1beta1.CommitInfo", CommitInfo as never], + ["/cosmos.base.store.v1beta1.StoreInfo", StoreInfo as never], + ["/cosmos.base.store.v1beta1.CommitID", CommitID as never], +]; +export const aminoConverters = { + "/cosmos.base.store.v1beta1.CommitInfo": { + aminoType: "cosmos-sdk/CommitInfo", + toAmino: (message: CommitInfo) => ({ ...message }), + fromAmino: (object: CommitInfo) => ({ ...object }), + }, + + "/cosmos.base.store.v1beta1.StoreInfo": { + aminoType: "cosmos-sdk/StoreInfo", + toAmino: (message: StoreInfo) => ({ ...message }), + fromAmino: (object: StoreInfo) => ({ ...object }), + }, + + "/cosmos.base.store.v1beta1.CommitID": { + aminoType: "cosmos-sdk/CommitID", + toAmino: (message: CommitID) => ({ ...message }), + fromAmino: (object: CommitID) => ({ ...object }), + }, +}; diff --git a/packages/cosmos/generated/encoding/cosmos/base/store/v1beta1/index.ts b/packages/cosmos/generated/encoding/cosmos/base/store/v1beta1/index.ts new file mode 100644 index 000000000..ea683009b --- /dev/null +++ b/packages/cosmos/generated/encoding/cosmos/base/store/v1beta1/index.ts @@ -0,0 +1,4 @@ +// @ts-nocheck + +export * from './commit_info'; +export * from './listening'; \ No newline at end of file diff --git a/packages/cosmos/generated/encoding/cosmos/base/store/v1beta1/listening.ts b/packages/cosmos/generated/encoding/cosmos/base/store/v1beta1/listening.ts new file mode 100644 index 000000000..7307efb01 --- /dev/null +++ b/packages/cosmos/generated/encoding/cosmos/base/store/v1beta1/listening.ts @@ -0,0 +1,152 @@ +import type { GeneratedType } from "@cosmjs/proto-signing"; + +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +import type { StoreKVPair as StoreKVPair_type } from "../../../../../types/cosmos/base/store/v1beta1"; + +import type { DeepPartial, Exact, MessageFns } from "../../../../common"; + +export interface StoreKVPair extends StoreKVPair_type {} + +export const StoreKVPair: MessageFns = { + $type: "cosmos.base.store.v1beta1.StoreKVPair" as const, + + encode(message: StoreKVPair, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.store_key !== "") { + writer.uint32(10).string(message.store_key); + } + if (message.delete !== false) { + writer.uint32(16).bool(message.delete); + } + if (message.key.length !== 0) { + writer.uint32(26).bytes(message.key); + } + if (message.value.length !== 0) { + writer.uint32(34).bytes(message.value); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): StoreKVPair { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseStoreKVPair(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.store_key = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.delete = reader.bool(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.key = reader.bytes(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.value = reader.bytes(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): StoreKVPair { + return { + store_key: isSet(object.store_key) ? globalThis.String(object.store_key) : "", + delete: isSet(object.delete) ? globalThis.Boolean(object.delete) : false, + key: isSet(object.key) ? bytesFromBase64(object.key) : new Uint8Array(0), + value: isSet(object.value) ? bytesFromBase64(object.value) : new Uint8Array(0), + }; + }, + + toJSON(message: StoreKVPair): unknown { + const obj: any = {}; + if (message.store_key !== "") { + obj.store_key = message.store_key; + } + if (message.delete !== false) { + obj.delete = message.delete; + } + if (message.key.length !== 0) { + obj.key = base64FromBytes(message.key); + } + if (message.value.length !== 0) { + obj.value = base64FromBytes(message.value); + } + return obj; + }, + + create, I>>(base?: I): StoreKVPair { + return StoreKVPair.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): StoreKVPair { + const message = createBaseStoreKVPair(); + message.store_key = object.store_key ?? ""; + message.delete = object.delete ?? false; + message.key = object.key ?? new Uint8Array(0); + message.value = object.value ?? new Uint8Array(0); + return message; + }, +}; + +function createBaseStoreKVPair(): StoreKVPair { + return { store_key: "", delete: false, key: new Uint8Array(0), value: new Uint8Array(0) }; +} + +function bytesFromBase64(b64: string): Uint8Array { + if ((globalThis as any).Buffer) { + return Uint8Array.from(globalThis.Buffer.from(b64, "base64")); + } else { + const bin = globalThis.atob(b64); + const arr = new Uint8Array(bin.length); + for (let i = 0; i < bin.length; ++i) { + arr[i] = bin.charCodeAt(i); + } + return arr; + } +} + +function base64FromBytes(arr: Uint8Array): string { + if ((globalThis as any).Buffer) { + return globalThis.Buffer.from(arr).toString("base64"); + } else { + const bin: string[] = []; + arr.forEach((byte) => { + bin.push(globalThis.String.fromCharCode(byte)); + }); + return globalThis.btoa(bin.join("")); + } +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} +export const registry: Array<[string, GeneratedType]> = [["/cosmos.base.store.v1beta1.StoreKVPair", StoreKVPair as never]]; +export const aminoConverters = { + "/cosmos.base.store.v1beta1.StoreKVPair": { + aminoType: "cosmos-sdk/StoreKVPair", + toAmino: (message: StoreKVPair) => ({ ...message }), + fromAmino: (object: StoreKVPair) => ({ ...object }), + }, +}; diff --git a/packages/cosmos/generated/encoding/cosmos/base/tendermint/v1beta1/index.ts b/packages/cosmos/generated/encoding/cosmos/base/tendermint/v1beta1/index.ts new file mode 100644 index 000000000..847fe8275 --- /dev/null +++ b/packages/cosmos/generated/encoding/cosmos/base/tendermint/v1beta1/index.ts @@ -0,0 +1,3 @@ +// @ts-nocheck + +export * from './query'; \ No newline at end of file diff --git a/packages/cosmos/generated/encoding/cosmos/base/tendermint/v1beta1/query.ts b/packages/cosmos/generated/encoding/cosmos/base/tendermint/v1beta1/query.ts new file mode 100644 index 000000000..136eb84f0 --- /dev/null +++ b/packages/cosmos/generated/encoding/cosmos/base/tendermint/v1beta1/query.ts @@ -0,0 +1,1281 @@ +import type { GeneratedType } from "@cosmjs/proto-signing"; + +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +import { Any } from "../../../../google/protobuf/any"; + +import { NodeInfo } from "../../../../tendermint/p2p/types"; + +import { Block } from "../../../../tendermint/types/block"; + +import { BlockID } from "../../../../tendermint/types/types"; + +import { PageRequest, PageResponse } from "../../query/v1beta1/pagination"; + +import type { + GetBlockByHeightRequest as GetBlockByHeightRequest_type, + GetBlockByHeightResponse as GetBlockByHeightResponse_type, + GetLatestBlockRequest as GetLatestBlockRequest_type, + GetLatestBlockResponse as GetLatestBlockResponse_type, + GetLatestValidatorSetRequest as GetLatestValidatorSetRequest_type, + GetLatestValidatorSetResponse as GetLatestValidatorSetResponse_type, + GetNodeInfoRequest as GetNodeInfoRequest_type, + GetNodeInfoResponse as GetNodeInfoResponse_type, + GetSyncingRequest as GetSyncingRequest_type, + GetSyncingResponse as GetSyncingResponse_type, + GetValidatorSetByHeightRequest as GetValidatorSetByHeightRequest_type, + GetValidatorSetByHeightResponse as GetValidatorSetByHeightResponse_type, + Module as Module_type, + Validator as Validator_type, + VersionInfo as VersionInfo_type, +} from "../../../../../types/cosmos/base/tendermint/v1beta1"; + +import type { DeepPartial, Exact, MessageFns } from "../../../../common"; + +export interface GetValidatorSetByHeightRequest extends GetValidatorSetByHeightRequest_type {} +export interface GetValidatorSetByHeightResponse extends GetValidatorSetByHeightResponse_type {} +export interface GetLatestValidatorSetRequest extends GetLatestValidatorSetRequest_type {} +export interface GetLatestValidatorSetResponse extends GetLatestValidatorSetResponse_type {} +export interface Validator extends Validator_type {} +export interface GetBlockByHeightRequest extends GetBlockByHeightRequest_type {} +export interface GetBlockByHeightResponse extends GetBlockByHeightResponse_type {} +export interface GetLatestBlockRequest extends GetLatestBlockRequest_type {} +export interface GetLatestBlockResponse extends GetLatestBlockResponse_type {} +export interface GetSyncingRequest extends GetSyncingRequest_type {} +export interface GetSyncingResponse extends GetSyncingResponse_type {} +export interface GetNodeInfoRequest extends GetNodeInfoRequest_type {} +export interface GetNodeInfoResponse extends GetNodeInfoResponse_type {} +export interface VersionInfo extends VersionInfo_type {} +export interface Module extends Module_type {} + +export const GetValidatorSetByHeightRequest: MessageFns = { + $type: "cosmos.base.tendermint.v1beta1.GetValidatorSetByHeightRequest" as const, + + encode(message: GetValidatorSetByHeightRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.height !== 0) { + writer.uint32(8).int64(message.height); + } + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetValidatorSetByHeightRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetValidatorSetByHeightRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.height = longToNumber(reader.int64()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GetValidatorSetByHeightRequest { + return { + height: isSet(object.height) ? globalThis.Number(object.height) : 0, + pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: GetValidatorSetByHeightRequest): unknown { + const obj: any = {}; + if (message.height !== 0) { + obj.height = Math.round(message.height); + } + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): GetValidatorSetByHeightRequest { + return GetValidatorSetByHeightRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): GetValidatorSetByHeightRequest { + const message = createBaseGetValidatorSetByHeightRequest(); + message.height = object.height ?? 0; + message.pagination = object.pagination !== undefined && object.pagination !== null ? PageRequest.fromPartial(object.pagination) : undefined; + return message; + }, +}; + +export const GetValidatorSetByHeightResponse: MessageFns = { + $type: "cosmos.base.tendermint.v1beta1.GetValidatorSetByHeightResponse" as const, + + encode(message: GetValidatorSetByHeightResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.block_height !== 0) { + writer.uint32(8).int64(message.block_height); + } + for (const v of message.validators) { + Validator.encode(v!, writer.uint32(18).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(26).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetValidatorSetByHeightResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetValidatorSetByHeightResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.block_height = longToNumber(reader.int64()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.validators.push(Validator.decode(reader, reader.uint32())); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GetValidatorSetByHeightResponse { + return { + block_height: isSet(object.block_height) ? globalThis.Number(object.block_height) : 0, + validators: globalThis.Array.isArray(object?.validators) ? object.validators.map((e: any) => Validator.fromJSON(e)) : [], + pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: GetValidatorSetByHeightResponse): unknown { + const obj: any = {}; + if (message.block_height !== 0) { + obj.block_height = Math.round(message.block_height); + } + if (message.validators?.length) { + obj.validators = message.validators.map((e) => Validator.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): GetValidatorSetByHeightResponse { + return GetValidatorSetByHeightResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): GetValidatorSetByHeightResponse { + const message = createBaseGetValidatorSetByHeightResponse(); + message.block_height = object.block_height ?? 0; + message.validators = object.validators?.map((e) => Validator.fromPartial(e)) || []; + message.pagination = object.pagination !== undefined && object.pagination !== null ? PageResponse.fromPartial(object.pagination) : undefined; + return message; + }, +}; + +export const GetLatestValidatorSetRequest: MessageFns = { + $type: "cosmos.base.tendermint.v1beta1.GetLatestValidatorSetRequest" as const, + + encode(message: GetLatestValidatorSetRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetLatestValidatorSetRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetLatestValidatorSetRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GetLatestValidatorSetRequest { + return { pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined }; + }, + + toJSON(message: GetLatestValidatorSetRequest): unknown { + const obj: any = {}; + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): GetLatestValidatorSetRequest { + return GetLatestValidatorSetRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): GetLatestValidatorSetRequest { + const message = createBaseGetLatestValidatorSetRequest(); + message.pagination = object.pagination !== undefined && object.pagination !== null ? PageRequest.fromPartial(object.pagination) : undefined; + return message; + }, +}; + +export const GetLatestValidatorSetResponse: MessageFns = { + $type: "cosmos.base.tendermint.v1beta1.GetLatestValidatorSetResponse" as const, + + encode(message: GetLatestValidatorSetResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.block_height !== 0) { + writer.uint32(8).int64(message.block_height); + } + for (const v of message.validators) { + Validator.encode(v!, writer.uint32(18).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(26).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetLatestValidatorSetResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetLatestValidatorSetResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.block_height = longToNumber(reader.int64()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.validators.push(Validator.decode(reader, reader.uint32())); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GetLatestValidatorSetResponse { + return { + block_height: isSet(object.block_height) ? globalThis.Number(object.block_height) : 0, + validators: globalThis.Array.isArray(object?.validators) ? object.validators.map((e: any) => Validator.fromJSON(e)) : [], + pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: GetLatestValidatorSetResponse): unknown { + const obj: any = {}; + if (message.block_height !== 0) { + obj.block_height = Math.round(message.block_height); + } + if (message.validators?.length) { + obj.validators = message.validators.map((e) => Validator.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): GetLatestValidatorSetResponse { + return GetLatestValidatorSetResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): GetLatestValidatorSetResponse { + const message = createBaseGetLatestValidatorSetResponse(); + message.block_height = object.block_height ?? 0; + message.validators = object.validators?.map((e) => Validator.fromPartial(e)) || []; + message.pagination = object.pagination !== undefined && object.pagination !== null ? PageResponse.fromPartial(object.pagination) : undefined; + return message; + }, +}; + +export const Validator: MessageFns = { + $type: "cosmos.base.tendermint.v1beta1.Validator" as const, + + encode(message: Validator, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.address !== "") { + writer.uint32(10).string(message.address); + } + if (message.pub_key !== undefined) { + Any.encode(message.pub_key, writer.uint32(18).fork()).join(); + } + if (message.voting_power !== 0) { + writer.uint32(24).int64(message.voting_power); + } + if (message.proposer_priority !== 0) { + writer.uint32(32).int64(message.proposer_priority); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Validator { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseValidator(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.address = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pub_key = Any.decode(reader, reader.uint32()); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.voting_power = longToNumber(reader.int64()); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.proposer_priority = longToNumber(reader.int64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Validator { + return { + address: isSet(object.address) ? globalThis.String(object.address) : "", + pub_key: isSet(object.pub_key) ? Any.fromJSON(object.pub_key) : undefined, + voting_power: isSet(object.voting_power) ? globalThis.Number(object.voting_power) : 0, + proposer_priority: isSet(object.proposer_priority) ? globalThis.Number(object.proposer_priority) : 0, + }; + }, + + toJSON(message: Validator): unknown { + const obj: any = {}; + if (message.address !== "") { + obj.address = message.address; + } + if (message.pub_key !== undefined) { + obj.pub_key = Any.toJSON(message.pub_key); + } + if (message.voting_power !== 0) { + obj.voting_power = Math.round(message.voting_power); + } + if (message.proposer_priority !== 0) { + obj.proposer_priority = Math.round(message.proposer_priority); + } + return obj; + }, + + create, I>>(base?: I): Validator { + return Validator.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Validator { + const message = createBaseValidator(); + message.address = object.address ?? ""; + message.pub_key = object.pub_key !== undefined && object.pub_key !== null ? Any.fromPartial(object.pub_key) : undefined; + message.voting_power = object.voting_power ?? 0; + message.proposer_priority = object.proposer_priority ?? 0; + return message; + }, +}; + +export const GetBlockByHeightRequest: MessageFns = { + $type: "cosmos.base.tendermint.v1beta1.GetBlockByHeightRequest" as const, + + encode(message: GetBlockByHeightRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.height !== 0) { + writer.uint32(8).int64(message.height); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetBlockByHeightRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetBlockByHeightRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.height = longToNumber(reader.int64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GetBlockByHeightRequest { + return { height: isSet(object.height) ? globalThis.Number(object.height) : 0 }; + }, + + toJSON(message: GetBlockByHeightRequest): unknown { + const obj: any = {}; + if (message.height !== 0) { + obj.height = Math.round(message.height); + } + return obj; + }, + + create, I>>(base?: I): GetBlockByHeightRequest { + return GetBlockByHeightRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): GetBlockByHeightRequest { + const message = createBaseGetBlockByHeightRequest(); + message.height = object.height ?? 0; + return message; + }, +}; + +export const GetBlockByHeightResponse: MessageFns = { + $type: "cosmos.base.tendermint.v1beta1.GetBlockByHeightResponse" as const, + + encode(message: GetBlockByHeightResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.block_id !== undefined) { + BlockID.encode(message.block_id, writer.uint32(10).fork()).join(); + } + if (message.block !== undefined) { + Block.encode(message.block, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetBlockByHeightResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetBlockByHeightResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.block_id = BlockID.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.block = Block.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GetBlockByHeightResponse { + return { + block_id: isSet(object.block_id) ? BlockID.fromJSON(object.block_id) : undefined, + block: isSet(object.block) ? Block.fromJSON(object.block) : undefined, + }; + }, + + toJSON(message: GetBlockByHeightResponse): unknown { + const obj: any = {}; + if (message.block_id !== undefined) { + obj.block_id = BlockID.toJSON(message.block_id); + } + if (message.block !== undefined) { + obj.block = Block.toJSON(message.block); + } + return obj; + }, + + create, I>>(base?: I): GetBlockByHeightResponse { + return GetBlockByHeightResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): GetBlockByHeightResponse { + const message = createBaseGetBlockByHeightResponse(); + message.block_id = object.block_id !== undefined && object.block_id !== null ? BlockID.fromPartial(object.block_id) : undefined; + message.block = object.block !== undefined && object.block !== null ? Block.fromPartial(object.block) : undefined; + return message; + }, +}; + +export const GetLatestBlockRequest: MessageFns = { + $type: "cosmos.base.tendermint.v1beta1.GetLatestBlockRequest" as const, + + encode(_: GetLatestBlockRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetLatestBlockRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetLatestBlockRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): GetLatestBlockRequest { + return {}; + }, + + toJSON(_: GetLatestBlockRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): GetLatestBlockRequest { + return GetLatestBlockRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): GetLatestBlockRequest { + const message = createBaseGetLatestBlockRequest(); + return message; + }, +}; + +export const GetLatestBlockResponse: MessageFns = { + $type: "cosmos.base.tendermint.v1beta1.GetLatestBlockResponse" as const, + + encode(message: GetLatestBlockResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.block_id !== undefined) { + BlockID.encode(message.block_id, writer.uint32(10).fork()).join(); + } + if (message.block !== undefined) { + Block.encode(message.block, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetLatestBlockResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetLatestBlockResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.block_id = BlockID.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.block = Block.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GetLatestBlockResponse { + return { + block_id: isSet(object.block_id) ? BlockID.fromJSON(object.block_id) : undefined, + block: isSet(object.block) ? Block.fromJSON(object.block) : undefined, + }; + }, + + toJSON(message: GetLatestBlockResponse): unknown { + const obj: any = {}; + if (message.block_id !== undefined) { + obj.block_id = BlockID.toJSON(message.block_id); + } + if (message.block !== undefined) { + obj.block = Block.toJSON(message.block); + } + return obj; + }, + + create, I>>(base?: I): GetLatestBlockResponse { + return GetLatestBlockResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): GetLatestBlockResponse { + const message = createBaseGetLatestBlockResponse(); + message.block_id = object.block_id !== undefined && object.block_id !== null ? BlockID.fromPartial(object.block_id) : undefined; + message.block = object.block !== undefined && object.block !== null ? Block.fromPartial(object.block) : undefined; + return message; + }, +}; + +export const GetSyncingRequest: MessageFns = { + $type: "cosmos.base.tendermint.v1beta1.GetSyncingRequest" as const, + + encode(_: GetSyncingRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetSyncingRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetSyncingRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): GetSyncingRequest { + return {}; + }, + + toJSON(_: GetSyncingRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): GetSyncingRequest { + return GetSyncingRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): GetSyncingRequest { + const message = createBaseGetSyncingRequest(); + return message; + }, +}; + +export const GetSyncingResponse: MessageFns = { + $type: "cosmos.base.tendermint.v1beta1.GetSyncingResponse" as const, + + encode(message: GetSyncingResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.syncing !== false) { + writer.uint32(8).bool(message.syncing); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetSyncingResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetSyncingResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.syncing = reader.bool(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GetSyncingResponse { + return { syncing: isSet(object.syncing) ? globalThis.Boolean(object.syncing) : false }; + }, + + toJSON(message: GetSyncingResponse): unknown { + const obj: any = {}; + if (message.syncing !== false) { + obj.syncing = message.syncing; + } + return obj; + }, + + create, I>>(base?: I): GetSyncingResponse { + return GetSyncingResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): GetSyncingResponse { + const message = createBaseGetSyncingResponse(); + message.syncing = object.syncing ?? false; + return message; + }, +}; + +export const GetNodeInfoRequest: MessageFns = { + $type: "cosmos.base.tendermint.v1beta1.GetNodeInfoRequest" as const, + + encode(_: GetNodeInfoRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetNodeInfoRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetNodeInfoRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): GetNodeInfoRequest { + return {}; + }, + + toJSON(_: GetNodeInfoRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): GetNodeInfoRequest { + return GetNodeInfoRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): GetNodeInfoRequest { + const message = createBaseGetNodeInfoRequest(); + return message; + }, +}; + +export const GetNodeInfoResponse: MessageFns = { + $type: "cosmos.base.tendermint.v1beta1.GetNodeInfoResponse" as const, + + encode(message: GetNodeInfoResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.default_node_info !== undefined) { + NodeInfo.encode(message.default_node_info, writer.uint32(10).fork()).join(); + } + if (message.application_version !== undefined) { + VersionInfo.encode(message.application_version, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetNodeInfoResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetNodeInfoResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.default_node_info = NodeInfo.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.application_version = VersionInfo.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GetNodeInfoResponse { + return { + default_node_info: isSet(object.default_node_info) ? NodeInfo.fromJSON(object.default_node_info) : undefined, + application_version: isSet(object.application_version) ? VersionInfo.fromJSON(object.application_version) : undefined, + }; + }, + + toJSON(message: GetNodeInfoResponse): unknown { + const obj: any = {}; + if (message.default_node_info !== undefined) { + obj.default_node_info = NodeInfo.toJSON(message.default_node_info); + } + if (message.application_version !== undefined) { + obj.application_version = VersionInfo.toJSON(message.application_version); + } + return obj; + }, + + create, I>>(base?: I): GetNodeInfoResponse { + return GetNodeInfoResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): GetNodeInfoResponse { + const message = createBaseGetNodeInfoResponse(); + message.default_node_info = + object.default_node_info !== undefined && object.default_node_info !== null ? NodeInfo.fromPartial(object.default_node_info) : undefined; + message.application_version = + object.application_version !== undefined && object.application_version !== null ? VersionInfo.fromPartial(object.application_version) : undefined; + return message; + }, +}; + +export const VersionInfo: MessageFns = { + $type: "cosmos.base.tendermint.v1beta1.VersionInfo" as const, + + encode(message: VersionInfo, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== "") { + writer.uint32(10).string(message.name); + } + if (message.app_name !== "") { + writer.uint32(18).string(message.app_name); + } + if (message.version !== "") { + writer.uint32(26).string(message.version); + } + if (message.git_commit !== "") { + writer.uint32(34).string(message.git_commit); + } + if (message.build_tags !== "") { + writer.uint32(42).string(message.build_tags); + } + if (message.go_version !== "") { + writer.uint32(50).string(message.go_version); + } + for (const v of message.build_deps) { + Module.encode(v!, writer.uint32(58).fork()).join(); + } + if (message.cosmos_sdk_version !== "") { + writer.uint32(66).string(message.cosmos_sdk_version); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): VersionInfo { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseVersionInfo(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.name = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.app_name = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.version = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.git_commit = reader.string(); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.build_tags = reader.string(); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.go_version = reader.string(); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.build_deps.push(Module.decode(reader, reader.uint32())); + continue; + case 8: + if (tag !== 66) { + break; + } + + message.cosmos_sdk_version = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): VersionInfo { + return { + name: isSet(object.name) ? globalThis.String(object.name) : "", + app_name: isSet(object.app_name) ? globalThis.String(object.app_name) : "", + version: isSet(object.version) ? globalThis.String(object.version) : "", + git_commit: isSet(object.git_commit) ? globalThis.String(object.git_commit) : "", + build_tags: isSet(object.build_tags) ? globalThis.String(object.build_tags) : "", + go_version: isSet(object.go_version) ? globalThis.String(object.go_version) : "", + build_deps: globalThis.Array.isArray(object?.build_deps) ? object.build_deps.map((e: any) => Module.fromJSON(e)) : [], + cosmos_sdk_version: isSet(object.cosmos_sdk_version) ? globalThis.String(object.cosmos_sdk_version) : "", + }; + }, + + toJSON(message: VersionInfo): unknown { + const obj: any = {}; + if (message.name !== "") { + obj.name = message.name; + } + if (message.app_name !== "") { + obj.app_name = message.app_name; + } + if (message.version !== "") { + obj.version = message.version; + } + if (message.git_commit !== "") { + obj.git_commit = message.git_commit; + } + if (message.build_tags !== "") { + obj.build_tags = message.build_tags; + } + if (message.go_version !== "") { + obj.go_version = message.go_version; + } + if (message.build_deps?.length) { + obj.build_deps = message.build_deps.map((e) => Module.toJSON(e)); + } + if (message.cosmos_sdk_version !== "") { + obj.cosmos_sdk_version = message.cosmos_sdk_version; + } + return obj; + }, + + create, I>>(base?: I): VersionInfo { + return VersionInfo.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): VersionInfo { + const message = createBaseVersionInfo(); + message.name = object.name ?? ""; + message.app_name = object.app_name ?? ""; + message.version = object.version ?? ""; + message.git_commit = object.git_commit ?? ""; + message.build_tags = object.build_tags ?? ""; + message.go_version = object.go_version ?? ""; + message.build_deps = object.build_deps?.map((e) => Module.fromPartial(e)) || []; + message.cosmos_sdk_version = object.cosmos_sdk_version ?? ""; + return message; + }, +}; + +export const Module: MessageFns = { + $type: "cosmos.base.tendermint.v1beta1.Module" as const, + + encode(message: Module, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.path !== "") { + writer.uint32(10).string(message.path); + } + if (message.version !== "") { + writer.uint32(18).string(message.version); + } + if (message.sum !== "") { + writer.uint32(26).string(message.sum); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Module { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseModule(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.path = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.version = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.sum = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Module { + return { + path: isSet(object.path) ? globalThis.String(object.path) : "", + version: isSet(object.version) ? globalThis.String(object.version) : "", + sum: isSet(object.sum) ? globalThis.String(object.sum) : "", + }; + }, + + toJSON(message: Module): unknown { + const obj: any = {}; + if (message.path !== "") { + obj.path = message.path; + } + if (message.version !== "") { + obj.version = message.version; + } + if (message.sum !== "") { + obj.sum = message.sum; + } + return obj; + }, + + create, I>>(base?: I): Module { + return Module.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Module { + const message = createBaseModule(); + message.path = object.path ?? ""; + message.version = object.version ?? ""; + message.sum = object.sum ?? ""; + return message; + }, +}; + +function createBaseGetValidatorSetByHeightRequest(): GetValidatorSetByHeightRequest { + return { height: 0, pagination: undefined }; +} + +function createBaseGetValidatorSetByHeightResponse(): GetValidatorSetByHeightResponse { + return { block_height: 0, validators: [], pagination: undefined }; +} + +function createBaseGetLatestValidatorSetRequest(): GetLatestValidatorSetRequest { + return { pagination: undefined }; +} + +function createBaseGetLatestValidatorSetResponse(): GetLatestValidatorSetResponse { + return { block_height: 0, validators: [], pagination: undefined }; +} + +function createBaseValidator(): Validator { + return { address: "", pub_key: undefined, voting_power: 0, proposer_priority: 0 }; +} + +function createBaseGetBlockByHeightRequest(): GetBlockByHeightRequest { + return { height: 0 }; +} + +function createBaseGetBlockByHeightResponse(): GetBlockByHeightResponse { + return { block_id: undefined, block: undefined }; +} + +function createBaseGetLatestBlockRequest(): GetLatestBlockRequest { + return {}; +} + +function createBaseGetLatestBlockResponse(): GetLatestBlockResponse { + return { block_id: undefined, block: undefined }; +} + +function createBaseGetSyncingRequest(): GetSyncingRequest { + return {}; +} + +function createBaseGetSyncingResponse(): GetSyncingResponse { + return { syncing: false }; +} + +function createBaseGetNodeInfoRequest(): GetNodeInfoRequest { + return {}; +} + +function createBaseGetNodeInfoResponse(): GetNodeInfoResponse { + return { default_node_info: undefined, application_version: undefined }; +} + +function createBaseVersionInfo(): VersionInfo { + return { + name: "", + app_name: "", + version: "", + git_commit: "", + build_tags: "", + go_version: "", + build_deps: [], + cosmos_sdk_version: "", + }; +} + +function createBaseModule(): Module { + return { path: "", version: "", sum: "" }; +} + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} +export const registry: Array<[string, GeneratedType]> = [ + ["/cosmos.base.tendermint.v1beta1.Validator", Validator as never], + ["/cosmos.base.tendermint.v1beta1.GetSyncingRequest", GetSyncingRequest as never], + ["/cosmos.base.tendermint.v1beta1.GetSyncingResponse", GetSyncingResponse as never], + ["/cosmos.base.tendermint.v1beta1.GetNodeInfoRequest", GetNodeInfoRequest as never], + ["/cosmos.base.tendermint.v1beta1.VersionInfo", VersionInfo as never], + ["/cosmos.base.tendermint.v1beta1.Module", Module as never], +]; +export const aminoConverters = { + "/cosmos.base.tendermint.v1beta1.Validator": { + aminoType: "cosmos-sdk/Validator", + toAmino: (message: Validator) => ({ ...message }), + fromAmino: (object: Validator) => ({ ...object }), + }, + + "/cosmos.base.tendermint.v1beta1.GetSyncingRequest": { + aminoType: "cosmos-sdk/GetSyncingRequest", + toAmino: (message: GetSyncingRequest) => ({ ...message }), + fromAmino: (object: GetSyncingRequest) => ({ ...object }), + }, + + "/cosmos.base.tendermint.v1beta1.GetSyncingResponse": { + aminoType: "cosmos-sdk/GetSyncingResponse", + toAmino: (message: GetSyncingResponse) => ({ ...message }), + fromAmino: (object: GetSyncingResponse) => ({ ...object }), + }, + + "/cosmos.base.tendermint.v1beta1.GetNodeInfoRequest": { + aminoType: "cosmos-sdk/GetNodeInfoRequest", + toAmino: (message: GetNodeInfoRequest) => ({ ...message }), + fromAmino: (object: GetNodeInfoRequest) => ({ ...object }), + }, + + "/cosmos.base.tendermint.v1beta1.VersionInfo": { + aminoType: "cosmos-sdk/VersionInfo", + toAmino: (message: VersionInfo) => ({ ...message }), + fromAmino: (object: VersionInfo) => ({ ...object }), + }, + + "/cosmos.base.tendermint.v1beta1.Module": { + aminoType: "cosmos-sdk/Module", + toAmino: (message: Module) => ({ ...message }), + fromAmino: (object: Module) => ({ ...object }), + }, +}; diff --git a/packages/cosmos/generated/encoding/cosmos/base/v1beta1/coin.ts b/packages/cosmos/generated/encoding/cosmos/base/v1beta1/coin.ts new file mode 100644 index 000000000..46665fa27 --- /dev/null +++ b/packages/cosmos/generated/encoding/cosmos/base/v1beta1/coin.ts @@ -0,0 +1,317 @@ +import type { GeneratedType } from "@cosmjs/proto-signing"; + +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +import type { Coin as Coin_type, DecCoin as DecCoin_type, DecProto as DecProto_type, IntProto as IntProto_type } from "../../../../types/cosmos/base/v1beta1"; + +import type { DeepPartial, Exact, MessageFns } from "../../../common"; + +export interface Coin extends Coin_type {} +export interface DecCoin extends DecCoin_type {} +export interface IntProto extends IntProto_type {} +export interface DecProto extends DecProto_type {} + +export const Coin: MessageFns = { + $type: "cosmos.base.v1beta1.Coin" as const, + + encode(message: Coin, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.denom !== "") { + writer.uint32(10).string(message.denom); + } + if (message.amount !== "") { + writer.uint32(18).string(message.amount); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Coin { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseCoin(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.denom = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.amount = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Coin { + return { + denom: isSet(object.denom) ? globalThis.String(object.denom) : "", + amount: isSet(object.amount) ? globalThis.String(object.amount) : "", + }; + }, + + toJSON(message: Coin): unknown { + const obj: any = {}; + if (message.denom !== "") { + obj.denom = message.denom; + } + if (message.amount !== "") { + obj.amount = message.amount; + } + return obj; + }, + + create, I>>(base?: I): Coin { + return Coin.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Coin { + const message = createBaseCoin(); + message.denom = object.denom ?? ""; + message.amount = object.amount ?? ""; + return message; + }, +}; + +export const DecCoin: MessageFns = { + $type: "cosmos.base.v1beta1.DecCoin" as const, + + encode(message: DecCoin, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.denom !== "") { + writer.uint32(10).string(message.denom); + } + if (message.amount !== "") { + writer.uint32(18).string(message.amount); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): DecCoin { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDecCoin(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.denom = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.amount = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): DecCoin { + return { + denom: isSet(object.denom) ? globalThis.String(object.denom) : "", + amount: isSet(object.amount) ? globalThis.String(object.amount) : "", + }; + }, + + toJSON(message: DecCoin): unknown { + const obj: any = {}; + if (message.denom !== "") { + obj.denom = message.denom; + } + if (message.amount !== "") { + obj.amount = message.amount; + } + return obj; + }, + + create, I>>(base?: I): DecCoin { + return DecCoin.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): DecCoin { + const message = createBaseDecCoin(); + message.denom = object.denom ?? ""; + message.amount = object.amount ?? ""; + return message; + }, +}; + +export const IntProto: MessageFns = { + $type: "cosmos.base.v1beta1.IntProto" as const, + + encode(message: IntProto, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.int !== "") { + writer.uint32(10).string(message.int); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): IntProto { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseIntProto(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.int = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): IntProto { + return { int: isSet(object.int) ? globalThis.String(object.int) : "" }; + }, + + toJSON(message: IntProto): unknown { + const obj: any = {}; + if (message.int !== "") { + obj.int = message.int; + } + return obj; + }, + + create, I>>(base?: I): IntProto { + return IntProto.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): IntProto { + const message = createBaseIntProto(); + message.int = object.int ?? ""; + return message; + }, +}; + +export const DecProto: MessageFns = { + $type: "cosmos.base.v1beta1.DecProto" as const, + + encode(message: DecProto, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.dec !== "") { + writer.uint32(10).string(message.dec); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): DecProto { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDecProto(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.dec = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): DecProto { + return { dec: isSet(object.dec) ? globalThis.String(object.dec) : "" }; + }, + + toJSON(message: DecProto): unknown { + const obj: any = {}; + if (message.dec !== "") { + obj.dec = message.dec; + } + return obj; + }, + + create, I>>(base?: I): DecProto { + return DecProto.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): DecProto { + const message = createBaseDecProto(); + message.dec = object.dec ?? ""; + return message; + }, +}; + +function createBaseCoin(): Coin { + return { denom: "", amount: "" }; +} + +function createBaseDecCoin(): DecCoin { + return { denom: "", amount: "" }; +} + +function createBaseIntProto(): IntProto { + return { int: "" }; +} + +function createBaseDecProto(): DecProto { + return { dec: "" }; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} +export const registry: Array<[string, GeneratedType]> = [ + ["/cosmos.base.v1beta1.Coin", Coin as never], + ["/cosmos.base.v1beta1.DecCoin", DecCoin as never], + ["/cosmos.base.v1beta1.IntProto", IntProto as never], + ["/cosmos.base.v1beta1.DecProto", DecProto as never], +]; +export const aminoConverters = { + "/cosmos.base.v1beta1.Coin": { + aminoType: "cosmos-sdk/Coin", + toAmino: (message: Coin) => ({ ...message }), + fromAmino: (object: Coin) => ({ ...object }), + }, + + "/cosmos.base.v1beta1.DecCoin": { + aminoType: "cosmos-sdk/DecCoin", + toAmino: (message: DecCoin) => ({ ...message }), + fromAmino: (object: DecCoin) => ({ ...object }), + }, + + "/cosmos.base.v1beta1.IntProto": { + aminoType: "cosmos-sdk/IntProto", + toAmino: (message: IntProto) => ({ ...message }), + fromAmino: (object: IntProto) => ({ ...object }), + }, + + "/cosmos.base.v1beta1.DecProto": { + aminoType: "cosmos-sdk/DecProto", + toAmino: (message: DecProto) => ({ ...message }), + fromAmino: (object: DecProto) => ({ ...object }), + }, +}; diff --git a/packages/cosmos/generated/encoding/cosmos/base/v1beta1/index.ts b/packages/cosmos/generated/encoding/cosmos/base/v1beta1/index.ts new file mode 100644 index 000000000..b81aacb46 --- /dev/null +++ b/packages/cosmos/generated/encoding/cosmos/base/v1beta1/index.ts @@ -0,0 +1,3 @@ +// @ts-nocheck + +export * from './coin'; \ No newline at end of file diff --git a/packages/cosmos/generated/encoding/cosmos/capability/v1beta1/capability.ts b/packages/cosmos/generated/encoding/cosmos/capability/v1beta1/capability.ts new file mode 100644 index 000000000..2c4017560 --- /dev/null +++ b/packages/cosmos/generated/encoding/cosmos/capability/v1beta1/capability.ts @@ -0,0 +1,248 @@ +import type { GeneratedType } from "@cosmjs/proto-signing"; + +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +import type { + CapabilityOwners as CapabilityOwners_type, + Capability as Capability_type, + Owner as Owner_type, +} from "../../../../types/cosmos/capability/v1beta1"; + +import type { DeepPartial, Exact, MessageFns } from "../../../common"; + +export interface Capability extends Capability_type {} +export interface Owner extends Owner_type {} +export interface CapabilityOwners extends CapabilityOwners_type {} + +export const Capability: MessageFns = { + $type: "cosmos.capability.v1beta1.Capability" as const, + + encode(message: Capability, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.index !== 0) { + writer.uint32(8).uint64(message.index); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Capability { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseCapability(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.index = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Capability { + return { index: isSet(object.index) ? globalThis.Number(object.index) : 0 }; + }, + + toJSON(message: Capability): unknown { + const obj: any = {}; + if (message.index !== 0) { + obj.index = Math.round(message.index); + } + return obj; + }, + + create, I>>(base?: I): Capability { + return Capability.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Capability { + const message = createBaseCapability(); + message.index = object.index ?? 0; + return message; + }, +}; + +export const Owner: MessageFns = { + $type: "cosmos.capability.v1beta1.Owner" as const, + + encode(message: Owner, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.module !== "") { + writer.uint32(10).string(message.module); + } + if (message.name !== "") { + writer.uint32(18).string(message.name); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Owner { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseOwner(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.module = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.name = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Owner { + return { + module: isSet(object.module) ? globalThis.String(object.module) : "", + name: isSet(object.name) ? globalThis.String(object.name) : "", + }; + }, + + toJSON(message: Owner): unknown { + const obj: any = {}; + if (message.module !== "") { + obj.module = message.module; + } + if (message.name !== "") { + obj.name = message.name; + } + return obj; + }, + + create, I>>(base?: I): Owner { + return Owner.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Owner { + const message = createBaseOwner(); + message.module = object.module ?? ""; + message.name = object.name ?? ""; + return message; + }, +}; + +export const CapabilityOwners: MessageFns = { + $type: "cosmos.capability.v1beta1.CapabilityOwners" as const, + + encode(message: CapabilityOwners, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.owners) { + Owner.encode(v!, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): CapabilityOwners { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseCapabilityOwners(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.owners.push(Owner.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): CapabilityOwners { + return { owners: globalThis.Array.isArray(object?.owners) ? object.owners.map((e: any) => Owner.fromJSON(e)) : [] }; + }, + + toJSON(message: CapabilityOwners): unknown { + const obj: any = {}; + if (message.owners?.length) { + obj.owners = message.owners.map((e) => Owner.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): CapabilityOwners { + return CapabilityOwners.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): CapabilityOwners { + const message = createBaseCapabilityOwners(); + message.owners = object.owners?.map((e) => Owner.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseCapability(): Capability { + return { index: 0 }; +} + +function createBaseOwner(): Owner { + return { module: "", name: "" }; +} + +function createBaseCapabilityOwners(): CapabilityOwners { + return { owners: [] }; +} + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} +export const registry: Array<[string, GeneratedType]> = [ + ["/cosmos.capability.v1beta1.Capability", Capability as never], + ["/cosmos.capability.v1beta1.Owner", Owner as never], + ["/cosmos.capability.v1beta1.CapabilityOwners", CapabilityOwners as never], +]; +export const aminoConverters = { + "/cosmos.capability.v1beta1.Capability": { + aminoType: "cosmos-sdk/Capability", + toAmino: (message: Capability) => ({ ...message }), + fromAmino: (object: Capability) => ({ ...object }), + }, + + "/cosmos.capability.v1beta1.Owner": { + aminoType: "cosmos-sdk/Owner", + toAmino: (message: Owner) => ({ ...message }), + fromAmino: (object: Owner) => ({ ...object }), + }, + + "/cosmos.capability.v1beta1.CapabilityOwners": { + aminoType: "cosmos-sdk/CapabilityOwners", + toAmino: (message: CapabilityOwners) => ({ ...message }), + fromAmino: (object: CapabilityOwners) => ({ ...object }), + }, +}; diff --git a/packages/cosmos/generated/encoding/cosmos/capability/v1beta1/genesis.ts b/packages/cosmos/generated/encoding/cosmos/capability/v1beta1/genesis.ts new file mode 100644 index 000000000..2c8120bec --- /dev/null +++ b/packages/cosmos/generated/encoding/cosmos/capability/v1beta1/genesis.ts @@ -0,0 +1,196 @@ +import type { GeneratedType } from "@cosmjs/proto-signing"; + +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +import { CapabilityOwners } from "./capability"; + +import type { GenesisOwners as GenesisOwners_type, GenesisState as GenesisState_type } from "../../../../types/cosmos/capability/v1beta1"; + +import type { DeepPartial, Exact, MessageFns } from "../../../common"; + +export interface GenesisOwners extends GenesisOwners_type {} +export interface GenesisState extends GenesisState_type {} + +export const GenesisOwners: MessageFns = { + $type: "cosmos.capability.v1beta1.GenesisOwners" as const, + + encode(message: GenesisOwners, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.index !== 0) { + writer.uint32(8).uint64(message.index); + } + if (message.index_owners !== undefined) { + CapabilityOwners.encode(message.index_owners, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GenesisOwners { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGenesisOwners(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.index = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.index_owners = CapabilityOwners.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GenesisOwners { + return { + index: isSet(object.index) ? globalThis.Number(object.index) : 0, + index_owners: isSet(object.index_owners) ? CapabilityOwners.fromJSON(object.index_owners) : undefined, + }; + }, + + toJSON(message: GenesisOwners): unknown { + const obj: any = {}; + if (message.index !== 0) { + obj.index = Math.round(message.index); + } + if (message.index_owners !== undefined) { + obj.index_owners = CapabilityOwners.toJSON(message.index_owners); + } + return obj; + }, + + create, I>>(base?: I): GenesisOwners { + return GenesisOwners.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): GenesisOwners { + const message = createBaseGenesisOwners(); + message.index = object.index ?? 0; + message.index_owners = object.index_owners !== undefined && object.index_owners !== null ? CapabilityOwners.fromPartial(object.index_owners) : undefined; + return message; + }, +}; + +export const GenesisState: MessageFns = { + $type: "cosmos.capability.v1beta1.GenesisState" as const, + + encode(message: GenesisState, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.index !== 0) { + writer.uint32(8).uint64(message.index); + } + for (const v of message.owners) { + GenesisOwners.encode(v!, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GenesisState { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGenesisState(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.index = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.owners.push(GenesisOwners.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GenesisState { + return { + index: isSet(object.index) ? globalThis.Number(object.index) : 0, + owners: globalThis.Array.isArray(object?.owners) ? object.owners.map((e: any) => GenesisOwners.fromJSON(e)) : [], + }; + }, + + toJSON(message: GenesisState): unknown { + const obj: any = {}; + if (message.index !== 0) { + obj.index = Math.round(message.index); + } + if (message.owners?.length) { + obj.owners = message.owners.map((e) => GenesisOwners.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): GenesisState { + return GenesisState.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): GenesisState { + const message = createBaseGenesisState(); + message.index = object.index ?? 0; + message.owners = object.owners?.map((e) => GenesisOwners.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseGenesisOwners(): GenesisOwners { + return { index: 0, index_owners: undefined }; +} + +function createBaseGenesisState(): GenesisState { + return { index: 0, owners: [] }; +} + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} +export const registry: Array<[string, GeneratedType]> = [ + ["/cosmos.capability.v1beta1.GenesisOwners", GenesisOwners as never], + ["/cosmos.capability.v1beta1.GenesisState", GenesisState as never], +]; +export const aminoConverters = { + "/cosmos.capability.v1beta1.GenesisOwners": { + aminoType: "cosmos-sdk/GenesisOwners", + toAmino: (message: GenesisOwners) => ({ ...message }), + fromAmino: (object: GenesisOwners) => ({ ...object }), + }, + + "/cosmos.capability.v1beta1.GenesisState": { + aminoType: "cosmos-sdk/GenesisState", + toAmino: (message: GenesisState) => ({ ...message }), + fromAmino: (object: GenesisState) => ({ ...object }), + }, +}; diff --git a/packages/cosmos/generated/encoding/cosmos/capability/v1beta1/index.ts b/packages/cosmos/generated/encoding/cosmos/capability/v1beta1/index.ts new file mode 100644 index 000000000..8a11e58ff --- /dev/null +++ b/packages/cosmos/generated/encoding/cosmos/capability/v1beta1/index.ts @@ -0,0 +1,4 @@ +// @ts-nocheck + +export * from './capability'; +export * from './genesis'; \ No newline at end of file diff --git a/packages/cosmos/generated/encoding/cosmos/crisis/v1beta1/genesis.ts b/packages/cosmos/generated/encoding/cosmos/crisis/v1beta1/genesis.ts new file mode 100644 index 000000000..0997cd800 --- /dev/null +++ b/packages/cosmos/generated/encoding/cosmos/crisis/v1beta1/genesis.ts @@ -0,0 +1,82 @@ +import type { GeneratedType } from "@cosmjs/proto-signing"; + +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +import { Coin } from "../../base/v1beta1/coin"; + +import type { GenesisState as GenesisState_type } from "../../../../types/cosmos/crisis/v1beta1"; + +import type { DeepPartial, Exact, MessageFns } from "../../../common"; + +export interface GenesisState extends GenesisState_type {} + +export const GenesisState: MessageFns = { + $type: "cosmos.crisis.v1beta1.GenesisState" as const, + + encode(message: GenesisState, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.constant_fee !== undefined) { + Coin.encode(message.constant_fee, writer.uint32(26).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GenesisState { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGenesisState(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 3: + if (tag !== 26) { + break; + } + + message.constant_fee = Coin.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GenesisState { + return { constant_fee: isSet(object.constant_fee) ? Coin.fromJSON(object.constant_fee) : undefined }; + }, + + toJSON(message: GenesisState): unknown { + const obj: any = {}; + if (message.constant_fee !== undefined) { + obj.constant_fee = Coin.toJSON(message.constant_fee); + } + return obj; + }, + + create, I>>(base?: I): GenesisState { + return GenesisState.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): GenesisState { + const message = createBaseGenesisState(); + message.constant_fee = object.constant_fee !== undefined && object.constant_fee !== null ? Coin.fromPartial(object.constant_fee) : undefined; + return message; + }, +}; + +function createBaseGenesisState(): GenesisState { + return { constant_fee: undefined }; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} +export const registry: Array<[string, GeneratedType]> = [["/cosmos.crisis.v1beta1.GenesisState", GenesisState as never]]; +export const aminoConverters = { + "/cosmos.crisis.v1beta1.GenesisState": { + aminoType: "cosmos-sdk/GenesisState", + toAmino: (message: GenesisState) => ({ ...message }), + fromAmino: (object: GenesisState) => ({ ...object }), + }, +}; diff --git a/packages/cosmos/generated/encoding/cosmos/crisis/v1beta1/index.ts b/packages/cosmos/generated/encoding/cosmos/crisis/v1beta1/index.ts new file mode 100644 index 000000000..afdc62858 --- /dev/null +++ b/packages/cosmos/generated/encoding/cosmos/crisis/v1beta1/index.ts @@ -0,0 +1,4 @@ +// @ts-nocheck + +export * from './genesis'; +export * from './tx'; \ No newline at end of file diff --git a/packages/cosmos/generated/encoding/cosmos/crisis/v1beta1/tx.ts b/packages/cosmos/generated/encoding/cosmos/crisis/v1beta1/tx.ts new file mode 100644 index 000000000..507c6a70f --- /dev/null +++ b/packages/cosmos/generated/encoding/cosmos/crisis/v1beta1/tx.ts @@ -0,0 +1,161 @@ +import type { GeneratedType } from "@cosmjs/proto-signing"; + +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +import type { + MsgVerifyInvariantResponse as MsgVerifyInvariantResponse_type, + MsgVerifyInvariant as MsgVerifyInvariant_type, +} from "../../../../types/cosmos/crisis/v1beta1"; + +import type { DeepPartial, Exact, MessageFns } from "../../../common"; + +export interface MsgVerifyInvariant extends MsgVerifyInvariant_type {} +export interface MsgVerifyInvariantResponse extends MsgVerifyInvariantResponse_type {} + +export const MsgVerifyInvariant: MessageFns = { + $type: "cosmos.crisis.v1beta1.MsgVerifyInvariant" as const, + + encode(message: MsgVerifyInvariant, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.sender !== "") { + writer.uint32(10).string(message.sender); + } + if (message.invariant_module_name !== "") { + writer.uint32(18).string(message.invariant_module_name); + } + if (message.invariant_route !== "") { + writer.uint32(26).string(message.invariant_route); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgVerifyInvariant { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgVerifyInvariant(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.sender = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.invariant_module_name = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.invariant_route = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgVerifyInvariant { + return { + sender: isSet(object.sender) ? globalThis.String(object.sender) : "", + invariant_module_name: isSet(object.invariant_module_name) ? globalThis.String(object.invariant_module_name) : "", + invariant_route: isSet(object.invariant_route) ? globalThis.String(object.invariant_route) : "", + }; + }, + + toJSON(message: MsgVerifyInvariant): unknown { + const obj: any = {}; + if (message.sender !== "") { + obj.sender = message.sender; + } + if (message.invariant_module_name !== "") { + obj.invariant_module_name = message.invariant_module_name; + } + if (message.invariant_route !== "") { + obj.invariant_route = message.invariant_route; + } + return obj; + }, + + create, I>>(base?: I): MsgVerifyInvariant { + return MsgVerifyInvariant.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgVerifyInvariant { + const message = createBaseMsgVerifyInvariant(); + message.sender = object.sender ?? ""; + message.invariant_module_name = object.invariant_module_name ?? ""; + message.invariant_route = object.invariant_route ?? ""; + return message; + }, +}; + +export const MsgVerifyInvariantResponse: MessageFns = { + $type: "cosmos.crisis.v1beta1.MsgVerifyInvariantResponse" as const, + + encode(_: MsgVerifyInvariantResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgVerifyInvariantResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgVerifyInvariantResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgVerifyInvariantResponse { + return {}; + }, + + toJSON(_: MsgVerifyInvariantResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgVerifyInvariantResponse { + return MsgVerifyInvariantResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgVerifyInvariantResponse { + const message = createBaseMsgVerifyInvariantResponse(); + return message; + }, +}; + +function createBaseMsgVerifyInvariant(): MsgVerifyInvariant { + return { sender: "", invariant_module_name: "", invariant_route: "" }; +} + +function createBaseMsgVerifyInvariantResponse(): MsgVerifyInvariantResponse { + return {}; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} +export const registry: Array<[string, GeneratedType]> = [["/cosmos.crisis.v1beta1.MsgVerifyInvariant", MsgVerifyInvariant as never]]; +export const aminoConverters = { + "/cosmos.crisis.v1beta1.MsgVerifyInvariant": { + aminoType: "cosmos-sdk/MsgVerifyInvariant", + toAmino: (message: MsgVerifyInvariant) => ({ ...message }), + fromAmino: (object: MsgVerifyInvariant) => ({ ...object }), + }, +}; diff --git a/packages/cosmos/generated/encoding/cosmos/crypto/ed25519/index.ts b/packages/cosmos/generated/encoding/cosmos/crypto/ed25519/index.ts new file mode 100644 index 000000000..2d2828c1d --- /dev/null +++ b/packages/cosmos/generated/encoding/cosmos/crypto/ed25519/index.ts @@ -0,0 +1,3 @@ +// @ts-nocheck + +export * from './keys'; \ No newline at end of file diff --git a/packages/cosmos/generated/encoding/cosmos/crypto/ed25519/keys.ts b/packages/cosmos/generated/encoding/cosmos/crypto/ed25519/keys.ts new file mode 100644 index 000000000..cc56573dd --- /dev/null +++ b/packages/cosmos/generated/encoding/cosmos/crypto/ed25519/keys.ts @@ -0,0 +1,174 @@ +import type { GeneratedType } from "@cosmjs/proto-signing"; + +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +import type { PrivKey as PrivKey_type, PubKey as PubKey_type } from "../../../../types/cosmos/crypto/ed25519"; + +import type { DeepPartial, Exact, MessageFns } from "../../../common"; + +export interface PubKey extends PubKey_type {} +export interface PrivKey extends PrivKey_type {} + +export const PubKey: MessageFns = { + $type: "cosmos.crypto.ed25519.PubKey" as const, + + encode(message: PubKey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.key.length !== 0) { + writer.uint32(10).bytes(message.key); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): PubKey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePubKey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.key = reader.bytes(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): PubKey { + return { key: isSet(object.key) ? bytesFromBase64(object.key) : new Uint8Array(0) }; + }, + + toJSON(message: PubKey): unknown { + const obj: any = {}; + if (message.key.length !== 0) { + obj.key = base64FromBytes(message.key); + } + return obj; + }, + + create, I>>(base?: I): PubKey { + return PubKey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): PubKey { + const message = createBasePubKey(); + message.key = object.key ?? new Uint8Array(0); + return message; + }, +}; + +export const PrivKey: MessageFns = { + $type: "cosmos.crypto.ed25519.PrivKey" as const, + + encode(message: PrivKey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.key.length !== 0) { + writer.uint32(10).bytes(message.key); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): PrivKey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePrivKey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.key = reader.bytes(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): PrivKey { + return { key: isSet(object.key) ? bytesFromBase64(object.key) : new Uint8Array(0) }; + }, + + toJSON(message: PrivKey): unknown { + const obj: any = {}; + if (message.key.length !== 0) { + obj.key = base64FromBytes(message.key); + } + return obj; + }, + + create, I>>(base?: I): PrivKey { + return PrivKey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): PrivKey { + const message = createBasePrivKey(); + message.key = object.key ?? new Uint8Array(0); + return message; + }, +}; + +function createBasePubKey(): PubKey { + return { key: new Uint8Array(0) }; +} + +function createBasePrivKey(): PrivKey { + return { key: new Uint8Array(0) }; +} + +function bytesFromBase64(b64: string): Uint8Array { + if ((globalThis as any).Buffer) { + return Uint8Array.from(globalThis.Buffer.from(b64, "base64")); + } else { + const bin = globalThis.atob(b64); + const arr = new Uint8Array(bin.length); + for (let i = 0; i < bin.length; ++i) { + arr[i] = bin.charCodeAt(i); + } + return arr; + } +} + +function base64FromBytes(arr: Uint8Array): string { + if ((globalThis as any).Buffer) { + return globalThis.Buffer.from(arr).toString("base64"); + } else { + const bin: string[] = []; + arr.forEach((byte) => { + bin.push(globalThis.String.fromCharCode(byte)); + }); + return globalThis.btoa(bin.join("")); + } +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} +export const registry: Array<[string, GeneratedType]> = [ + ["/cosmos.crypto.ed25519.PubKey", PubKey as never], + ["/cosmos.crypto.ed25519.PrivKey", PrivKey as never], +]; +export const aminoConverters = { + "/cosmos.crypto.ed25519.PubKey": { + aminoType: "cosmos-sdk/PubKey", + toAmino: (message: PubKey) => ({ ...message }), + fromAmino: (object: PubKey) => ({ ...object }), + }, + + "/cosmos.crypto.ed25519.PrivKey": { + aminoType: "cosmos-sdk/PrivKey", + toAmino: (message: PrivKey) => ({ ...message }), + fromAmino: (object: PrivKey) => ({ ...object }), + }, +}; diff --git a/packages/cosmos/generated/encoding/cosmos/crypto/multisig/index.ts b/packages/cosmos/generated/encoding/cosmos/crypto/multisig/index.ts new file mode 100644 index 000000000..2d2828c1d --- /dev/null +++ b/packages/cosmos/generated/encoding/cosmos/crypto/multisig/index.ts @@ -0,0 +1,3 @@ +// @ts-nocheck + +export * from './keys'; \ No newline at end of file diff --git a/packages/cosmos/generated/encoding/cosmos/crypto/multisig/keys.ts b/packages/cosmos/generated/encoding/cosmos/crypto/multisig/keys.ts new file mode 100644 index 000000000..c26297ee7 --- /dev/null +++ b/packages/cosmos/generated/encoding/cosmos/crypto/multisig/keys.ts @@ -0,0 +1,99 @@ +import type { GeneratedType } from "@cosmjs/proto-signing"; + +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +import { Any } from "../../../google/protobuf/any"; + +import type { LegacyAminoPubKey as LegacyAminoPubKey_type } from "../../../../types/cosmos/crypto/multisig"; + +import type { DeepPartial, Exact, MessageFns } from "../../../common"; + +export interface LegacyAminoPubKey extends LegacyAminoPubKey_type {} + +export const LegacyAminoPubKey: MessageFns = { + $type: "cosmos.crypto.multisig.LegacyAminoPubKey" as const, + + encode(message: LegacyAminoPubKey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.threshold !== 0) { + writer.uint32(8).uint32(message.threshold); + } + for (const v of message.public_keys) { + Any.encode(v!, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): LegacyAminoPubKey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseLegacyAminoPubKey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.threshold = reader.uint32(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.public_keys.push(Any.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): LegacyAminoPubKey { + return { + threshold: isSet(object.threshold) ? globalThis.Number(object.threshold) : 0, + public_keys: globalThis.Array.isArray(object?.public_keys) ? object.public_keys.map((e: any) => Any.fromJSON(e)) : [], + }; + }, + + toJSON(message: LegacyAminoPubKey): unknown { + const obj: any = {}; + if (message.threshold !== 0) { + obj.threshold = Math.round(message.threshold); + } + if (message.public_keys?.length) { + obj.public_keys = message.public_keys.map((e) => Any.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): LegacyAminoPubKey { + return LegacyAminoPubKey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): LegacyAminoPubKey { + const message = createBaseLegacyAminoPubKey(); + message.threshold = object.threshold ?? 0; + message.public_keys = object.public_keys?.map((e) => Any.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseLegacyAminoPubKey(): LegacyAminoPubKey { + return { threshold: 0, public_keys: [] }; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} +export const registry: Array<[string, GeneratedType]> = [["/cosmos.crypto.multisig.LegacyAminoPubKey", LegacyAminoPubKey as never]]; +export const aminoConverters = { + "/cosmos.crypto.multisig.LegacyAminoPubKey": { + aminoType: "cosmos-sdk/LegacyAminoPubKey", + toAmino: (message: LegacyAminoPubKey) => ({ ...message }), + fromAmino: (object: LegacyAminoPubKey) => ({ ...object }), + }, +}; diff --git a/packages/cosmos/generated/encoding/cosmos/crypto/multisig/v1beta1/index.ts b/packages/cosmos/generated/encoding/cosmos/crypto/multisig/v1beta1/index.ts new file mode 100644 index 000000000..77ccbe516 --- /dev/null +++ b/packages/cosmos/generated/encoding/cosmos/crypto/multisig/v1beta1/index.ts @@ -0,0 +1,3 @@ +// @ts-nocheck + +export * from './multisig'; \ No newline at end of file diff --git a/packages/cosmos/generated/encoding/cosmos/crypto/multisig/v1beta1/multisig.ts b/packages/cosmos/generated/encoding/cosmos/crypto/multisig/v1beta1/multisig.ts new file mode 100644 index 000000000..785687492 --- /dev/null +++ b/packages/cosmos/generated/encoding/cosmos/crypto/multisig/v1beta1/multisig.ts @@ -0,0 +1,193 @@ +import type { GeneratedType } from "@cosmjs/proto-signing"; + +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +import type { CompactBitArray as CompactBitArray_type, MultiSignature as MultiSignature_type } from "../../../../../types/cosmos/crypto/multisig/v1beta1"; + +import type { DeepPartial, Exact, MessageFns } from "../../../../common"; + +export interface MultiSignature extends MultiSignature_type {} +export interface CompactBitArray extends CompactBitArray_type {} + +export const MultiSignature: MessageFns = { + $type: "cosmos.crypto.multisig.v1beta1.MultiSignature" as const, + + encode(message: MultiSignature, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.signatures) { + writer.uint32(10).bytes(v!); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MultiSignature { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMultiSignature(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.signatures.push(reader.bytes()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MultiSignature { + return { + signatures: globalThis.Array.isArray(object?.signatures) ? object.signatures.map((e: any) => bytesFromBase64(e)) : [], + }; + }, + + toJSON(message: MultiSignature): unknown { + const obj: any = {}; + if (message.signatures?.length) { + obj.signatures = message.signatures.map((e) => base64FromBytes(e)); + } + return obj; + }, + + create, I>>(base?: I): MultiSignature { + return MultiSignature.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MultiSignature { + const message = createBaseMultiSignature(); + message.signatures = object.signatures?.map((e) => e) || []; + return message; + }, +}; + +export const CompactBitArray: MessageFns = { + $type: "cosmos.crypto.multisig.v1beta1.CompactBitArray" as const, + + encode(message: CompactBitArray, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.extra_bits_stored !== 0) { + writer.uint32(8).uint32(message.extra_bits_stored); + } + if (message.elems.length !== 0) { + writer.uint32(18).bytes(message.elems); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): CompactBitArray { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseCompactBitArray(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.extra_bits_stored = reader.uint32(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.elems = reader.bytes(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): CompactBitArray { + return { + extra_bits_stored: isSet(object.extra_bits_stored) ? globalThis.Number(object.extra_bits_stored) : 0, + elems: isSet(object.elems) ? bytesFromBase64(object.elems) : new Uint8Array(0), + }; + }, + + toJSON(message: CompactBitArray): unknown { + const obj: any = {}; + if (message.extra_bits_stored !== 0) { + obj.extra_bits_stored = Math.round(message.extra_bits_stored); + } + if (message.elems.length !== 0) { + obj.elems = base64FromBytes(message.elems); + } + return obj; + }, + + create, I>>(base?: I): CompactBitArray { + return CompactBitArray.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): CompactBitArray { + const message = createBaseCompactBitArray(); + message.extra_bits_stored = object.extra_bits_stored ?? 0; + message.elems = object.elems ?? new Uint8Array(0); + return message; + }, +}; + +function createBaseMultiSignature(): MultiSignature { + return { signatures: [] }; +} + +function createBaseCompactBitArray(): CompactBitArray { + return { extra_bits_stored: 0, elems: new Uint8Array(0) }; +} + +function bytesFromBase64(b64: string): Uint8Array { + if ((globalThis as any).Buffer) { + return Uint8Array.from(globalThis.Buffer.from(b64, "base64")); + } else { + const bin = globalThis.atob(b64); + const arr = new Uint8Array(bin.length); + for (let i = 0; i < bin.length; ++i) { + arr[i] = bin.charCodeAt(i); + } + return arr; + } +} + +function base64FromBytes(arr: Uint8Array): string { + if ((globalThis as any).Buffer) { + return globalThis.Buffer.from(arr).toString("base64"); + } else { + const bin: string[] = []; + arr.forEach((byte) => { + bin.push(globalThis.String.fromCharCode(byte)); + }); + return globalThis.btoa(bin.join("")); + } +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} +export const registry: Array<[string, GeneratedType]> = [ + ["/cosmos.crypto.multisig.v1beta1.MultiSignature", MultiSignature as never], + ["/cosmos.crypto.multisig.v1beta1.CompactBitArray", CompactBitArray as never], +]; +export const aminoConverters = { + "/cosmos.crypto.multisig.v1beta1.MultiSignature": { + aminoType: "cosmos-sdk/MultiSignature", + toAmino: (message: MultiSignature) => ({ ...message }), + fromAmino: (object: MultiSignature) => ({ ...object }), + }, + + "/cosmos.crypto.multisig.v1beta1.CompactBitArray": { + aminoType: "cosmos-sdk/CompactBitArray", + toAmino: (message: CompactBitArray) => ({ ...message }), + fromAmino: (object: CompactBitArray) => ({ ...object }), + }, +}; diff --git a/packages/cosmos/generated/encoding/cosmos/crypto/secp256k1/index.ts b/packages/cosmos/generated/encoding/cosmos/crypto/secp256k1/index.ts new file mode 100644 index 000000000..2d2828c1d --- /dev/null +++ b/packages/cosmos/generated/encoding/cosmos/crypto/secp256k1/index.ts @@ -0,0 +1,3 @@ +// @ts-nocheck + +export * from './keys'; \ No newline at end of file diff --git a/packages/cosmos/generated/encoding/cosmos/crypto/secp256k1/keys.ts b/packages/cosmos/generated/encoding/cosmos/crypto/secp256k1/keys.ts new file mode 100644 index 000000000..06f138b55 --- /dev/null +++ b/packages/cosmos/generated/encoding/cosmos/crypto/secp256k1/keys.ts @@ -0,0 +1,174 @@ +import type { GeneratedType } from "@cosmjs/proto-signing"; + +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +import type { PrivKey as PrivKey_type, PubKey as PubKey_type } from "../../../../types/cosmos/crypto/secp256k1"; + +import type { DeepPartial, Exact, MessageFns } from "../../../common"; + +export interface PubKey extends PubKey_type {} +export interface PrivKey extends PrivKey_type {} + +export const PubKey: MessageFns = { + $type: "cosmos.crypto.secp256k1.PubKey" as const, + + encode(message: PubKey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.key.length !== 0) { + writer.uint32(10).bytes(message.key); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): PubKey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePubKey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.key = reader.bytes(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): PubKey { + return { key: isSet(object.key) ? bytesFromBase64(object.key) : new Uint8Array(0) }; + }, + + toJSON(message: PubKey): unknown { + const obj: any = {}; + if (message.key.length !== 0) { + obj.key = base64FromBytes(message.key); + } + return obj; + }, + + create, I>>(base?: I): PubKey { + return PubKey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): PubKey { + const message = createBasePubKey(); + message.key = object.key ?? new Uint8Array(0); + return message; + }, +}; + +export const PrivKey: MessageFns = { + $type: "cosmos.crypto.secp256k1.PrivKey" as const, + + encode(message: PrivKey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.key.length !== 0) { + writer.uint32(10).bytes(message.key); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): PrivKey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePrivKey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.key = reader.bytes(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): PrivKey { + return { key: isSet(object.key) ? bytesFromBase64(object.key) : new Uint8Array(0) }; + }, + + toJSON(message: PrivKey): unknown { + const obj: any = {}; + if (message.key.length !== 0) { + obj.key = base64FromBytes(message.key); + } + return obj; + }, + + create, I>>(base?: I): PrivKey { + return PrivKey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): PrivKey { + const message = createBasePrivKey(); + message.key = object.key ?? new Uint8Array(0); + return message; + }, +}; + +function createBasePubKey(): PubKey { + return { key: new Uint8Array(0) }; +} + +function createBasePrivKey(): PrivKey { + return { key: new Uint8Array(0) }; +} + +function bytesFromBase64(b64: string): Uint8Array { + if ((globalThis as any).Buffer) { + return Uint8Array.from(globalThis.Buffer.from(b64, "base64")); + } else { + const bin = globalThis.atob(b64); + const arr = new Uint8Array(bin.length); + for (let i = 0; i < bin.length; ++i) { + arr[i] = bin.charCodeAt(i); + } + return arr; + } +} + +function base64FromBytes(arr: Uint8Array): string { + if ((globalThis as any).Buffer) { + return globalThis.Buffer.from(arr).toString("base64"); + } else { + const bin: string[] = []; + arr.forEach((byte) => { + bin.push(globalThis.String.fromCharCode(byte)); + }); + return globalThis.btoa(bin.join("")); + } +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} +export const registry: Array<[string, GeneratedType]> = [ + ["/cosmos.crypto.secp256k1.PubKey", PubKey as never], + ["/cosmos.crypto.secp256k1.PrivKey", PrivKey as never], +]; +export const aminoConverters = { + "/cosmos.crypto.secp256k1.PubKey": { + aminoType: "cosmos-sdk/PubKey", + toAmino: (message: PubKey) => ({ ...message }), + fromAmino: (object: PubKey) => ({ ...object }), + }, + + "/cosmos.crypto.secp256k1.PrivKey": { + aminoType: "cosmos-sdk/PrivKey", + toAmino: (message: PrivKey) => ({ ...message }), + fromAmino: (object: PrivKey) => ({ ...object }), + }, +}; diff --git a/packages/cosmos/generated/encoding/cosmos/crypto/secp256r1/index.ts b/packages/cosmos/generated/encoding/cosmos/crypto/secp256r1/index.ts new file mode 100644 index 000000000..2d2828c1d --- /dev/null +++ b/packages/cosmos/generated/encoding/cosmos/crypto/secp256r1/index.ts @@ -0,0 +1,3 @@ +// @ts-nocheck + +export * from './keys'; \ No newline at end of file diff --git a/packages/cosmos/generated/encoding/cosmos/crypto/secp256r1/keys.ts b/packages/cosmos/generated/encoding/cosmos/crypto/secp256r1/keys.ts new file mode 100644 index 000000000..4b053b639 --- /dev/null +++ b/packages/cosmos/generated/encoding/cosmos/crypto/secp256r1/keys.ts @@ -0,0 +1,174 @@ +import type { GeneratedType } from "@cosmjs/proto-signing"; + +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +import type { PrivKey as PrivKey_type, PubKey as PubKey_type } from "../../../../types/cosmos/crypto/secp256r1"; + +import type { DeepPartial, Exact, MessageFns } from "../../../common"; + +export interface PubKey extends PubKey_type {} +export interface PrivKey extends PrivKey_type {} + +export const PubKey: MessageFns = { + $type: "cosmos.crypto.secp256r1.PubKey" as const, + + encode(message: PubKey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.key.length !== 0) { + writer.uint32(10).bytes(message.key); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): PubKey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePubKey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.key = reader.bytes(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): PubKey { + return { key: isSet(object.key) ? bytesFromBase64(object.key) : new Uint8Array(0) }; + }, + + toJSON(message: PubKey): unknown { + const obj: any = {}; + if (message.key.length !== 0) { + obj.key = base64FromBytes(message.key); + } + return obj; + }, + + create, I>>(base?: I): PubKey { + return PubKey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): PubKey { + const message = createBasePubKey(); + message.key = object.key ?? new Uint8Array(0); + return message; + }, +}; + +export const PrivKey: MessageFns = { + $type: "cosmos.crypto.secp256r1.PrivKey" as const, + + encode(message: PrivKey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.secret.length !== 0) { + writer.uint32(10).bytes(message.secret); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): PrivKey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePrivKey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.secret = reader.bytes(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): PrivKey { + return { secret: isSet(object.secret) ? bytesFromBase64(object.secret) : new Uint8Array(0) }; + }, + + toJSON(message: PrivKey): unknown { + const obj: any = {}; + if (message.secret.length !== 0) { + obj.secret = base64FromBytes(message.secret); + } + return obj; + }, + + create, I>>(base?: I): PrivKey { + return PrivKey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): PrivKey { + const message = createBasePrivKey(); + message.secret = object.secret ?? new Uint8Array(0); + return message; + }, +}; + +function createBasePubKey(): PubKey { + return { key: new Uint8Array(0) }; +} + +function createBasePrivKey(): PrivKey { + return { secret: new Uint8Array(0) }; +} + +function bytesFromBase64(b64: string): Uint8Array { + if ((globalThis as any).Buffer) { + return Uint8Array.from(globalThis.Buffer.from(b64, "base64")); + } else { + const bin = globalThis.atob(b64); + const arr = new Uint8Array(bin.length); + for (let i = 0; i < bin.length; ++i) { + arr[i] = bin.charCodeAt(i); + } + return arr; + } +} + +function base64FromBytes(arr: Uint8Array): string { + if ((globalThis as any).Buffer) { + return globalThis.Buffer.from(arr).toString("base64"); + } else { + const bin: string[] = []; + arr.forEach((byte) => { + bin.push(globalThis.String.fromCharCode(byte)); + }); + return globalThis.btoa(bin.join("")); + } +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} +export const registry: Array<[string, GeneratedType]> = [ + ["/cosmos.crypto.secp256r1.PubKey", PubKey as never], + ["/cosmos.crypto.secp256r1.PrivKey", PrivKey as never], +]; +export const aminoConverters = { + "/cosmos.crypto.secp256r1.PubKey": { + aminoType: "cosmos-sdk/PubKey", + toAmino: (message: PubKey) => ({ ...message }), + fromAmino: (object: PubKey) => ({ ...object }), + }, + + "/cosmos.crypto.secp256r1.PrivKey": { + aminoType: "cosmos-sdk/PrivKey", + toAmino: (message: PrivKey) => ({ ...message }), + fromAmino: (object: PrivKey) => ({ ...object }), + }, +}; diff --git a/packages/cosmos/generated/encoding/cosmos/crypto/sr25519/index.ts b/packages/cosmos/generated/encoding/cosmos/crypto/sr25519/index.ts new file mode 100644 index 000000000..2d2828c1d --- /dev/null +++ b/packages/cosmos/generated/encoding/cosmos/crypto/sr25519/index.ts @@ -0,0 +1,3 @@ +// @ts-nocheck + +export * from './keys'; \ No newline at end of file diff --git a/packages/cosmos/generated/encoding/cosmos/crypto/sr25519/keys.ts b/packages/cosmos/generated/encoding/cosmos/crypto/sr25519/keys.ts new file mode 100644 index 000000000..1d8210dea --- /dev/null +++ b/packages/cosmos/generated/encoding/cosmos/crypto/sr25519/keys.ts @@ -0,0 +1,105 @@ +import type { GeneratedType } from "@cosmjs/proto-signing"; + +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +import type { PubKey as PubKey_type } from "../../../../types/cosmos/crypto/sr25519"; + +import type { DeepPartial, Exact, MessageFns } from "../../../common"; + +export interface PubKey extends PubKey_type {} + +export const PubKey: MessageFns = { + $type: "cosmos.crypto.sr25519.PubKey" as const, + + encode(message: PubKey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.key.length !== 0) { + writer.uint32(10).bytes(message.key); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): PubKey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePubKey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.key = reader.bytes(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): PubKey { + return { key: isSet(object.key) ? bytesFromBase64(object.key) : new Uint8Array(0) }; + }, + + toJSON(message: PubKey): unknown { + const obj: any = {}; + if (message.key.length !== 0) { + obj.key = base64FromBytes(message.key); + } + return obj; + }, + + create, I>>(base?: I): PubKey { + return PubKey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): PubKey { + const message = createBasePubKey(); + message.key = object.key ?? new Uint8Array(0); + return message; + }, +}; + +function createBasePubKey(): PubKey { + return { key: new Uint8Array(0) }; +} + +function bytesFromBase64(b64: string): Uint8Array { + if ((globalThis as any).Buffer) { + return Uint8Array.from(globalThis.Buffer.from(b64, "base64")); + } else { + const bin = globalThis.atob(b64); + const arr = new Uint8Array(bin.length); + for (let i = 0; i < bin.length; ++i) { + arr[i] = bin.charCodeAt(i); + } + return arr; + } +} + +function base64FromBytes(arr: Uint8Array): string { + if ((globalThis as any).Buffer) { + return globalThis.Buffer.from(arr).toString("base64"); + } else { + const bin: string[] = []; + arr.forEach((byte) => { + bin.push(globalThis.String.fromCharCode(byte)); + }); + return globalThis.btoa(bin.join("")); + } +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} +export const registry: Array<[string, GeneratedType]> = [["/cosmos.crypto.sr25519.PubKey", PubKey as never]]; +export const aminoConverters = { + "/cosmos.crypto.sr25519.PubKey": { + aminoType: "cosmos-sdk/PubKey", + toAmino: (message: PubKey) => ({ ...message }), + fromAmino: (object: PubKey) => ({ ...object }), + }, +}; diff --git a/packages/cosmos/generated/encoding/cosmos/distribution/v1beta1/distribution.ts b/packages/cosmos/generated/encoding/cosmos/distribution/v1beta1/distribution.ts new file mode 100644 index 000000000..712a5de3c --- /dev/null +++ b/packages/cosmos/generated/encoding/cosmos/distribution/v1beta1/distribution.ts @@ -0,0 +1,1053 @@ +import type { GeneratedType } from "@cosmjs/proto-signing"; + +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +import { Coin, DecCoin } from "../../base/v1beta1/coin"; + +import type { + CommunityPoolSpendProposalWithDeposit as CommunityPoolSpendProposalWithDeposit_type, + CommunityPoolSpendProposal as CommunityPoolSpendProposal_type, + DelegationDelegatorReward as DelegationDelegatorReward_type, + DelegatorStartingInfo as DelegatorStartingInfo_type, + FeePool as FeePool_type, + Params as Params_type, + ValidatorAccumulatedCommission as ValidatorAccumulatedCommission_type, + ValidatorCurrentRewards as ValidatorCurrentRewards_type, + ValidatorHistoricalRewards as ValidatorHistoricalRewards_type, + ValidatorOutstandingRewards as ValidatorOutstandingRewards_type, + ValidatorSlashEvent as ValidatorSlashEvent_type, + ValidatorSlashEvents as ValidatorSlashEvents_type, +} from "../../../../types/cosmos/distribution/v1beta1"; + +import type { DeepPartial, Exact, MessageFns } from "../../../common"; + +export interface Params extends Params_type {} +export interface ValidatorHistoricalRewards extends ValidatorHistoricalRewards_type {} +export interface ValidatorCurrentRewards extends ValidatorCurrentRewards_type {} +export interface ValidatorAccumulatedCommission extends ValidatorAccumulatedCommission_type {} +export interface ValidatorOutstandingRewards extends ValidatorOutstandingRewards_type {} +export interface ValidatorSlashEvent extends ValidatorSlashEvent_type {} +export interface ValidatorSlashEvents extends ValidatorSlashEvents_type {} +export interface FeePool extends FeePool_type {} +export interface CommunityPoolSpendProposal extends CommunityPoolSpendProposal_type {} +export interface DelegatorStartingInfo extends DelegatorStartingInfo_type {} +export interface DelegationDelegatorReward extends DelegationDelegatorReward_type {} +export interface CommunityPoolSpendProposalWithDeposit extends CommunityPoolSpendProposalWithDeposit_type {} + +export const Params: MessageFns = { + $type: "cosmos.distribution.v1beta1.Params" as const, + + encode(message: Params, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.community_tax !== "") { + writer.uint32(10).string(message.community_tax); + } + if (message.base_proposer_reward !== "") { + writer.uint32(18).string(message.base_proposer_reward); + } + if (message.bonus_proposer_reward !== "") { + writer.uint32(26).string(message.bonus_proposer_reward); + } + if (message.withdraw_addr_enabled !== false) { + writer.uint32(32).bool(message.withdraw_addr_enabled); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Params { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.community_tax = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.base_proposer_reward = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.bonus_proposer_reward = reader.string(); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.withdraw_addr_enabled = reader.bool(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Params { + return { + community_tax: isSet(object.community_tax) ? globalThis.String(object.community_tax) : "", + base_proposer_reward: isSet(object.base_proposer_reward) ? globalThis.String(object.base_proposer_reward) : "", + bonus_proposer_reward: isSet(object.bonus_proposer_reward) ? globalThis.String(object.bonus_proposer_reward) : "", + withdraw_addr_enabled: isSet(object.withdraw_addr_enabled) ? globalThis.Boolean(object.withdraw_addr_enabled) : false, + }; + }, + + toJSON(message: Params): unknown { + const obj: any = {}; + if (message.community_tax !== "") { + obj.community_tax = message.community_tax; + } + if (message.base_proposer_reward !== "") { + obj.base_proposer_reward = message.base_proposer_reward; + } + if (message.bonus_proposer_reward !== "") { + obj.bonus_proposer_reward = message.bonus_proposer_reward; + } + if (message.withdraw_addr_enabled !== false) { + obj.withdraw_addr_enabled = message.withdraw_addr_enabled; + } + return obj; + }, + + create, I>>(base?: I): Params { + return Params.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Params { + const message = createBaseParams(); + message.community_tax = object.community_tax ?? ""; + message.base_proposer_reward = object.base_proposer_reward ?? ""; + message.bonus_proposer_reward = object.bonus_proposer_reward ?? ""; + message.withdraw_addr_enabled = object.withdraw_addr_enabled ?? false; + return message; + }, +}; + +export const ValidatorHistoricalRewards: MessageFns = { + $type: "cosmos.distribution.v1beta1.ValidatorHistoricalRewards" as const, + + encode(message: ValidatorHistoricalRewards, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.cumulative_reward_ratio) { + DecCoin.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.reference_count !== 0) { + writer.uint32(16).uint32(message.reference_count); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ValidatorHistoricalRewards { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseValidatorHistoricalRewards(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.cumulative_reward_ratio.push(DecCoin.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.reference_count = reader.uint32(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ValidatorHistoricalRewards { + return { + cumulative_reward_ratio: globalThis.Array.isArray(object?.cumulative_reward_ratio) + ? object.cumulative_reward_ratio.map((e: any) => DecCoin.fromJSON(e)) + : [], + reference_count: isSet(object.reference_count) ? globalThis.Number(object.reference_count) : 0, + }; + }, + + toJSON(message: ValidatorHistoricalRewards): unknown { + const obj: any = {}; + if (message.cumulative_reward_ratio?.length) { + obj.cumulative_reward_ratio = message.cumulative_reward_ratio.map((e) => DecCoin.toJSON(e)); + } + if (message.reference_count !== 0) { + obj.reference_count = Math.round(message.reference_count); + } + return obj; + }, + + create, I>>(base?: I): ValidatorHistoricalRewards { + return ValidatorHistoricalRewards.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ValidatorHistoricalRewards { + const message = createBaseValidatorHistoricalRewards(); + message.cumulative_reward_ratio = object.cumulative_reward_ratio?.map((e) => DecCoin.fromPartial(e)) || []; + message.reference_count = object.reference_count ?? 0; + return message; + }, +}; + +export const ValidatorCurrentRewards: MessageFns = { + $type: "cosmos.distribution.v1beta1.ValidatorCurrentRewards" as const, + + encode(message: ValidatorCurrentRewards, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.rewards) { + DecCoin.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.period !== 0) { + writer.uint32(16).uint64(message.period); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ValidatorCurrentRewards { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseValidatorCurrentRewards(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.rewards.push(DecCoin.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.period = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ValidatorCurrentRewards { + return { + rewards: globalThis.Array.isArray(object?.rewards) ? object.rewards.map((e: any) => DecCoin.fromJSON(e)) : [], + period: isSet(object.period) ? globalThis.Number(object.period) : 0, + }; + }, + + toJSON(message: ValidatorCurrentRewards): unknown { + const obj: any = {}; + if (message.rewards?.length) { + obj.rewards = message.rewards.map((e) => DecCoin.toJSON(e)); + } + if (message.period !== 0) { + obj.period = Math.round(message.period); + } + return obj; + }, + + create, I>>(base?: I): ValidatorCurrentRewards { + return ValidatorCurrentRewards.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ValidatorCurrentRewards { + const message = createBaseValidatorCurrentRewards(); + message.rewards = object.rewards?.map((e) => DecCoin.fromPartial(e)) || []; + message.period = object.period ?? 0; + return message; + }, +}; + +export const ValidatorAccumulatedCommission: MessageFns = { + $type: "cosmos.distribution.v1beta1.ValidatorAccumulatedCommission" as const, + + encode(message: ValidatorAccumulatedCommission, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.commission) { + DecCoin.encode(v!, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ValidatorAccumulatedCommission { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseValidatorAccumulatedCommission(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.commission.push(DecCoin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ValidatorAccumulatedCommission { + return { + commission: globalThis.Array.isArray(object?.commission) ? object.commission.map((e: any) => DecCoin.fromJSON(e)) : [], + }; + }, + + toJSON(message: ValidatorAccumulatedCommission): unknown { + const obj: any = {}; + if (message.commission?.length) { + obj.commission = message.commission.map((e) => DecCoin.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): ValidatorAccumulatedCommission { + return ValidatorAccumulatedCommission.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ValidatorAccumulatedCommission { + const message = createBaseValidatorAccumulatedCommission(); + message.commission = object.commission?.map((e) => DecCoin.fromPartial(e)) || []; + return message; + }, +}; + +export const ValidatorOutstandingRewards: MessageFns = { + $type: "cosmos.distribution.v1beta1.ValidatorOutstandingRewards" as const, + + encode(message: ValidatorOutstandingRewards, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.rewards) { + DecCoin.encode(v!, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ValidatorOutstandingRewards { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseValidatorOutstandingRewards(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.rewards.push(DecCoin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ValidatorOutstandingRewards { + return { + rewards: globalThis.Array.isArray(object?.rewards) ? object.rewards.map((e: any) => DecCoin.fromJSON(e)) : [], + }; + }, + + toJSON(message: ValidatorOutstandingRewards): unknown { + const obj: any = {}; + if (message.rewards?.length) { + obj.rewards = message.rewards.map((e) => DecCoin.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): ValidatorOutstandingRewards { + return ValidatorOutstandingRewards.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ValidatorOutstandingRewards { + const message = createBaseValidatorOutstandingRewards(); + message.rewards = object.rewards?.map((e) => DecCoin.fromPartial(e)) || []; + return message; + }, +}; + +export const ValidatorSlashEvent: MessageFns = { + $type: "cosmos.distribution.v1beta1.ValidatorSlashEvent" as const, + + encode(message: ValidatorSlashEvent, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.validator_period !== 0) { + writer.uint32(8).uint64(message.validator_period); + } + if (message.fraction !== "") { + writer.uint32(18).string(message.fraction); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ValidatorSlashEvent { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseValidatorSlashEvent(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.validator_period = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.fraction = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ValidatorSlashEvent { + return { + validator_period: isSet(object.validator_period) ? globalThis.Number(object.validator_period) : 0, + fraction: isSet(object.fraction) ? globalThis.String(object.fraction) : "", + }; + }, + + toJSON(message: ValidatorSlashEvent): unknown { + const obj: any = {}; + if (message.validator_period !== 0) { + obj.validator_period = Math.round(message.validator_period); + } + if (message.fraction !== "") { + obj.fraction = message.fraction; + } + return obj; + }, + + create, I>>(base?: I): ValidatorSlashEvent { + return ValidatorSlashEvent.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ValidatorSlashEvent { + const message = createBaseValidatorSlashEvent(); + message.validator_period = object.validator_period ?? 0; + message.fraction = object.fraction ?? ""; + return message; + }, +}; + +export const ValidatorSlashEvents: MessageFns = { + $type: "cosmos.distribution.v1beta1.ValidatorSlashEvents" as const, + + encode(message: ValidatorSlashEvents, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.validator_slash_events) { + ValidatorSlashEvent.encode(v!, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ValidatorSlashEvents { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseValidatorSlashEvents(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.validator_slash_events.push(ValidatorSlashEvent.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ValidatorSlashEvents { + return { + validator_slash_events: globalThis.Array.isArray(object?.validator_slash_events) + ? object.validator_slash_events.map((e: any) => ValidatorSlashEvent.fromJSON(e)) + : [], + }; + }, + + toJSON(message: ValidatorSlashEvents): unknown { + const obj: any = {}; + if (message.validator_slash_events?.length) { + obj.validator_slash_events = message.validator_slash_events.map((e) => ValidatorSlashEvent.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): ValidatorSlashEvents { + return ValidatorSlashEvents.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ValidatorSlashEvents { + const message = createBaseValidatorSlashEvents(); + message.validator_slash_events = object.validator_slash_events?.map((e) => ValidatorSlashEvent.fromPartial(e)) || []; + return message; + }, +}; + +export const FeePool: MessageFns = { + $type: "cosmos.distribution.v1beta1.FeePool" as const, + + encode(message: FeePool, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.community_pool) { + DecCoin.encode(v!, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): FeePool { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseFeePool(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.community_pool.push(DecCoin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): FeePool { + return { + community_pool: globalThis.Array.isArray(object?.community_pool) ? object.community_pool.map((e: any) => DecCoin.fromJSON(e)) : [], + }; + }, + + toJSON(message: FeePool): unknown { + const obj: any = {}; + if (message.community_pool?.length) { + obj.community_pool = message.community_pool.map((e) => DecCoin.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): FeePool { + return FeePool.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): FeePool { + const message = createBaseFeePool(); + message.community_pool = object.community_pool?.map((e) => DecCoin.fromPartial(e)) || []; + return message; + }, +}; + +export const CommunityPoolSpendProposal: MessageFns = { + $type: "cosmos.distribution.v1beta1.CommunityPoolSpendProposal" as const, + + encode(message: CommunityPoolSpendProposal, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.title !== "") { + writer.uint32(10).string(message.title); + } + if (message.description !== "") { + writer.uint32(18).string(message.description); + } + if (message.recipient !== "") { + writer.uint32(26).string(message.recipient); + } + for (const v of message.amount) { + Coin.encode(v!, writer.uint32(34).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): CommunityPoolSpendProposal { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseCommunityPoolSpendProposal(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.title = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.description = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.recipient = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.amount.push(Coin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): CommunityPoolSpendProposal { + return { + title: isSet(object.title) ? globalThis.String(object.title) : "", + description: isSet(object.description) ? globalThis.String(object.description) : "", + recipient: isSet(object.recipient) ? globalThis.String(object.recipient) : "", + amount: globalThis.Array.isArray(object?.amount) ? object.amount.map((e: any) => Coin.fromJSON(e)) : [], + }; + }, + + toJSON(message: CommunityPoolSpendProposal): unknown { + const obj: any = {}; + if (message.title !== "") { + obj.title = message.title; + } + if (message.description !== "") { + obj.description = message.description; + } + if (message.recipient !== "") { + obj.recipient = message.recipient; + } + if (message.amount?.length) { + obj.amount = message.amount.map((e) => Coin.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): CommunityPoolSpendProposal { + return CommunityPoolSpendProposal.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): CommunityPoolSpendProposal { + const message = createBaseCommunityPoolSpendProposal(); + message.title = object.title ?? ""; + message.description = object.description ?? ""; + message.recipient = object.recipient ?? ""; + message.amount = object.amount?.map((e) => Coin.fromPartial(e)) || []; + return message; + }, +}; + +export const DelegatorStartingInfo: MessageFns = { + $type: "cosmos.distribution.v1beta1.DelegatorStartingInfo" as const, + + encode(message: DelegatorStartingInfo, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.previous_period !== 0) { + writer.uint32(8).uint64(message.previous_period); + } + if (message.stake !== "") { + writer.uint32(18).string(message.stake); + } + if (message.height !== 0) { + writer.uint32(24).uint64(message.height); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): DelegatorStartingInfo { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDelegatorStartingInfo(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.previous_period = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.stake = reader.string(); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.height = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): DelegatorStartingInfo { + return { + previous_period: isSet(object.previous_period) ? globalThis.Number(object.previous_period) : 0, + stake: isSet(object.stake) ? globalThis.String(object.stake) : "", + height: isSet(object.height) ? globalThis.Number(object.height) : 0, + }; + }, + + toJSON(message: DelegatorStartingInfo): unknown { + const obj: any = {}; + if (message.previous_period !== 0) { + obj.previous_period = Math.round(message.previous_period); + } + if (message.stake !== "") { + obj.stake = message.stake; + } + if (message.height !== 0) { + obj.height = Math.round(message.height); + } + return obj; + }, + + create, I>>(base?: I): DelegatorStartingInfo { + return DelegatorStartingInfo.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): DelegatorStartingInfo { + const message = createBaseDelegatorStartingInfo(); + message.previous_period = object.previous_period ?? 0; + message.stake = object.stake ?? ""; + message.height = object.height ?? 0; + return message; + }, +}; + +export const DelegationDelegatorReward: MessageFns = { + $type: "cosmos.distribution.v1beta1.DelegationDelegatorReward" as const, + + encode(message: DelegationDelegatorReward, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.validator_address !== "") { + writer.uint32(10).string(message.validator_address); + } + for (const v of message.reward) { + DecCoin.encode(v!, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): DelegationDelegatorReward { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDelegationDelegatorReward(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.validator_address = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.reward.push(DecCoin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): DelegationDelegatorReward { + return { + validator_address: isSet(object.validator_address) ? globalThis.String(object.validator_address) : "", + reward: globalThis.Array.isArray(object?.reward) ? object.reward.map((e: any) => DecCoin.fromJSON(e)) : [], + }; + }, + + toJSON(message: DelegationDelegatorReward): unknown { + const obj: any = {}; + if (message.validator_address !== "") { + obj.validator_address = message.validator_address; + } + if (message.reward?.length) { + obj.reward = message.reward.map((e) => DecCoin.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): DelegationDelegatorReward { + return DelegationDelegatorReward.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): DelegationDelegatorReward { + const message = createBaseDelegationDelegatorReward(); + message.validator_address = object.validator_address ?? ""; + message.reward = object.reward?.map((e) => DecCoin.fromPartial(e)) || []; + return message; + }, +}; + +export const CommunityPoolSpendProposalWithDeposit: MessageFns< + CommunityPoolSpendProposalWithDeposit, + "cosmos.distribution.v1beta1.CommunityPoolSpendProposalWithDeposit" +> = { + $type: "cosmos.distribution.v1beta1.CommunityPoolSpendProposalWithDeposit" as const, + + encode(message: CommunityPoolSpendProposalWithDeposit, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.title !== "") { + writer.uint32(10).string(message.title); + } + if (message.description !== "") { + writer.uint32(18).string(message.description); + } + if (message.recipient !== "") { + writer.uint32(26).string(message.recipient); + } + if (message.amount !== "") { + writer.uint32(34).string(message.amount); + } + if (message.deposit !== "") { + writer.uint32(42).string(message.deposit); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): CommunityPoolSpendProposalWithDeposit { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseCommunityPoolSpendProposalWithDeposit(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.title = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.description = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.recipient = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.amount = reader.string(); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.deposit = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): CommunityPoolSpendProposalWithDeposit { + return { + title: isSet(object.title) ? globalThis.String(object.title) : "", + description: isSet(object.description) ? globalThis.String(object.description) : "", + recipient: isSet(object.recipient) ? globalThis.String(object.recipient) : "", + amount: isSet(object.amount) ? globalThis.String(object.amount) : "", + deposit: isSet(object.deposit) ? globalThis.String(object.deposit) : "", + }; + }, + + toJSON(message: CommunityPoolSpendProposalWithDeposit): unknown { + const obj: any = {}; + if (message.title !== "") { + obj.title = message.title; + } + if (message.description !== "") { + obj.description = message.description; + } + if (message.recipient !== "") { + obj.recipient = message.recipient; + } + if (message.amount !== "") { + obj.amount = message.amount; + } + if (message.deposit !== "") { + obj.deposit = message.deposit; + } + return obj; + }, + + create, I>>(base?: I): CommunityPoolSpendProposalWithDeposit { + return CommunityPoolSpendProposalWithDeposit.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): CommunityPoolSpendProposalWithDeposit { + const message = createBaseCommunityPoolSpendProposalWithDeposit(); + message.title = object.title ?? ""; + message.description = object.description ?? ""; + message.recipient = object.recipient ?? ""; + message.amount = object.amount ?? ""; + message.deposit = object.deposit ?? ""; + return message; + }, +}; + +function createBaseParams(): Params { + return { community_tax: "", base_proposer_reward: "", bonus_proposer_reward: "", withdraw_addr_enabled: false }; +} + +function createBaseValidatorHistoricalRewards(): ValidatorHistoricalRewards { + return { cumulative_reward_ratio: [], reference_count: 0 }; +} + +function createBaseValidatorCurrentRewards(): ValidatorCurrentRewards { + return { rewards: [], period: 0 }; +} + +function createBaseValidatorAccumulatedCommission(): ValidatorAccumulatedCommission { + return { commission: [] }; +} + +function createBaseValidatorOutstandingRewards(): ValidatorOutstandingRewards { + return { rewards: [] }; +} + +function createBaseValidatorSlashEvent(): ValidatorSlashEvent { + return { validator_period: 0, fraction: "" }; +} + +function createBaseValidatorSlashEvents(): ValidatorSlashEvents { + return { validator_slash_events: [] }; +} + +function createBaseFeePool(): FeePool { + return { community_pool: [] }; +} + +function createBaseCommunityPoolSpendProposal(): CommunityPoolSpendProposal { + return { title: "", description: "", recipient: "", amount: [] }; +} + +function createBaseDelegatorStartingInfo(): DelegatorStartingInfo { + return { previous_period: 0, stake: "", height: 0 }; +} + +function createBaseDelegationDelegatorReward(): DelegationDelegatorReward { + return { validator_address: "", reward: [] }; +} + +function createBaseCommunityPoolSpendProposalWithDeposit(): CommunityPoolSpendProposalWithDeposit { + return { title: "", description: "", recipient: "", amount: "", deposit: "" }; +} + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} +export const registry: Array<[string, GeneratedType]> = [ + ["/cosmos.distribution.v1beta1.Params", Params as never], + ["/cosmos.distribution.v1beta1.ValidatorSlashEvent", ValidatorSlashEvent as never], + ["/cosmos.distribution.v1beta1.FeePool", FeePool as never], +]; +export const aminoConverters = { + "/cosmos.distribution.v1beta1.Params": { + aminoType: "cosmos-sdk/Params", + toAmino: (message: Params) => ({ ...message }), + fromAmino: (object: Params) => ({ ...object }), + }, + + "/cosmos.distribution.v1beta1.ValidatorSlashEvent": { + aminoType: "cosmos-sdk/ValidatorSlashEvent", + toAmino: (message: ValidatorSlashEvent) => ({ ...message }), + fromAmino: (object: ValidatorSlashEvent) => ({ ...object }), + }, + + "/cosmos.distribution.v1beta1.FeePool": { + aminoType: "cosmos-sdk/FeePool", + toAmino: (message: FeePool) => ({ ...message }), + fromAmino: (object: FeePool) => ({ ...object }), + }, +}; diff --git a/packages/cosmos/generated/encoding/cosmos/distribution/v1beta1/genesis.ts b/packages/cosmos/generated/encoding/cosmos/distribution/v1beta1/genesis.ts new file mode 100644 index 000000000..bc4e7fea1 --- /dev/null +++ b/packages/cosmos/generated/encoding/cosmos/distribution/v1beta1/genesis.ts @@ -0,0 +1,882 @@ +import type { GeneratedType } from "@cosmjs/proto-signing"; + +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +import { DecCoin } from "../../base/v1beta1/coin"; + +import { + DelegatorStartingInfo, + FeePool, + Params, + ValidatorAccumulatedCommission, + ValidatorCurrentRewards, + ValidatorHistoricalRewards, + ValidatorSlashEvent, +} from "./distribution"; + +import type { + DelegatorStartingInfoRecord as DelegatorStartingInfoRecord_type, + DelegatorWithdrawInfo as DelegatorWithdrawInfo_type, + GenesisState as GenesisState_type, + ValidatorAccumulatedCommissionRecord as ValidatorAccumulatedCommissionRecord_type, + ValidatorCurrentRewardsRecord as ValidatorCurrentRewardsRecord_type, + ValidatorHistoricalRewardsRecord as ValidatorHistoricalRewardsRecord_type, + ValidatorOutstandingRewardsRecord as ValidatorOutstandingRewardsRecord_type, + ValidatorSlashEventRecord as ValidatorSlashEventRecord_type, +} from "../../../../types/cosmos/distribution/v1beta1"; + +import type { DeepPartial, Exact, MessageFns } from "../../../common"; + +export interface DelegatorWithdrawInfo extends DelegatorWithdrawInfo_type {} +export interface ValidatorOutstandingRewardsRecord extends ValidatorOutstandingRewardsRecord_type {} +export interface ValidatorAccumulatedCommissionRecord extends ValidatorAccumulatedCommissionRecord_type {} +export interface ValidatorHistoricalRewardsRecord extends ValidatorHistoricalRewardsRecord_type {} +export interface ValidatorCurrentRewardsRecord extends ValidatorCurrentRewardsRecord_type {} +export interface DelegatorStartingInfoRecord extends DelegatorStartingInfoRecord_type {} +export interface ValidatorSlashEventRecord extends ValidatorSlashEventRecord_type {} +export interface GenesisState extends GenesisState_type {} + +export const DelegatorWithdrawInfo: MessageFns = { + $type: "cosmos.distribution.v1beta1.DelegatorWithdrawInfo" as const, + + encode(message: DelegatorWithdrawInfo, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.delegator_address !== "") { + writer.uint32(10).string(message.delegator_address); + } + if (message.withdraw_address !== "") { + writer.uint32(18).string(message.withdraw_address); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): DelegatorWithdrawInfo { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDelegatorWithdrawInfo(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.delegator_address = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.withdraw_address = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): DelegatorWithdrawInfo { + return { + delegator_address: isSet(object.delegator_address) ? globalThis.String(object.delegator_address) : "", + withdraw_address: isSet(object.withdraw_address) ? globalThis.String(object.withdraw_address) : "", + }; + }, + + toJSON(message: DelegatorWithdrawInfo): unknown { + const obj: any = {}; + if (message.delegator_address !== "") { + obj.delegator_address = message.delegator_address; + } + if (message.withdraw_address !== "") { + obj.withdraw_address = message.withdraw_address; + } + return obj; + }, + + create, I>>(base?: I): DelegatorWithdrawInfo { + return DelegatorWithdrawInfo.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): DelegatorWithdrawInfo { + const message = createBaseDelegatorWithdrawInfo(); + message.delegator_address = object.delegator_address ?? ""; + message.withdraw_address = object.withdraw_address ?? ""; + return message; + }, +}; + +export const ValidatorOutstandingRewardsRecord: MessageFns = + { + $type: "cosmos.distribution.v1beta1.ValidatorOutstandingRewardsRecord" as const, + + encode(message: ValidatorOutstandingRewardsRecord, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.validator_address !== "") { + writer.uint32(10).string(message.validator_address); + } + for (const v of message.outstanding_rewards) { + DecCoin.encode(v!, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ValidatorOutstandingRewardsRecord { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseValidatorOutstandingRewardsRecord(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.validator_address = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.outstanding_rewards.push(DecCoin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ValidatorOutstandingRewardsRecord { + return { + validator_address: isSet(object.validator_address) ? globalThis.String(object.validator_address) : "", + outstanding_rewards: globalThis.Array.isArray(object?.outstanding_rewards) ? object.outstanding_rewards.map((e: any) => DecCoin.fromJSON(e)) : [], + }; + }, + + toJSON(message: ValidatorOutstandingRewardsRecord): unknown { + const obj: any = {}; + if (message.validator_address !== "") { + obj.validator_address = message.validator_address; + } + if (message.outstanding_rewards?.length) { + obj.outstanding_rewards = message.outstanding_rewards.map((e) => DecCoin.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): ValidatorOutstandingRewardsRecord { + return ValidatorOutstandingRewardsRecord.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ValidatorOutstandingRewardsRecord { + const message = createBaseValidatorOutstandingRewardsRecord(); + message.validator_address = object.validator_address ?? ""; + message.outstanding_rewards = object.outstanding_rewards?.map((e) => DecCoin.fromPartial(e)) || []; + return message; + }, + }; + +export const ValidatorAccumulatedCommissionRecord: MessageFns< + ValidatorAccumulatedCommissionRecord, + "cosmos.distribution.v1beta1.ValidatorAccumulatedCommissionRecord" +> = { + $type: "cosmos.distribution.v1beta1.ValidatorAccumulatedCommissionRecord" as const, + + encode(message: ValidatorAccumulatedCommissionRecord, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.validator_address !== "") { + writer.uint32(10).string(message.validator_address); + } + if (message.accumulated !== undefined) { + ValidatorAccumulatedCommission.encode(message.accumulated, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ValidatorAccumulatedCommissionRecord { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseValidatorAccumulatedCommissionRecord(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.validator_address = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.accumulated = ValidatorAccumulatedCommission.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ValidatorAccumulatedCommissionRecord { + return { + validator_address: isSet(object.validator_address) ? globalThis.String(object.validator_address) : "", + accumulated: isSet(object.accumulated) ? ValidatorAccumulatedCommission.fromJSON(object.accumulated) : undefined, + }; + }, + + toJSON(message: ValidatorAccumulatedCommissionRecord): unknown { + const obj: any = {}; + if (message.validator_address !== "") { + obj.validator_address = message.validator_address; + } + if (message.accumulated !== undefined) { + obj.accumulated = ValidatorAccumulatedCommission.toJSON(message.accumulated); + } + return obj; + }, + + create, I>>(base?: I): ValidatorAccumulatedCommissionRecord { + return ValidatorAccumulatedCommissionRecord.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ValidatorAccumulatedCommissionRecord { + const message = createBaseValidatorAccumulatedCommissionRecord(); + message.validator_address = object.validator_address ?? ""; + message.accumulated = + object.accumulated !== undefined && object.accumulated !== null ? ValidatorAccumulatedCommission.fromPartial(object.accumulated) : undefined; + return message; + }, +}; + +export const ValidatorHistoricalRewardsRecord: MessageFns = { + $type: "cosmos.distribution.v1beta1.ValidatorHistoricalRewardsRecord" as const, + + encode(message: ValidatorHistoricalRewardsRecord, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.validator_address !== "") { + writer.uint32(10).string(message.validator_address); + } + if (message.period !== 0) { + writer.uint32(16).uint64(message.period); + } + if (message.rewards !== undefined) { + ValidatorHistoricalRewards.encode(message.rewards, writer.uint32(26).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ValidatorHistoricalRewardsRecord { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseValidatorHistoricalRewardsRecord(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.validator_address = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.period = longToNumber(reader.uint64()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.rewards = ValidatorHistoricalRewards.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ValidatorHistoricalRewardsRecord { + return { + validator_address: isSet(object.validator_address) ? globalThis.String(object.validator_address) : "", + period: isSet(object.period) ? globalThis.Number(object.period) : 0, + rewards: isSet(object.rewards) ? ValidatorHistoricalRewards.fromJSON(object.rewards) : undefined, + }; + }, + + toJSON(message: ValidatorHistoricalRewardsRecord): unknown { + const obj: any = {}; + if (message.validator_address !== "") { + obj.validator_address = message.validator_address; + } + if (message.period !== 0) { + obj.period = Math.round(message.period); + } + if (message.rewards !== undefined) { + obj.rewards = ValidatorHistoricalRewards.toJSON(message.rewards); + } + return obj; + }, + + create, I>>(base?: I): ValidatorHistoricalRewardsRecord { + return ValidatorHistoricalRewardsRecord.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ValidatorHistoricalRewardsRecord { + const message = createBaseValidatorHistoricalRewardsRecord(); + message.validator_address = object.validator_address ?? ""; + message.period = object.period ?? 0; + message.rewards = object.rewards !== undefined && object.rewards !== null ? ValidatorHistoricalRewards.fromPartial(object.rewards) : undefined; + return message; + }, +}; + +export const ValidatorCurrentRewardsRecord: MessageFns = { + $type: "cosmos.distribution.v1beta1.ValidatorCurrentRewardsRecord" as const, + + encode(message: ValidatorCurrentRewardsRecord, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.validator_address !== "") { + writer.uint32(10).string(message.validator_address); + } + if (message.rewards !== undefined) { + ValidatorCurrentRewards.encode(message.rewards, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ValidatorCurrentRewardsRecord { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseValidatorCurrentRewardsRecord(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.validator_address = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.rewards = ValidatorCurrentRewards.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ValidatorCurrentRewardsRecord { + return { + validator_address: isSet(object.validator_address) ? globalThis.String(object.validator_address) : "", + rewards: isSet(object.rewards) ? ValidatorCurrentRewards.fromJSON(object.rewards) : undefined, + }; + }, + + toJSON(message: ValidatorCurrentRewardsRecord): unknown { + const obj: any = {}; + if (message.validator_address !== "") { + obj.validator_address = message.validator_address; + } + if (message.rewards !== undefined) { + obj.rewards = ValidatorCurrentRewards.toJSON(message.rewards); + } + return obj; + }, + + create, I>>(base?: I): ValidatorCurrentRewardsRecord { + return ValidatorCurrentRewardsRecord.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ValidatorCurrentRewardsRecord { + const message = createBaseValidatorCurrentRewardsRecord(); + message.validator_address = object.validator_address ?? ""; + message.rewards = object.rewards !== undefined && object.rewards !== null ? ValidatorCurrentRewards.fromPartial(object.rewards) : undefined; + return message; + }, +}; + +export const DelegatorStartingInfoRecord: MessageFns = { + $type: "cosmos.distribution.v1beta1.DelegatorStartingInfoRecord" as const, + + encode(message: DelegatorStartingInfoRecord, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.delegator_address !== "") { + writer.uint32(10).string(message.delegator_address); + } + if (message.validator_address !== "") { + writer.uint32(18).string(message.validator_address); + } + if (message.starting_info !== undefined) { + DelegatorStartingInfo.encode(message.starting_info, writer.uint32(26).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): DelegatorStartingInfoRecord { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDelegatorStartingInfoRecord(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.delegator_address = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.validator_address = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.starting_info = DelegatorStartingInfo.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): DelegatorStartingInfoRecord { + return { + delegator_address: isSet(object.delegator_address) ? globalThis.String(object.delegator_address) : "", + validator_address: isSet(object.validator_address) ? globalThis.String(object.validator_address) : "", + starting_info: isSet(object.starting_info) ? DelegatorStartingInfo.fromJSON(object.starting_info) : undefined, + }; + }, + + toJSON(message: DelegatorStartingInfoRecord): unknown { + const obj: any = {}; + if (message.delegator_address !== "") { + obj.delegator_address = message.delegator_address; + } + if (message.validator_address !== "") { + obj.validator_address = message.validator_address; + } + if (message.starting_info !== undefined) { + obj.starting_info = DelegatorStartingInfo.toJSON(message.starting_info); + } + return obj; + }, + + create, I>>(base?: I): DelegatorStartingInfoRecord { + return DelegatorStartingInfoRecord.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): DelegatorStartingInfoRecord { + const message = createBaseDelegatorStartingInfoRecord(); + message.delegator_address = object.delegator_address ?? ""; + message.validator_address = object.validator_address ?? ""; + message.starting_info = + object.starting_info !== undefined && object.starting_info !== null ? DelegatorStartingInfo.fromPartial(object.starting_info) : undefined; + return message; + }, +}; + +export const ValidatorSlashEventRecord: MessageFns = { + $type: "cosmos.distribution.v1beta1.ValidatorSlashEventRecord" as const, + + encode(message: ValidatorSlashEventRecord, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.validator_address !== "") { + writer.uint32(10).string(message.validator_address); + } + if (message.height !== 0) { + writer.uint32(16).uint64(message.height); + } + if (message.period !== 0) { + writer.uint32(24).uint64(message.period); + } + if (message.validator_slash_event !== undefined) { + ValidatorSlashEvent.encode(message.validator_slash_event, writer.uint32(34).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ValidatorSlashEventRecord { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseValidatorSlashEventRecord(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.validator_address = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.height = longToNumber(reader.uint64()); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.period = longToNumber(reader.uint64()); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.validator_slash_event = ValidatorSlashEvent.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ValidatorSlashEventRecord { + return { + validator_address: isSet(object.validator_address) ? globalThis.String(object.validator_address) : "", + height: isSet(object.height) ? globalThis.Number(object.height) : 0, + period: isSet(object.period) ? globalThis.Number(object.period) : 0, + validator_slash_event: isSet(object.validator_slash_event) ? ValidatorSlashEvent.fromJSON(object.validator_slash_event) : undefined, + }; + }, + + toJSON(message: ValidatorSlashEventRecord): unknown { + const obj: any = {}; + if (message.validator_address !== "") { + obj.validator_address = message.validator_address; + } + if (message.height !== 0) { + obj.height = Math.round(message.height); + } + if (message.period !== 0) { + obj.period = Math.round(message.period); + } + if (message.validator_slash_event !== undefined) { + obj.validator_slash_event = ValidatorSlashEvent.toJSON(message.validator_slash_event); + } + return obj; + }, + + create, I>>(base?: I): ValidatorSlashEventRecord { + return ValidatorSlashEventRecord.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ValidatorSlashEventRecord { + const message = createBaseValidatorSlashEventRecord(); + message.validator_address = object.validator_address ?? ""; + message.height = object.height ?? 0; + message.period = object.period ?? 0; + message.validator_slash_event = + object.validator_slash_event !== undefined && object.validator_slash_event !== null + ? ValidatorSlashEvent.fromPartial(object.validator_slash_event) + : undefined; + return message; + }, +}; + +export const GenesisState: MessageFns = { + $type: "cosmos.distribution.v1beta1.GenesisState" as const, + + encode(message: GenesisState, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(10).fork()).join(); + } + if (message.fee_pool !== undefined) { + FeePool.encode(message.fee_pool, writer.uint32(18).fork()).join(); + } + for (const v of message.delegator_withdraw_infos) { + DelegatorWithdrawInfo.encode(v!, writer.uint32(26).fork()).join(); + } + if (message.previous_proposer !== "") { + writer.uint32(34).string(message.previous_proposer); + } + for (const v of message.outstanding_rewards) { + ValidatorOutstandingRewardsRecord.encode(v!, writer.uint32(42).fork()).join(); + } + for (const v of message.validator_accumulated_commissions) { + ValidatorAccumulatedCommissionRecord.encode(v!, writer.uint32(50).fork()).join(); + } + for (const v of message.validator_historical_rewards) { + ValidatorHistoricalRewardsRecord.encode(v!, writer.uint32(58).fork()).join(); + } + for (const v of message.validator_current_rewards) { + ValidatorCurrentRewardsRecord.encode(v!, writer.uint32(66).fork()).join(); + } + for (const v of message.delegator_starting_infos) { + DelegatorStartingInfoRecord.encode(v!, writer.uint32(74).fork()).join(); + } + for (const v of message.validator_slash_events) { + ValidatorSlashEventRecord.encode(v!, writer.uint32(82).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GenesisState { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGenesisState(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.params = Params.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.fee_pool = FeePool.decode(reader, reader.uint32()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.delegator_withdraw_infos.push(DelegatorWithdrawInfo.decode(reader, reader.uint32())); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.previous_proposer = reader.string(); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.outstanding_rewards.push(ValidatorOutstandingRewardsRecord.decode(reader, reader.uint32())); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.validator_accumulated_commissions.push(ValidatorAccumulatedCommissionRecord.decode(reader, reader.uint32())); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.validator_historical_rewards.push(ValidatorHistoricalRewardsRecord.decode(reader, reader.uint32())); + continue; + case 8: + if (tag !== 66) { + break; + } + + message.validator_current_rewards.push(ValidatorCurrentRewardsRecord.decode(reader, reader.uint32())); + continue; + case 9: + if (tag !== 74) { + break; + } + + message.delegator_starting_infos.push(DelegatorStartingInfoRecord.decode(reader, reader.uint32())); + continue; + case 10: + if (tag !== 82) { + break; + } + + message.validator_slash_events.push(ValidatorSlashEventRecord.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GenesisState { + return { + params: isSet(object.params) ? Params.fromJSON(object.params) : undefined, + fee_pool: isSet(object.fee_pool) ? FeePool.fromJSON(object.fee_pool) : undefined, + delegator_withdraw_infos: globalThis.Array.isArray(object?.delegator_withdraw_infos) + ? object.delegator_withdraw_infos.map((e: any) => DelegatorWithdrawInfo.fromJSON(e)) + : [], + previous_proposer: isSet(object.previous_proposer) ? globalThis.String(object.previous_proposer) : "", + outstanding_rewards: globalThis.Array.isArray(object?.outstanding_rewards) + ? object.outstanding_rewards.map((e: any) => ValidatorOutstandingRewardsRecord.fromJSON(e)) + : [], + validator_accumulated_commissions: globalThis.Array.isArray(object?.validator_accumulated_commissions) + ? object.validator_accumulated_commissions.map((e: any) => ValidatorAccumulatedCommissionRecord.fromJSON(e)) + : [], + validator_historical_rewards: globalThis.Array.isArray(object?.validator_historical_rewards) + ? object.validator_historical_rewards.map((e: any) => ValidatorHistoricalRewardsRecord.fromJSON(e)) + : [], + validator_current_rewards: globalThis.Array.isArray(object?.validator_current_rewards) + ? object.validator_current_rewards.map((e: any) => ValidatorCurrentRewardsRecord.fromJSON(e)) + : [], + delegator_starting_infos: globalThis.Array.isArray(object?.delegator_starting_infos) + ? object.delegator_starting_infos.map((e: any) => DelegatorStartingInfoRecord.fromJSON(e)) + : [], + validator_slash_events: globalThis.Array.isArray(object?.validator_slash_events) + ? object.validator_slash_events.map((e: any) => ValidatorSlashEventRecord.fromJSON(e)) + : [], + }; + }, + + toJSON(message: GenesisState): unknown { + const obj: any = {}; + if (message.params !== undefined) { + obj.params = Params.toJSON(message.params); + } + if (message.fee_pool !== undefined) { + obj.fee_pool = FeePool.toJSON(message.fee_pool); + } + if (message.delegator_withdraw_infos?.length) { + obj.delegator_withdraw_infos = message.delegator_withdraw_infos.map((e) => DelegatorWithdrawInfo.toJSON(e)); + } + if (message.previous_proposer !== "") { + obj.previous_proposer = message.previous_proposer; + } + if (message.outstanding_rewards?.length) { + obj.outstanding_rewards = message.outstanding_rewards.map((e) => ValidatorOutstandingRewardsRecord.toJSON(e)); + } + if (message.validator_accumulated_commissions?.length) { + obj.validator_accumulated_commissions = message.validator_accumulated_commissions.map((e) => ValidatorAccumulatedCommissionRecord.toJSON(e)); + } + if (message.validator_historical_rewards?.length) { + obj.validator_historical_rewards = message.validator_historical_rewards.map((e) => ValidatorHistoricalRewardsRecord.toJSON(e)); + } + if (message.validator_current_rewards?.length) { + obj.validator_current_rewards = message.validator_current_rewards.map((e) => ValidatorCurrentRewardsRecord.toJSON(e)); + } + if (message.delegator_starting_infos?.length) { + obj.delegator_starting_infos = message.delegator_starting_infos.map((e) => DelegatorStartingInfoRecord.toJSON(e)); + } + if (message.validator_slash_events?.length) { + obj.validator_slash_events = message.validator_slash_events.map((e) => ValidatorSlashEventRecord.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): GenesisState { + return GenesisState.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): GenesisState { + const message = createBaseGenesisState(); + message.params = object.params !== undefined && object.params !== null ? Params.fromPartial(object.params) : undefined; + message.fee_pool = object.fee_pool !== undefined && object.fee_pool !== null ? FeePool.fromPartial(object.fee_pool) : undefined; + message.delegator_withdraw_infos = object.delegator_withdraw_infos?.map((e) => DelegatorWithdrawInfo.fromPartial(e)) || []; + message.previous_proposer = object.previous_proposer ?? ""; + message.outstanding_rewards = object.outstanding_rewards?.map((e) => ValidatorOutstandingRewardsRecord.fromPartial(e)) || []; + message.validator_accumulated_commissions = object.validator_accumulated_commissions?.map((e) => ValidatorAccumulatedCommissionRecord.fromPartial(e)) || []; + message.validator_historical_rewards = object.validator_historical_rewards?.map((e) => ValidatorHistoricalRewardsRecord.fromPartial(e)) || []; + message.validator_current_rewards = object.validator_current_rewards?.map((e) => ValidatorCurrentRewardsRecord.fromPartial(e)) || []; + message.delegator_starting_infos = object.delegator_starting_infos?.map((e) => DelegatorStartingInfoRecord.fromPartial(e)) || []; + message.validator_slash_events = object.validator_slash_events?.map((e) => ValidatorSlashEventRecord.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseDelegatorWithdrawInfo(): DelegatorWithdrawInfo { + return { delegator_address: "", withdraw_address: "" }; +} + +function createBaseValidatorOutstandingRewardsRecord(): ValidatorOutstandingRewardsRecord { + return { validator_address: "", outstanding_rewards: [] }; +} + +function createBaseValidatorAccumulatedCommissionRecord(): ValidatorAccumulatedCommissionRecord { + return { validator_address: "", accumulated: undefined }; +} + +function createBaseValidatorHistoricalRewardsRecord(): ValidatorHistoricalRewardsRecord { + return { validator_address: "", period: 0, rewards: undefined }; +} + +function createBaseValidatorCurrentRewardsRecord(): ValidatorCurrentRewardsRecord { + return { validator_address: "", rewards: undefined }; +} + +function createBaseDelegatorStartingInfoRecord(): DelegatorStartingInfoRecord { + return { delegator_address: "", validator_address: "", starting_info: undefined }; +} + +function createBaseValidatorSlashEventRecord(): ValidatorSlashEventRecord { + return { validator_address: "", height: 0, period: 0, validator_slash_event: undefined }; +} + +function createBaseGenesisState(): GenesisState { + return { + params: undefined, + fee_pool: undefined, + delegator_withdraw_infos: [], + previous_proposer: "", + outstanding_rewards: [], + validator_accumulated_commissions: [], + validator_historical_rewards: [], + validator_current_rewards: [], + delegator_starting_infos: [], + validator_slash_events: [], + }; +} + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} +export const registry: Array<[string, GeneratedType]> = [["/cosmos.distribution.v1beta1.GenesisState", GenesisState as never]]; +export const aminoConverters = { + "/cosmos.distribution.v1beta1.GenesisState": { + aminoType: "cosmos-sdk/GenesisState", + toAmino: (message: GenesisState) => ({ ...message }), + fromAmino: (object: GenesisState) => ({ ...object }), + }, +}; diff --git a/packages/cosmos/generated/encoding/cosmos/distribution/v1beta1/index.ts b/packages/cosmos/generated/encoding/cosmos/distribution/v1beta1/index.ts new file mode 100644 index 000000000..9a5e3080e --- /dev/null +++ b/packages/cosmos/generated/encoding/cosmos/distribution/v1beta1/index.ts @@ -0,0 +1,6 @@ +// @ts-nocheck + +export * from './distribution'; +export * from './genesis'; +export * from './query'; +export * from './tx'; \ No newline at end of file diff --git a/packages/cosmos/generated/encoding/cosmos/distribution/v1beta1/query.ts b/packages/cosmos/generated/encoding/cosmos/distribution/v1beta1/query.ts new file mode 100644 index 000000000..efb5432b5 --- /dev/null +++ b/packages/cosmos/generated/encoding/cosmos/distribution/v1beta1/query.ts @@ -0,0 +1,1240 @@ +import type { GeneratedType } from "@cosmjs/proto-signing"; + +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +import { PageRequest, PageResponse } from "../../base/query/v1beta1/pagination"; + +import { DecCoin } from "../../base/v1beta1/coin"; + +import { DelegationDelegatorReward, Params, ValidatorAccumulatedCommission, ValidatorOutstandingRewards, ValidatorSlashEvent } from "./distribution"; + +import type { + QueryCommunityPoolRequest as QueryCommunityPoolRequest_type, + QueryCommunityPoolResponse as QueryCommunityPoolResponse_type, + QueryDelegationRewardsRequest as QueryDelegationRewardsRequest_type, + QueryDelegationRewardsResponse as QueryDelegationRewardsResponse_type, + QueryDelegationTotalRewardsRequest as QueryDelegationTotalRewardsRequest_type, + QueryDelegationTotalRewardsResponse as QueryDelegationTotalRewardsResponse_type, + QueryDelegatorValidatorsRequest as QueryDelegatorValidatorsRequest_type, + QueryDelegatorValidatorsResponse as QueryDelegatorValidatorsResponse_type, + QueryDelegatorWithdrawAddressRequest as QueryDelegatorWithdrawAddressRequest_type, + QueryDelegatorWithdrawAddressResponse as QueryDelegatorWithdrawAddressResponse_type, + QueryParamsRequest as QueryParamsRequest_type, + QueryParamsResponse as QueryParamsResponse_type, + QueryValidatorCommissionRequest as QueryValidatorCommissionRequest_type, + QueryValidatorCommissionResponse as QueryValidatorCommissionResponse_type, + QueryValidatorOutstandingRewardsRequest as QueryValidatorOutstandingRewardsRequest_type, + QueryValidatorOutstandingRewardsResponse as QueryValidatorOutstandingRewardsResponse_type, + QueryValidatorSlashesRequest as QueryValidatorSlashesRequest_type, + QueryValidatorSlashesResponse as QueryValidatorSlashesResponse_type, +} from "../../../../types/cosmos/distribution/v1beta1"; + +import type { DeepPartial, Exact, MessageFns } from "../../../common"; + +export interface QueryParamsRequest extends QueryParamsRequest_type {} +export interface QueryParamsResponse extends QueryParamsResponse_type {} +export interface QueryValidatorOutstandingRewardsRequest extends QueryValidatorOutstandingRewardsRequest_type {} +export interface QueryValidatorOutstandingRewardsResponse extends QueryValidatorOutstandingRewardsResponse_type {} +export interface QueryValidatorCommissionRequest extends QueryValidatorCommissionRequest_type {} +export interface QueryValidatorCommissionResponse extends QueryValidatorCommissionResponse_type {} +export interface QueryValidatorSlashesRequest extends QueryValidatorSlashesRequest_type {} +export interface QueryValidatorSlashesResponse extends QueryValidatorSlashesResponse_type {} +export interface QueryDelegationRewardsRequest extends QueryDelegationRewardsRequest_type {} +export interface QueryDelegationRewardsResponse extends QueryDelegationRewardsResponse_type {} +export interface QueryDelegationTotalRewardsRequest extends QueryDelegationTotalRewardsRequest_type {} +export interface QueryDelegationTotalRewardsResponse extends QueryDelegationTotalRewardsResponse_type {} +export interface QueryDelegatorValidatorsRequest extends QueryDelegatorValidatorsRequest_type {} +export interface QueryDelegatorValidatorsResponse extends QueryDelegatorValidatorsResponse_type {} +export interface QueryDelegatorWithdrawAddressRequest extends QueryDelegatorWithdrawAddressRequest_type {} +export interface QueryDelegatorWithdrawAddressResponse extends QueryDelegatorWithdrawAddressResponse_type {} +export interface QueryCommunityPoolRequest extends QueryCommunityPoolRequest_type {} +export interface QueryCommunityPoolResponse extends QueryCommunityPoolResponse_type {} + +export const QueryParamsRequest: MessageFns = { + $type: "cosmos.distribution.v1beta1.QueryParamsRequest" as const, + + encode(_: QueryParamsRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryParamsRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryParamsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): QueryParamsRequest { + return {}; + }, + + toJSON(_: QueryParamsRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): QueryParamsRequest { + return QueryParamsRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): QueryParamsRequest { + const message = createBaseQueryParamsRequest(); + return message; + }, +}; + +export const QueryParamsResponse: MessageFns = { + $type: "cosmos.distribution.v1beta1.QueryParamsResponse" as const, + + encode(message: QueryParamsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryParamsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryParamsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.params = Params.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryParamsResponse { + return { params: isSet(object.params) ? Params.fromJSON(object.params) : undefined }; + }, + + toJSON(message: QueryParamsResponse): unknown { + const obj: any = {}; + if (message.params !== undefined) { + obj.params = Params.toJSON(message.params); + } + return obj; + }, + + create, I>>(base?: I): QueryParamsResponse { + return QueryParamsResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryParamsResponse { + const message = createBaseQueryParamsResponse(); + message.params = object.params !== undefined && object.params !== null ? Params.fromPartial(object.params) : undefined; + return message; + }, +}; + +export const QueryValidatorOutstandingRewardsRequest: MessageFns< + QueryValidatorOutstandingRewardsRequest, + "cosmos.distribution.v1beta1.QueryValidatorOutstandingRewardsRequest" +> = { + $type: "cosmos.distribution.v1beta1.QueryValidatorOutstandingRewardsRequest" as const, + + encode(message: QueryValidatorOutstandingRewardsRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.validator_address !== "") { + writer.uint32(10).string(message.validator_address); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryValidatorOutstandingRewardsRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryValidatorOutstandingRewardsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.validator_address = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryValidatorOutstandingRewardsRequest { + return { validator_address: isSet(object.validator_address) ? globalThis.String(object.validator_address) : "" }; + }, + + toJSON(message: QueryValidatorOutstandingRewardsRequest): unknown { + const obj: any = {}; + if (message.validator_address !== "") { + obj.validator_address = message.validator_address; + } + return obj; + }, + + create, I>>(base?: I): QueryValidatorOutstandingRewardsRequest { + return QueryValidatorOutstandingRewardsRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryValidatorOutstandingRewardsRequest { + const message = createBaseQueryValidatorOutstandingRewardsRequest(); + message.validator_address = object.validator_address ?? ""; + return message; + }, +}; + +export const QueryValidatorOutstandingRewardsResponse: MessageFns< + QueryValidatorOutstandingRewardsResponse, + "cosmos.distribution.v1beta1.QueryValidatorOutstandingRewardsResponse" +> = { + $type: "cosmos.distribution.v1beta1.QueryValidatorOutstandingRewardsResponse" as const, + + encode(message: QueryValidatorOutstandingRewardsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.rewards !== undefined) { + ValidatorOutstandingRewards.encode(message.rewards, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryValidatorOutstandingRewardsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryValidatorOutstandingRewardsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.rewards = ValidatorOutstandingRewards.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryValidatorOutstandingRewardsResponse { + return { rewards: isSet(object.rewards) ? ValidatorOutstandingRewards.fromJSON(object.rewards) : undefined }; + }, + + toJSON(message: QueryValidatorOutstandingRewardsResponse): unknown { + const obj: any = {}; + if (message.rewards !== undefined) { + obj.rewards = ValidatorOutstandingRewards.toJSON(message.rewards); + } + return obj; + }, + + create, I>>(base?: I): QueryValidatorOutstandingRewardsResponse { + return QueryValidatorOutstandingRewardsResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryValidatorOutstandingRewardsResponse { + const message = createBaseQueryValidatorOutstandingRewardsResponse(); + message.rewards = object.rewards !== undefined && object.rewards !== null ? ValidatorOutstandingRewards.fromPartial(object.rewards) : undefined; + return message; + }, +}; + +export const QueryValidatorCommissionRequest: MessageFns = { + $type: "cosmos.distribution.v1beta1.QueryValidatorCommissionRequest" as const, + + encode(message: QueryValidatorCommissionRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.validator_address !== "") { + writer.uint32(10).string(message.validator_address); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryValidatorCommissionRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryValidatorCommissionRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.validator_address = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryValidatorCommissionRequest { + return { validator_address: isSet(object.validator_address) ? globalThis.String(object.validator_address) : "" }; + }, + + toJSON(message: QueryValidatorCommissionRequest): unknown { + const obj: any = {}; + if (message.validator_address !== "") { + obj.validator_address = message.validator_address; + } + return obj; + }, + + create, I>>(base?: I): QueryValidatorCommissionRequest { + return QueryValidatorCommissionRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryValidatorCommissionRequest { + const message = createBaseQueryValidatorCommissionRequest(); + message.validator_address = object.validator_address ?? ""; + return message; + }, +}; + +export const QueryValidatorCommissionResponse: MessageFns = { + $type: "cosmos.distribution.v1beta1.QueryValidatorCommissionResponse" as const, + + encode(message: QueryValidatorCommissionResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.commission !== undefined) { + ValidatorAccumulatedCommission.encode(message.commission, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryValidatorCommissionResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryValidatorCommissionResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.commission = ValidatorAccumulatedCommission.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryValidatorCommissionResponse { + return { + commission: isSet(object.commission) ? ValidatorAccumulatedCommission.fromJSON(object.commission) : undefined, + }; + }, + + toJSON(message: QueryValidatorCommissionResponse): unknown { + const obj: any = {}; + if (message.commission !== undefined) { + obj.commission = ValidatorAccumulatedCommission.toJSON(message.commission); + } + return obj; + }, + + create, I>>(base?: I): QueryValidatorCommissionResponse { + return QueryValidatorCommissionResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryValidatorCommissionResponse { + const message = createBaseQueryValidatorCommissionResponse(); + message.commission = + object.commission !== undefined && object.commission !== null ? ValidatorAccumulatedCommission.fromPartial(object.commission) : undefined; + return message; + }, +}; + +export const QueryValidatorSlashesRequest: MessageFns = { + $type: "cosmos.distribution.v1beta1.QueryValidatorSlashesRequest" as const, + + encode(message: QueryValidatorSlashesRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.validator_address !== "") { + writer.uint32(10).string(message.validator_address); + } + if (message.starting_height !== 0) { + writer.uint32(16).uint64(message.starting_height); + } + if (message.ending_height !== 0) { + writer.uint32(24).uint64(message.ending_height); + } + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(34).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryValidatorSlashesRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryValidatorSlashesRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.validator_address = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.starting_height = longToNumber(reader.uint64()); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.ending_height = longToNumber(reader.uint64()); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryValidatorSlashesRequest { + return { + validator_address: isSet(object.validator_address) ? globalThis.String(object.validator_address) : "", + starting_height: isSet(object.starting_height) ? globalThis.Number(object.starting_height) : 0, + ending_height: isSet(object.ending_height) ? globalThis.Number(object.ending_height) : 0, + pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryValidatorSlashesRequest): unknown { + const obj: any = {}; + if (message.validator_address !== "") { + obj.validator_address = message.validator_address; + } + if (message.starting_height !== 0) { + obj.starting_height = Math.round(message.starting_height); + } + if (message.ending_height !== 0) { + obj.ending_height = Math.round(message.ending_height); + } + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryValidatorSlashesRequest { + return QueryValidatorSlashesRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryValidatorSlashesRequest { + const message = createBaseQueryValidatorSlashesRequest(); + message.validator_address = object.validator_address ?? ""; + message.starting_height = object.starting_height ?? 0; + message.ending_height = object.ending_height ?? 0; + message.pagination = object.pagination !== undefined && object.pagination !== null ? PageRequest.fromPartial(object.pagination) : undefined; + return message; + }, +}; + +export const QueryValidatorSlashesResponse: MessageFns = { + $type: "cosmos.distribution.v1beta1.QueryValidatorSlashesResponse" as const, + + encode(message: QueryValidatorSlashesResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.slashes) { + ValidatorSlashEvent.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryValidatorSlashesResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryValidatorSlashesResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.slashes.push(ValidatorSlashEvent.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryValidatorSlashesResponse { + return { + slashes: globalThis.Array.isArray(object?.slashes) ? object.slashes.map((e: any) => ValidatorSlashEvent.fromJSON(e)) : [], + pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryValidatorSlashesResponse): unknown { + const obj: any = {}; + if (message.slashes?.length) { + obj.slashes = message.slashes.map((e) => ValidatorSlashEvent.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryValidatorSlashesResponse { + return QueryValidatorSlashesResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryValidatorSlashesResponse { + const message = createBaseQueryValidatorSlashesResponse(); + message.slashes = object.slashes?.map((e) => ValidatorSlashEvent.fromPartial(e)) || []; + message.pagination = object.pagination !== undefined && object.pagination !== null ? PageResponse.fromPartial(object.pagination) : undefined; + return message; + }, +}; + +export const QueryDelegationRewardsRequest: MessageFns = { + $type: "cosmos.distribution.v1beta1.QueryDelegationRewardsRequest" as const, + + encode(message: QueryDelegationRewardsRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.delegator_address !== "") { + writer.uint32(10).string(message.delegator_address); + } + if (message.validator_address !== "") { + writer.uint32(18).string(message.validator_address); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryDelegationRewardsRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDelegationRewardsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.delegator_address = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.validator_address = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDelegationRewardsRequest { + return { + delegator_address: isSet(object.delegator_address) ? globalThis.String(object.delegator_address) : "", + validator_address: isSet(object.validator_address) ? globalThis.String(object.validator_address) : "", + }; + }, + + toJSON(message: QueryDelegationRewardsRequest): unknown { + const obj: any = {}; + if (message.delegator_address !== "") { + obj.delegator_address = message.delegator_address; + } + if (message.validator_address !== "") { + obj.validator_address = message.validator_address; + } + return obj; + }, + + create, I>>(base?: I): QueryDelegationRewardsRequest { + return QueryDelegationRewardsRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryDelegationRewardsRequest { + const message = createBaseQueryDelegationRewardsRequest(); + message.delegator_address = object.delegator_address ?? ""; + message.validator_address = object.validator_address ?? ""; + return message; + }, +}; + +export const QueryDelegationRewardsResponse: MessageFns = { + $type: "cosmos.distribution.v1beta1.QueryDelegationRewardsResponse" as const, + + encode(message: QueryDelegationRewardsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.rewards) { + DecCoin.encode(v!, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryDelegationRewardsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDelegationRewardsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.rewards.push(DecCoin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDelegationRewardsResponse { + return { + rewards: globalThis.Array.isArray(object?.rewards) ? object.rewards.map((e: any) => DecCoin.fromJSON(e)) : [], + }; + }, + + toJSON(message: QueryDelegationRewardsResponse): unknown { + const obj: any = {}; + if (message.rewards?.length) { + obj.rewards = message.rewards.map((e) => DecCoin.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): QueryDelegationRewardsResponse { + return QueryDelegationRewardsResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryDelegationRewardsResponse { + const message = createBaseQueryDelegationRewardsResponse(); + message.rewards = object.rewards?.map((e) => DecCoin.fromPartial(e)) || []; + return message; + }, +}; + +export const QueryDelegationTotalRewardsRequest: MessageFns< + QueryDelegationTotalRewardsRequest, + "cosmos.distribution.v1beta1.QueryDelegationTotalRewardsRequest" +> = { + $type: "cosmos.distribution.v1beta1.QueryDelegationTotalRewardsRequest" as const, + + encode(message: QueryDelegationTotalRewardsRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.delegator_address !== "") { + writer.uint32(10).string(message.delegator_address); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryDelegationTotalRewardsRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDelegationTotalRewardsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.delegator_address = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDelegationTotalRewardsRequest { + return { delegator_address: isSet(object.delegator_address) ? globalThis.String(object.delegator_address) : "" }; + }, + + toJSON(message: QueryDelegationTotalRewardsRequest): unknown { + const obj: any = {}; + if (message.delegator_address !== "") { + obj.delegator_address = message.delegator_address; + } + return obj; + }, + + create, I>>(base?: I): QueryDelegationTotalRewardsRequest { + return QueryDelegationTotalRewardsRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryDelegationTotalRewardsRequest { + const message = createBaseQueryDelegationTotalRewardsRequest(); + message.delegator_address = object.delegator_address ?? ""; + return message; + }, +}; + +export const QueryDelegationTotalRewardsResponse: MessageFns< + QueryDelegationTotalRewardsResponse, + "cosmos.distribution.v1beta1.QueryDelegationTotalRewardsResponse" +> = { + $type: "cosmos.distribution.v1beta1.QueryDelegationTotalRewardsResponse" as const, + + encode(message: QueryDelegationTotalRewardsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.rewards) { + DelegationDelegatorReward.encode(v!, writer.uint32(10).fork()).join(); + } + for (const v of message.total) { + DecCoin.encode(v!, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryDelegationTotalRewardsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDelegationTotalRewardsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.rewards.push(DelegationDelegatorReward.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.total.push(DecCoin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDelegationTotalRewardsResponse { + return { + rewards: globalThis.Array.isArray(object?.rewards) ? object.rewards.map((e: any) => DelegationDelegatorReward.fromJSON(e)) : [], + total: globalThis.Array.isArray(object?.total) ? object.total.map((e: any) => DecCoin.fromJSON(e)) : [], + }; + }, + + toJSON(message: QueryDelegationTotalRewardsResponse): unknown { + const obj: any = {}; + if (message.rewards?.length) { + obj.rewards = message.rewards.map((e) => DelegationDelegatorReward.toJSON(e)); + } + if (message.total?.length) { + obj.total = message.total.map((e) => DecCoin.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): QueryDelegationTotalRewardsResponse { + return QueryDelegationTotalRewardsResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryDelegationTotalRewardsResponse { + const message = createBaseQueryDelegationTotalRewardsResponse(); + message.rewards = object.rewards?.map((e) => DelegationDelegatorReward.fromPartial(e)) || []; + message.total = object.total?.map((e) => DecCoin.fromPartial(e)) || []; + return message; + }, +}; + +export const QueryDelegatorValidatorsRequest: MessageFns = { + $type: "cosmos.distribution.v1beta1.QueryDelegatorValidatorsRequest" as const, + + encode(message: QueryDelegatorValidatorsRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.delegator_address !== "") { + writer.uint32(10).string(message.delegator_address); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryDelegatorValidatorsRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDelegatorValidatorsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.delegator_address = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDelegatorValidatorsRequest { + return { delegator_address: isSet(object.delegator_address) ? globalThis.String(object.delegator_address) : "" }; + }, + + toJSON(message: QueryDelegatorValidatorsRequest): unknown { + const obj: any = {}; + if (message.delegator_address !== "") { + obj.delegator_address = message.delegator_address; + } + return obj; + }, + + create, I>>(base?: I): QueryDelegatorValidatorsRequest { + return QueryDelegatorValidatorsRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryDelegatorValidatorsRequest { + const message = createBaseQueryDelegatorValidatorsRequest(); + message.delegator_address = object.delegator_address ?? ""; + return message; + }, +}; + +export const QueryDelegatorValidatorsResponse: MessageFns = { + $type: "cosmos.distribution.v1beta1.QueryDelegatorValidatorsResponse" as const, + + encode(message: QueryDelegatorValidatorsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.validators) { + writer.uint32(10).string(v!); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryDelegatorValidatorsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDelegatorValidatorsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.validators.push(reader.string()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDelegatorValidatorsResponse { + return { + validators: globalThis.Array.isArray(object?.validators) ? object.validators.map((e: any) => globalThis.String(e)) : [], + }; + }, + + toJSON(message: QueryDelegatorValidatorsResponse): unknown { + const obj: any = {}; + if (message.validators?.length) { + obj.validators = message.validators; + } + return obj; + }, + + create, I>>(base?: I): QueryDelegatorValidatorsResponse { + return QueryDelegatorValidatorsResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryDelegatorValidatorsResponse { + const message = createBaseQueryDelegatorValidatorsResponse(); + message.validators = object.validators?.map((e) => e) || []; + return message; + }, +}; + +export const QueryDelegatorWithdrawAddressRequest: MessageFns< + QueryDelegatorWithdrawAddressRequest, + "cosmos.distribution.v1beta1.QueryDelegatorWithdrawAddressRequest" +> = { + $type: "cosmos.distribution.v1beta1.QueryDelegatorWithdrawAddressRequest" as const, + + encode(message: QueryDelegatorWithdrawAddressRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.delegator_address !== "") { + writer.uint32(10).string(message.delegator_address); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryDelegatorWithdrawAddressRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDelegatorWithdrawAddressRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.delegator_address = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDelegatorWithdrawAddressRequest { + return { delegator_address: isSet(object.delegator_address) ? globalThis.String(object.delegator_address) : "" }; + }, + + toJSON(message: QueryDelegatorWithdrawAddressRequest): unknown { + const obj: any = {}; + if (message.delegator_address !== "") { + obj.delegator_address = message.delegator_address; + } + return obj; + }, + + create, I>>(base?: I): QueryDelegatorWithdrawAddressRequest { + return QueryDelegatorWithdrawAddressRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryDelegatorWithdrawAddressRequest { + const message = createBaseQueryDelegatorWithdrawAddressRequest(); + message.delegator_address = object.delegator_address ?? ""; + return message; + }, +}; + +export const QueryDelegatorWithdrawAddressResponse: MessageFns< + QueryDelegatorWithdrawAddressResponse, + "cosmos.distribution.v1beta1.QueryDelegatorWithdrawAddressResponse" +> = { + $type: "cosmos.distribution.v1beta1.QueryDelegatorWithdrawAddressResponse" as const, + + encode(message: QueryDelegatorWithdrawAddressResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.withdraw_address !== "") { + writer.uint32(10).string(message.withdraw_address); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryDelegatorWithdrawAddressResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDelegatorWithdrawAddressResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.withdraw_address = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDelegatorWithdrawAddressResponse { + return { withdraw_address: isSet(object.withdraw_address) ? globalThis.String(object.withdraw_address) : "" }; + }, + + toJSON(message: QueryDelegatorWithdrawAddressResponse): unknown { + const obj: any = {}; + if (message.withdraw_address !== "") { + obj.withdraw_address = message.withdraw_address; + } + return obj; + }, + + create, I>>(base?: I): QueryDelegatorWithdrawAddressResponse { + return QueryDelegatorWithdrawAddressResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryDelegatorWithdrawAddressResponse { + const message = createBaseQueryDelegatorWithdrawAddressResponse(); + message.withdraw_address = object.withdraw_address ?? ""; + return message; + }, +}; + +export const QueryCommunityPoolRequest: MessageFns = { + $type: "cosmos.distribution.v1beta1.QueryCommunityPoolRequest" as const, + + encode(_: QueryCommunityPoolRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryCommunityPoolRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryCommunityPoolRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): QueryCommunityPoolRequest { + return {}; + }, + + toJSON(_: QueryCommunityPoolRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): QueryCommunityPoolRequest { + return QueryCommunityPoolRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): QueryCommunityPoolRequest { + const message = createBaseQueryCommunityPoolRequest(); + return message; + }, +}; + +export const QueryCommunityPoolResponse: MessageFns = { + $type: "cosmos.distribution.v1beta1.QueryCommunityPoolResponse" as const, + + encode(message: QueryCommunityPoolResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.pool) { + DecCoin.encode(v!, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryCommunityPoolResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryCommunityPoolResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.pool.push(DecCoin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryCommunityPoolResponse { + return { pool: globalThis.Array.isArray(object?.pool) ? object.pool.map((e: any) => DecCoin.fromJSON(e)) : [] }; + }, + + toJSON(message: QueryCommunityPoolResponse): unknown { + const obj: any = {}; + if (message.pool?.length) { + obj.pool = message.pool.map((e) => DecCoin.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): QueryCommunityPoolResponse { + return QueryCommunityPoolResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryCommunityPoolResponse { + const message = createBaseQueryCommunityPoolResponse(); + message.pool = object.pool?.map((e) => DecCoin.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseQueryParamsRequest(): QueryParamsRequest { + return {}; +} + +function createBaseQueryParamsResponse(): QueryParamsResponse { + return { params: undefined }; +} + +function createBaseQueryValidatorOutstandingRewardsRequest(): QueryValidatorOutstandingRewardsRequest { + return { validator_address: "" }; +} + +function createBaseQueryValidatorOutstandingRewardsResponse(): QueryValidatorOutstandingRewardsResponse { + return { rewards: undefined }; +} + +function createBaseQueryValidatorCommissionRequest(): QueryValidatorCommissionRequest { + return { validator_address: "" }; +} + +function createBaseQueryValidatorCommissionResponse(): QueryValidatorCommissionResponse { + return { commission: undefined }; +} + +function createBaseQueryValidatorSlashesRequest(): QueryValidatorSlashesRequest { + return { validator_address: "", starting_height: 0, ending_height: 0, pagination: undefined }; +} + +function createBaseQueryValidatorSlashesResponse(): QueryValidatorSlashesResponse { + return { slashes: [], pagination: undefined }; +} + +function createBaseQueryDelegationRewardsRequest(): QueryDelegationRewardsRequest { + return { delegator_address: "", validator_address: "" }; +} + +function createBaseQueryDelegationRewardsResponse(): QueryDelegationRewardsResponse { + return { rewards: [] }; +} + +function createBaseQueryDelegationTotalRewardsRequest(): QueryDelegationTotalRewardsRequest { + return { delegator_address: "" }; +} + +function createBaseQueryDelegationTotalRewardsResponse(): QueryDelegationTotalRewardsResponse { + return { rewards: [], total: [] }; +} + +function createBaseQueryDelegatorValidatorsRequest(): QueryDelegatorValidatorsRequest { + return { delegator_address: "" }; +} + +function createBaseQueryDelegatorValidatorsResponse(): QueryDelegatorValidatorsResponse { + return { validators: [] }; +} + +function createBaseQueryDelegatorWithdrawAddressRequest(): QueryDelegatorWithdrawAddressRequest { + return { delegator_address: "" }; +} + +function createBaseQueryDelegatorWithdrawAddressResponse(): QueryDelegatorWithdrawAddressResponse { + return { withdraw_address: "" }; +} + +function createBaseQueryCommunityPoolRequest(): QueryCommunityPoolRequest { + return {}; +} + +function createBaseQueryCommunityPoolResponse(): QueryCommunityPoolResponse { + return { pool: [] }; +} + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} +export const registry: Array<[string, GeneratedType]> = [ + ["/cosmos.distribution.v1beta1.QueryParamsRequest", QueryParamsRequest as never], + ["/cosmos.distribution.v1beta1.QueryParamsResponse", QueryParamsResponse as never], +]; +export const aminoConverters = { + "/cosmos.distribution.v1beta1.QueryParamsRequest": { + aminoType: "cosmos-sdk/QueryParamsRequest", + toAmino: (message: QueryParamsRequest) => ({ ...message }), + fromAmino: (object: QueryParamsRequest) => ({ ...object }), + }, + + "/cosmos.distribution.v1beta1.QueryParamsResponse": { + aminoType: "cosmos-sdk/QueryParamsResponse", + toAmino: (message: QueryParamsResponse) => ({ ...message }), + fromAmino: (object: QueryParamsResponse) => ({ ...object }), + }, +}; diff --git a/packages/cosmos/generated/encoding/cosmos/distribution/v1beta1/tx.ts b/packages/cosmos/generated/encoding/cosmos/distribution/v1beta1/tx.ts new file mode 100644 index 000000000..176103a54 --- /dev/null +++ b/packages/cosmos/generated/encoding/cosmos/distribution/v1beta1/tx.ts @@ -0,0 +1,502 @@ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +import { Coin } from "../../base/v1beta1/coin"; + +import type { + MsgFundCommunityPoolResponse as MsgFundCommunityPoolResponse_type, + MsgFundCommunityPool as MsgFundCommunityPool_type, + MsgSetWithdrawAddressResponse as MsgSetWithdrawAddressResponse_type, + MsgSetWithdrawAddress as MsgSetWithdrawAddress_type, + MsgWithdrawDelegatorRewardResponse as MsgWithdrawDelegatorRewardResponse_type, + MsgWithdrawDelegatorReward as MsgWithdrawDelegatorReward_type, + MsgWithdrawValidatorCommissionResponse as MsgWithdrawValidatorCommissionResponse_type, + MsgWithdrawValidatorCommission as MsgWithdrawValidatorCommission_type, +} from "../../../../types/cosmos/distribution/v1beta1"; + +import type { DeepPartial, Exact, MessageFns } from "../../../common"; + +export interface MsgSetWithdrawAddress extends MsgSetWithdrawAddress_type {} +export interface MsgSetWithdrawAddressResponse extends MsgSetWithdrawAddressResponse_type {} +export interface MsgWithdrawDelegatorReward extends MsgWithdrawDelegatorReward_type {} +export interface MsgWithdrawDelegatorRewardResponse extends MsgWithdrawDelegatorRewardResponse_type {} +export interface MsgWithdrawValidatorCommission extends MsgWithdrawValidatorCommission_type {} +export interface MsgWithdrawValidatorCommissionResponse extends MsgWithdrawValidatorCommissionResponse_type {} +export interface MsgFundCommunityPool extends MsgFundCommunityPool_type {} +export interface MsgFundCommunityPoolResponse extends MsgFundCommunityPoolResponse_type {} + +export const MsgSetWithdrawAddress: MessageFns = { + $type: "cosmos.distribution.v1beta1.MsgSetWithdrawAddress" as const, + + encode(message: MsgSetWithdrawAddress, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.delegator_address !== "") { + writer.uint32(10).string(message.delegator_address); + } + if (message.withdraw_address !== "") { + writer.uint32(18).string(message.withdraw_address); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgSetWithdrawAddress { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSetWithdrawAddress(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.delegator_address = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.withdraw_address = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgSetWithdrawAddress { + return { + delegator_address: isSet(object.delegator_address) ? globalThis.String(object.delegator_address) : "", + withdraw_address: isSet(object.withdraw_address) ? globalThis.String(object.withdraw_address) : "", + }; + }, + + toJSON(message: MsgSetWithdrawAddress): unknown { + const obj: any = {}; + if (message.delegator_address !== "") { + obj.delegator_address = message.delegator_address; + } + if (message.withdraw_address !== "") { + obj.withdraw_address = message.withdraw_address; + } + return obj; + }, + + create, I>>(base?: I): MsgSetWithdrawAddress { + return MsgSetWithdrawAddress.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgSetWithdrawAddress { + const message = createBaseMsgSetWithdrawAddress(); + message.delegator_address = object.delegator_address ?? ""; + message.withdraw_address = object.withdraw_address ?? ""; + return message; + }, +}; + +export const MsgSetWithdrawAddressResponse: MessageFns = { + $type: "cosmos.distribution.v1beta1.MsgSetWithdrawAddressResponse" as const, + + encode(_: MsgSetWithdrawAddressResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgSetWithdrawAddressResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSetWithdrawAddressResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgSetWithdrawAddressResponse { + return {}; + }, + + toJSON(_: MsgSetWithdrawAddressResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgSetWithdrawAddressResponse { + return MsgSetWithdrawAddressResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgSetWithdrawAddressResponse { + const message = createBaseMsgSetWithdrawAddressResponse(); + return message; + }, +}; + +export const MsgWithdrawDelegatorReward: MessageFns = { + $type: "cosmos.distribution.v1beta1.MsgWithdrawDelegatorReward" as const, + + encode(message: MsgWithdrawDelegatorReward, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.delegator_address !== "") { + writer.uint32(10).string(message.delegator_address); + } + if (message.validator_address !== "") { + writer.uint32(18).string(message.validator_address); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgWithdrawDelegatorReward { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgWithdrawDelegatorReward(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.delegator_address = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.validator_address = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgWithdrawDelegatorReward { + return { + delegator_address: isSet(object.delegator_address) ? globalThis.String(object.delegator_address) : "", + validator_address: isSet(object.validator_address) ? globalThis.String(object.validator_address) : "", + }; + }, + + toJSON(message: MsgWithdrawDelegatorReward): unknown { + const obj: any = {}; + if (message.delegator_address !== "") { + obj.delegator_address = message.delegator_address; + } + if (message.validator_address !== "") { + obj.validator_address = message.validator_address; + } + return obj; + }, + + create, I>>(base?: I): MsgWithdrawDelegatorReward { + return MsgWithdrawDelegatorReward.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgWithdrawDelegatorReward { + const message = createBaseMsgWithdrawDelegatorReward(); + message.delegator_address = object.delegator_address ?? ""; + message.validator_address = object.validator_address ?? ""; + return message; + }, +}; + +export const MsgWithdrawDelegatorRewardResponse: MessageFns< + MsgWithdrawDelegatorRewardResponse, + "cosmos.distribution.v1beta1.MsgWithdrawDelegatorRewardResponse" +> = { + $type: "cosmos.distribution.v1beta1.MsgWithdrawDelegatorRewardResponse" as const, + + encode(_: MsgWithdrawDelegatorRewardResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgWithdrawDelegatorRewardResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgWithdrawDelegatorRewardResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgWithdrawDelegatorRewardResponse { + return {}; + }, + + toJSON(_: MsgWithdrawDelegatorRewardResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgWithdrawDelegatorRewardResponse { + return MsgWithdrawDelegatorRewardResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgWithdrawDelegatorRewardResponse { + const message = createBaseMsgWithdrawDelegatorRewardResponse(); + return message; + }, +}; + +export const MsgWithdrawValidatorCommission: MessageFns = { + $type: "cosmos.distribution.v1beta1.MsgWithdrawValidatorCommission" as const, + + encode(message: MsgWithdrawValidatorCommission, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.validator_address !== "") { + writer.uint32(10).string(message.validator_address); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgWithdrawValidatorCommission { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgWithdrawValidatorCommission(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.validator_address = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgWithdrawValidatorCommission { + return { validator_address: isSet(object.validator_address) ? globalThis.String(object.validator_address) : "" }; + }, + + toJSON(message: MsgWithdrawValidatorCommission): unknown { + const obj: any = {}; + if (message.validator_address !== "") { + obj.validator_address = message.validator_address; + } + return obj; + }, + + create, I>>(base?: I): MsgWithdrawValidatorCommission { + return MsgWithdrawValidatorCommission.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgWithdrawValidatorCommission { + const message = createBaseMsgWithdrawValidatorCommission(); + message.validator_address = object.validator_address ?? ""; + return message; + }, +}; + +export const MsgWithdrawValidatorCommissionResponse: MessageFns< + MsgWithdrawValidatorCommissionResponse, + "cosmos.distribution.v1beta1.MsgWithdrawValidatorCommissionResponse" +> = { + $type: "cosmos.distribution.v1beta1.MsgWithdrawValidatorCommissionResponse" as const, + + encode(_: MsgWithdrawValidatorCommissionResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgWithdrawValidatorCommissionResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgWithdrawValidatorCommissionResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgWithdrawValidatorCommissionResponse { + return {}; + }, + + toJSON(_: MsgWithdrawValidatorCommissionResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgWithdrawValidatorCommissionResponse { + return MsgWithdrawValidatorCommissionResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgWithdrawValidatorCommissionResponse { + const message = createBaseMsgWithdrawValidatorCommissionResponse(); + return message; + }, +}; + +export const MsgFundCommunityPool: MessageFns = { + $type: "cosmos.distribution.v1beta1.MsgFundCommunityPool" as const, + + encode(message: MsgFundCommunityPool, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.amount) { + Coin.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.depositor !== "") { + writer.uint32(18).string(message.depositor); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgFundCommunityPool { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgFundCommunityPool(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.amount.push(Coin.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.depositor = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgFundCommunityPool { + return { + amount: globalThis.Array.isArray(object?.amount) ? object.amount.map((e: any) => Coin.fromJSON(e)) : [], + depositor: isSet(object.depositor) ? globalThis.String(object.depositor) : "", + }; + }, + + toJSON(message: MsgFundCommunityPool): unknown { + const obj: any = {}; + if (message.amount?.length) { + obj.amount = message.amount.map((e) => Coin.toJSON(e)); + } + if (message.depositor !== "") { + obj.depositor = message.depositor; + } + return obj; + }, + + create, I>>(base?: I): MsgFundCommunityPool { + return MsgFundCommunityPool.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgFundCommunityPool { + const message = createBaseMsgFundCommunityPool(); + message.amount = object.amount?.map((e) => Coin.fromPartial(e)) || []; + message.depositor = object.depositor ?? ""; + return message; + }, +}; + +export const MsgFundCommunityPoolResponse: MessageFns = { + $type: "cosmos.distribution.v1beta1.MsgFundCommunityPoolResponse" as const, + + encode(_: MsgFundCommunityPoolResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgFundCommunityPoolResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgFundCommunityPoolResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgFundCommunityPoolResponse { + return {}; + }, + + toJSON(_: MsgFundCommunityPoolResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgFundCommunityPoolResponse { + return MsgFundCommunityPoolResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgFundCommunityPoolResponse { + const message = createBaseMsgFundCommunityPoolResponse(); + return message; + }, +}; + +function createBaseMsgSetWithdrawAddress(): MsgSetWithdrawAddress { + return { delegator_address: "", withdraw_address: "" }; +} + +function createBaseMsgSetWithdrawAddressResponse(): MsgSetWithdrawAddressResponse { + return {}; +} + +function createBaseMsgWithdrawDelegatorReward(): MsgWithdrawDelegatorReward { + return { delegator_address: "", validator_address: "" }; +} + +function createBaseMsgWithdrawDelegatorRewardResponse(): MsgWithdrawDelegatorRewardResponse { + return {}; +} + +function createBaseMsgWithdrawValidatorCommission(): MsgWithdrawValidatorCommission { + return { validator_address: "" }; +} + +function createBaseMsgWithdrawValidatorCommissionResponse(): MsgWithdrawValidatorCommissionResponse { + return {}; +} + +function createBaseMsgFundCommunityPool(): MsgFundCommunityPool { + return { amount: [], depositor: "" }; +} + +function createBaseMsgFundCommunityPoolResponse(): MsgFundCommunityPoolResponse { + return {}; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} diff --git a/packages/cosmos/generated/encoding/cosmos/evidence/v1beta1/evidence.ts b/packages/cosmos/generated/encoding/cosmos/evidence/v1beta1/evidence.ts new file mode 100644 index 000000000..237e47038 --- /dev/null +++ b/packages/cosmos/generated/encoding/cosmos/evidence/v1beta1/evidence.ts @@ -0,0 +1,162 @@ +import type { GeneratedType } from "@cosmjs/proto-signing"; + +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +import { Timestamp } from "../../../google/protobuf/timestamp"; + +import type { Equivocation as Equivocation_type } from "../../../../types/cosmos/evidence/v1beta1"; + +import type { DeepPartial, Exact, MessageFns } from "../../../common"; + +export interface Equivocation extends Equivocation_type {} + +export const Equivocation: MessageFns = { + $type: "cosmos.evidence.v1beta1.Equivocation" as const, + + encode(message: Equivocation, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.height !== 0) { + writer.uint32(8).int64(message.height); + } + if (message.time !== undefined) { + Timestamp.encode(toTimestamp(message.time), writer.uint32(18).fork()).join(); + } + if (message.power !== 0) { + writer.uint32(24).int64(message.power); + } + if (message.consensus_address !== "") { + writer.uint32(34).string(message.consensus_address); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Equivocation { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEquivocation(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.height = longToNumber(reader.int64()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.time = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.power = longToNumber(reader.int64()); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.consensus_address = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Equivocation { + return { + height: isSet(object.height) ? globalThis.Number(object.height) : 0, + time: isSet(object.time) ? fromJsonTimestamp(object.time) : undefined, + power: isSet(object.power) ? globalThis.Number(object.power) : 0, + consensus_address: isSet(object.consensus_address) ? globalThis.String(object.consensus_address) : "", + }; + }, + + toJSON(message: Equivocation): unknown { + const obj: any = {}; + if (message.height !== 0) { + obj.height = Math.round(message.height); + } + if (message.time !== undefined) { + obj.time = message.time.toISOString(); + } + if (message.power !== 0) { + obj.power = Math.round(message.power); + } + if (message.consensus_address !== "") { + obj.consensus_address = message.consensus_address; + } + return obj; + }, + + create, I>>(base?: I): Equivocation { + return Equivocation.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Equivocation { + const message = createBaseEquivocation(); + message.height = object.height ?? 0; + message.time = object.time ?? undefined; + message.power = object.power ?? 0; + message.consensus_address = object.consensus_address ?? ""; + return message; + }, +}; + +function createBaseEquivocation(): Equivocation { + return { height: 0, time: undefined, power: 0, consensus_address: "" }; +} + +function toTimestamp(date: Date): Timestamp { + const seconds = Math.trunc(date.getTime() / 1_000); + const nanos = (date.getTime() % 1_000) * 1_000_000; + return { seconds, nanos }; +} + +function fromTimestamp(t: Timestamp): Date { + let millis = (t.seconds || 0) * 1_000; + millis += (t.nanos || 0) / 1_000_000; + return new globalThis.Date(millis); +} + +function fromJsonTimestamp(o: any): Date { + if (o instanceof globalThis.Date) { + return o; + } else if (typeof o === "string") { + return new globalThis.Date(o); + } else { + return fromTimestamp(Timestamp.fromJSON(o)); + } +} + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} +export const registry: Array<[string, GeneratedType]> = [["/cosmos.evidence.v1beta1.Equivocation", Equivocation as never]]; +export const aminoConverters = { + "/cosmos.evidence.v1beta1.Equivocation": { + aminoType: "cosmos-sdk/Equivocation", + toAmino: (message: Equivocation) => ({ ...message }), + fromAmino: (object: Equivocation) => ({ ...object }), + }, +}; diff --git a/packages/cosmos/generated/encoding/cosmos/evidence/v1beta1/genesis.ts b/packages/cosmos/generated/encoding/cosmos/evidence/v1beta1/genesis.ts new file mode 100644 index 000000000..2c0642b5d --- /dev/null +++ b/packages/cosmos/generated/encoding/cosmos/evidence/v1beta1/genesis.ts @@ -0,0 +1,80 @@ +import type { GeneratedType } from "@cosmjs/proto-signing"; + +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +import { Any } from "../../../google/protobuf/any"; + +import type { GenesisState as GenesisState_type } from "../../../../types/cosmos/evidence/v1beta1"; + +import type { DeepPartial, Exact, MessageFns } from "../../../common"; + +export interface GenesisState extends GenesisState_type {} + +export const GenesisState: MessageFns = { + $type: "cosmos.evidence.v1beta1.GenesisState" as const, + + encode(message: GenesisState, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.evidence) { + Any.encode(v!, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GenesisState { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGenesisState(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.evidence.push(Any.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GenesisState { + return { + evidence: globalThis.Array.isArray(object?.evidence) ? object.evidence.map((e: any) => Any.fromJSON(e)) : [], + }; + }, + + toJSON(message: GenesisState): unknown { + const obj: any = {}; + if (message.evidence?.length) { + obj.evidence = message.evidence.map((e) => Any.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): GenesisState { + return GenesisState.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): GenesisState { + const message = createBaseGenesisState(); + message.evidence = object.evidence?.map((e) => Any.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseGenesisState(): GenesisState { + return { evidence: [] }; +} +export const registry: Array<[string, GeneratedType]> = [["/cosmos.evidence.v1beta1.GenesisState", GenesisState as never]]; +export const aminoConverters = { + "/cosmos.evidence.v1beta1.GenesisState": { + aminoType: "cosmos-sdk/GenesisState", + toAmino: (message: GenesisState) => ({ ...message }), + fromAmino: (object: GenesisState) => ({ ...object }), + }, +}; diff --git a/packages/cosmos/generated/encoding/cosmos/evidence/v1beta1/index.ts b/packages/cosmos/generated/encoding/cosmos/evidence/v1beta1/index.ts new file mode 100644 index 000000000..9287c42ee --- /dev/null +++ b/packages/cosmos/generated/encoding/cosmos/evidence/v1beta1/index.ts @@ -0,0 +1,6 @@ +// @ts-nocheck + +export * from './evidence'; +export * from './genesis'; +export * from './query'; +export * from './tx'; \ No newline at end of file diff --git a/packages/cosmos/generated/encoding/cosmos/evidence/v1beta1/query.ts b/packages/cosmos/generated/encoding/cosmos/evidence/v1beta1/query.ts new file mode 100644 index 000000000..614d7e30d --- /dev/null +++ b/packages/cosmos/generated/encoding/cosmos/evidence/v1beta1/query.ts @@ -0,0 +1,320 @@ +import type { GeneratedType } from "@cosmjs/proto-signing"; + +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +import { Any } from "../../../google/protobuf/any"; + +import { PageRequest, PageResponse } from "../../base/query/v1beta1/pagination"; + +import type { + QueryAllEvidenceRequest as QueryAllEvidenceRequest_type, + QueryAllEvidenceResponse as QueryAllEvidenceResponse_type, + QueryEvidenceRequest as QueryEvidenceRequest_type, + QueryEvidenceResponse as QueryEvidenceResponse_type, +} from "../../../../types/cosmos/evidence/v1beta1"; + +import type { DeepPartial, Exact, MessageFns } from "../../../common"; + +export interface QueryEvidenceRequest extends QueryEvidenceRequest_type {} +export interface QueryEvidenceResponse extends QueryEvidenceResponse_type {} +export interface QueryAllEvidenceRequest extends QueryAllEvidenceRequest_type {} +export interface QueryAllEvidenceResponse extends QueryAllEvidenceResponse_type {} + +export const QueryEvidenceRequest: MessageFns = { + $type: "cosmos.evidence.v1beta1.QueryEvidenceRequest" as const, + + encode(message: QueryEvidenceRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.evidence_hash.length !== 0) { + writer.uint32(10).bytes(message.evidence_hash); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryEvidenceRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryEvidenceRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.evidence_hash = reader.bytes(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryEvidenceRequest { + return { evidence_hash: isSet(object.evidence_hash) ? bytesFromBase64(object.evidence_hash) : new Uint8Array(0) }; + }, + + toJSON(message: QueryEvidenceRequest): unknown { + const obj: any = {}; + if (message.evidence_hash.length !== 0) { + obj.evidence_hash = base64FromBytes(message.evidence_hash); + } + return obj; + }, + + create, I>>(base?: I): QueryEvidenceRequest { + return QueryEvidenceRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryEvidenceRequest { + const message = createBaseQueryEvidenceRequest(); + message.evidence_hash = object.evidence_hash ?? new Uint8Array(0); + return message; + }, +}; + +export const QueryEvidenceResponse: MessageFns = { + $type: "cosmos.evidence.v1beta1.QueryEvidenceResponse" as const, + + encode(message: QueryEvidenceResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.evidence !== undefined) { + Any.encode(message.evidence, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryEvidenceResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryEvidenceResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.evidence = Any.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryEvidenceResponse { + return { evidence: isSet(object.evidence) ? Any.fromJSON(object.evidence) : undefined }; + }, + + toJSON(message: QueryEvidenceResponse): unknown { + const obj: any = {}; + if (message.evidence !== undefined) { + obj.evidence = Any.toJSON(message.evidence); + } + return obj; + }, + + create, I>>(base?: I): QueryEvidenceResponse { + return QueryEvidenceResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryEvidenceResponse { + const message = createBaseQueryEvidenceResponse(); + message.evidence = object.evidence !== undefined && object.evidence !== null ? Any.fromPartial(object.evidence) : undefined; + return message; + }, +}; + +export const QueryAllEvidenceRequest: MessageFns = { + $type: "cosmos.evidence.v1beta1.QueryAllEvidenceRequest" as const, + + encode(message: QueryAllEvidenceRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryAllEvidenceRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryAllEvidenceRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryAllEvidenceRequest { + return { pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined }; + }, + + toJSON(message: QueryAllEvidenceRequest): unknown { + const obj: any = {}; + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryAllEvidenceRequest { + return QueryAllEvidenceRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryAllEvidenceRequest { + const message = createBaseQueryAllEvidenceRequest(); + message.pagination = object.pagination !== undefined && object.pagination !== null ? PageRequest.fromPartial(object.pagination) : undefined; + return message; + }, +}; + +export const QueryAllEvidenceResponse: MessageFns = { + $type: "cosmos.evidence.v1beta1.QueryAllEvidenceResponse" as const, + + encode(message: QueryAllEvidenceResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.evidence) { + Any.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryAllEvidenceResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryAllEvidenceResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.evidence.push(Any.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryAllEvidenceResponse { + return { + evidence: globalThis.Array.isArray(object?.evidence) ? object.evidence.map((e: any) => Any.fromJSON(e)) : [], + pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryAllEvidenceResponse): unknown { + const obj: any = {}; + if (message.evidence?.length) { + obj.evidence = message.evidence.map((e) => Any.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryAllEvidenceResponse { + return QueryAllEvidenceResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryAllEvidenceResponse { + const message = createBaseQueryAllEvidenceResponse(); + message.evidence = object.evidence?.map((e) => Any.fromPartial(e)) || []; + message.pagination = object.pagination !== undefined && object.pagination !== null ? PageResponse.fromPartial(object.pagination) : undefined; + return message; + }, +}; + +function createBaseQueryEvidenceRequest(): QueryEvidenceRequest { + return { evidence_hash: new Uint8Array(0) }; +} + +function createBaseQueryEvidenceResponse(): QueryEvidenceResponse { + return { evidence: undefined }; +} + +function createBaseQueryAllEvidenceRequest(): QueryAllEvidenceRequest { + return { pagination: undefined }; +} + +function createBaseQueryAllEvidenceResponse(): QueryAllEvidenceResponse { + return { evidence: [], pagination: undefined }; +} + +function bytesFromBase64(b64: string): Uint8Array { + if ((globalThis as any).Buffer) { + return Uint8Array.from(globalThis.Buffer.from(b64, "base64")); + } else { + const bin = globalThis.atob(b64); + const arr = new Uint8Array(bin.length); + for (let i = 0; i < bin.length; ++i) { + arr[i] = bin.charCodeAt(i); + } + return arr; + } +} + +function base64FromBytes(arr: Uint8Array): string { + if ((globalThis as any).Buffer) { + return globalThis.Buffer.from(arr).toString("base64"); + } else { + const bin: string[] = []; + arr.forEach((byte) => { + bin.push(globalThis.String.fromCharCode(byte)); + }); + return globalThis.btoa(bin.join("")); + } +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} +export const registry: Array<[string, GeneratedType]> = [ + ["/cosmos.evidence.v1beta1.QueryEvidenceRequest", QueryEvidenceRequest as never], + ["/cosmos.evidence.v1beta1.QueryEvidenceResponse", QueryEvidenceResponse as never], +]; +export const aminoConverters = { + "/cosmos.evidence.v1beta1.QueryEvidenceRequest": { + aminoType: "cosmos-sdk/QueryEvidenceRequest", + toAmino: (message: QueryEvidenceRequest) => ({ ...message }), + fromAmino: (object: QueryEvidenceRequest) => ({ ...object }), + }, + + "/cosmos.evidence.v1beta1.QueryEvidenceResponse": { + aminoType: "cosmos-sdk/QueryEvidenceResponse", + toAmino: (message: QueryEvidenceResponse) => ({ ...message }), + fromAmino: (object: QueryEvidenceResponse) => ({ ...object }), + }, +}; diff --git a/packages/cosmos/generated/encoding/cosmos/evidence/v1beta1/tx.ts b/packages/cosmos/generated/encoding/cosmos/evidence/v1beta1/tx.ts new file mode 100644 index 000000000..03dfee7d4 --- /dev/null +++ b/packages/cosmos/generated/encoding/cosmos/evidence/v1beta1/tx.ts @@ -0,0 +1,187 @@ +import type { GeneratedType } from "@cosmjs/proto-signing"; + +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +import { Any } from "../../../google/protobuf/any"; + +import type { + MsgSubmitEvidenceResponse as MsgSubmitEvidenceResponse_type, + MsgSubmitEvidence as MsgSubmitEvidence_type, +} from "../../../../types/cosmos/evidence/v1beta1"; + +import type { DeepPartial, Exact, MessageFns } from "../../../common"; + +export interface MsgSubmitEvidence extends MsgSubmitEvidence_type {} +export interface MsgSubmitEvidenceResponse extends MsgSubmitEvidenceResponse_type {} + +export const MsgSubmitEvidence: MessageFns = { + $type: "cosmos.evidence.v1beta1.MsgSubmitEvidence" as const, + + encode(message: MsgSubmitEvidence, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.submitter !== "") { + writer.uint32(10).string(message.submitter); + } + if (message.evidence !== undefined) { + Any.encode(message.evidence, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgSubmitEvidence { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSubmitEvidence(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.submitter = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.evidence = Any.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgSubmitEvidence { + return { + submitter: isSet(object.submitter) ? globalThis.String(object.submitter) : "", + evidence: isSet(object.evidence) ? Any.fromJSON(object.evidence) : undefined, + }; + }, + + toJSON(message: MsgSubmitEvidence): unknown { + const obj: any = {}; + if (message.submitter !== "") { + obj.submitter = message.submitter; + } + if (message.evidence !== undefined) { + obj.evidence = Any.toJSON(message.evidence); + } + return obj; + }, + + create, I>>(base?: I): MsgSubmitEvidence { + return MsgSubmitEvidence.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgSubmitEvidence { + const message = createBaseMsgSubmitEvidence(); + message.submitter = object.submitter ?? ""; + message.evidence = object.evidence !== undefined && object.evidence !== null ? Any.fromPartial(object.evidence) : undefined; + return message; + }, +}; + +export const MsgSubmitEvidenceResponse: MessageFns = { + $type: "cosmos.evidence.v1beta1.MsgSubmitEvidenceResponse" as const, + + encode(message: MsgSubmitEvidenceResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.hash.length !== 0) { + writer.uint32(34).bytes(message.hash); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgSubmitEvidenceResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSubmitEvidenceResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 4: + if (tag !== 34) { + break; + } + + message.hash = reader.bytes(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgSubmitEvidenceResponse { + return { hash: isSet(object.hash) ? bytesFromBase64(object.hash) : new Uint8Array(0) }; + }, + + toJSON(message: MsgSubmitEvidenceResponse): unknown { + const obj: any = {}; + if (message.hash.length !== 0) { + obj.hash = base64FromBytes(message.hash); + } + return obj; + }, + + create, I>>(base?: I): MsgSubmitEvidenceResponse { + return MsgSubmitEvidenceResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgSubmitEvidenceResponse { + const message = createBaseMsgSubmitEvidenceResponse(); + message.hash = object.hash ?? new Uint8Array(0); + return message; + }, +}; + +function createBaseMsgSubmitEvidence(): MsgSubmitEvidence { + return { submitter: "", evidence: undefined }; +} + +function createBaseMsgSubmitEvidenceResponse(): MsgSubmitEvidenceResponse { + return { hash: new Uint8Array(0) }; +} + +function bytesFromBase64(b64: string): Uint8Array { + if ((globalThis as any).Buffer) { + return Uint8Array.from(globalThis.Buffer.from(b64, "base64")); + } else { + const bin = globalThis.atob(b64); + const arr = new Uint8Array(bin.length); + for (let i = 0; i < bin.length; ++i) { + arr[i] = bin.charCodeAt(i); + } + return arr; + } +} + +function base64FromBytes(arr: Uint8Array): string { + if ((globalThis as any).Buffer) { + return globalThis.Buffer.from(arr).toString("base64"); + } else { + const bin: string[] = []; + arr.forEach((byte) => { + bin.push(globalThis.String.fromCharCode(byte)); + }); + return globalThis.btoa(bin.join("")); + } +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} +export const registry: Array<[string, GeneratedType]> = [["/cosmos.evidence.v1beta1.MsgSubmitEvidence", MsgSubmitEvidence as never]]; +export const aminoConverters = { + "/cosmos.evidence.v1beta1.MsgSubmitEvidence": { + aminoType: "cosmos-sdk/MsgSubmitEvidence", + toAmino: (message: MsgSubmitEvidence) => ({ ...message }), + fromAmino: (object: MsgSubmitEvidence) => ({ ...object }), + }, +}; diff --git a/packages/cosmos/generated/encoding/cosmos/feegrant/v1beta1/feegrant.ts b/packages/cosmos/generated/encoding/cosmos/feegrant/v1beta1/feegrant.ts new file mode 100644 index 000000000..b8bffa872 --- /dev/null +++ b/packages/cosmos/generated/encoding/cosmos/feegrant/v1beta1/feegrant.ts @@ -0,0 +1,446 @@ +import type { GeneratedType } from "@cosmjs/proto-signing"; + +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +import { Any } from "../../../google/protobuf/any"; + +import { Duration } from "../../../google/protobuf/duration"; + +import { Timestamp } from "../../../google/protobuf/timestamp"; + +import { Coin } from "../../base/v1beta1/coin"; + +import type { + AllowedMsgAllowance as AllowedMsgAllowance_type, + BasicAllowance as BasicAllowance_type, + Grant as Grant_type, + PeriodicAllowance as PeriodicAllowance_type, +} from "../../../../types/cosmos/feegrant/v1beta1"; + +import type { DeepPartial, Exact, MessageFns } from "../../../common"; + +export interface BasicAllowance extends BasicAllowance_type {} +export interface PeriodicAllowance extends PeriodicAllowance_type {} +export interface AllowedMsgAllowance extends AllowedMsgAllowance_type {} +export interface Grant extends Grant_type {} + +export const BasicAllowance: MessageFns = { + $type: "cosmos.feegrant.v1beta1.BasicAllowance" as const, + + encode(message: BasicAllowance, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.spend_limit) { + Coin.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.expiration !== undefined) { + Timestamp.encode(toTimestamp(message.expiration), writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): BasicAllowance { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseBasicAllowance(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.spend_limit.push(Coin.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.expiration = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): BasicAllowance { + return { + spend_limit: globalThis.Array.isArray(object?.spend_limit) ? object.spend_limit.map((e: any) => Coin.fromJSON(e)) : [], + expiration: isSet(object.expiration) ? fromJsonTimestamp(object.expiration) : undefined, + }; + }, + + toJSON(message: BasicAllowance): unknown { + const obj: any = {}; + if (message.spend_limit?.length) { + obj.spend_limit = message.spend_limit.map((e) => Coin.toJSON(e)); + } + if (message.expiration !== undefined) { + obj.expiration = message.expiration.toISOString(); + } + return obj; + }, + + create, I>>(base?: I): BasicAllowance { + return BasicAllowance.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): BasicAllowance { + const message = createBaseBasicAllowance(); + message.spend_limit = object.spend_limit?.map((e) => Coin.fromPartial(e)) || []; + message.expiration = object.expiration ?? undefined; + return message; + }, +}; + +export const PeriodicAllowance: MessageFns = { + $type: "cosmos.feegrant.v1beta1.PeriodicAllowance" as const, + + encode(message: PeriodicAllowance, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.basic !== undefined) { + BasicAllowance.encode(message.basic, writer.uint32(10).fork()).join(); + } + if (message.period !== undefined) { + Duration.encode(message.period, writer.uint32(18).fork()).join(); + } + for (const v of message.period_spend_limit) { + Coin.encode(v!, writer.uint32(26).fork()).join(); + } + for (const v of message.period_can_spend) { + Coin.encode(v!, writer.uint32(34).fork()).join(); + } + if (message.period_reset !== undefined) { + Timestamp.encode(toTimestamp(message.period_reset), writer.uint32(42).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): PeriodicAllowance { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePeriodicAllowance(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.basic = BasicAllowance.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.period = Duration.decode(reader, reader.uint32()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.period_spend_limit.push(Coin.decode(reader, reader.uint32())); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.period_can_spend.push(Coin.decode(reader, reader.uint32())); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.period_reset = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): PeriodicAllowance { + return { + basic: isSet(object.basic) ? BasicAllowance.fromJSON(object.basic) : undefined, + period: isSet(object.period) ? Duration.fromJSON(object.period) : undefined, + period_spend_limit: globalThis.Array.isArray(object?.period_spend_limit) ? object.period_spend_limit.map((e: any) => Coin.fromJSON(e)) : [], + period_can_spend: globalThis.Array.isArray(object?.period_can_spend) ? object.period_can_spend.map((e: any) => Coin.fromJSON(e)) : [], + period_reset: isSet(object.period_reset) ? fromJsonTimestamp(object.period_reset) : undefined, + }; + }, + + toJSON(message: PeriodicAllowance): unknown { + const obj: any = {}; + if (message.basic !== undefined) { + obj.basic = BasicAllowance.toJSON(message.basic); + } + if (message.period !== undefined) { + obj.period = Duration.toJSON(message.period); + } + if (message.period_spend_limit?.length) { + obj.period_spend_limit = message.period_spend_limit.map((e) => Coin.toJSON(e)); + } + if (message.period_can_spend?.length) { + obj.period_can_spend = message.period_can_spend.map((e) => Coin.toJSON(e)); + } + if (message.period_reset !== undefined) { + obj.period_reset = message.period_reset.toISOString(); + } + return obj; + }, + + create, I>>(base?: I): PeriodicAllowance { + return PeriodicAllowance.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): PeriodicAllowance { + const message = createBasePeriodicAllowance(); + message.basic = object.basic !== undefined && object.basic !== null ? BasicAllowance.fromPartial(object.basic) : undefined; + message.period = object.period !== undefined && object.period !== null ? Duration.fromPartial(object.period) : undefined; + message.period_spend_limit = object.period_spend_limit?.map((e) => Coin.fromPartial(e)) || []; + message.period_can_spend = object.period_can_spend?.map((e) => Coin.fromPartial(e)) || []; + message.period_reset = object.period_reset ?? undefined; + return message; + }, +}; + +export const AllowedMsgAllowance: MessageFns = { + $type: "cosmos.feegrant.v1beta1.AllowedMsgAllowance" as const, + + encode(message: AllowedMsgAllowance, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.allowance !== undefined) { + Any.encode(message.allowance, writer.uint32(10).fork()).join(); + } + for (const v of message.allowed_messages) { + writer.uint32(18).string(v!); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): AllowedMsgAllowance { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseAllowedMsgAllowance(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.allowance = Any.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.allowed_messages.push(reader.string()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): AllowedMsgAllowance { + return { + allowance: isSet(object.allowance) ? Any.fromJSON(object.allowance) : undefined, + allowed_messages: globalThis.Array.isArray(object?.allowed_messages) ? object.allowed_messages.map((e: any) => globalThis.String(e)) : [], + }; + }, + + toJSON(message: AllowedMsgAllowance): unknown { + const obj: any = {}; + if (message.allowance !== undefined) { + obj.allowance = Any.toJSON(message.allowance); + } + if (message.allowed_messages?.length) { + obj.allowed_messages = message.allowed_messages; + } + return obj; + }, + + create, I>>(base?: I): AllowedMsgAllowance { + return AllowedMsgAllowance.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): AllowedMsgAllowance { + const message = createBaseAllowedMsgAllowance(); + message.allowance = object.allowance !== undefined && object.allowance !== null ? Any.fromPartial(object.allowance) : undefined; + message.allowed_messages = object.allowed_messages?.map((e) => e) || []; + return message; + }, +}; + +export const Grant: MessageFns = { + $type: "cosmos.feegrant.v1beta1.Grant" as const, + + encode(message: Grant, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.granter !== "") { + writer.uint32(10).string(message.granter); + } + if (message.grantee !== "") { + writer.uint32(18).string(message.grantee); + } + if (message.allowance !== undefined) { + Any.encode(message.allowance, writer.uint32(26).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Grant { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGrant(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.granter = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.grantee = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.allowance = Any.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Grant { + return { + granter: isSet(object.granter) ? globalThis.String(object.granter) : "", + grantee: isSet(object.grantee) ? globalThis.String(object.grantee) : "", + allowance: isSet(object.allowance) ? Any.fromJSON(object.allowance) : undefined, + }; + }, + + toJSON(message: Grant): unknown { + const obj: any = {}; + if (message.granter !== "") { + obj.granter = message.granter; + } + if (message.grantee !== "") { + obj.grantee = message.grantee; + } + if (message.allowance !== undefined) { + obj.allowance = Any.toJSON(message.allowance); + } + return obj; + }, + + create, I>>(base?: I): Grant { + return Grant.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Grant { + const message = createBaseGrant(); + message.granter = object.granter ?? ""; + message.grantee = object.grantee ?? ""; + message.allowance = object.allowance !== undefined && object.allowance !== null ? Any.fromPartial(object.allowance) : undefined; + return message; + }, +}; + +function createBaseBasicAllowance(): BasicAllowance { + return { spend_limit: [], expiration: undefined }; +} + +function createBasePeriodicAllowance(): PeriodicAllowance { + return { basic: undefined, period: undefined, period_spend_limit: [], period_can_spend: [], period_reset: undefined }; +} + +function createBaseAllowedMsgAllowance(): AllowedMsgAllowance { + return { allowance: undefined, allowed_messages: [] }; +} + +function createBaseGrant(): Grant { + return { granter: "", grantee: "", allowance: undefined }; +} + +function toTimestamp(date: Date): Timestamp { + const seconds = Math.trunc(date.getTime() / 1_000); + const nanos = (date.getTime() % 1_000) * 1_000_000; + return { seconds, nanos }; +} + +function fromTimestamp(t: Timestamp): Date { + let millis = (t.seconds || 0) * 1_000; + millis += (t.nanos || 0) / 1_000_000; + return new globalThis.Date(millis); +} + +function fromJsonTimestamp(o: any): Date { + if (o instanceof globalThis.Date) { + return o; + } else if (typeof o === "string") { + return new globalThis.Date(o); + } else { + return fromTimestamp(Timestamp.fromJSON(o)); + } +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} +export const registry: Array<[string, GeneratedType]> = [ + ["/cosmos.feegrant.v1beta1.BasicAllowance", BasicAllowance as never], + ["/cosmos.feegrant.v1beta1.PeriodicAllowance", PeriodicAllowance as never], + ["/cosmos.feegrant.v1beta1.AllowedMsgAllowance", AllowedMsgAllowance as never], + ["/cosmos.feegrant.v1beta1.Grant", Grant as never], +]; +export const aminoConverters = { + "/cosmos.feegrant.v1beta1.BasicAllowance": { + aminoType: "cosmos-sdk/BasicAllowance", + toAmino: (message: BasicAllowance) => ({ ...message }), + fromAmino: (object: BasicAllowance) => ({ ...object }), + }, + + "/cosmos.feegrant.v1beta1.PeriodicAllowance": { + aminoType: "cosmos-sdk/PeriodicAllowance", + toAmino: (message: PeriodicAllowance) => ({ ...message }), + fromAmino: (object: PeriodicAllowance) => ({ ...object }), + }, + + "/cosmos.feegrant.v1beta1.AllowedMsgAllowance": { + aminoType: "cosmos-sdk/AllowedMsgAllowance", + toAmino: (message: AllowedMsgAllowance) => ({ ...message }), + fromAmino: (object: AllowedMsgAllowance) => ({ ...object }), + }, + + "/cosmos.feegrant.v1beta1.Grant": { + aminoType: "cosmos-sdk/Grant", + toAmino: (message: Grant) => ({ ...message }), + fromAmino: (object: Grant) => ({ ...object }), + }, +}; diff --git a/packages/cosmos/generated/encoding/cosmos/feegrant/v1beta1/genesis.ts b/packages/cosmos/generated/encoding/cosmos/feegrant/v1beta1/genesis.ts new file mode 100644 index 000000000..af5f97a79 --- /dev/null +++ b/packages/cosmos/generated/encoding/cosmos/feegrant/v1beta1/genesis.ts @@ -0,0 +1,80 @@ +import type { GeneratedType } from "@cosmjs/proto-signing"; + +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +import { Grant } from "./feegrant"; + +import type { GenesisState as GenesisState_type } from "../../../../types/cosmos/feegrant/v1beta1"; + +import type { DeepPartial, Exact, MessageFns } from "../../../common"; + +export interface GenesisState extends GenesisState_type {} + +export const GenesisState: MessageFns = { + $type: "cosmos.feegrant.v1beta1.GenesisState" as const, + + encode(message: GenesisState, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.allowances) { + Grant.encode(v!, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GenesisState { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGenesisState(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.allowances.push(Grant.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GenesisState { + return { + allowances: globalThis.Array.isArray(object?.allowances) ? object.allowances.map((e: any) => Grant.fromJSON(e)) : [], + }; + }, + + toJSON(message: GenesisState): unknown { + const obj: any = {}; + if (message.allowances?.length) { + obj.allowances = message.allowances.map((e) => Grant.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): GenesisState { + return GenesisState.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): GenesisState { + const message = createBaseGenesisState(); + message.allowances = object.allowances?.map((e) => Grant.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseGenesisState(): GenesisState { + return { allowances: [] }; +} +export const registry: Array<[string, GeneratedType]> = [["/cosmos.feegrant.v1beta1.GenesisState", GenesisState as never]]; +export const aminoConverters = { + "/cosmos.feegrant.v1beta1.GenesisState": { + aminoType: "cosmos-sdk/GenesisState", + toAmino: (message: GenesisState) => ({ ...message }), + fromAmino: (object: GenesisState) => ({ ...object }), + }, +}; diff --git a/packages/cosmos/generated/encoding/cosmos/feegrant/v1beta1/index.ts b/packages/cosmos/generated/encoding/cosmos/feegrant/v1beta1/index.ts new file mode 100644 index 000000000..2c26afaf4 --- /dev/null +++ b/packages/cosmos/generated/encoding/cosmos/feegrant/v1beta1/index.ts @@ -0,0 +1,6 @@ +// @ts-nocheck + +export * from './feegrant'; +export * from './genesis'; +export * from './query'; +export * from './tx'; \ No newline at end of file diff --git a/packages/cosmos/generated/encoding/cosmos/feegrant/v1beta1/query.ts b/packages/cosmos/generated/encoding/cosmos/feegrant/v1beta1/query.ts new file mode 100644 index 000000000..fcb3670a3 --- /dev/null +++ b/packages/cosmos/generated/encoding/cosmos/feegrant/v1beta1/query.ts @@ -0,0 +1,476 @@ +import type { GeneratedType } from "@cosmjs/proto-signing"; + +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +import { PageRequest, PageResponse } from "../../base/query/v1beta1/pagination"; + +import { Grant } from "./feegrant"; + +import type { + QueryAllowanceRequest as QueryAllowanceRequest_type, + QueryAllowanceResponse as QueryAllowanceResponse_type, + QueryAllowancesByGranterRequest as QueryAllowancesByGranterRequest_type, + QueryAllowancesByGranterResponse as QueryAllowancesByGranterResponse_type, + QueryAllowancesRequest as QueryAllowancesRequest_type, + QueryAllowancesResponse as QueryAllowancesResponse_type, +} from "../../../../types/cosmos/feegrant/v1beta1"; + +import type { DeepPartial, Exact, MessageFns } from "../../../common"; + +export interface QueryAllowanceRequest extends QueryAllowanceRequest_type {} +export interface QueryAllowanceResponse extends QueryAllowanceResponse_type {} +export interface QueryAllowancesRequest extends QueryAllowancesRequest_type {} +export interface QueryAllowancesResponse extends QueryAllowancesResponse_type {} +export interface QueryAllowancesByGranterRequest extends QueryAllowancesByGranterRequest_type {} +export interface QueryAllowancesByGranterResponse extends QueryAllowancesByGranterResponse_type {} + +export const QueryAllowanceRequest: MessageFns = { + $type: "cosmos.feegrant.v1beta1.QueryAllowanceRequest" as const, + + encode(message: QueryAllowanceRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.granter !== "") { + writer.uint32(10).string(message.granter); + } + if (message.grantee !== "") { + writer.uint32(18).string(message.grantee); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryAllowanceRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryAllowanceRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.granter = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.grantee = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryAllowanceRequest { + return { + granter: isSet(object.granter) ? globalThis.String(object.granter) : "", + grantee: isSet(object.grantee) ? globalThis.String(object.grantee) : "", + }; + }, + + toJSON(message: QueryAllowanceRequest): unknown { + const obj: any = {}; + if (message.granter !== "") { + obj.granter = message.granter; + } + if (message.grantee !== "") { + obj.grantee = message.grantee; + } + return obj; + }, + + create, I>>(base?: I): QueryAllowanceRequest { + return QueryAllowanceRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryAllowanceRequest { + const message = createBaseQueryAllowanceRequest(); + message.granter = object.granter ?? ""; + message.grantee = object.grantee ?? ""; + return message; + }, +}; + +export const QueryAllowanceResponse: MessageFns = { + $type: "cosmos.feegrant.v1beta1.QueryAllowanceResponse" as const, + + encode(message: QueryAllowanceResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.allowance !== undefined) { + Grant.encode(message.allowance, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryAllowanceResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryAllowanceResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.allowance = Grant.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryAllowanceResponse { + return { allowance: isSet(object.allowance) ? Grant.fromJSON(object.allowance) : undefined }; + }, + + toJSON(message: QueryAllowanceResponse): unknown { + const obj: any = {}; + if (message.allowance !== undefined) { + obj.allowance = Grant.toJSON(message.allowance); + } + return obj; + }, + + create, I>>(base?: I): QueryAllowanceResponse { + return QueryAllowanceResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryAllowanceResponse { + const message = createBaseQueryAllowanceResponse(); + message.allowance = object.allowance !== undefined && object.allowance !== null ? Grant.fromPartial(object.allowance) : undefined; + return message; + }, +}; + +export const QueryAllowancesRequest: MessageFns = { + $type: "cosmos.feegrant.v1beta1.QueryAllowancesRequest" as const, + + encode(message: QueryAllowancesRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.grantee !== "") { + writer.uint32(10).string(message.grantee); + } + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryAllowancesRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryAllowancesRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.grantee = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryAllowancesRequest { + return { + grantee: isSet(object.grantee) ? globalThis.String(object.grantee) : "", + pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryAllowancesRequest): unknown { + const obj: any = {}; + if (message.grantee !== "") { + obj.grantee = message.grantee; + } + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryAllowancesRequest { + return QueryAllowancesRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryAllowancesRequest { + const message = createBaseQueryAllowancesRequest(); + message.grantee = object.grantee ?? ""; + message.pagination = object.pagination !== undefined && object.pagination !== null ? PageRequest.fromPartial(object.pagination) : undefined; + return message; + }, +}; + +export const QueryAllowancesResponse: MessageFns = { + $type: "cosmos.feegrant.v1beta1.QueryAllowancesResponse" as const, + + encode(message: QueryAllowancesResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.allowances) { + Grant.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryAllowancesResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryAllowancesResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.allowances.push(Grant.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryAllowancesResponse { + return { + allowances: globalThis.Array.isArray(object?.allowances) ? object.allowances.map((e: any) => Grant.fromJSON(e)) : [], + pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryAllowancesResponse): unknown { + const obj: any = {}; + if (message.allowances?.length) { + obj.allowances = message.allowances.map((e) => Grant.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryAllowancesResponse { + return QueryAllowancesResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryAllowancesResponse { + const message = createBaseQueryAllowancesResponse(); + message.allowances = object.allowances?.map((e) => Grant.fromPartial(e)) || []; + message.pagination = object.pagination !== undefined && object.pagination !== null ? PageResponse.fromPartial(object.pagination) : undefined; + return message; + }, +}; + +export const QueryAllowancesByGranterRequest: MessageFns = { + $type: "cosmos.feegrant.v1beta1.QueryAllowancesByGranterRequest" as const, + + encode(message: QueryAllowancesByGranterRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.granter !== "") { + writer.uint32(10).string(message.granter); + } + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryAllowancesByGranterRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryAllowancesByGranterRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.granter = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryAllowancesByGranterRequest { + return { + granter: isSet(object.granter) ? globalThis.String(object.granter) : "", + pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryAllowancesByGranterRequest): unknown { + const obj: any = {}; + if (message.granter !== "") { + obj.granter = message.granter; + } + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryAllowancesByGranterRequest { + return QueryAllowancesByGranterRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryAllowancesByGranterRequest { + const message = createBaseQueryAllowancesByGranterRequest(); + message.granter = object.granter ?? ""; + message.pagination = object.pagination !== undefined && object.pagination !== null ? PageRequest.fromPartial(object.pagination) : undefined; + return message; + }, +}; + +export const QueryAllowancesByGranterResponse: MessageFns = { + $type: "cosmos.feegrant.v1beta1.QueryAllowancesByGranterResponse" as const, + + encode(message: QueryAllowancesByGranterResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.allowances) { + Grant.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryAllowancesByGranterResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryAllowancesByGranterResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.allowances.push(Grant.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryAllowancesByGranterResponse { + return { + allowances: globalThis.Array.isArray(object?.allowances) ? object.allowances.map((e: any) => Grant.fromJSON(e)) : [], + pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryAllowancesByGranterResponse): unknown { + const obj: any = {}; + if (message.allowances?.length) { + obj.allowances = message.allowances.map((e) => Grant.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryAllowancesByGranterResponse { + return QueryAllowancesByGranterResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryAllowancesByGranterResponse { + const message = createBaseQueryAllowancesByGranterResponse(); + message.allowances = object.allowances?.map((e) => Grant.fromPartial(e)) || []; + message.pagination = object.pagination !== undefined && object.pagination !== null ? PageResponse.fromPartial(object.pagination) : undefined; + return message; + }, +}; + +function createBaseQueryAllowanceRequest(): QueryAllowanceRequest { + return { granter: "", grantee: "" }; +} + +function createBaseQueryAllowanceResponse(): QueryAllowanceResponse { + return { allowance: undefined }; +} + +function createBaseQueryAllowancesRequest(): QueryAllowancesRequest { + return { grantee: "", pagination: undefined }; +} + +function createBaseQueryAllowancesResponse(): QueryAllowancesResponse { + return { allowances: [], pagination: undefined }; +} + +function createBaseQueryAllowancesByGranterRequest(): QueryAllowancesByGranterRequest { + return { granter: "", pagination: undefined }; +} + +function createBaseQueryAllowancesByGranterResponse(): QueryAllowancesByGranterResponse { + return { allowances: [], pagination: undefined }; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} +export const registry: Array<[string, GeneratedType]> = [["/cosmos.feegrant.v1beta1.QueryAllowanceRequest", QueryAllowanceRequest as never]]; +export const aminoConverters = { + "/cosmos.feegrant.v1beta1.QueryAllowanceRequest": { + aminoType: "cosmos-sdk/QueryAllowanceRequest", + toAmino: (message: QueryAllowanceRequest) => ({ ...message }), + fromAmino: (object: QueryAllowanceRequest) => ({ ...object }), + }, +}; diff --git a/packages/cosmos/generated/encoding/cosmos/feegrant/v1beta1/tx.ts b/packages/cosmos/generated/encoding/cosmos/feegrant/v1beta1/tx.ts new file mode 100644 index 000000000..b48a26eed --- /dev/null +++ b/packages/cosmos/generated/encoding/cosmos/feegrant/v1beta1/tx.ts @@ -0,0 +1,297 @@ +import type { GeneratedType } from "@cosmjs/proto-signing"; + +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +import { Any } from "../../../google/protobuf/any"; + +import type { + MsgGrantAllowanceResponse as MsgGrantAllowanceResponse_type, + MsgGrantAllowance as MsgGrantAllowance_type, + MsgRevokeAllowanceResponse as MsgRevokeAllowanceResponse_type, + MsgRevokeAllowance as MsgRevokeAllowance_type, +} from "../../../../types/cosmos/feegrant/v1beta1"; + +import type { DeepPartial, Exact, MessageFns } from "../../../common"; + +export interface MsgGrantAllowance extends MsgGrantAllowance_type {} +export interface MsgGrantAllowanceResponse extends MsgGrantAllowanceResponse_type {} +export interface MsgRevokeAllowance extends MsgRevokeAllowance_type {} +export interface MsgRevokeAllowanceResponse extends MsgRevokeAllowanceResponse_type {} + +export const MsgGrantAllowance: MessageFns = { + $type: "cosmos.feegrant.v1beta1.MsgGrantAllowance" as const, + + encode(message: MsgGrantAllowance, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.granter !== "") { + writer.uint32(10).string(message.granter); + } + if (message.grantee !== "") { + writer.uint32(18).string(message.grantee); + } + if (message.allowance !== undefined) { + Any.encode(message.allowance, writer.uint32(26).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgGrantAllowance { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgGrantAllowance(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.granter = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.grantee = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.allowance = Any.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgGrantAllowance { + return { + granter: isSet(object.granter) ? globalThis.String(object.granter) : "", + grantee: isSet(object.grantee) ? globalThis.String(object.grantee) : "", + allowance: isSet(object.allowance) ? Any.fromJSON(object.allowance) : undefined, + }; + }, + + toJSON(message: MsgGrantAllowance): unknown { + const obj: any = {}; + if (message.granter !== "") { + obj.granter = message.granter; + } + if (message.grantee !== "") { + obj.grantee = message.grantee; + } + if (message.allowance !== undefined) { + obj.allowance = Any.toJSON(message.allowance); + } + return obj; + }, + + create, I>>(base?: I): MsgGrantAllowance { + return MsgGrantAllowance.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgGrantAllowance { + const message = createBaseMsgGrantAllowance(); + message.granter = object.granter ?? ""; + message.grantee = object.grantee ?? ""; + message.allowance = object.allowance !== undefined && object.allowance !== null ? Any.fromPartial(object.allowance) : undefined; + return message; + }, +}; + +export const MsgGrantAllowanceResponse: MessageFns = { + $type: "cosmos.feegrant.v1beta1.MsgGrantAllowanceResponse" as const, + + encode(_: MsgGrantAllowanceResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgGrantAllowanceResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgGrantAllowanceResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgGrantAllowanceResponse { + return {}; + }, + + toJSON(_: MsgGrantAllowanceResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgGrantAllowanceResponse { + return MsgGrantAllowanceResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgGrantAllowanceResponse { + const message = createBaseMsgGrantAllowanceResponse(); + return message; + }, +}; + +export const MsgRevokeAllowance: MessageFns = { + $type: "cosmos.feegrant.v1beta1.MsgRevokeAllowance" as const, + + encode(message: MsgRevokeAllowance, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.granter !== "") { + writer.uint32(10).string(message.granter); + } + if (message.grantee !== "") { + writer.uint32(18).string(message.grantee); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgRevokeAllowance { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgRevokeAllowance(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.granter = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.grantee = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgRevokeAllowance { + return { + granter: isSet(object.granter) ? globalThis.String(object.granter) : "", + grantee: isSet(object.grantee) ? globalThis.String(object.grantee) : "", + }; + }, + + toJSON(message: MsgRevokeAllowance): unknown { + const obj: any = {}; + if (message.granter !== "") { + obj.granter = message.granter; + } + if (message.grantee !== "") { + obj.grantee = message.grantee; + } + return obj; + }, + + create, I>>(base?: I): MsgRevokeAllowance { + return MsgRevokeAllowance.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgRevokeAllowance { + const message = createBaseMsgRevokeAllowance(); + message.granter = object.granter ?? ""; + message.grantee = object.grantee ?? ""; + return message; + }, +}; + +export const MsgRevokeAllowanceResponse: MessageFns = { + $type: "cosmos.feegrant.v1beta1.MsgRevokeAllowanceResponse" as const, + + encode(_: MsgRevokeAllowanceResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgRevokeAllowanceResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgRevokeAllowanceResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgRevokeAllowanceResponse { + return {}; + }, + + toJSON(_: MsgRevokeAllowanceResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgRevokeAllowanceResponse { + return MsgRevokeAllowanceResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgRevokeAllowanceResponse { + const message = createBaseMsgRevokeAllowanceResponse(); + return message; + }, +}; + +function createBaseMsgGrantAllowance(): MsgGrantAllowance { + return { granter: "", grantee: "", allowance: undefined }; +} + +function createBaseMsgGrantAllowanceResponse(): MsgGrantAllowanceResponse { + return {}; +} + +function createBaseMsgRevokeAllowance(): MsgRevokeAllowance { + return { granter: "", grantee: "" }; +} + +function createBaseMsgRevokeAllowanceResponse(): MsgRevokeAllowanceResponse { + return {}; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} +export const registry: Array<[string, GeneratedType]> = [ + ["/cosmos.feegrant.v1beta1.MsgGrantAllowance", MsgGrantAllowance as never], + ["/cosmos.feegrant.v1beta1.MsgRevokeAllowance", MsgRevokeAllowance as never], +]; +export const aminoConverters = { + "/cosmos.feegrant.v1beta1.MsgGrantAllowance": { + aminoType: "cosmos-sdk/MsgGrantAllowance", + toAmino: (message: MsgGrantAllowance) => ({ ...message }), + fromAmino: (object: MsgGrantAllowance) => ({ ...object }), + }, + + "/cosmos.feegrant.v1beta1.MsgRevokeAllowance": { + aminoType: "cosmos-sdk/MsgRevokeAllowance", + toAmino: (message: MsgRevokeAllowance) => ({ ...message }), + fromAmino: (object: MsgRevokeAllowance) => ({ ...object }), + }, +}; diff --git a/packages/cosmos/generated/encoding/cosmos/genutil/v1beta1/genesis.ts b/packages/cosmos/generated/encoding/cosmos/genutil/v1beta1/genesis.ts new file mode 100644 index 000000000..265cb382f --- /dev/null +++ b/packages/cosmos/generated/encoding/cosmos/genutil/v1beta1/genesis.ts @@ -0,0 +1,103 @@ +import type { GeneratedType } from "@cosmjs/proto-signing"; + +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +import type { GenesisState as GenesisState_type } from "../../../../types/cosmos/genutil/v1beta1"; + +import type { DeepPartial, Exact, MessageFns } from "../../../common"; + +export interface GenesisState extends GenesisState_type {} + +export const GenesisState: MessageFns = { + $type: "cosmos.genutil.v1beta1.GenesisState" as const, + + encode(message: GenesisState, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.gen_txs) { + writer.uint32(10).bytes(v!); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GenesisState { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGenesisState(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.gen_txs.push(reader.bytes()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GenesisState { + return { + gen_txs: globalThis.Array.isArray(object?.gen_txs) ? object.gen_txs.map((e: any) => bytesFromBase64(e)) : [], + }; + }, + + toJSON(message: GenesisState): unknown { + const obj: any = {}; + if (message.gen_txs?.length) { + obj.gen_txs = message.gen_txs.map((e) => base64FromBytes(e)); + } + return obj; + }, + + create, I>>(base?: I): GenesisState { + return GenesisState.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): GenesisState { + const message = createBaseGenesisState(); + message.gen_txs = object.gen_txs?.map((e) => e) || []; + return message; + }, +}; + +function createBaseGenesisState(): GenesisState { + return { gen_txs: [] }; +} + +function bytesFromBase64(b64: string): Uint8Array { + if ((globalThis as any).Buffer) { + return Uint8Array.from(globalThis.Buffer.from(b64, "base64")); + } else { + const bin = globalThis.atob(b64); + const arr = new Uint8Array(bin.length); + for (let i = 0; i < bin.length; ++i) { + arr[i] = bin.charCodeAt(i); + } + return arr; + } +} + +function base64FromBytes(arr: Uint8Array): string { + if ((globalThis as any).Buffer) { + return globalThis.Buffer.from(arr).toString("base64"); + } else { + const bin: string[] = []; + arr.forEach((byte) => { + bin.push(globalThis.String.fromCharCode(byte)); + }); + return globalThis.btoa(bin.join("")); + } +} +export const registry: Array<[string, GeneratedType]> = [["/cosmos.genutil.v1beta1.GenesisState", GenesisState as never]]; +export const aminoConverters = { + "/cosmos.genutil.v1beta1.GenesisState": { + aminoType: "cosmos-sdk/GenesisState", + toAmino: (message: GenesisState) => ({ ...message }), + fromAmino: (object: GenesisState) => ({ ...object }), + }, +}; diff --git a/packages/cosmos/generated/encoding/cosmos/genutil/v1beta1/index.ts b/packages/cosmos/generated/encoding/cosmos/genutil/v1beta1/index.ts new file mode 100644 index 000000000..1659c80ed --- /dev/null +++ b/packages/cosmos/generated/encoding/cosmos/genutil/v1beta1/index.ts @@ -0,0 +1,3 @@ +// @ts-nocheck + +export * from './genesis'; \ No newline at end of file diff --git a/packages/cosmos/generated/encoding/cosmos/gov/v1beta1/genesis.ts b/packages/cosmos/generated/encoding/cosmos/gov/v1beta1/genesis.ts new file mode 100644 index 000000000..cb59b3be1 --- /dev/null +++ b/packages/cosmos/generated/encoding/cosmos/gov/v1beta1/genesis.ts @@ -0,0 +1,194 @@ +import type { GeneratedType } from "@cosmjs/proto-signing"; + +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +import { Deposit, DepositParams, Proposal, TallyParams, Vote, VotingParams } from "./gov"; + +import type { GenesisState as GenesisState_type } from "../../../../types/cosmos/gov/v1beta1"; + +import type { DeepPartial, Exact, MessageFns } from "../../../common"; + +export interface GenesisState extends GenesisState_type {} + +export const GenesisState: MessageFns = { + $type: "cosmos.gov.v1beta1.GenesisState" as const, + + encode(message: GenesisState, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.starting_proposal_id !== 0) { + writer.uint32(8).uint64(message.starting_proposal_id); + } + for (const v of message.deposits) { + Deposit.encode(v!, writer.uint32(18).fork()).join(); + } + for (const v of message.votes) { + Vote.encode(v!, writer.uint32(26).fork()).join(); + } + for (const v of message.proposals) { + Proposal.encode(v!, writer.uint32(34).fork()).join(); + } + if (message.deposit_params !== undefined) { + DepositParams.encode(message.deposit_params, writer.uint32(42).fork()).join(); + } + if (message.voting_params !== undefined) { + VotingParams.encode(message.voting_params, writer.uint32(50).fork()).join(); + } + if (message.tally_params !== undefined) { + TallyParams.encode(message.tally_params, writer.uint32(58).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GenesisState { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGenesisState(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.starting_proposal_id = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.deposits.push(Deposit.decode(reader, reader.uint32())); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.votes.push(Vote.decode(reader, reader.uint32())); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.proposals.push(Proposal.decode(reader, reader.uint32())); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.deposit_params = DepositParams.decode(reader, reader.uint32()); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.voting_params = VotingParams.decode(reader, reader.uint32()); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.tally_params = TallyParams.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GenesisState { + return { + starting_proposal_id: isSet(object.starting_proposal_id) ? globalThis.Number(object.starting_proposal_id) : 0, + deposits: globalThis.Array.isArray(object?.deposits) ? object.deposits.map((e: any) => Deposit.fromJSON(e)) : [], + votes: globalThis.Array.isArray(object?.votes) ? object.votes.map((e: any) => Vote.fromJSON(e)) : [], + proposals: globalThis.Array.isArray(object?.proposals) ? object.proposals.map((e: any) => Proposal.fromJSON(e)) : [], + deposit_params: isSet(object.deposit_params) ? DepositParams.fromJSON(object.deposit_params) : undefined, + voting_params: isSet(object.voting_params) ? VotingParams.fromJSON(object.voting_params) : undefined, + tally_params: isSet(object.tally_params) ? TallyParams.fromJSON(object.tally_params) : undefined, + }; + }, + + toJSON(message: GenesisState): unknown { + const obj: any = {}; + if (message.starting_proposal_id !== 0) { + obj.starting_proposal_id = Math.round(message.starting_proposal_id); + } + if (message.deposits?.length) { + obj.deposits = message.deposits.map((e) => Deposit.toJSON(e)); + } + if (message.votes?.length) { + obj.votes = message.votes.map((e) => Vote.toJSON(e)); + } + if (message.proposals?.length) { + obj.proposals = message.proposals.map((e) => Proposal.toJSON(e)); + } + if (message.deposit_params !== undefined) { + obj.deposit_params = DepositParams.toJSON(message.deposit_params); + } + if (message.voting_params !== undefined) { + obj.voting_params = VotingParams.toJSON(message.voting_params); + } + if (message.tally_params !== undefined) { + obj.tally_params = TallyParams.toJSON(message.tally_params); + } + return obj; + }, + + create, I>>(base?: I): GenesisState { + return GenesisState.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): GenesisState { + const message = createBaseGenesisState(); + message.starting_proposal_id = object.starting_proposal_id ?? 0; + 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.deposit_params = + object.deposit_params !== undefined && object.deposit_params !== null ? DepositParams.fromPartial(object.deposit_params) : undefined; + message.voting_params = object.voting_params !== undefined && object.voting_params !== null ? VotingParams.fromPartial(object.voting_params) : undefined; + message.tally_params = object.tally_params !== undefined && object.tally_params !== null ? TallyParams.fromPartial(object.tally_params) : undefined; + return message; + }, +}; + +function createBaseGenesisState(): GenesisState { + return { + starting_proposal_id: 0, + deposits: [], + votes: [], + proposals: [], + deposit_params: undefined, + voting_params: undefined, + tally_params: undefined, + }; +} + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} +export const registry: Array<[string, GeneratedType]> = [["/cosmos.gov.v1beta1.GenesisState", GenesisState as never]]; +export const aminoConverters = { + "/cosmos.gov.v1beta1.GenesisState": { + aminoType: "cosmos-sdk/GenesisState", + toAmino: (message: GenesisState) => ({ ...message }), + fromAmino: (object: GenesisState) => ({ ...object }), + }, +}; diff --git a/packages/cosmos/generated/encoding/cosmos/gov/v1beta1/gov.ts b/packages/cosmos/generated/encoding/cosmos/gov/v1beta1/gov.ts new file mode 100644 index 000000000..a3184ac2e --- /dev/null +++ b/packages/cosmos/generated/encoding/cosmos/gov/v1beta1/gov.ts @@ -0,0 +1,1230 @@ +import type { GeneratedType } from "@cosmjs/proto-signing"; + +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +import { Any } from "../../../google/protobuf/any"; + +import { Duration } from "../../../google/protobuf/duration"; + +import { Timestamp } from "../../../google/protobuf/timestamp"; + +import { Coin } from "../../base/v1beta1/coin"; + +import type { + DepositParams as DepositParams_type, + Deposit as Deposit_type, + Proposal as Proposal_type, + TallyParams as TallyParams_type, + TallyResult as TallyResult_type, + TextProposal as TextProposal_type, + Vote as Vote_type, + VotingParams as VotingParams_type, + WeightedVoteOption as WeightedVoteOption_type, +} from "../../../../types/cosmos/gov/v1beta1"; + +import { ProposalStatus, VoteOption } from "../../../../types/cosmos/gov/v1beta1"; + +import type { DeepPartial, Exact, MessageFns } from "../../../common"; + +export interface WeightedVoteOption extends WeightedVoteOption_type {} +export interface TextProposal extends TextProposal_type {} +export interface Deposit extends Deposit_type {} +export interface Proposal extends Proposal_type {} +export interface TallyResult extends TallyResult_type {} +export interface Vote extends Vote_type {} +export interface DepositParams extends DepositParams_type {} +export interface VotingParams extends VotingParams_type {} +export interface TallyParams extends TallyParams_type {} + +export const WeightedVoteOption: MessageFns = { + $type: "cosmos.gov.v1beta1.WeightedVoteOption" as const, + + encode(message: WeightedVoteOption, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.option !== 0) { + writer.uint32(8).int32(message.option); + } + if (message.weight !== "") { + writer.uint32(18).string(message.weight); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): WeightedVoteOption { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseWeightedVoteOption(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.option = reader.int32() as any; + continue; + case 2: + if (tag !== 18) { + break; + } + + message.weight = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): WeightedVoteOption { + return { + option: isSet(object.option) ? voteOptionFromJSON(object.option) : 0, + weight: isSet(object.weight) ? globalThis.String(object.weight) : "", + }; + }, + + toJSON(message: WeightedVoteOption): unknown { + const obj: any = {}; + if (message.option !== 0) { + obj.option = voteOptionToJSON(message.option); + } + if (message.weight !== "") { + obj.weight = message.weight; + } + return obj; + }, + + create, I>>(base?: I): WeightedVoteOption { + return WeightedVoteOption.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): WeightedVoteOption { + const message = createBaseWeightedVoteOption(); + message.option = object.option ?? 0; + message.weight = object.weight ?? ""; + return message; + }, +}; + +export const TextProposal: MessageFns = { + $type: "cosmos.gov.v1beta1.TextProposal" as const, + + encode(message: TextProposal, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.title !== "") { + writer.uint32(10).string(message.title); + } + if (message.description !== "") { + writer.uint32(18).string(message.description); + } + if (message.is_expedited !== false) { + writer.uint32(24).bool(message.is_expedited); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): TextProposal { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseTextProposal(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.title = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.description = reader.string(); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.is_expedited = reader.bool(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): TextProposal { + return { + title: isSet(object.title) ? globalThis.String(object.title) : "", + description: isSet(object.description) ? globalThis.String(object.description) : "", + is_expedited: isSet(object.is_expedited) ? globalThis.Boolean(object.is_expedited) : false, + }; + }, + + toJSON(message: TextProposal): unknown { + const obj: any = {}; + if (message.title !== "") { + obj.title = message.title; + } + if (message.description !== "") { + obj.description = message.description; + } + if (message.is_expedited !== false) { + obj.is_expedited = message.is_expedited; + } + return obj; + }, + + create, I>>(base?: I): TextProposal { + return TextProposal.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): TextProposal { + const message = createBaseTextProposal(); + message.title = object.title ?? ""; + message.description = object.description ?? ""; + message.is_expedited = object.is_expedited ?? false; + return message; + }, +}; + +export const Deposit: MessageFns = { + $type: "cosmos.gov.v1beta1.Deposit" as const, + + encode(message: Deposit, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.proposal_id !== 0) { + writer.uint32(8).uint64(message.proposal_id); + } + if (message.depositor !== "") { + writer.uint32(18).string(message.depositor); + } + for (const v of message.amount) { + Coin.encode(v!, writer.uint32(26).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Deposit { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDeposit(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.proposal_id = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.depositor = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.amount.push(Coin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Deposit { + return { + proposal_id: isSet(object.proposal_id) ? globalThis.Number(object.proposal_id) : 0, + depositor: isSet(object.depositor) ? globalThis.String(object.depositor) : "", + amount: globalThis.Array.isArray(object?.amount) ? object.amount.map((e: any) => Coin.fromJSON(e)) : [], + }; + }, + + toJSON(message: Deposit): unknown { + const obj: any = {}; + if (message.proposal_id !== 0) { + obj.proposal_id = Math.round(message.proposal_id); + } + if (message.depositor !== "") { + obj.depositor = message.depositor; + } + if (message.amount?.length) { + obj.amount = message.amount.map((e) => Coin.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): Deposit { + return Deposit.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Deposit { + const message = createBaseDeposit(); + message.proposal_id = object.proposal_id ?? 0; + message.depositor = object.depositor ?? ""; + message.amount = object.amount?.map((e) => Coin.fromPartial(e)) || []; + return message; + }, +}; + +export const Proposal: MessageFns = { + $type: "cosmos.gov.v1beta1.Proposal" as const, + + encode(message: Proposal, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.proposal_id !== 0) { + writer.uint32(8).uint64(message.proposal_id); + } + if (message.content !== undefined) { + Any.encode(message.content, writer.uint32(18).fork()).join(); + } + if (message.status !== 0) { + writer.uint32(24).int32(message.status); + } + if (message.final_tally_result !== undefined) { + TallyResult.encode(message.final_tally_result, writer.uint32(34).fork()).join(); + } + if (message.submit_time !== undefined) { + Timestamp.encode(toTimestamp(message.submit_time), writer.uint32(42).fork()).join(); + } + if (message.deposit_end_time !== undefined) { + Timestamp.encode(toTimestamp(message.deposit_end_time), writer.uint32(50).fork()).join(); + } + for (const v of message.total_deposit) { + Coin.encode(v!, writer.uint32(58).fork()).join(); + } + if (message.voting_start_time !== undefined) { + Timestamp.encode(toTimestamp(message.voting_start_time), writer.uint32(66).fork()).join(); + } + if (message.voting_end_time !== undefined) { + Timestamp.encode(toTimestamp(message.voting_end_time), writer.uint32(74).fork()).join(); + } + if (message.is_expedited !== false) { + writer.uint32(80).bool(message.is_expedited); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Proposal { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseProposal(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.proposal_id = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.content = Any.decode(reader, reader.uint32()); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.status = reader.int32() as any; + continue; + case 4: + if (tag !== 34) { + break; + } + + message.final_tally_result = TallyResult.decode(reader, reader.uint32()); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.submit_time = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.deposit_end_time = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.total_deposit.push(Coin.decode(reader, reader.uint32())); + continue; + case 8: + if (tag !== 66) { + break; + } + + message.voting_start_time = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + continue; + case 9: + if (tag !== 74) { + break; + } + + message.voting_end_time = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + continue; + case 10: + if (tag !== 80) { + break; + } + + message.is_expedited = reader.bool(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Proposal { + return { + proposal_id: isSet(object.proposal_id) ? globalThis.Number(object.proposal_id) : 0, + content: isSet(object.content) ? Any.fromJSON(object.content) : undefined, + status: isSet(object.status) ? proposalStatusFromJSON(object.status) : 0, + final_tally_result: isSet(object.final_tally_result) ? TallyResult.fromJSON(object.final_tally_result) : undefined, + submit_time: isSet(object.submit_time) ? fromJsonTimestamp(object.submit_time) : undefined, + deposit_end_time: isSet(object.deposit_end_time) ? fromJsonTimestamp(object.deposit_end_time) : undefined, + total_deposit: globalThis.Array.isArray(object?.total_deposit) ? object.total_deposit.map((e: any) => Coin.fromJSON(e)) : [], + voting_start_time: isSet(object.voting_start_time) ? fromJsonTimestamp(object.voting_start_time) : undefined, + voting_end_time: isSet(object.voting_end_time) ? fromJsonTimestamp(object.voting_end_time) : undefined, + is_expedited: isSet(object.is_expedited) ? globalThis.Boolean(object.is_expedited) : false, + }; + }, + + toJSON(message: Proposal): unknown { + const obj: any = {}; + if (message.proposal_id !== 0) { + obj.proposal_id = Math.round(message.proposal_id); + } + if (message.content !== undefined) { + obj.content = Any.toJSON(message.content); + } + if (message.status !== 0) { + obj.status = proposalStatusToJSON(message.status); + } + if (message.final_tally_result !== undefined) { + obj.final_tally_result = TallyResult.toJSON(message.final_tally_result); + } + if (message.submit_time !== undefined) { + obj.submit_time = message.submit_time.toISOString(); + } + if (message.deposit_end_time !== undefined) { + obj.deposit_end_time = message.deposit_end_time.toISOString(); + } + if (message.total_deposit?.length) { + obj.total_deposit = message.total_deposit.map((e) => Coin.toJSON(e)); + } + if (message.voting_start_time !== undefined) { + obj.voting_start_time = message.voting_start_time.toISOString(); + } + if (message.voting_end_time !== undefined) { + obj.voting_end_time = message.voting_end_time.toISOString(); + } + if (message.is_expedited !== false) { + obj.is_expedited = message.is_expedited; + } + return obj; + }, + + create, I>>(base?: I): Proposal { + return Proposal.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Proposal { + const message = createBaseProposal(); + message.proposal_id = object.proposal_id ?? 0; + message.content = object.content !== undefined && object.content !== null ? Any.fromPartial(object.content) : undefined; + message.status = object.status ?? 0; + message.final_tally_result = + object.final_tally_result !== undefined && object.final_tally_result !== null ? TallyResult.fromPartial(object.final_tally_result) : undefined; + message.submit_time = object.submit_time ?? undefined; + message.deposit_end_time = object.deposit_end_time ?? undefined; + message.total_deposit = object.total_deposit?.map((e) => Coin.fromPartial(e)) || []; + message.voting_start_time = object.voting_start_time ?? undefined; + message.voting_end_time = object.voting_end_time ?? undefined; + message.is_expedited = object.is_expedited ?? false; + return message; + }, +}; + +export const TallyResult: MessageFns = { + $type: "cosmos.gov.v1beta1.TallyResult" as const, + + encode(message: TallyResult, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + 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.no_with_veto !== "") { + writer.uint32(34).string(message.no_with_veto); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): TallyResult { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseTallyResult(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.yes = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.abstain = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.no = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.no_with_veto = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): TallyResult { + return { + yes: isSet(object.yes) ? globalThis.String(object.yes) : "", + abstain: isSet(object.abstain) ? globalThis.String(object.abstain) : "", + no: isSet(object.no) ? globalThis.String(object.no) : "", + no_with_veto: isSet(object.no_with_veto) ? globalThis.String(object.no_with_veto) : "", + }; + }, + + toJSON(message: TallyResult): unknown { + const obj: any = {}; + if (message.yes !== "") { + obj.yes = message.yes; + } + if (message.abstain !== "") { + obj.abstain = message.abstain; + } + if (message.no !== "") { + obj.no = message.no; + } + if (message.no_with_veto !== "") { + obj.no_with_veto = message.no_with_veto; + } + return obj; + }, + + create, I>>(base?: I): TallyResult { + return TallyResult.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): TallyResult { + const message = createBaseTallyResult(); + message.yes = object.yes ?? ""; + message.abstain = object.abstain ?? ""; + message.no = object.no ?? ""; + message.no_with_veto = object.no_with_veto ?? ""; + return message; + }, +}; + +export const Vote: MessageFns = { + $type: "cosmos.gov.v1beta1.Vote" as const, + + encode(message: Vote, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.proposal_id !== 0) { + writer.uint32(8).uint64(message.proposal_id); + } + 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()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Vote { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseVote(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.proposal_id = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.voter = reader.string(); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.option = reader.int32() as any; + continue; + case 4: + if (tag !== 34) { + break; + } + + message.options.push(WeightedVoteOption.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Vote { + return { + proposal_id: isSet(object.proposal_id) ? globalThis.Number(object.proposal_id) : 0, + voter: isSet(object.voter) ? globalThis.String(object.voter) : "", + option: isSet(object.option) ? voteOptionFromJSON(object.option) : 0, + options: globalThis.Array.isArray(object?.options) ? object.options.map((e: any) => WeightedVoteOption.fromJSON(e)) : [], + }; + }, + + toJSON(message: Vote): unknown { + const obj: any = {}; + if (message.proposal_id !== 0) { + obj.proposal_id = Math.round(message.proposal_id); + } + if (message.voter !== "") { + obj.voter = message.voter; + } + if (message.option !== 0) { + obj.option = voteOptionToJSON(message.option); + } + if (message.options?.length) { + obj.options = message.options.map((e) => WeightedVoteOption.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): Vote { + return Vote.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Vote { + const message = createBaseVote(); + message.proposal_id = object.proposal_id ?? 0; + message.voter = object.voter ?? ""; + message.option = object.option ?? 0; + message.options = object.options?.map((e) => WeightedVoteOption.fromPartial(e)) || []; + return message; + }, +}; + +export const DepositParams: MessageFns = { + $type: "cosmos.gov.v1beta1.DepositParams" as const, + + encode(message: DepositParams, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.min_deposit) { + Coin.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.max_deposit_period !== undefined) { + Duration.encode(message.max_deposit_period, writer.uint32(18).fork()).join(); + } + for (const v of message.min_expedited_deposit) { + Coin.encode(v!, writer.uint32(26).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): DepositParams { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDepositParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.min_deposit.push(Coin.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.max_deposit_period = Duration.decode(reader, reader.uint32()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.min_expedited_deposit.push(Coin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): DepositParams { + return { + min_deposit: globalThis.Array.isArray(object?.min_deposit) ? object.min_deposit.map((e: any) => Coin.fromJSON(e)) : [], + max_deposit_period: isSet(object.max_deposit_period) ? Duration.fromJSON(object.max_deposit_period) : undefined, + min_expedited_deposit: globalThis.Array.isArray(object?.min_expedited_deposit) ? object.min_expedited_deposit.map((e: any) => Coin.fromJSON(e)) : [], + }; + }, + + toJSON(message: DepositParams): unknown { + const obj: any = {}; + if (message.min_deposit?.length) { + obj.min_deposit = message.min_deposit.map((e) => Coin.toJSON(e)); + } + if (message.max_deposit_period !== undefined) { + obj.max_deposit_period = Duration.toJSON(message.max_deposit_period); + } + if (message.min_expedited_deposit?.length) { + obj.min_expedited_deposit = message.min_expedited_deposit.map((e) => Coin.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): DepositParams { + return DepositParams.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): DepositParams { + const message = createBaseDepositParams(); + message.min_deposit = object.min_deposit?.map((e) => Coin.fromPartial(e)) || []; + message.max_deposit_period = + object.max_deposit_period !== undefined && object.max_deposit_period !== null ? Duration.fromPartial(object.max_deposit_period) : undefined; + message.min_expedited_deposit = object.min_expedited_deposit?.map((e) => Coin.fromPartial(e)) || []; + return message; + }, +}; + +export const VotingParams: MessageFns = { + $type: "cosmos.gov.v1beta1.VotingParams" as const, + + encode(message: VotingParams, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.voting_period !== undefined) { + Duration.encode(message.voting_period, writer.uint32(10).fork()).join(); + } + if (message.expedited_voting_period !== undefined) { + Duration.encode(message.expedited_voting_period, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): VotingParams { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseVotingParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.voting_period = Duration.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.expedited_voting_period = Duration.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): VotingParams { + return { + voting_period: isSet(object.voting_period) ? Duration.fromJSON(object.voting_period) : undefined, + expedited_voting_period: isSet(object.expedited_voting_period) ? Duration.fromJSON(object.expedited_voting_period) : undefined, + }; + }, + + toJSON(message: VotingParams): unknown { + const obj: any = {}; + if (message.voting_period !== undefined) { + obj.voting_period = Duration.toJSON(message.voting_period); + } + if (message.expedited_voting_period !== undefined) { + obj.expedited_voting_period = Duration.toJSON(message.expedited_voting_period); + } + return obj; + }, + + create, I>>(base?: I): VotingParams { + return VotingParams.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): VotingParams { + const message = createBaseVotingParams(); + message.voting_period = object.voting_period !== undefined && object.voting_period !== null ? Duration.fromPartial(object.voting_period) : undefined; + message.expedited_voting_period = + object.expedited_voting_period !== undefined && object.expedited_voting_period !== null + ? Duration.fromPartial(object.expedited_voting_period) + : undefined; + return message; + }, +}; + +export const TallyParams: MessageFns = { + $type: "cosmos.gov.v1beta1.TallyParams" as const, + + encode(message: TallyParams, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.quorum.length !== 0) { + writer.uint32(10).bytes(message.quorum); + } + if (message.threshold.length !== 0) { + writer.uint32(18).bytes(message.threshold); + } + if (message.veto_threshold.length !== 0) { + writer.uint32(26).bytes(message.veto_threshold); + } + if (message.expedited_quorum.length !== 0) { + writer.uint32(34).bytes(message.expedited_quorum); + } + if (message.expedited_threshold.length !== 0) { + writer.uint32(42).bytes(message.expedited_threshold); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): TallyParams { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseTallyParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.quorum = reader.bytes(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.threshold = reader.bytes(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.veto_threshold = reader.bytes(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.expedited_quorum = reader.bytes(); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.expedited_threshold = reader.bytes(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): TallyParams { + return { + quorum: isSet(object.quorum) ? bytesFromBase64(object.quorum) : new Uint8Array(0), + threshold: isSet(object.threshold) ? bytesFromBase64(object.threshold) : new Uint8Array(0), + veto_threshold: isSet(object.veto_threshold) ? bytesFromBase64(object.veto_threshold) : new Uint8Array(0), + expedited_quorum: isSet(object.expedited_quorum) ? bytesFromBase64(object.expedited_quorum) : new Uint8Array(0), + expedited_threshold: isSet(object.expedited_threshold) ? bytesFromBase64(object.expedited_threshold) : new Uint8Array(0), + }; + }, + + toJSON(message: TallyParams): unknown { + const obj: any = {}; + if (message.quorum.length !== 0) { + obj.quorum = base64FromBytes(message.quorum); + } + if (message.threshold.length !== 0) { + obj.threshold = base64FromBytes(message.threshold); + } + if (message.veto_threshold.length !== 0) { + obj.veto_threshold = base64FromBytes(message.veto_threshold); + } + if (message.expedited_quorum.length !== 0) { + obj.expedited_quorum = base64FromBytes(message.expedited_quorum); + } + if (message.expedited_threshold.length !== 0) { + obj.expedited_threshold = base64FromBytes(message.expedited_threshold); + } + return obj; + }, + + create, I>>(base?: I): TallyParams { + return TallyParams.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): TallyParams { + const message = createBaseTallyParams(); + message.quorum = object.quorum ?? new Uint8Array(0); + message.threshold = object.threshold ?? new Uint8Array(0); + message.veto_threshold = object.veto_threshold ?? new Uint8Array(0); + message.expedited_quorum = object.expedited_quorum ?? new Uint8Array(0); + message.expedited_threshold = object.expedited_threshold ?? new Uint8Array(0); + return message; + }, +}; + +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"; + } +} + +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"; + } +} + +function createBaseWeightedVoteOption(): WeightedVoteOption { + return { option: 0, weight: "" }; +} + +function createBaseTextProposal(): TextProposal { + return { title: "", description: "", is_expedited: false }; +} + +function createBaseDeposit(): Deposit { + return { proposal_id: 0, depositor: "", amount: [] }; +} + +function createBaseProposal(): Proposal { + return { + proposal_id: 0, + content: undefined, + status: 0, + final_tally_result: undefined, + submit_time: undefined, + deposit_end_time: undefined, + total_deposit: [], + voting_start_time: undefined, + voting_end_time: undefined, + is_expedited: false, + }; +} + +function createBaseTallyResult(): TallyResult { + return { yes: "", abstain: "", no: "", no_with_veto: "" }; +} + +function createBaseVote(): Vote { + return { proposal_id: 0, voter: "", option: 0, options: [] }; +} + +function createBaseDepositParams(): DepositParams { + return { min_deposit: [], max_deposit_period: undefined, min_expedited_deposit: [] }; +} + +function createBaseVotingParams(): VotingParams { + return { voting_period: undefined, expedited_voting_period: undefined }; +} + +function createBaseTallyParams(): TallyParams { + return { + quorum: new Uint8Array(0), + threshold: new Uint8Array(0), + veto_threshold: new Uint8Array(0), + expedited_quorum: new Uint8Array(0), + expedited_threshold: new Uint8Array(0), + }; +} + +function bytesFromBase64(b64: string): Uint8Array { + if ((globalThis as any).Buffer) { + return Uint8Array.from(globalThis.Buffer.from(b64, "base64")); + } else { + const bin = globalThis.atob(b64); + const arr = new Uint8Array(bin.length); + for (let i = 0; i < bin.length; ++i) { + arr[i] = bin.charCodeAt(i); + } + return arr; + } +} + +function base64FromBytes(arr: Uint8Array): string { + if ((globalThis as any).Buffer) { + return globalThis.Buffer.from(arr).toString("base64"); + } else { + const bin: string[] = []; + arr.forEach((byte) => { + bin.push(globalThis.String.fromCharCode(byte)); + }); + return globalThis.btoa(bin.join("")); + } +} + +function toTimestamp(date: Date): Timestamp { + const seconds = Math.trunc(date.getTime() / 1_000); + const nanos = (date.getTime() % 1_000) * 1_000_000; + return { seconds, nanos }; +} + +function fromTimestamp(t: Timestamp): Date { + let millis = (t.seconds || 0) * 1_000; + millis += (t.nanos || 0) / 1_000_000; + return new globalThis.Date(millis); +} + +function fromJsonTimestamp(o: any): Date { + if (o instanceof globalThis.Date) { + return o; + } else if (typeof o === "string") { + return new globalThis.Date(o); + } else { + return fromTimestamp(Timestamp.fromJSON(o)); + } +} + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} +export const registry: Array<[string, GeneratedType]> = [ + ["/cosmos.gov.v1beta1.WeightedVoteOption", WeightedVoteOption as never], + ["/cosmos.gov.v1beta1.TextProposal", TextProposal as never], + ["/cosmos.gov.v1beta1.Deposit", Deposit as never], + ["/cosmos.gov.v1beta1.Proposal", Proposal as never], + ["/cosmos.gov.v1beta1.TallyResult", TallyResult as never], + ["/cosmos.gov.v1beta1.Vote", Vote as never], + ["/cosmos.gov.v1beta1.DepositParams", DepositParams as never], + ["/cosmos.gov.v1beta1.VotingParams", VotingParams as never], + ["/cosmos.gov.v1beta1.TallyParams", TallyParams as never], +]; +export const aminoConverters = { + "/cosmos.gov.v1beta1.WeightedVoteOption": { + aminoType: "cosmos-sdk/WeightedVoteOption", + toAmino: (message: WeightedVoteOption) => ({ ...message }), + fromAmino: (object: WeightedVoteOption) => ({ ...object }), + }, + + "/cosmos.gov.v1beta1.TextProposal": { + aminoType: "cosmos-sdk/TextProposal", + toAmino: (message: TextProposal) => ({ ...message }), + fromAmino: (object: TextProposal) => ({ ...object }), + }, + + "/cosmos.gov.v1beta1.Deposit": { + aminoType: "cosmos-sdk/Deposit", + toAmino: (message: Deposit) => ({ ...message }), + fromAmino: (object: Deposit) => ({ ...object }), + }, + + "/cosmos.gov.v1beta1.Proposal": { + aminoType: "cosmos-sdk/Proposal", + toAmino: (message: Proposal) => ({ ...message }), + fromAmino: (object: Proposal) => ({ ...object }), + }, + + "/cosmos.gov.v1beta1.TallyResult": { + aminoType: "cosmos-sdk/TallyResult", + toAmino: (message: TallyResult) => ({ ...message }), + fromAmino: (object: TallyResult) => ({ ...object }), + }, + + "/cosmos.gov.v1beta1.Vote": { + aminoType: "cosmos-sdk/Vote", + toAmino: (message: Vote) => ({ ...message }), + fromAmino: (object: Vote) => ({ ...object }), + }, + + "/cosmos.gov.v1beta1.DepositParams": { + aminoType: "cosmos-sdk/DepositParams", + toAmino: (message: DepositParams) => ({ ...message }), + fromAmino: (object: DepositParams) => ({ ...object }), + }, + + "/cosmos.gov.v1beta1.VotingParams": { + aminoType: "cosmos-sdk/VotingParams", + toAmino: (message: VotingParams) => ({ ...message }), + fromAmino: (object: VotingParams) => ({ ...object }), + }, + + "/cosmos.gov.v1beta1.TallyParams": { + aminoType: "cosmos-sdk/TallyParams", + toAmino: (message: TallyParams) => ({ ...message }), + fromAmino: (object: TallyParams) => ({ ...object }), + }, +}; diff --git a/packages/cosmos/generated/encoding/cosmos/gov/v1beta1/index.ts b/packages/cosmos/generated/encoding/cosmos/gov/v1beta1/index.ts new file mode 100644 index 000000000..57dc0904c --- /dev/null +++ b/packages/cosmos/generated/encoding/cosmos/gov/v1beta1/index.ts @@ -0,0 +1,6 @@ +// @ts-nocheck + +export * from './genesis'; +export * from './gov'; +export * from './query'; +export * from './tx'; \ No newline at end of file diff --git a/packages/cosmos/generated/encoding/cosmos/gov/v1beta1/query.ts b/packages/cosmos/generated/encoding/cosmos/gov/v1beta1/query.ts new file mode 100644 index 000000000..c66764ca4 --- /dev/null +++ b/packages/cosmos/generated/encoding/cosmos/gov/v1beta1/query.ts @@ -0,0 +1,1304 @@ +import type { GeneratedType } from "@cosmjs/proto-signing"; + +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +import { PageRequest, PageResponse } from "../../base/query/v1beta1/pagination"; + +import { Deposit, DepositParams, Proposal, TallyParams, TallyResult, Vote, VotingParams, proposalStatusFromJSON, proposalStatusToJSON } from "./gov"; + +import type { + QueryDepositRequest as QueryDepositRequest_type, + QueryDepositResponse as QueryDepositResponse_type, + QueryDepositsRequest as QueryDepositsRequest_type, + QueryDepositsResponse as QueryDepositsResponse_type, + QueryParamsRequest as QueryParamsRequest_type, + QueryParamsResponse as QueryParamsResponse_type, + QueryProposalRequest as QueryProposalRequest_type, + QueryProposalResponse as QueryProposalResponse_type, + QueryProposalsRequest as QueryProposalsRequest_type, + QueryProposalsResponse as QueryProposalsResponse_type, + QueryTallyResultRequest as QueryTallyResultRequest_type, + QueryTallyResultResponse as QueryTallyResultResponse_type, + QueryVoteRequest as QueryVoteRequest_type, + QueryVoteResponse as QueryVoteResponse_type, + QueryVotesRequest as QueryVotesRequest_type, + QueryVotesResponse as QueryVotesResponse_type, +} from "../../../../types/cosmos/gov/v1beta1"; + +import type { DeepPartial, Exact, MessageFns } from "../../../common"; + +export interface QueryProposalRequest extends QueryProposalRequest_type {} +export interface QueryProposalResponse extends QueryProposalResponse_type {} +export interface QueryProposalsRequest extends QueryProposalsRequest_type {} +export interface QueryProposalsResponse extends QueryProposalsResponse_type {} +export interface QueryVoteRequest extends QueryVoteRequest_type {} +export interface QueryVoteResponse extends QueryVoteResponse_type {} +export interface QueryVotesRequest extends QueryVotesRequest_type {} +export interface QueryVotesResponse extends QueryVotesResponse_type {} +export interface QueryParamsRequest extends QueryParamsRequest_type {} +export interface QueryParamsResponse extends QueryParamsResponse_type {} +export interface QueryDepositRequest extends QueryDepositRequest_type {} +export interface QueryDepositResponse extends QueryDepositResponse_type {} +export interface QueryDepositsRequest extends QueryDepositsRequest_type {} +export interface QueryDepositsResponse extends QueryDepositsResponse_type {} +export interface QueryTallyResultRequest extends QueryTallyResultRequest_type {} +export interface QueryTallyResultResponse extends QueryTallyResultResponse_type {} + +export const QueryProposalRequest: MessageFns = { + $type: "cosmos.gov.v1beta1.QueryProposalRequest" as const, + + encode(message: QueryProposalRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.proposal_id !== 0) { + writer.uint32(8).uint64(message.proposal_id); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryProposalRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryProposalRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.proposal_id = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryProposalRequest { + return { proposal_id: isSet(object.proposal_id) ? globalThis.Number(object.proposal_id) : 0 }; + }, + + toJSON(message: QueryProposalRequest): unknown { + const obj: any = {}; + if (message.proposal_id !== 0) { + obj.proposal_id = Math.round(message.proposal_id); + } + return obj; + }, + + create, I>>(base?: I): QueryProposalRequest { + return QueryProposalRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryProposalRequest { + const message = createBaseQueryProposalRequest(); + message.proposal_id = object.proposal_id ?? 0; + return message; + }, +}; + +export const QueryProposalResponse: MessageFns = { + $type: "cosmos.gov.v1beta1.QueryProposalResponse" as const, + + encode(message: QueryProposalResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.proposal !== undefined) { + Proposal.encode(message.proposal, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryProposalResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryProposalResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.proposal = Proposal.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryProposalResponse { + return { proposal: isSet(object.proposal) ? Proposal.fromJSON(object.proposal) : undefined }; + }, + + toJSON(message: QueryProposalResponse): unknown { + const obj: any = {}; + if (message.proposal !== undefined) { + obj.proposal = Proposal.toJSON(message.proposal); + } + return obj; + }, + + create, I>>(base?: I): QueryProposalResponse { + return QueryProposalResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryProposalResponse { + const message = createBaseQueryProposalResponse(); + message.proposal = object.proposal !== undefined && object.proposal !== null ? Proposal.fromPartial(object.proposal) : undefined; + return message; + }, +}; + +export const QueryProposalsRequest: MessageFns = { + $type: "cosmos.gov.v1beta1.QueryProposalsRequest" as const, + + encode(message: QueryProposalsRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.proposal_status !== 0) { + writer.uint32(8).int32(message.proposal_status); + } + 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()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryProposalsRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryProposalsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.proposal_status = reader.int32() as any; + continue; + case 2: + if (tag !== 18) { + break; + } + + message.voter = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.depositor = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryProposalsRequest { + return { + proposal_status: isSet(object.proposal_status) ? proposalStatusFromJSON(object.proposal_status) : 0, + voter: isSet(object.voter) ? globalThis.String(object.voter) : "", + depositor: isSet(object.depositor) ? globalThis.String(object.depositor) : "", + pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryProposalsRequest): unknown { + const obj: any = {}; + if (message.proposal_status !== 0) { + obj.proposal_status = proposalStatusToJSON(message.proposal_status); + } + if (message.voter !== "") { + obj.voter = message.voter; + } + if (message.depositor !== "") { + obj.depositor = message.depositor; + } + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryProposalsRequest { + return QueryProposalsRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryProposalsRequest { + const message = createBaseQueryProposalsRequest(); + message.proposal_status = object.proposal_status ?? 0; + message.voter = object.voter ?? ""; + message.depositor = object.depositor ?? ""; + message.pagination = object.pagination !== undefined && object.pagination !== null ? PageRequest.fromPartial(object.pagination) : undefined; + return message; + }, +}; + +export const QueryProposalsResponse: MessageFns = { + $type: "cosmos.gov.v1beta1.QueryProposalsResponse" as const, + + encode(message: QueryProposalsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.proposals) { + Proposal.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryProposalsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryProposalsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.proposals.push(Proposal.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryProposalsResponse { + return { + proposals: globalThis.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?.length) { + obj.proposals = message.proposals.map((e) => Proposal.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryProposalsResponse { + return QueryProposalsResponse.fromPartial(base ?? ({} as any)); + }, + 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; + }, +}; + +export const QueryVoteRequest: MessageFns = { + $type: "cosmos.gov.v1beta1.QueryVoteRequest" as const, + + encode(message: QueryVoteRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.proposal_id !== 0) { + writer.uint32(8).uint64(message.proposal_id); + } + if (message.voter !== "") { + writer.uint32(18).string(message.voter); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryVoteRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryVoteRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.proposal_id = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.voter = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryVoteRequest { + return { + proposal_id: isSet(object.proposal_id) ? globalThis.Number(object.proposal_id) : 0, + voter: isSet(object.voter) ? globalThis.String(object.voter) : "", + }; + }, + + toJSON(message: QueryVoteRequest): unknown { + const obj: any = {}; + if (message.proposal_id !== 0) { + obj.proposal_id = Math.round(message.proposal_id); + } + if (message.voter !== "") { + obj.voter = message.voter; + } + return obj; + }, + + create, I>>(base?: I): QueryVoteRequest { + return QueryVoteRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryVoteRequest { + const message = createBaseQueryVoteRequest(); + message.proposal_id = object.proposal_id ?? 0; + message.voter = object.voter ?? ""; + return message; + }, +}; + +export const QueryVoteResponse: MessageFns = { + $type: "cosmos.gov.v1beta1.QueryVoteResponse" as const, + + encode(message: QueryVoteResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.vote !== undefined) { + Vote.encode(message.vote, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryVoteResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryVoteResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.vote = Vote.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryVoteResponse { + return { vote: isSet(object.vote) ? Vote.fromJSON(object.vote) : undefined }; + }, + + toJSON(message: QueryVoteResponse): unknown { + const obj: any = {}; + if (message.vote !== undefined) { + obj.vote = Vote.toJSON(message.vote); + } + return obj; + }, + + create, I>>(base?: I): QueryVoteResponse { + return QueryVoteResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryVoteResponse { + const message = createBaseQueryVoteResponse(); + message.vote = object.vote !== undefined && object.vote !== null ? Vote.fromPartial(object.vote) : undefined; + return message; + }, +}; + +export const QueryVotesRequest: MessageFns = { + $type: "cosmos.gov.v1beta1.QueryVotesRequest" as const, + + encode(message: QueryVotesRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.proposal_id !== 0) { + writer.uint32(8).uint64(message.proposal_id); + } + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryVotesRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryVotesRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.proposal_id = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryVotesRequest { + return { + proposal_id: isSet(object.proposal_id) ? globalThis.Number(object.proposal_id) : 0, + pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryVotesRequest): unknown { + const obj: any = {}; + if (message.proposal_id !== 0) { + obj.proposal_id = Math.round(message.proposal_id); + } + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryVotesRequest { + return QueryVotesRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryVotesRequest { + const message = createBaseQueryVotesRequest(); + message.proposal_id = object.proposal_id ?? 0; + message.pagination = object.pagination !== undefined && object.pagination !== null ? PageRequest.fromPartial(object.pagination) : undefined; + return message; + }, +}; + +export const QueryVotesResponse: MessageFns = { + $type: "cosmos.gov.v1beta1.QueryVotesResponse" as const, + + encode(message: QueryVotesResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.votes) { + Vote.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryVotesResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryVotesResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.votes.push(Vote.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryVotesResponse { + return { + votes: globalThis.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?.length) { + obj.votes = message.votes.map((e) => Vote.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryVotesResponse { + return QueryVotesResponse.fromPartial(base ?? ({} as any)); + }, + 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; + }, +}; + +export const QueryParamsRequest: MessageFns = { + $type: "cosmos.gov.v1beta1.QueryParamsRequest" as const, + + encode(message: QueryParamsRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.params_type !== "") { + writer.uint32(10).string(message.params_type); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryParamsRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryParamsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.params_type = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryParamsRequest { + return { params_type: isSet(object.params_type) ? globalThis.String(object.params_type) : "" }; + }, + + toJSON(message: QueryParamsRequest): unknown { + const obj: any = {}; + if (message.params_type !== "") { + obj.params_type = message.params_type; + } + return obj; + }, + + create, I>>(base?: I): QueryParamsRequest { + return QueryParamsRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryParamsRequest { + const message = createBaseQueryParamsRequest(); + message.params_type = object.params_type ?? ""; + return message; + }, +}; + +export const QueryParamsResponse: MessageFns = { + $type: "cosmos.gov.v1beta1.QueryParamsResponse" as const, + + encode(message: QueryParamsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.voting_params !== undefined) { + VotingParams.encode(message.voting_params, writer.uint32(10).fork()).join(); + } + if (message.deposit_params !== undefined) { + DepositParams.encode(message.deposit_params, writer.uint32(18).fork()).join(); + } + if (message.tally_params !== undefined) { + TallyParams.encode(message.tally_params, writer.uint32(26).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryParamsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryParamsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.voting_params = VotingParams.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.deposit_params = DepositParams.decode(reader, reader.uint32()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.tally_params = TallyParams.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryParamsResponse { + return { + voting_params: isSet(object.voting_params) ? VotingParams.fromJSON(object.voting_params) : undefined, + deposit_params: isSet(object.deposit_params) ? DepositParams.fromJSON(object.deposit_params) : undefined, + tally_params: isSet(object.tally_params) ? TallyParams.fromJSON(object.tally_params) : undefined, + }; + }, + + toJSON(message: QueryParamsResponse): unknown { + const obj: any = {}; + if (message.voting_params !== undefined) { + obj.voting_params = VotingParams.toJSON(message.voting_params); + } + if (message.deposit_params !== undefined) { + obj.deposit_params = DepositParams.toJSON(message.deposit_params); + } + if (message.tally_params !== undefined) { + obj.tally_params = TallyParams.toJSON(message.tally_params); + } + return obj; + }, + + create, I>>(base?: I): QueryParamsResponse { + return QueryParamsResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryParamsResponse { + const message = createBaseQueryParamsResponse(); + message.voting_params = object.voting_params !== undefined && object.voting_params !== null ? VotingParams.fromPartial(object.voting_params) : undefined; + message.deposit_params = + object.deposit_params !== undefined && object.deposit_params !== null ? DepositParams.fromPartial(object.deposit_params) : undefined; + message.tally_params = object.tally_params !== undefined && object.tally_params !== null ? TallyParams.fromPartial(object.tally_params) : undefined; + return message; + }, +}; + +export const QueryDepositRequest: MessageFns = { + $type: "cosmos.gov.v1beta1.QueryDepositRequest" as const, + + encode(message: QueryDepositRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.proposal_id !== 0) { + writer.uint32(8).uint64(message.proposal_id); + } + if (message.depositor !== "") { + writer.uint32(18).string(message.depositor); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryDepositRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDepositRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.proposal_id = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.depositor = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDepositRequest { + return { + proposal_id: isSet(object.proposal_id) ? globalThis.Number(object.proposal_id) : 0, + depositor: isSet(object.depositor) ? globalThis.String(object.depositor) : "", + }; + }, + + toJSON(message: QueryDepositRequest): unknown { + const obj: any = {}; + if (message.proposal_id !== 0) { + obj.proposal_id = Math.round(message.proposal_id); + } + if (message.depositor !== "") { + obj.depositor = message.depositor; + } + return obj; + }, + + create, I>>(base?: I): QueryDepositRequest { + return QueryDepositRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryDepositRequest { + const message = createBaseQueryDepositRequest(); + message.proposal_id = object.proposal_id ?? 0; + message.depositor = object.depositor ?? ""; + return message; + }, +}; + +export const QueryDepositResponse: MessageFns = { + $type: "cosmos.gov.v1beta1.QueryDepositResponse" as const, + + encode(message: QueryDepositResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.deposit !== undefined) { + Deposit.encode(message.deposit, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryDepositResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDepositResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.deposit = Deposit.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDepositResponse { + return { deposit: isSet(object.deposit) ? Deposit.fromJSON(object.deposit) : undefined }; + }, + + toJSON(message: QueryDepositResponse): unknown { + const obj: any = {}; + if (message.deposit !== undefined) { + obj.deposit = Deposit.toJSON(message.deposit); + } + return obj; + }, + + create, I>>(base?: I): QueryDepositResponse { + return QueryDepositResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryDepositResponse { + const message = createBaseQueryDepositResponse(); + message.deposit = object.deposit !== undefined && object.deposit !== null ? Deposit.fromPartial(object.deposit) : undefined; + return message; + }, +}; + +export const QueryDepositsRequest: MessageFns = { + $type: "cosmos.gov.v1beta1.QueryDepositsRequest" as const, + + encode(message: QueryDepositsRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.proposal_id !== 0) { + writer.uint32(8).uint64(message.proposal_id); + } + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryDepositsRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDepositsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.proposal_id = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDepositsRequest { + return { + proposal_id: isSet(object.proposal_id) ? globalThis.Number(object.proposal_id) : 0, + pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryDepositsRequest): unknown { + const obj: any = {}; + if (message.proposal_id !== 0) { + obj.proposal_id = Math.round(message.proposal_id); + } + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryDepositsRequest { + return QueryDepositsRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryDepositsRequest { + const message = createBaseQueryDepositsRequest(); + message.proposal_id = object.proposal_id ?? 0; + message.pagination = object.pagination !== undefined && object.pagination !== null ? PageRequest.fromPartial(object.pagination) : undefined; + return message; + }, +}; + +export const QueryDepositsResponse: MessageFns = { + $type: "cosmos.gov.v1beta1.QueryDepositsResponse" as const, + + encode(message: QueryDepositsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.deposits) { + Deposit.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryDepositsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDepositsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.deposits.push(Deposit.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDepositsResponse { + return { + deposits: globalThis.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?.length) { + obj.deposits = message.deposits.map((e) => Deposit.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryDepositsResponse { + return QueryDepositsResponse.fromPartial(base ?? ({} as any)); + }, + 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; + }, +}; + +export const QueryTallyResultRequest: MessageFns = { + $type: "cosmos.gov.v1beta1.QueryTallyResultRequest" as const, + + encode(message: QueryTallyResultRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.proposal_id !== 0) { + writer.uint32(8).uint64(message.proposal_id); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryTallyResultRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryTallyResultRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.proposal_id = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryTallyResultRequest { + return { proposal_id: isSet(object.proposal_id) ? globalThis.Number(object.proposal_id) : 0 }; + }, + + toJSON(message: QueryTallyResultRequest): unknown { + const obj: any = {}; + if (message.proposal_id !== 0) { + obj.proposal_id = Math.round(message.proposal_id); + } + return obj; + }, + + create, I>>(base?: I): QueryTallyResultRequest { + return QueryTallyResultRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryTallyResultRequest { + const message = createBaseQueryTallyResultRequest(); + message.proposal_id = object.proposal_id ?? 0; + return message; + }, +}; + +export const QueryTallyResultResponse: MessageFns = { + $type: "cosmos.gov.v1beta1.QueryTallyResultResponse" as const, + + encode(message: QueryTallyResultResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.tally !== undefined) { + TallyResult.encode(message.tally, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryTallyResultResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryTallyResultResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.tally = TallyResult.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryTallyResultResponse { + return { tally: isSet(object.tally) ? TallyResult.fromJSON(object.tally) : undefined }; + }, + + toJSON(message: QueryTallyResultResponse): unknown { + const obj: any = {}; + if (message.tally !== undefined) { + obj.tally = TallyResult.toJSON(message.tally); + } + return obj; + }, + + create, I>>(base?: I): QueryTallyResultResponse { + return QueryTallyResultResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryTallyResultResponse { + const message = createBaseQueryTallyResultResponse(); + message.tally = object.tally !== undefined && object.tally !== null ? TallyResult.fromPartial(object.tally) : undefined; + return message; + }, +}; + +function createBaseQueryProposalRequest(): QueryProposalRequest { + return { proposal_id: 0 }; +} + +function createBaseQueryProposalResponse(): QueryProposalResponse { + return { proposal: undefined }; +} + +function createBaseQueryProposalsRequest(): QueryProposalsRequest { + return { proposal_status: 0, voter: "", depositor: "", pagination: undefined }; +} + +function createBaseQueryProposalsResponse(): QueryProposalsResponse { + return { proposals: [], pagination: undefined }; +} + +function createBaseQueryVoteRequest(): QueryVoteRequest { + return { proposal_id: 0, voter: "" }; +} + +function createBaseQueryVoteResponse(): QueryVoteResponse { + return { vote: undefined }; +} + +function createBaseQueryVotesRequest(): QueryVotesRequest { + return { proposal_id: 0, pagination: undefined }; +} + +function createBaseQueryVotesResponse(): QueryVotesResponse { + return { votes: [], pagination: undefined }; +} + +function createBaseQueryParamsRequest(): QueryParamsRequest { + return { params_type: "" }; +} + +function createBaseQueryParamsResponse(): QueryParamsResponse { + return { voting_params: undefined, deposit_params: undefined, tally_params: undefined }; +} + +function createBaseQueryDepositRequest(): QueryDepositRequest { + return { proposal_id: 0, depositor: "" }; +} + +function createBaseQueryDepositResponse(): QueryDepositResponse { + return { deposit: undefined }; +} + +function createBaseQueryDepositsRequest(): QueryDepositsRequest { + return { proposal_id: 0, pagination: undefined }; +} + +function createBaseQueryDepositsResponse(): QueryDepositsResponse { + return { deposits: [], pagination: undefined }; +} + +function createBaseQueryTallyResultRequest(): QueryTallyResultRequest { + return { proposal_id: 0 }; +} + +function createBaseQueryTallyResultResponse(): QueryTallyResultResponse { + return { tally: undefined }; +} + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} +export const registry: Array<[string, GeneratedType]> = [ + ["/cosmos.gov.v1beta1.QueryProposalRequest", QueryProposalRequest as never], + ["/cosmos.gov.v1beta1.QueryProposalResponse", QueryProposalResponse as never], + ["/cosmos.gov.v1beta1.QueryProposalsRequest", QueryProposalsRequest as never], + ["/cosmos.gov.v1beta1.QueryProposalsResponse", QueryProposalsResponse as never], + ["/cosmos.gov.v1beta1.QueryVoteRequest", QueryVoteRequest as never], + ["/cosmos.gov.v1beta1.QueryVoteResponse", QueryVoteResponse as never], + ["/cosmos.gov.v1beta1.QueryVotesRequest", QueryVotesRequest as never], + ["/cosmos.gov.v1beta1.QueryVotesResponse", QueryVotesResponse as never], + ["/cosmos.gov.v1beta1.QueryParamsRequest", QueryParamsRequest as never], + ["/cosmos.gov.v1beta1.QueryParamsResponse", QueryParamsResponse as never], + ["/cosmos.gov.v1beta1.QueryDepositRequest", QueryDepositRequest as never], + ["/cosmos.gov.v1beta1.QueryDepositResponse", QueryDepositResponse as never], + ["/cosmos.gov.v1beta1.QueryDepositsRequest", QueryDepositsRequest as never], + ["/cosmos.gov.v1beta1.QueryDepositsResponse", QueryDepositsResponse as never], +]; +export const aminoConverters = { + "/cosmos.gov.v1beta1.QueryProposalRequest": { + aminoType: "cosmos-sdk/QueryProposalRequest", + toAmino: (message: QueryProposalRequest) => ({ ...message }), + fromAmino: (object: QueryProposalRequest) => ({ ...object }), + }, + + "/cosmos.gov.v1beta1.QueryProposalResponse": { + aminoType: "cosmos-sdk/QueryProposalResponse", + toAmino: (message: QueryProposalResponse) => ({ ...message }), + fromAmino: (object: QueryProposalResponse) => ({ ...object }), + }, + + "/cosmos.gov.v1beta1.QueryProposalsRequest": { + aminoType: "cosmos-sdk/QueryProposalsRequest", + toAmino: (message: QueryProposalsRequest) => ({ ...message }), + fromAmino: (object: QueryProposalsRequest) => ({ ...object }), + }, + + "/cosmos.gov.v1beta1.QueryProposalsResponse": { + aminoType: "cosmos-sdk/QueryProposalsResponse", + toAmino: (message: QueryProposalsResponse) => ({ ...message }), + fromAmino: (object: QueryProposalsResponse) => ({ ...object }), + }, + + "/cosmos.gov.v1beta1.QueryVoteRequest": { + aminoType: "cosmos-sdk/QueryVoteRequest", + toAmino: (message: QueryVoteRequest) => ({ ...message }), + fromAmino: (object: QueryVoteRequest) => ({ ...object }), + }, + + "/cosmos.gov.v1beta1.QueryVoteResponse": { + aminoType: "cosmos-sdk/QueryVoteResponse", + toAmino: (message: QueryVoteResponse) => ({ ...message }), + fromAmino: (object: QueryVoteResponse) => ({ ...object }), + }, + + "/cosmos.gov.v1beta1.QueryVotesRequest": { + aminoType: "cosmos-sdk/QueryVotesRequest", + toAmino: (message: QueryVotesRequest) => ({ ...message }), + fromAmino: (object: QueryVotesRequest) => ({ ...object }), + }, + + "/cosmos.gov.v1beta1.QueryVotesResponse": { + aminoType: "cosmos-sdk/QueryVotesResponse", + toAmino: (message: QueryVotesResponse) => ({ ...message }), + fromAmino: (object: QueryVotesResponse) => ({ ...object }), + }, + + "/cosmos.gov.v1beta1.QueryParamsRequest": { + aminoType: "cosmos-sdk/QueryParamsRequest", + toAmino: (message: QueryParamsRequest) => ({ ...message }), + fromAmino: (object: QueryParamsRequest) => ({ ...object }), + }, + + "/cosmos.gov.v1beta1.QueryParamsResponse": { + aminoType: "cosmos-sdk/QueryParamsResponse", + toAmino: (message: QueryParamsResponse) => ({ ...message }), + fromAmino: (object: QueryParamsResponse) => ({ ...object }), + }, + + "/cosmos.gov.v1beta1.QueryDepositRequest": { + aminoType: "cosmos-sdk/QueryDepositRequest", + toAmino: (message: QueryDepositRequest) => ({ ...message }), + fromAmino: (object: QueryDepositRequest) => ({ ...object }), + }, + + "/cosmos.gov.v1beta1.QueryDepositResponse": { + aminoType: "cosmos-sdk/QueryDepositResponse", + toAmino: (message: QueryDepositResponse) => ({ ...message }), + fromAmino: (object: QueryDepositResponse) => ({ ...object }), + }, + + "/cosmos.gov.v1beta1.QueryDepositsRequest": { + aminoType: "cosmos-sdk/QueryDepositsRequest", + toAmino: (message: QueryDepositsRequest) => ({ ...message }), + fromAmino: (object: QueryDepositsRequest) => ({ ...object }), + }, + + "/cosmos.gov.v1beta1.QueryDepositsResponse": { + aminoType: "cosmos-sdk/QueryDepositsResponse", + toAmino: (message: QueryDepositsResponse) => ({ ...message }), + fromAmino: (object: QueryDepositsResponse) => ({ ...object }), + }, +}; diff --git a/packages/cosmos/generated/encoding/cosmos/gov/v1beta1/tx.ts b/packages/cosmos/generated/encoding/cosmos/gov/v1beta1/tx.ts new file mode 100644 index 000000000..b6fc86b70 --- /dev/null +++ b/packages/cosmos/generated/encoding/cosmos/gov/v1beta1/tx.ts @@ -0,0 +1,664 @@ +import type { GeneratedType } from "@cosmjs/proto-signing"; + +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +import { Any } from "../../../google/protobuf/any"; + +import { Coin } from "../../base/v1beta1/coin"; + +import { WeightedVoteOption, voteOptionFromJSON, voteOptionToJSON } from "./gov"; + +import type { + MsgDepositResponse as MsgDepositResponse_type, + MsgDeposit as MsgDeposit_type, + MsgSubmitProposalResponse as MsgSubmitProposalResponse_type, + MsgSubmitProposal as MsgSubmitProposal_type, + MsgVoteResponse as MsgVoteResponse_type, + MsgVoteWeightedResponse as MsgVoteWeightedResponse_type, + MsgVoteWeighted as MsgVoteWeighted_type, + MsgVote as MsgVote_type, +} from "../../../../types/cosmos/gov/v1beta1"; + +import type { DeepPartial, Exact, MessageFns } from "../../../common"; + +export interface MsgSubmitProposal extends MsgSubmitProposal_type {} +export interface MsgSubmitProposalResponse extends MsgSubmitProposalResponse_type {} +export interface MsgVote extends MsgVote_type {} +export interface MsgVoteResponse extends MsgVoteResponse_type {} +export interface MsgVoteWeighted extends MsgVoteWeighted_type {} +export interface MsgVoteWeightedResponse extends MsgVoteWeightedResponse_type {} +export interface MsgDeposit extends MsgDeposit_type {} +export interface MsgDepositResponse extends MsgDepositResponse_type {} + +export const MsgSubmitProposal: MessageFns = { + $type: "cosmos.gov.v1beta1.MsgSubmitProposal" as const, + + encode(message: MsgSubmitProposal, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.content !== undefined) { + Any.encode(message.content, writer.uint32(10).fork()).join(); + } + for (const v of message.initial_deposit) { + Coin.encode(v!, writer.uint32(18).fork()).join(); + } + if (message.proposer !== "") { + writer.uint32(26).string(message.proposer); + } + if (message.is_expedited !== false) { + writer.uint32(32).bool(message.is_expedited); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgSubmitProposal { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSubmitProposal(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.content = Any.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.initial_deposit.push(Coin.decode(reader, reader.uint32())); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.proposer = reader.string(); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.is_expedited = reader.bool(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgSubmitProposal { + return { + content: isSet(object.content) ? Any.fromJSON(object.content) : undefined, + initial_deposit: globalThis.Array.isArray(object?.initial_deposit) ? object.initial_deposit.map((e: any) => Coin.fromJSON(e)) : [], + proposer: isSet(object.proposer) ? globalThis.String(object.proposer) : "", + is_expedited: isSet(object.is_expedited) ? globalThis.Boolean(object.is_expedited) : false, + }; + }, + + toJSON(message: MsgSubmitProposal): unknown { + const obj: any = {}; + if (message.content !== undefined) { + obj.content = Any.toJSON(message.content); + } + if (message.initial_deposit?.length) { + obj.initial_deposit = message.initial_deposit.map((e) => Coin.toJSON(e)); + } + if (message.proposer !== "") { + obj.proposer = message.proposer; + } + if (message.is_expedited !== false) { + obj.is_expedited = message.is_expedited; + } + return obj; + }, + + create, I>>(base?: I): MsgSubmitProposal { + return MsgSubmitProposal.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgSubmitProposal { + const message = createBaseMsgSubmitProposal(); + message.content = object.content !== undefined && object.content !== null ? Any.fromPartial(object.content) : undefined; + message.initial_deposit = object.initial_deposit?.map((e) => Coin.fromPartial(e)) || []; + message.proposer = object.proposer ?? ""; + message.is_expedited = object.is_expedited ?? false; + return message; + }, +}; + +export const MsgSubmitProposalResponse: MessageFns = { + $type: "cosmos.gov.v1beta1.MsgSubmitProposalResponse" as const, + + encode(message: MsgSubmitProposalResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.proposal_id !== 0) { + writer.uint32(8).uint64(message.proposal_id); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgSubmitProposalResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSubmitProposalResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.proposal_id = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgSubmitProposalResponse { + return { proposal_id: isSet(object.proposal_id) ? globalThis.Number(object.proposal_id) : 0 }; + }, + + toJSON(message: MsgSubmitProposalResponse): unknown { + const obj: any = {}; + if (message.proposal_id !== 0) { + obj.proposal_id = Math.round(message.proposal_id); + } + return obj; + }, + + create, I>>(base?: I): MsgSubmitProposalResponse { + return MsgSubmitProposalResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgSubmitProposalResponse { + const message = createBaseMsgSubmitProposalResponse(); + message.proposal_id = object.proposal_id ?? 0; + return message; + }, +}; + +export const MsgVote: MessageFns = { + $type: "cosmos.gov.v1beta1.MsgVote" as const, + + encode(message: MsgVote, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.proposal_id !== 0) { + writer.uint32(8).uint64(message.proposal_id); + } + if (message.voter !== "") { + writer.uint32(18).string(message.voter); + } + if (message.option !== 0) { + writer.uint32(24).int32(message.option); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgVote { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgVote(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.proposal_id = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.voter = reader.string(); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.option = reader.int32() as any; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgVote { + return { + proposal_id: isSet(object.proposal_id) ? globalThis.Number(object.proposal_id) : 0, + voter: isSet(object.voter) ? globalThis.String(object.voter) : "", + option: isSet(object.option) ? voteOptionFromJSON(object.option) : 0, + }; + }, + + toJSON(message: MsgVote): unknown { + const obj: any = {}; + if (message.proposal_id !== 0) { + obj.proposal_id = Math.round(message.proposal_id); + } + if (message.voter !== "") { + obj.voter = message.voter; + } + if (message.option !== 0) { + obj.option = voteOptionToJSON(message.option); + } + return obj; + }, + + create, I>>(base?: I): MsgVote { + return MsgVote.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgVote { + const message = createBaseMsgVote(); + message.proposal_id = object.proposal_id ?? 0; + message.voter = object.voter ?? ""; + message.option = object.option ?? 0; + return message; + }, +}; + +export const MsgVoteResponse: MessageFns = { + $type: "cosmos.gov.v1beta1.MsgVoteResponse" as const, + + encode(_: MsgVoteResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgVoteResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgVoteResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgVoteResponse { + return {}; + }, + + toJSON(_: MsgVoteResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgVoteResponse { + return MsgVoteResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgVoteResponse { + const message = createBaseMsgVoteResponse(); + return message; + }, +}; + +export const MsgVoteWeighted: MessageFns = { + $type: "cosmos.gov.v1beta1.MsgVoteWeighted" as const, + + encode(message: MsgVoteWeighted, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.proposal_id !== 0) { + writer.uint32(8).uint64(message.proposal_id); + } + if (message.voter !== "") { + writer.uint32(18).string(message.voter); + } + for (const v of message.options) { + WeightedVoteOption.encode(v!, writer.uint32(26).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgVoteWeighted { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgVoteWeighted(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.proposal_id = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.voter = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.options.push(WeightedVoteOption.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgVoteWeighted { + return { + proposal_id: isSet(object.proposal_id) ? globalThis.Number(object.proposal_id) : 0, + voter: isSet(object.voter) ? globalThis.String(object.voter) : "", + options: globalThis.Array.isArray(object?.options) ? object.options.map((e: any) => WeightedVoteOption.fromJSON(e)) : [], + }; + }, + + toJSON(message: MsgVoteWeighted): unknown { + const obj: any = {}; + if (message.proposal_id !== 0) { + obj.proposal_id = Math.round(message.proposal_id); + } + if (message.voter !== "") { + obj.voter = message.voter; + } + if (message.options?.length) { + obj.options = message.options.map((e) => WeightedVoteOption.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): MsgVoteWeighted { + return MsgVoteWeighted.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgVoteWeighted { + const message = createBaseMsgVoteWeighted(); + message.proposal_id = object.proposal_id ?? 0; + message.voter = object.voter ?? ""; + message.options = object.options?.map((e) => WeightedVoteOption.fromPartial(e)) || []; + return message; + }, +}; + +export const MsgVoteWeightedResponse: MessageFns = { + $type: "cosmos.gov.v1beta1.MsgVoteWeightedResponse" as const, + + encode(_: MsgVoteWeightedResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgVoteWeightedResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgVoteWeightedResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgVoteWeightedResponse { + return {}; + }, + + toJSON(_: MsgVoteWeightedResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgVoteWeightedResponse { + return MsgVoteWeightedResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgVoteWeightedResponse { + const message = createBaseMsgVoteWeightedResponse(); + return message; + }, +}; + +export const MsgDeposit: MessageFns = { + $type: "cosmos.gov.v1beta1.MsgDeposit" as const, + + encode(message: MsgDeposit, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.proposal_id !== 0) { + writer.uint32(8).uint64(message.proposal_id); + } + if (message.depositor !== "") { + writer.uint32(18).string(message.depositor); + } + for (const v of message.amount) { + Coin.encode(v!, writer.uint32(26).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgDeposit { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgDeposit(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.proposal_id = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.depositor = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.amount.push(Coin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgDeposit { + return { + proposal_id: isSet(object.proposal_id) ? globalThis.Number(object.proposal_id) : 0, + depositor: isSet(object.depositor) ? globalThis.String(object.depositor) : "", + amount: globalThis.Array.isArray(object?.amount) ? object.amount.map((e: any) => Coin.fromJSON(e)) : [], + }; + }, + + toJSON(message: MsgDeposit): unknown { + const obj: any = {}; + if (message.proposal_id !== 0) { + obj.proposal_id = Math.round(message.proposal_id); + } + if (message.depositor !== "") { + obj.depositor = message.depositor; + } + if (message.amount?.length) { + obj.amount = message.amount.map((e) => Coin.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): MsgDeposit { + return MsgDeposit.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgDeposit { + const message = createBaseMsgDeposit(); + message.proposal_id = object.proposal_id ?? 0; + message.depositor = object.depositor ?? ""; + message.amount = object.amount?.map((e) => Coin.fromPartial(e)) || []; + return message; + }, +}; + +export const MsgDepositResponse: MessageFns = { + $type: "cosmos.gov.v1beta1.MsgDepositResponse" as const, + + encode(_: MsgDepositResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgDepositResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgDepositResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgDepositResponse { + return {}; + }, + + toJSON(_: MsgDepositResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgDepositResponse { + return MsgDepositResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgDepositResponse { + const message = createBaseMsgDepositResponse(); + return message; + }, +}; + +function createBaseMsgSubmitProposal(): MsgSubmitProposal { + return { content: undefined, initial_deposit: [], proposer: "", is_expedited: false }; +} + +function createBaseMsgSubmitProposalResponse(): MsgSubmitProposalResponse { + return { proposal_id: 0 }; +} + +function createBaseMsgVote(): MsgVote { + return { proposal_id: 0, voter: "", option: 0 }; +} + +function createBaseMsgVoteResponse(): MsgVoteResponse { + return {}; +} + +function createBaseMsgVoteWeighted(): MsgVoteWeighted { + return { proposal_id: 0, voter: "", options: [] }; +} + +function createBaseMsgVoteWeightedResponse(): MsgVoteWeightedResponse { + return {}; +} + +function createBaseMsgDeposit(): MsgDeposit { + return { proposal_id: 0, depositor: "", amount: [] }; +} + +function createBaseMsgDepositResponse(): MsgDepositResponse { + return {}; +} + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} +export const registry: Array<[string, GeneratedType]> = [ + ["/cosmos.gov.v1beta1.MsgSubmitProposal", MsgSubmitProposal as never], + ["/cosmos.gov.v1beta1.MsgVote", MsgVote as never], + ["/cosmos.gov.v1beta1.MsgVoteResponse", MsgVoteResponse as never], + ["/cosmos.gov.v1beta1.MsgVoteWeighted", MsgVoteWeighted as never], + ["/cosmos.gov.v1beta1.MsgDeposit", MsgDeposit as never], + ["/cosmos.gov.v1beta1.MsgDepositResponse", MsgDepositResponse as never], +]; +export const aminoConverters = { + "/cosmos.gov.v1beta1.MsgSubmitProposal": { + aminoType: "cosmos-sdk/MsgSubmitProposal", + toAmino: (message: MsgSubmitProposal) => ({ ...message }), + fromAmino: (object: MsgSubmitProposal) => ({ ...object }), + }, + + "/cosmos.gov.v1beta1.MsgVote": { + aminoType: "cosmos-sdk/MsgVote", + toAmino: (message: MsgVote) => ({ ...message }), + fromAmino: (object: MsgVote) => ({ ...object }), + }, + + "/cosmos.gov.v1beta1.MsgVoteResponse": { + aminoType: "cosmos-sdk/MsgVoteResponse", + toAmino: (message: MsgVoteResponse) => ({ ...message }), + fromAmino: (object: MsgVoteResponse) => ({ ...object }), + }, + + "/cosmos.gov.v1beta1.MsgVoteWeighted": { + aminoType: "cosmos-sdk/MsgVoteWeighted", + toAmino: (message: MsgVoteWeighted) => ({ ...message }), + fromAmino: (object: MsgVoteWeighted) => ({ ...object }), + }, + + "/cosmos.gov.v1beta1.MsgDeposit": { + aminoType: "cosmos-sdk/MsgDeposit", + toAmino: (message: MsgDeposit) => ({ ...message }), + fromAmino: (object: MsgDeposit) => ({ ...object }), + }, + + "/cosmos.gov.v1beta1.MsgDepositResponse": { + aminoType: "cosmos-sdk/MsgDepositResponse", + toAmino: (message: MsgDepositResponse) => ({ ...message }), + fromAmino: (object: MsgDepositResponse) => ({ ...object }), + }, +}; diff --git a/packages/cosmos/generated/encoding/cosmos/mint/v1beta1/genesis.ts b/packages/cosmos/generated/encoding/cosmos/mint/v1beta1/genesis.ts new file mode 100644 index 000000000..e5357f0f1 --- /dev/null +++ b/packages/cosmos/generated/encoding/cosmos/mint/v1beta1/genesis.ts @@ -0,0 +1,99 @@ +import type { GeneratedType } from "@cosmjs/proto-signing"; + +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +import { Minter, Params } from "./mint"; + +import type { GenesisState as GenesisState_type } from "../../../../types/cosmos/mint/v1beta1"; + +import type { DeepPartial, Exact, MessageFns } from "../../../common"; + +export interface GenesisState extends GenesisState_type {} + +export const GenesisState: MessageFns = { + $type: "cosmos.mint.v1beta1.GenesisState" as const, + + encode(message: GenesisState, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.minter !== undefined) { + Minter.encode(message.minter, writer.uint32(10).fork()).join(); + } + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GenesisState { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGenesisState(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.minter = Minter.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.params = Params.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GenesisState { + return { + minter: isSet(object.minter) ? Minter.fromJSON(object.minter) : undefined, + params: isSet(object.params) ? Params.fromJSON(object.params) : undefined, + }; + }, + + toJSON(message: GenesisState): unknown { + const obj: any = {}; + if (message.minter !== undefined) { + obj.minter = Minter.toJSON(message.minter); + } + if (message.params !== undefined) { + obj.params = Params.toJSON(message.params); + } + return obj; + }, + + create, I>>(base?: I): GenesisState { + return GenesisState.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): GenesisState { + const message = createBaseGenesisState(); + message.minter = object.minter !== undefined && object.minter !== null ? Minter.fromPartial(object.minter) : undefined; + message.params = object.params !== undefined && object.params !== null ? Params.fromPartial(object.params) : undefined; + return message; + }, +}; + +function createBaseGenesisState(): GenesisState { + return { minter: undefined, params: undefined }; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} +export const registry: Array<[string, GeneratedType]> = [["/cosmos.mint.v1beta1.GenesisState", GenesisState as never]]; +export const aminoConverters = { + "/cosmos.mint.v1beta1.GenesisState": { + aminoType: "cosmos-sdk/GenesisState", + toAmino: (message: GenesisState) => ({ ...message }), + fromAmino: (object: GenesisState) => ({ ...object }), + }, +}; diff --git a/packages/cosmos/generated/encoding/cosmos/mint/v1beta1/index.ts b/packages/cosmos/generated/encoding/cosmos/mint/v1beta1/index.ts new file mode 100644 index 000000000..3d9b6202b --- /dev/null +++ b/packages/cosmos/generated/encoding/cosmos/mint/v1beta1/index.ts @@ -0,0 +1,5 @@ +// @ts-nocheck + +export * from './genesis'; +export * from './mint'; +export * from './query'; \ No newline at end of file diff --git a/packages/cosmos/generated/encoding/cosmos/mint/v1beta1/mint.ts b/packages/cosmos/generated/encoding/cosmos/mint/v1beta1/mint.ts new file mode 100644 index 000000000..2b12c93c9 --- /dev/null +++ b/packages/cosmos/generated/encoding/cosmos/mint/v1beta1/mint.ts @@ -0,0 +1,261 @@ +import type { GeneratedType } from "@cosmjs/proto-signing"; + +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +import type { Minter as Minter_type, Params as Params_type } from "../../../../types/cosmos/mint/v1beta1"; + +import type { DeepPartial, Exact, MessageFns } from "../../../common"; + +export interface Minter extends Minter_type {} +export interface Params extends Params_type {} + +export const Minter: MessageFns = { + $type: "cosmos.mint.v1beta1.Minter" as const, + + encode(message: Minter, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.inflation !== "") { + writer.uint32(10).string(message.inflation); + } + if (message.annual_provisions !== "") { + writer.uint32(18).string(message.annual_provisions); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Minter { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMinter(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.inflation = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.annual_provisions = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Minter { + return { + inflation: isSet(object.inflation) ? globalThis.String(object.inflation) : "", + annual_provisions: isSet(object.annual_provisions) ? globalThis.String(object.annual_provisions) : "", + }; + }, + + toJSON(message: Minter): unknown { + const obj: any = {}; + if (message.inflation !== "") { + obj.inflation = message.inflation; + } + if (message.annual_provisions !== "") { + obj.annual_provisions = message.annual_provisions; + } + return obj; + }, + + create, I>>(base?: I): Minter { + return Minter.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Minter { + const message = createBaseMinter(); + message.inflation = object.inflation ?? ""; + message.annual_provisions = object.annual_provisions ?? ""; + return message; + }, +}; + +export const Params: MessageFns = { + $type: "cosmos.mint.v1beta1.Params" as const, + + encode(message: Params, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.mint_denom !== "") { + writer.uint32(10).string(message.mint_denom); + } + if (message.inflation_rate_change !== "") { + writer.uint32(18).string(message.inflation_rate_change); + } + if (message.inflation_max !== "") { + writer.uint32(26).string(message.inflation_max); + } + if (message.inflation_min !== "") { + writer.uint32(34).string(message.inflation_min); + } + if (message.goal_bonded !== "") { + writer.uint32(42).string(message.goal_bonded); + } + if (message.blocks_per_year !== 0) { + writer.uint32(48).uint64(message.blocks_per_year); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Params { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.mint_denom = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.inflation_rate_change = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.inflation_max = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.inflation_min = reader.string(); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.goal_bonded = reader.string(); + continue; + case 6: + if (tag !== 48) { + break; + } + + message.blocks_per_year = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Params { + return { + mint_denom: isSet(object.mint_denom) ? globalThis.String(object.mint_denom) : "", + inflation_rate_change: isSet(object.inflation_rate_change) ? globalThis.String(object.inflation_rate_change) : "", + inflation_max: isSet(object.inflation_max) ? globalThis.String(object.inflation_max) : "", + inflation_min: isSet(object.inflation_min) ? globalThis.String(object.inflation_min) : "", + goal_bonded: isSet(object.goal_bonded) ? globalThis.String(object.goal_bonded) : "", + blocks_per_year: isSet(object.blocks_per_year) ? globalThis.Number(object.blocks_per_year) : 0, + }; + }, + + toJSON(message: Params): unknown { + const obj: any = {}; + if (message.mint_denom !== "") { + obj.mint_denom = message.mint_denom; + } + if (message.inflation_rate_change !== "") { + obj.inflation_rate_change = message.inflation_rate_change; + } + if (message.inflation_max !== "") { + obj.inflation_max = message.inflation_max; + } + if (message.inflation_min !== "") { + obj.inflation_min = message.inflation_min; + } + if (message.goal_bonded !== "") { + obj.goal_bonded = message.goal_bonded; + } + if (message.blocks_per_year !== 0) { + obj.blocks_per_year = Math.round(message.blocks_per_year); + } + return obj; + }, + + create, I>>(base?: I): Params { + return Params.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Params { + const message = createBaseParams(); + message.mint_denom = object.mint_denom ?? ""; + message.inflation_rate_change = object.inflation_rate_change ?? ""; + message.inflation_max = object.inflation_max ?? ""; + message.inflation_min = object.inflation_min ?? ""; + message.goal_bonded = object.goal_bonded ?? ""; + message.blocks_per_year = object.blocks_per_year ?? 0; + return message; + }, +}; + +function createBaseMinter(): Minter { + return { inflation: "", annual_provisions: "" }; +} + +function createBaseParams(): Params { + return { + mint_denom: "", + inflation_rate_change: "", + inflation_max: "", + inflation_min: "", + goal_bonded: "", + blocks_per_year: 0, + }; +} + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} +export const registry: Array<[string, GeneratedType]> = [ + ["/cosmos.mint.v1beta1.Minter", Minter as never], + ["/cosmos.mint.v1beta1.Params", Params as never], +]; +export const aminoConverters = { + "/cosmos.mint.v1beta1.Minter": { + aminoType: "cosmos-sdk/Minter", + toAmino: (message: Minter) => ({ ...message }), + fromAmino: (object: Minter) => ({ ...object }), + }, + + "/cosmos.mint.v1beta1.Params": { + aminoType: "cosmos-sdk/Params", + toAmino: (message: Params) => ({ ...message }), + fromAmino: (object: Params) => ({ ...object }), + }, +}; diff --git a/packages/cosmos/generated/encoding/cosmos/mint/v1beta1/query.ts b/packages/cosmos/generated/encoding/cosmos/mint/v1beta1/query.ts new file mode 100644 index 000000000..bdb8a725d --- /dev/null +++ b/packages/cosmos/generated/encoding/cosmos/mint/v1beta1/query.ts @@ -0,0 +1,397 @@ +import type { GeneratedType } from "@cosmjs/proto-signing"; + +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +import { Params } from "./mint"; + +import type { + QueryAnnualProvisionsRequest as QueryAnnualProvisionsRequest_type, + QueryAnnualProvisionsResponse as QueryAnnualProvisionsResponse_type, + QueryInflationRequest as QueryInflationRequest_type, + QueryInflationResponse as QueryInflationResponse_type, + QueryParamsRequest as QueryParamsRequest_type, + QueryParamsResponse as QueryParamsResponse_type, +} from "../../../../types/cosmos/mint/v1beta1"; + +import type { DeepPartial, Exact, MessageFns } from "../../../common"; + +export interface QueryParamsRequest extends QueryParamsRequest_type {} +export interface QueryParamsResponse extends QueryParamsResponse_type {} +export interface QueryInflationRequest extends QueryInflationRequest_type {} +export interface QueryInflationResponse extends QueryInflationResponse_type {} +export interface QueryAnnualProvisionsRequest extends QueryAnnualProvisionsRequest_type {} +export interface QueryAnnualProvisionsResponse extends QueryAnnualProvisionsResponse_type {} + +export const QueryParamsRequest: MessageFns = { + $type: "cosmos.mint.v1beta1.QueryParamsRequest" as const, + + encode(_: QueryParamsRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryParamsRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryParamsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): QueryParamsRequest { + return {}; + }, + + toJSON(_: QueryParamsRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): QueryParamsRequest { + return QueryParamsRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): QueryParamsRequest { + const message = createBaseQueryParamsRequest(); + return message; + }, +}; + +export const QueryParamsResponse: MessageFns = { + $type: "cosmos.mint.v1beta1.QueryParamsResponse" as const, + + encode(message: QueryParamsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryParamsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryParamsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.params = Params.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryParamsResponse { + return { params: isSet(object.params) ? Params.fromJSON(object.params) : undefined }; + }, + + toJSON(message: QueryParamsResponse): unknown { + const obj: any = {}; + if (message.params !== undefined) { + obj.params = Params.toJSON(message.params); + } + return obj; + }, + + create, I>>(base?: I): QueryParamsResponse { + return QueryParamsResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryParamsResponse { + const message = createBaseQueryParamsResponse(); + message.params = object.params !== undefined && object.params !== null ? Params.fromPartial(object.params) : undefined; + return message; + }, +}; + +export const QueryInflationRequest: MessageFns = { + $type: "cosmos.mint.v1beta1.QueryInflationRequest" as const, + + encode(_: QueryInflationRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryInflationRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryInflationRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): QueryInflationRequest { + return {}; + }, + + toJSON(_: QueryInflationRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): QueryInflationRequest { + return QueryInflationRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): QueryInflationRequest { + const message = createBaseQueryInflationRequest(); + return message; + }, +}; + +export const QueryInflationResponse: MessageFns = { + $type: "cosmos.mint.v1beta1.QueryInflationResponse" as const, + + encode(message: QueryInflationResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.inflation.length !== 0) { + writer.uint32(10).bytes(message.inflation); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryInflationResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryInflationResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.inflation = reader.bytes(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryInflationResponse { + return { inflation: isSet(object.inflation) ? bytesFromBase64(object.inflation) : new Uint8Array(0) }; + }, + + toJSON(message: QueryInflationResponse): unknown { + const obj: any = {}; + if (message.inflation.length !== 0) { + obj.inflation = base64FromBytes(message.inflation); + } + return obj; + }, + + create, I>>(base?: I): QueryInflationResponse { + return QueryInflationResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryInflationResponse { + const message = createBaseQueryInflationResponse(); + message.inflation = object.inflation ?? new Uint8Array(0); + return message; + }, +}; + +export const QueryAnnualProvisionsRequest: MessageFns = { + $type: "cosmos.mint.v1beta1.QueryAnnualProvisionsRequest" as const, + + encode(_: QueryAnnualProvisionsRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryAnnualProvisionsRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryAnnualProvisionsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): QueryAnnualProvisionsRequest { + return {}; + }, + + toJSON(_: QueryAnnualProvisionsRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): QueryAnnualProvisionsRequest { + return QueryAnnualProvisionsRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): QueryAnnualProvisionsRequest { + const message = createBaseQueryAnnualProvisionsRequest(); + return message; + }, +}; + +export const QueryAnnualProvisionsResponse: MessageFns = { + $type: "cosmos.mint.v1beta1.QueryAnnualProvisionsResponse" as const, + + encode(message: QueryAnnualProvisionsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.annual_provisions.length !== 0) { + writer.uint32(10).bytes(message.annual_provisions); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryAnnualProvisionsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryAnnualProvisionsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.annual_provisions = reader.bytes(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryAnnualProvisionsResponse { + return { + annual_provisions: isSet(object.annual_provisions) ? bytesFromBase64(object.annual_provisions) : new Uint8Array(0), + }; + }, + + toJSON(message: QueryAnnualProvisionsResponse): unknown { + const obj: any = {}; + if (message.annual_provisions.length !== 0) { + obj.annual_provisions = base64FromBytes(message.annual_provisions); + } + return obj; + }, + + create, I>>(base?: I): QueryAnnualProvisionsResponse { + return QueryAnnualProvisionsResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryAnnualProvisionsResponse { + const message = createBaseQueryAnnualProvisionsResponse(); + message.annual_provisions = object.annual_provisions ?? new Uint8Array(0); + return message; + }, +}; + +function createBaseQueryParamsRequest(): QueryParamsRequest { + return {}; +} + +function createBaseQueryParamsResponse(): QueryParamsResponse { + return { params: undefined }; +} + +function createBaseQueryInflationRequest(): QueryInflationRequest { + return {}; +} + +function createBaseQueryInflationResponse(): QueryInflationResponse { + return { inflation: new Uint8Array(0) }; +} + +function createBaseQueryAnnualProvisionsRequest(): QueryAnnualProvisionsRequest { + return {}; +} + +function createBaseQueryAnnualProvisionsResponse(): QueryAnnualProvisionsResponse { + return { annual_provisions: new Uint8Array(0) }; +} + +function bytesFromBase64(b64: string): Uint8Array { + if ((globalThis as any).Buffer) { + return Uint8Array.from(globalThis.Buffer.from(b64, "base64")); + } else { + const bin = globalThis.atob(b64); + const arr = new Uint8Array(bin.length); + for (let i = 0; i < bin.length; ++i) { + arr[i] = bin.charCodeAt(i); + } + return arr; + } +} + +function base64FromBytes(arr: Uint8Array): string { + if ((globalThis as any).Buffer) { + return globalThis.Buffer.from(arr).toString("base64"); + } else { + const bin: string[] = []; + arr.forEach((byte) => { + bin.push(globalThis.String.fromCharCode(byte)); + }); + return globalThis.btoa(bin.join("")); + } +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} +export const registry: Array<[string, GeneratedType]> = [ + ["/cosmos.mint.v1beta1.QueryParamsRequest", QueryParamsRequest as never], + ["/cosmos.mint.v1beta1.QueryParamsResponse", QueryParamsResponse as never], + ["/cosmos.mint.v1beta1.QueryInflationRequest", QueryInflationRequest as never], + ["/cosmos.mint.v1beta1.QueryInflationResponse", QueryInflationResponse as never], +]; +export const aminoConverters = { + "/cosmos.mint.v1beta1.QueryParamsRequest": { + aminoType: "cosmos-sdk/QueryParamsRequest", + toAmino: (message: QueryParamsRequest) => ({ ...message }), + fromAmino: (object: QueryParamsRequest) => ({ ...object }), + }, + + "/cosmos.mint.v1beta1.QueryParamsResponse": { + aminoType: "cosmos-sdk/QueryParamsResponse", + toAmino: (message: QueryParamsResponse) => ({ ...message }), + fromAmino: (object: QueryParamsResponse) => ({ ...object }), + }, + + "/cosmos.mint.v1beta1.QueryInflationRequest": { + aminoType: "cosmos-sdk/QueryInflationRequest", + toAmino: (message: QueryInflationRequest) => ({ ...message }), + fromAmino: (object: QueryInflationRequest) => ({ ...object }), + }, + + "/cosmos.mint.v1beta1.QueryInflationResponse": { + aminoType: "cosmos-sdk/QueryInflationResponse", + toAmino: (message: QueryInflationResponse) => ({ ...message }), + fromAmino: (object: QueryInflationResponse) => ({ ...object }), + }, +}; diff --git a/packages/cosmos/generated/encoding/cosmos/params/types/index.ts b/packages/cosmos/generated/encoding/cosmos/params/types/index.ts new file mode 100644 index 000000000..316cec4f0 --- /dev/null +++ b/packages/cosmos/generated/encoding/cosmos/params/types/index.ts @@ -0,0 +1,3 @@ +// @ts-nocheck + +export * from './types'; \ No newline at end of file diff --git a/packages/cosmos/generated/encoding/cosmos/params/types/types.ts b/packages/cosmos/generated/encoding/cosmos/params/types/types.ts new file mode 100644 index 000000000..55c729117 --- /dev/null +++ b/packages/cosmos/generated/encoding/cosmos/params/types/types.ts @@ -0,0 +1,272 @@ +import type { GeneratedType } from "@cosmjs/proto-signing"; + +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +import { DecCoin } from "../../base/v1beta1/coin"; + +import type { + CosmosGasParams as CosmosGasParams_type, + FeesParams as FeesParams_type, + GenesisState as GenesisState_type, +} from "../../../../types/cosmos/params/types"; + +import type { DeepPartial, Exact, MessageFns } from "../../../common"; + +export interface FeesParams extends FeesParams_type {} +export interface CosmosGasParams extends CosmosGasParams_type {} +export interface GenesisState extends GenesisState_type {} + +export const FeesParams: MessageFns = { + $type: "cosmos.params.v1beta1.FeesParams" as const, + + encode(message: FeesParams, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.global_minimum_gas_prices) { + DecCoin.encode(v!, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): FeesParams { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseFeesParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.global_minimum_gas_prices.push(DecCoin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): FeesParams { + return { + global_minimum_gas_prices: globalThis.Array.isArray(object?.global_minimum_gas_prices) + ? object.global_minimum_gas_prices.map((e: any) => DecCoin.fromJSON(e)) + : [], + }; + }, + + toJSON(message: FeesParams): unknown { + const obj: any = {}; + if (message.global_minimum_gas_prices?.length) { + obj.global_minimum_gas_prices = message.global_minimum_gas_prices.map((e) => DecCoin.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): FeesParams { + return FeesParams.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): FeesParams { + const message = createBaseFeesParams(); + message.global_minimum_gas_prices = object.global_minimum_gas_prices?.map((e) => DecCoin.fromPartial(e)) || []; + return message; + }, +}; + +export const CosmosGasParams: MessageFns = { + $type: "cosmos.params.v1beta1.CosmosGasParams" as const, + + encode(message: CosmosGasParams, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.cosmos_gas_multiplier_numerator !== 0) { + writer.uint32(8).uint64(message.cosmos_gas_multiplier_numerator); + } + if (message.cosmos_gas_multiplier_denominator !== 0) { + writer.uint32(16).uint64(message.cosmos_gas_multiplier_denominator); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): CosmosGasParams { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseCosmosGasParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.cosmos_gas_multiplier_numerator = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.cosmos_gas_multiplier_denominator = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): CosmosGasParams { + return { + cosmos_gas_multiplier_numerator: isSet(object.cosmos_gas_multiplier_numerator) ? globalThis.Number(object.cosmos_gas_multiplier_numerator) : 0, + cosmos_gas_multiplier_denominator: isSet(object.cosmos_gas_multiplier_denominator) ? globalThis.Number(object.cosmos_gas_multiplier_denominator) : 0, + }; + }, + + toJSON(message: CosmosGasParams): unknown { + const obj: any = {}; + if (message.cosmos_gas_multiplier_numerator !== 0) { + obj.cosmos_gas_multiplier_numerator = Math.round(message.cosmos_gas_multiplier_numerator); + } + if (message.cosmos_gas_multiplier_denominator !== 0) { + obj.cosmos_gas_multiplier_denominator = Math.round(message.cosmos_gas_multiplier_denominator); + } + return obj; + }, + + create, I>>(base?: I): CosmosGasParams { + return CosmosGasParams.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): CosmosGasParams { + const message = createBaseCosmosGasParams(); + message.cosmos_gas_multiplier_numerator = object.cosmos_gas_multiplier_numerator ?? 0; + message.cosmos_gas_multiplier_denominator = object.cosmos_gas_multiplier_denominator ?? 0; + return message; + }, +}; + +export const GenesisState: MessageFns = { + $type: "cosmos.params.v1beta1.GenesisState" as const, + + encode(message: GenesisState, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.fees_params !== undefined) { + FeesParams.encode(message.fees_params, writer.uint32(10).fork()).join(); + } + if (message.cosmos_gas_params !== undefined) { + CosmosGasParams.encode(message.cosmos_gas_params, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GenesisState { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGenesisState(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.fees_params = FeesParams.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.cosmos_gas_params = CosmosGasParams.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GenesisState { + return { + fees_params: isSet(object.fees_params) ? FeesParams.fromJSON(object.fees_params) : undefined, + cosmos_gas_params: isSet(object.cosmos_gas_params) ? CosmosGasParams.fromJSON(object.cosmos_gas_params) : undefined, + }; + }, + + toJSON(message: GenesisState): unknown { + const obj: any = {}; + if (message.fees_params !== undefined) { + obj.fees_params = FeesParams.toJSON(message.fees_params); + } + if (message.cosmos_gas_params !== undefined) { + obj.cosmos_gas_params = CosmosGasParams.toJSON(message.cosmos_gas_params); + } + return obj; + }, + + create, I>>(base?: I): GenesisState { + return GenesisState.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): GenesisState { + const message = createBaseGenesisState(); + message.fees_params = object.fees_params !== undefined && object.fees_params !== null ? FeesParams.fromPartial(object.fees_params) : undefined; + message.cosmos_gas_params = + object.cosmos_gas_params !== undefined && object.cosmos_gas_params !== null ? CosmosGasParams.fromPartial(object.cosmos_gas_params) : undefined; + return message; + }, +}; + +function createBaseFeesParams(): FeesParams { + return { global_minimum_gas_prices: [] }; +} + +function createBaseCosmosGasParams(): CosmosGasParams { + return { cosmos_gas_multiplier_numerator: 0, cosmos_gas_multiplier_denominator: 0 }; +} + +function createBaseGenesisState(): GenesisState { + return { fees_params: undefined, cosmos_gas_params: undefined }; +} + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} +export const registry: Array<[string, GeneratedType]> = [ + ["/cosmos.params.v1beta1.FeesParams", FeesParams as never], + ["/cosmos.params.v1beta1.CosmosGasParams", CosmosGasParams as never], + ["/cosmos.params.v1beta1.GenesisState", GenesisState as never], +]; +export const aminoConverters = { + "/cosmos.params.v1beta1.FeesParams": { + aminoType: "cosmos-sdk/FeesParams", + toAmino: (message: FeesParams) => ({ ...message }), + fromAmino: (object: FeesParams) => ({ ...object }), + }, + + "/cosmos.params.v1beta1.CosmosGasParams": { + aminoType: "cosmos-sdk/CosmosGasParams", + toAmino: (message: CosmosGasParams) => ({ ...message }), + fromAmino: (object: CosmosGasParams) => ({ ...object }), + }, + + "/cosmos.params.v1beta1.GenesisState": { + aminoType: "cosmos-sdk/GenesisState", + toAmino: (message: GenesisState) => ({ ...message }), + fromAmino: (object: GenesisState) => ({ ...object }), + }, +}; diff --git a/packages/cosmos/generated/encoding/cosmos/params/v1beta1/index.ts b/packages/cosmos/generated/encoding/cosmos/params/v1beta1/index.ts new file mode 100644 index 000000000..7aaa19318 --- /dev/null +++ b/packages/cosmos/generated/encoding/cosmos/params/v1beta1/index.ts @@ -0,0 +1,4 @@ +// @ts-nocheck + +export * from './params'; +export * from './query'; \ No newline at end of file diff --git a/packages/cosmos/generated/encoding/cosmos/params/v1beta1/params.ts b/packages/cosmos/generated/encoding/cosmos/params/v1beta1/params.ts new file mode 100644 index 000000000..3ebda1357 --- /dev/null +++ b/packages/cosmos/generated/encoding/cosmos/params/v1beta1/params.ts @@ -0,0 +1,219 @@ +import type { GeneratedType } from "@cosmjs/proto-signing"; + +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +import type { ParamChange as ParamChange_type, ParameterChangeProposal as ParameterChangeProposal_type } from "../../../../types/cosmos/params/v1beta1"; + +import type { DeepPartial, Exact, MessageFns } from "../../../common"; + +export interface ParameterChangeProposal extends ParameterChangeProposal_type {} +export interface ParamChange extends ParamChange_type {} + +export const ParameterChangeProposal: MessageFns = { + $type: "cosmos.params.v1beta1.ParameterChangeProposal" as const, + + encode(message: ParameterChangeProposal, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.title !== "") { + writer.uint32(10).string(message.title); + } + if (message.description !== "") { + writer.uint32(18).string(message.description); + } + for (const v of message.changes) { + ParamChange.encode(v!, writer.uint32(26).fork()).join(); + } + if (message.is_expedited !== false) { + writer.uint32(32).bool(message.is_expedited); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ParameterChangeProposal { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseParameterChangeProposal(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.title = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.description = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.changes.push(ParamChange.decode(reader, reader.uint32())); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.is_expedited = reader.bool(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ParameterChangeProposal { + return { + title: isSet(object.title) ? globalThis.String(object.title) : "", + description: isSet(object.description) ? globalThis.String(object.description) : "", + changes: globalThis.Array.isArray(object?.changes) ? object.changes.map((e: any) => ParamChange.fromJSON(e)) : [], + is_expedited: isSet(object.is_expedited) ? globalThis.Boolean(object.is_expedited) : false, + }; + }, + + toJSON(message: ParameterChangeProposal): unknown { + const obj: any = {}; + if (message.title !== "") { + obj.title = message.title; + } + if (message.description !== "") { + obj.description = message.description; + } + if (message.changes?.length) { + obj.changes = message.changes.map((e) => ParamChange.toJSON(e)); + } + if (message.is_expedited !== false) { + obj.is_expedited = message.is_expedited; + } + return obj; + }, + + create, I>>(base?: I): ParameterChangeProposal { + return ParameterChangeProposal.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ParameterChangeProposal { + const message = createBaseParameterChangeProposal(); + message.title = object.title ?? ""; + message.description = object.description ?? ""; + message.changes = object.changes?.map((e) => ParamChange.fromPartial(e)) || []; + message.is_expedited = object.is_expedited ?? false; + return message; + }, +}; + +export const ParamChange: MessageFns = { + $type: "cosmos.params.v1beta1.ParamChange" as const, + + encode(message: ParamChange, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.subspace !== "") { + writer.uint32(10).string(message.subspace); + } + if (message.key !== "") { + writer.uint32(18).string(message.key); + } + if (message.value !== "") { + writer.uint32(26).string(message.value); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ParamChange { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseParamChange(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.subspace = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.key = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.value = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ParamChange { + return { + subspace: isSet(object.subspace) ? globalThis.String(object.subspace) : "", + key: isSet(object.key) ? globalThis.String(object.key) : "", + value: isSet(object.value) ? globalThis.String(object.value) : "", + }; + }, + + toJSON(message: ParamChange): unknown { + const obj: any = {}; + if (message.subspace !== "") { + obj.subspace = message.subspace; + } + if (message.key !== "") { + obj.key = message.key; + } + if (message.value !== "") { + obj.value = message.value; + } + return obj; + }, + + create, I>>(base?: I): ParamChange { + return ParamChange.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ParamChange { + const message = createBaseParamChange(); + message.subspace = object.subspace ?? ""; + message.key = object.key ?? ""; + message.value = object.value ?? ""; + return message; + }, +}; + +function createBaseParameterChangeProposal(): ParameterChangeProposal { + return { title: "", description: "", changes: [], is_expedited: false }; +} + +function createBaseParamChange(): ParamChange { + return { subspace: "", key: "", value: "" }; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} +export const registry: Array<[string, GeneratedType]> = [["/cosmos.params.v1beta1.ParamChange", ParamChange as never]]; +export const aminoConverters = { + "/cosmos.params.v1beta1.ParamChange": { + aminoType: "cosmos-sdk/ParamChange", + toAmino: (message: ParamChange) => ({ ...message }), + fromAmino: (object: ParamChange) => ({ ...object }), + }, +}; diff --git a/packages/cosmos/generated/encoding/cosmos/params/v1beta1/query.ts b/packages/cosmos/generated/encoding/cosmos/params/v1beta1/query.ts new file mode 100644 index 000000000..902adfb91 --- /dev/null +++ b/packages/cosmos/generated/encoding/cosmos/params/v1beta1/query.ts @@ -0,0 +1,168 @@ +import type { GeneratedType } from "@cosmjs/proto-signing"; + +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +import { ParamChange } from "./params"; + +import type { QueryParamsRequest as QueryParamsRequest_type, QueryParamsResponse as QueryParamsResponse_type } from "../../../../types/cosmos/params/v1beta1"; + +import type { DeepPartial, Exact, MessageFns } from "../../../common"; + +export interface QueryParamsRequest extends QueryParamsRequest_type {} +export interface QueryParamsResponse extends QueryParamsResponse_type {} + +export const QueryParamsRequest: MessageFns = { + $type: "cosmos.params.v1beta1.QueryParamsRequest" as const, + + encode(message: QueryParamsRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.subspace !== "") { + writer.uint32(10).string(message.subspace); + } + if (message.key !== "") { + writer.uint32(18).string(message.key); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryParamsRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryParamsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.subspace = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.key = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryParamsRequest { + return { + subspace: isSet(object.subspace) ? globalThis.String(object.subspace) : "", + key: isSet(object.key) ? globalThis.String(object.key) : "", + }; + }, + + toJSON(message: QueryParamsRequest): unknown { + const obj: any = {}; + if (message.subspace !== "") { + obj.subspace = message.subspace; + } + if (message.key !== "") { + obj.key = message.key; + } + return obj; + }, + + create, I>>(base?: I): QueryParamsRequest { + return QueryParamsRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryParamsRequest { + const message = createBaseQueryParamsRequest(); + message.subspace = object.subspace ?? ""; + message.key = object.key ?? ""; + return message; + }, +}; + +export const QueryParamsResponse: MessageFns = { + $type: "cosmos.params.v1beta1.QueryParamsResponse" as const, + + encode(message: QueryParamsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.param !== undefined) { + ParamChange.encode(message.param, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryParamsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryParamsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.param = ParamChange.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryParamsResponse { + return { param: isSet(object.param) ? ParamChange.fromJSON(object.param) : undefined }; + }, + + toJSON(message: QueryParamsResponse): unknown { + const obj: any = {}; + if (message.param !== undefined) { + obj.param = ParamChange.toJSON(message.param); + } + return obj; + }, + + create, I>>(base?: I): QueryParamsResponse { + return QueryParamsResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryParamsResponse { + const message = createBaseQueryParamsResponse(); + message.param = object.param !== undefined && object.param !== null ? ParamChange.fromPartial(object.param) : undefined; + return message; + }, +}; + +function createBaseQueryParamsRequest(): QueryParamsRequest { + return { subspace: "", key: "" }; +} + +function createBaseQueryParamsResponse(): QueryParamsResponse { + return { param: undefined }; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} +export const registry: Array<[string, GeneratedType]> = [ + ["/cosmos.params.v1beta1.QueryParamsRequest", QueryParamsRequest as never], + ["/cosmos.params.v1beta1.QueryParamsResponse", QueryParamsResponse as never], +]; +export const aminoConverters = { + "/cosmos.params.v1beta1.QueryParamsRequest": { + aminoType: "cosmos-sdk/QueryParamsRequest", + toAmino: (message: QueryParamsRequest) => ({ ...message }), + fromAmino: (object: QueryParamsRequest) => ({ ...object }), + }, + + "/cosmos.params.v1beta1.QueryParamsResponse": { + aminoType: "cosmos-sdk/QueryParamsResponse", + toAmino: (message: QueryParamsResponse) => ({ ...message }), + fromAmino: (object: QueryParamsResponse) => ({ ...object }), + }, +}; diff --git a/packages/cosmos/generated/encoding/cosmos/slashing/v1beta1/genesis.ts b/packages/cosmos/generated/encoding/cosmos/slashing/v1beta1/genesis.ts new file mode 100644 index 000000000..777efc582 --- /dev/null +++ b/packages/cosmos/generated/encoding/cosmos/slashing/v1beta1/genesis.ts @@ -0,0 +1,671 @@ +import type { GeneratedType } from "@cosmjs/proto-signing"; + +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +import { + Params, + ValidatorMissedBlockArray, + ValidatorMissedBlockArrayLegacyMissedHeights, + ValidatorSigningInfo, + ValidatorSigningInfoLegacyMissedHeights, +} from "./slashing"; + +import type { + GenesisStateLegacyMissingHeights as GenesisStateLegacyMissingHeights_type, + GenesisStateLegacyV43 as GenesisStateLegacyV43_type, + GenesisState as GenesisState_type, + MissedBlock as MissedBlock_type, + SigningInfoLegacyMissedHeights as SigningInfoLegacyMissedHeights_type, + SigningInfo as SigningInfo_type, + ValidatorMissedBlocks as ValidatorMissedBlocks_type, +} from "../../../../types/cosmos/slashing/v1beta1"; + +import type { DeepPartial, Exact, MessageFns } from "../../../common"; + +export interface GenesisState extends GenesisState_type {} +export interface GenesisStateLegacyMissingHeights extends GenesisStateLegacyMissingHeights_type {} +export interface GenesisStateLegacyV43 extends GenesisStateLegacyV43_type {} +export interface SigningInfo extends SigningInfo_type {} +export interface SigningInfoLegacyMissedHeights extends SigningInfoLegacyMissedHeights_type {} +export interface ValidatorMissedBlocks extends ValidatorMissedBlocks_type {} +export interface MissedBlock extends MissedBlock_type {} + +export const GenesisState: MessageFns = { + $type: "cosmos.slashing.v1beta1.GenesisState" as const, + + encode(message: GenesisState, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(10).fork()).join(); + } + for (const v of message.signing_infos) { + SigningInfo.encode(v!, writer.uint32(18).fork()).join(); + } + for (const v of message.missed_blocks) { + ValidatorMissedBlockArray.encode(v!, writer.uint32(26).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GenesisState { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGenesisState(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.params = Params.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.signing_infos.push(SigningInfo.decode(reader, reader.uint32())); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.missed_blocks.push(ValidatorMissedBlockArray.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GenesisState { + return { + params: isSet(object.params) ? Params.fromJSON(object.params) : undefined, + signing_infos: globalThis.Array.isArray(object?.signing_infos) ? object.signing_infos.map((e: any) => SigningInfo.fromJSON(e)) : [], + missed_blocks: globalThis.Array.isArray(object?.missed_blocks) ? object.missed_blocks.map((e: any) => ValidatorMissedBlockArray.fromJSON(e)) : [], + }; + }, + + toJSON(message: GenesisState): unknown { + const obj: any = {}; + if (message.params !== undefined) { + obj.params = Params.toJSON(message.params); + } + if (message.signing_infos?.length) { + obj.signing_infos = message.signing_infos.map((e) => SigningInfo.toJSON(e)); + } + if (message.missed_blocks?.length) { + obj.missed_blocks = message.missed_blocks.map((e) => ValidatorMissedBlockArray.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): GenesisState { + return GenesisState.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): GenesisState { + const message = createBaseGenesisState(); + message.params = object.params !== undefined && object.params !== null ? Params.fromPartial(object.params) : undefined; + message.signing_infos = object.signing_infos?.map((e) => SigningInfo.fromPartial(e)) || []; + message.missed_blocks = object.missed_blocks?.map((e) => ValidatorMissedBlockArray.fromPartial(e)) || []; + return message; + }, +}; + +export const GenesisStateLegacyMissingHeights: MessageFns = { + $type: "cosmos.slashing.v1beta1.GenesisStateLegacyMissingHeights" as const, + + encode(message: GenesisStateLegacyMissingHeights, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(10).fork()).join(); + } + for (const v of message.signing_infos) { + SigningInfo.encode(v!, writer.uint32(18).fork()).join(); + } + for (const v of message.missed_blocks) { + ValidatorMissedBlockArrayLegacyMissedHeights.encode(v!, writer.uint32(26).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GenesisStateLegacyMissingHeights { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGenesisStateLegacyMissingHeights(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.params = Params.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.signing_infos.push(SigningInfo.decode(reader, reader.uint32())); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.missed_blocks.push(ValidatorMissedBlockArrayLegacyMissedHeights.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GenesisStateLegacyMissingHeights { + return { + params: isSet(object.params) ? Params.fromJSON(object.params) : undefined, + signing_infos: globalThis.Array.isArray(object?.signing_infos) ? object.signing_infos.map((e: any) => SigningInfo.fromJSON(e)) : [], + missed_blocks: globalThis.Array.isArray(object?.missed_blocks) + ? object.missed_blocks.map((e: any) => ValidatorMissedBlockArrayLegacyMissedHeights.fromJSON(e)) + : [], + }; + }, + + toJSON(message: GenesisStateLegacyMissingHeights): unknown { + const obj: any = {}; + if (message.params !== undefined) { + obj.params = Params.toJSON(message.params); + } + if (message.signing_infos?.length) { + obj.signing_infos = message.signing_infos.map((e) => SigningInfo.toJSON(e)); + } + if (message.missed_blocks?.length) { + obj.missed_blocks = message.missed_blocks.map((e) => ValidatorMissedBlockArrayLegacyMissedHeights.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): GenesisStateLegacyMissingHeights { + return GenesisStateLegacyMissingHeights.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): GenesisStateLegacyMissingHeights { + const message = createBaseGenesisStateLegacyMissingHeights(); + message.params = object.params !== undefined && object.params !== null ? Params.fromPartial(object.params) : undefined; + message.signing_infos = object.signing_infos?.map((e) => SigningInfo.fromPartial(e)) || []; + message.missed_blocks = object.missed_blocks?.map((e) => ValidatorMissedBlockArrayLegacyMissedHeights.fromPartial(e)) || []; + return message; + }, +}; + +export const GenesisStateLegacyV43: MessageFns = { + $type: "cosmos.slashing.v1beta1.GenesisStateLegacyV43" as const, + + encode(message: GenesisStateLegacyV43, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(10).fork()).join(); + } + for (const v of message.signing_infos) { + SigningInfo.encode(v!, writer.uint32(18).fork()).join(); + } + for (const v of message.missed_blocks) { + ValidatorMissedBlocks.encode(v!, writer.uint32(26).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GenesisStateLegacyV43 { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGenesisStateLegacyV43(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.params = Params.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.signing_infos.push(SigningInfo.decode(reader, reader.uint32())); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.missed_blocks.push(ValidatorMissedBlocks.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GenesisStateLegacyV43 { + return { + params: isSet(object.params) ? Params.fromJSON(object.params) : undefined, + signing_infos: globalThis.Array.isArray(object?.signing_infos) ? object.signing_infos.map((e: any) => SigningInfo.fromJSON(e)) : [], + missed_blocks: globalThis.Array.isArray(object?.missed_blocks) ? object.missed_blocks.map((e: any) => ValidatorMissedBlocks.fromJSON(e)) : [], + }; + }, + + toJSON(message: GenesisStateLegacyV43): unknown { + const obj: any = {}; + if (message.params !== undefined) { + obj.params = Params.toJSON(message.params); + } + if (message.signing_infos?.length) { + obj.signing_infos = message.signing_infos.map((e) => SigningInfo.toJSON(e)); + } + if (message.missed_blocks?.length) { + obj.missed_blocks = message.missed_blocks.map((e) => ValidatorMissedBlocks.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): GenesisStateLegacyV43 { + return GenesisStateLegacyV43.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): GenesisStateLegacyV43 { + const message = createBaseGenesisStateLegacyV43(); + message.params = object.params !== undefined && object.params !== null ? Params.fromPartial(object.params) : undefined; + message.signing_infos = object.signing_infos?.map((e) => SigningInfo.fromPartial(e)) || []; + message.missed_blocks = object.missed_blocks?.map((e) => ValidatorMissedBlocks.fromPartial(e)) || []; + return message; + }, +}; + +export const SigningInfo: MessageFns = { + $type: "cosmos.slashing.v1beta1.SigningInfo" as const, + + encode(message: SigningInfo, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.address !== "") { + writer.uint32(10).string(message.address); + } + if (message.validator_signing_info !== undefined) { + ValidatorSigningInfo.encode(message.validator_signing_info, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): SigningInfo { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseSigningInfo(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.address = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.validator_signing_info = ValidatorSigningInfo.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): SigningInfo { + return { + address: isSet(object.address) ? globalThis.String(object.address) : "", + validator_signing_info: isSet(object.validator_signing_info) ? ValidatorSigningInfo.fromJSON(object.validator_signing_info) : undefined, + }; + }, + + toJSON(message: SigningInfo): unknown { + const obj: any = {}; + if (message.address !== "") { + obj.address = message.address; + } + if (message.validator_signing_info !== undefined) { + obj.validator_signing_info = ValidatorSigningInfo.toJSON(message.validator_signing_info); + } + return obj; + }, + + create, I>>(base?: I): SigningInfo { + return SigningInfo.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): SigningInfo { + const message = createBaseSigningInfo(); + message.address = object.address ?? ""; + message.validator_signing_info = + object.validator_signing_info !== undefined && object.validator_signing_info !== null + ? ValidatorSigningInfo.fromPartial(object.validator_signing_info) + : undefined; + return message; + }, +}; + +export const SigningInfoLegacyMissedHeights: MessageFns = { + $type: "cosmos.slashing.v1beta1.SigningInfoLegacyMissedHeights" as const, + + encode(message: SigningInfoLegacyMissedHeights, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.address !== "") { + writer.uint32(10).string(message.address); + } + if (message.validator_signing_info !== undefined) { + ValidatorSigningInfoLegacyMissedHeights.encode(message.validator_signing_info, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): SigningInfoLegacyMissedHeights { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseSigningInfoLegacyMissedHeights(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.address = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.validator_signing_info = ValidatorSigningInfoLegacyMissedHeights.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): SigningInfoLegacyMissedHeights { + return { + address: isSet(object.address) ? globalThis.String(object.address) : "", + validator_signing_info: isSet(object.validator_signing_info) + ? ValidatorSigningInfoLegacyMissedHeights.fromJSON(object.validator_signing_info) + : undefined, + }; + }, + + toJSON(message: SigningInfoLegacyMissedHeights): unknown { + const obj: any = {}; + if (message.address !== "") { + obj.address = message.address; + } + if (message.validator_signing_info !== undefined) { + obj.validator_signing_info = ValidatorSigningInfoLegacyMissedHeights.toJSON(message.validator_signing_info); + } + return obj; + }, + + create, I>>(base?: I): SigningInfoLegacyMissedHeights { + return SigningInfoLegacyMissedHeights.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): SigningInfoLegacyMissedHeights { + const message = createBaseSigningInfoLegacyMissedHeights(); + message.address = object.address ?? ""; + message.validator_signing_info = + object.validator_signing_info !== undefined && object.validator_signing_info !== null + ? ValidatorSigningInfoLegacyMissedHeights.fromPartial(object.validator_signing_info) + : undefined; + return message; + }, +}; + +export const ValidatorMissedBlocks: MessageFns = { + $type: "cosmos.slashing.v1beta1.ValidatorMissedBlocks" as const, + + encode(message: ValidatorMissedBlocks, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.address !== "") { + writer.uint32(10).string(message.address); + } + for (const v of message.missed_blocks) { + MissedBlock.encode(v!, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ValidatorMissedBlocks { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseValidatorMissedBlocks(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.address = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.missed_blocks.push(MissedBlock.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ValidatorMissedBlocks { + return { + address: isSet(object.address) ? globalThis.String(object.address) : "", + missed_blocks: globalThis.Array.isArray(object?.missed_blocks) ? object.missed_blocks.map((e: any) => MissedBlock.fromJSON(e)) : [], + }; + }, + + toJSON(message: ValidatorMissedBlocks): unknown { + const obj: any = {}; + if (message.address !== "") { + obj.address = message.address; + } + if (message.missed_blocks?.length) { + obj.missed_blocks = message.missed_blocks.map((e) => MissedBlock.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): ValidatorMissedBlocks { + return ValidatorMissedBlocks.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ValidatorMissedBlocks { + const message = createBaseValidatorMissedBlocks(); + message.address = object.address ?? ""; + message.missed_blocks = object.missed_blocks?.map((e) => MissedBlock.fromPartial(e)) || []; + return message; + }, +}; + +export const MissedBlock: MessageFns = { + $type: "cosmos.slashing.v1beta1.MissedBlock" as const, + + encode(message: MissedBlock, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.index !== 0) { + writer.uint32(8).int64(message.index); + } + if (message.missed !== false) { + writer.uint32(16).bool(message.missed); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MissedBlock { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMissedBlock(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.index = longToNumber(reader.int64()); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.missed = reader.bool(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MissedBlock { + return { + index: isSet(object.index) ? globalThis.Number(object.index) : 0, + missed: isSet(object.missed) ? globalThis.Boolean(object.missed) : false, + }; + }, + + toJSON(message: MissedBlock): unknown { + const obj: any = {}; + if (message.index !== 0) { + obj.index = Math.round(message.index); + } + if (message.missed !== false) { + obj.missed = message.missed; + } + return obj; + }, + + create, I>>(base?: I): MissedBlock { + return MissedBlock.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MissedBlock { + const message = createBaseMissedBlock(); + message.index = object.index ?? 0; + message.missed = object.missed ?? false; + return message; + }, +}; + +function createBaseGenesisState(): GenesisState { + return { params: undefined, signing_infos: [], missed_blocks: [] }; +} + +function createBaseGenesisStateLegacyMissingHeights(): GenesisStateLegacyMissingHeights { + return { params: undefined, signing_infos: [], missed_blocks: [] }; +} + +function createBaseGenesisStateLegacyV43(): GenesisStateLegacyV43 { + return { params: undefined, signing_infos: [], missed_blocks: [] }; +} + +function createBaseSigningInfo(): SigningInfo { + return { address: "", validator_signing_info: undefined }; +} + +function createBaseSigningInfoLegacyMissedHeights(): SigningInfoLegacyMissedHeights { + return { address: "", validator_signing_info: undefined }; +} + +function createBaseValidatorMissedBlocks(): ValidatorMissedBlocks { + return { address: "", missed_blocks: [] }; +} + +function createBaseMissedBlock(): MissedBlock { + return { index: 0, missed: false }; +} + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} +export const registry: Array<[string, GeneratedType]> = [ + ["/cosmos.slashing.v1beta1.GenesisState", GenesisState as never], + ["/cosmos.slashing.v1beta1.GenesisStateLegacyV43", GenesisStateLegacyV43 as never], + ["/cosmos.slashing.v1beta1.SigningInfo", SigningInfo as never], + ["/cosmos.slashing.v1beta1.ValidatorMissedBlocks", ValidatorMissedBlocks as never], + ["/cosmos.slashing.v1beta1.MissedBlock", MissedBlock as never], +]; +export const aminoConverters = { + "/cosmos.slashing.v1beta1.GenesisState": { + aminoType: "cosmos-sdk/GenesisState", + toAmino: (message: GenesisState) => ({ ...message }), + fromAmino: (object: GenesisState) => ({ ...object }), + }, + + "/cosmos.slashing.v1beta1.GenesisStateLegacyV43": { + aminoType: "cosmos-sdk/GenesisStateLegacyV43", + toAmino: (message: GenesisStateLegacyV43) => ({ ...message }), + fromAmino: (object: GenesisStateLegacyV43) => ({ ...object }), + }, + + "/cosmos.slashing.v1beta1.SigningInfo": { + aminoType: "cosmos-sdk/SigningInfo", + toAmino: (message: SigningInfo) => ({ ...message }), + fromAmino: (object: SigningInfo) => ({ ...object }), + }, + + "/cosmos.slashing.v1beta1.ValidatorMissedBlocks": { + aminoType: "cosmos-sdk/ValidatorMissedBlocks", + toAmino: (message: ValidatorMissedBlocks) => ({ ...message }), + fromAmino: (object: ValidatorMissedBlocks) => ({ ...object }), + }, + + "/cosmos.slashing.v1beta1.MissedBlock": { + aminoType: "cosmos-sdk/MissedBlock", + toAmino: (message: MissedBlock) => ({ ...message }), + fromAmino: (object: MissedBlock) => ({ ...object }), + }, +}; diff --git a/packages/cosmos/generated/encoding/cosmos/slashing/v1beta1/index.ts b/packages/cosmos/generated/encoding/cosmos/slashing/v1beta1/index.ts new file mode 100644 index 000000000..811e58511 --- /dev/null +++ b/packages/cosmos/generated/encoding/cosmos/slashing/v1beta1/index.ts @@ -0,0 +1,6 @@ +// @ts-nocheck + +export * from './genesis'; +export * from './query'; +export * from './slashing'; +export * from './tx'; \ No newline at end of file diff --git a/packages/cosmos/generated/encoding/cosmos/slashing/v1beta1/query.ts b/packages/cosmos/generated/encoding/cosmos/slashing/v1beta1/query.ts new file mode 100644 index 000000000..c0efc4a89 --- /dev/null +++ b/packages/cosmos/generated/encoding/cosmos/slashing/v1beta1/query.ts @@ -0,0 +1,406 @@ +import type { GeneratedType } from "@cosmjs/proto-signing"; + +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +import { PageRequest, PageResponse } from "../../base/query/v1beta1/pagination"; + +import { Params, ValidatorSigningInfo } from "./slashing"; + +import type { + QueryParamsRequest as QueryParamsRequest_type, + QueryParamsResponse as QueryParamsResponse_type, + QuerySigningInfoRequest as QuerySigningInfoRequest_type, + QuerySigningInfoResponse as QuerySigningInfoResponse_type, + QuerySigningInfosRequest as QuerySigningInfosRequest_type, + QuerySigningInfosResponse as QuerySigningInfosResponse_type, +} from "../../../../types/cosmos/slashing/v1beta1"; + +import type { DeepPartial, Exact, MessageFns } from "../../../common"; + +export interface QueryParamsRequest extends QueryParamsRequest_type {} +export interface QueryParamsResponse extends QueryParamsResponse_type {} +export interface QuerySigningInfoRequest extends QuerySigningInfoRequest_type {} +export interface QuerySigningInfoResponse extends QuerySigningInfoResponse_type {} +export interface QuerySigningInfosRequest extends QuerySigningInfosRequest_type {} +export interface QuerySigningInfosResponse extends QuerySigningInfosResponse_type {} + +export const QueryParamsRequest: MessageFns = { + $type: "cosmos.slashing.v1beta1.QueryParamsRequest" as const, + + encode(_: QueryParamsRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryParamsRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryParamsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): QueryParamsRequest { + return {}; + }, + + toJSON(_: QueryParamsRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): QueryParamsRequest { + return QueryParamsRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): QueryParamsRequest { + const message = createBaseQueryParamsRequest(); + return message; + }, +}; + +export const QueryParamsResponse: MessageFns = { + $type: "cosmos.slashing.v1beta1.QueryParamsResponse" as const, + + encode(message: QueryParamsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryParamsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryParamsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.params = Params.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryParamsResponse { + return { params: isSet(object.params) ? Params.fromJSON(object.params) : undefined }; + }, + + toJSON(message: QueryParamsResponse): unknown { + const obj: any = {}; + if (message.params !== undefined) { + obj.params = Params.toJSON(message.params); + } + return obj; + }, + + create, I>>(base?: I): QueryParamsResponse { + return QueryParamsResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryParamsResponse { + const message = createBaseQueryParamsResponse(); + message.params = object.params !== undefined && object.params !== null ? Params.fromPartial(object.params) : undefined; + return message; + }, +}; + +export const QuerySigningInfoRequest: MessageFns = { + $type: "cosmos.slashing.v1beta1.QuerySigningInfoRequest" as const, + + encode(message: QuerySigningInfoRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.cons_address !== "") { + writer.uint32(10).string(message.cons_address); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QuerySigningInfoRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQuerySigningInfoRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.cons_address = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QuerySigningInfoRequest { + return { cons_address: isSet(object.cons_address) ? globalThis.String(object.cons_address) : "" }; + }, + + toJSON(message: QuerySigningInfoRequest): unknown { + const obj: any = {}; + if (message.cons_address !== "") { + obj.cons_address = message.cons_address; + } + return obj; + }, + + create, I>>(base?: I): QuerySigningInfoRequest { + return QuerySigningInfoRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QuerySigningInfoRequest { + const message = createBaseQuerySigningInfoRequest(); + message.cons_address = object.cons_address ?? ""; + return message; + }, +}; + +export const QuerySigningInfoResponse: MessageFns = { + $type: "cosmos.slashing.v1beta1.QuerySigningInfoResponse" as const, + + encode(message: QuerySigningInfoResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.val_signing_info !== undefined) { + ValidatorSigningInfo.encode(message.val_signing_info, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QuerySigningInfoResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQuerySigningInfoResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.val_signing_info = ValidatorSigningInfo.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QuerySigningInfoResponse { + return { + val_signing_info: isSet(object.val_signing_info) ? ValidatorSigningInfo.fromJSON(object.val_signing_info) : undefined, + }; + }, + + toJSON(message: QuerySigningInfoResponse): unknown { + const obj: any = {}; + if (message.val_signing_info !== undefined) { + obj.val_signing_info = ValidatorSigningInfo.toJSON(message.val_signing_info); + } + return obj; + }, + + create, I>>(base?: I): QuerySigningInfoResponse { + return QuerySigningInfoResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QuerySigningInfoResponse { + const message = createBaseQuerySigningInfoResponse(); + message.val_signing_info = + object.val_signing_info !== undefined && object.val_signing_info !== null ? ValidatorSigningInfo.fromPartial(object.val_signing_info) : undefined; + return message; + }, +}; + +export const QuerySigningInfosRequest: MessageFns = { + $type: "cosmos.slashing.v1beta1.QuerySigningInfosRequest" as const, + + encode(message: QuerySigningInfosRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QuerySigningInfosRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQuerySigningInfosRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QuerySigningInfosRequest { + return { pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined }; + }, + + toJSON(message: QuerySigningInfosRequest): unknown { + const obj: any = {}; + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QuerySigningInfosRequest { + return QuerySigningInfosRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QuerySigningInfosRequest { + const message = createBaseQuerySigningInfosRequest(); + message.pagination = object.pagination !== undefined && object.pagination !== null ? PageRequest.fromPartial(object.pagination) : undefined; + return message; + }, +}; + +export const QuerySigningInfosResponse: MessageFns = { + $type: "cosmos.slashing.v1beta1.QuerySigningInfosResponse" as const, + + encode(message: QuerySigningInfosResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.info) { + ValidatorSigningInfo.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QuerySigningInfosResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQuerySigningInfosResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.info.push(ValidatorSigningInfo.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QuerySigningInfosResponse { + return { + info: globalThis.Array.isArray(object?.info) ? object.info.map((e: any) => ValidatorSigningInfo.fromJSON(e)) : [], + pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QuerySigningInfosResponse): unknown { + const obj: any = {}; + if (message.info?.length) { + obj.info = message.info.map((e) => ValidatorSigningInfo.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QuerySigningInfosResponse { + return QuerySigningInfosResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QuerySigningInfosResponse { + const message = createBaseQuerySigningInfosResponse(); + message.info = object.info?.map((e) => ValidatorSigningInfo.fromPartial(e)) || []; + message.pagination = object.pagination !== undefined && object.pagination !== null ? PageResponse.fromPartial(object.pagination) : undefined; + return message; + }, +}; + +function createBaseQueryParamsRequest(): QueryParamsRequest { + return {}; +} + +function createBaseQueryParamsResponse(): QueryParamsResponse { + return { params: undefined }; +} + +function createBaseQuerySigningInfoRequest(): QuerySigningInfoRequest { + return { cons_address: "" }; +} + +function createBaseQuerySigningInfoResponse(): QuerySigningInfoResponse { + return { val_signing_info: undefined }; +} + +function createBaseQuerySigningInfosRequest(): QuerySigningInfosRequest { + return { pagination: undefined }; +} + +function createBaseQuerySigningInfosResponse(): QuerySigningInfosResponse { + return { info: [], pagination: undefined }; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} +export const registry: Array<[string, GeneratedType]> = [ + ["/cosmos.slashing.v1beta1.QueryParamsRequest", QueryParamsRequest as never], + ["/cosmos.slashing.v1beta1.QueryParamsResponse", QueryParamsResponse as never], +]; +export const aminoConverters = { + "/cosmos.slashing.v1beta1.QueryParamsRequest": { + aminoType: "cosmos-sdk/QueryParamsRequest", + toAmino: (message: QueryParamsRequest) => ({ ...message }), + fromAmino: (object: QueryParamsRequest) => ({ ...object }), + }, + + "/cosmos.slashing.v1beta1.QueryParamsResponse": { + aminoType: "cosmos-sdk/QueryParamsResponse", + toAmino: (message: QueryParamsResponse) => ({ ...message }), + fromAmino: (object: QueryParamsResponse) => ({ ...object }), + }, +}; diff --git a/packages/cosmos/generated/encoding/cosmos/slashing/v1beta1/slashing.ts b/packages/cosmos/generated/encoding/cosmos/slashing/v1beta1/slashing.ts new file mode 100644 index 000000000..726c77c7e --- /dev/null +++ b/packages/cosmos/generated/encoding/cosmos/slashing/v1beta1/slashing.ts @@ -0,0 +1,691 @@ +import type { GeneratedType } from "@cosmjs/proto-signing"; + +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +import { Duration } from "../../../google/protobuf/duration"; + +import { Timestamp } from "../../../google/protobuf/timestamp"; + +import type { + Params as Params_type, + ValidatorMissedBlockArrayLegacyMissedHeights as ValidatorMissedBlockArrayLegacyMissedHeights_type, + ValidatorMissedBlockArray as ValidatorMissedBlockArray_type, + ValidatorSigningInfoLegacyMissedHeights as ValidatorSigningInfoLegacyMissedHeights_type, + ValidatorSigningInfo as ValidatorSigningInfo_type, +} from "../../../../types/cosmos/slashing/v1beta1"; + +import type { DeepPartial, Exact, MessageFns } from "../../../common"; + +export interface ValidatorSigningInfoLegacyMissedHeights extends ValidatorSigningInfoLegacyMissedHeights_type {} +export interface ValidatorSigningInfo extends ValidatorSigningInfo_type {} +export interface ValidatorMissedBlockArrayLegacyMissedHeights extends ValidatorMissedBlockArrayLegacyMissedHeights_type {} +export interface ValidatorMissedBlockArray extends ValidatorMissedBlockArray_type {} +export interface Params extends Params_type {} + +export const ValidatorSigningInfoLegacyMissedHeights: MessageFns< + ValidatorSigningInfoLegacyMissedHeights, + "cosmos.slashing.v1beta1.ValidatorSigningInfoLegacyMissedHeights" +> = { + $type: "cosmos.slashing.v1beta1.ValidatorSigningInfoLegacyMissedHeights" as const, + + encode(message: ValidatorSigningInfoLegacyMissedHeights, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.address !== "") { + writer.uint32(10).string(message.address); + } + if (message.start_height !== 0) { + writer.uint32(16).int64(message.start_height); + } + if (message.jailed_until !== undefined) { + Timestamp.encode(toTimestamp(message.jailed_until), writer.uint32(26).fork()).join(); + } + if (message.tombstoned !== false) { + writer.uint32(32).bool(message.tombstoned); + } + if (message.missed_blocks_counter !== 0) { + writer.uint32(40).int64(message.missed_blocks_counter); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ValidatorSigningInfoLegacyMissedHeights { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseValidatorSigningInfoLegacyMissedHeights(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.address = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.start_height = longToNumber(reader.int64()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.jailed_until = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.tombstoned = reader.bool(); + continue; + case 5: + if (tag !== 40) { + break; + } + + message.missed_blocks_counter = longToNumber(reader.int64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ValidatorSigningInfoLegacyMissedHeights { + return { + address: isSet(object.address) ? globalThis.String(object.address) : "", + start_height: isSet(object.start_height) ? globalThis.Number(object.start_height) : 0, + jailed_until: isSet(object.jailed_until) ? fromJsonTimestamp(object.jailed_until) : undefined, + tombstoned: isSet(object.tombstoned) ? globalThis.Boolean(object.tombstoned) : false, + missed_blocks_counter: isSet(object.missed_blocks_counter) ? globalThis.Number(object.missed_blocks_counter) : 0, + }; + }, + + toJSON(message: ValidatorSigningInfoLegacyMissedHeights): unknown { + const obj: any = {}; + if (message.address !== "") { + obj.address = message.address; + } + if (message.start_height !== 0) { + obj.start_height = Math.round(message.start_height); + } + if (message.jailed_until !== undefined) { + obj.jailed_until = message.jailed_until.toISOString(); + } + if (message.tombstoned !== false) { + obj.tombstoned = message.tombstoned; + } + if (message.missed_blocks_counter !== 0) { + obj.missed_blocks_counter = Math.round(message.missed_blocks_counter); + } + return obj; + }, + + create, I>>(base?: I): ValidatorSigningInfoLegacyMissedHeights { + return ValidatorSigningInfoLegacyMissedHeights.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ValidatorSigningInfoLegacyMissedHeights { + const message = createBaseValidatorSigningInfoLegacyMissedHeights(); + message.address = object.address ?? ""; + message.start_height = object.start_height ?? 0; + message.jailed_until = object.jailed_until ?? undefined; + message.tombstoned = object.tombstoned ?? false; + message.missed_blocks_counter = object.missed_blocks_counter ?? 0; + return message; + }, +}; + +export const ValidatorSigningInfo: MessageFns = { + $type: "cosmos.slashing.v1beta1.ValidatorSigningInfo" as const, + + encode(message: ValidatorSigningInfo, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.address !== "") { + writer.uint32(10).string(message.address); + } + if (message.start_height !== 0) { + writer.uint32(16).int64(message.start_height); + } + if (message.index_offset !== 0) { + writer.uint32(24).int64(message.index_offset); + } + if (message.jailed_until !== undefined) { + Timestamp.encode(toTimestamp(message.jailed_until), writer.uint32(34).fork()).join(); + } + if (message.tombstoned !== false) { + writer.uint32(40).bool(message.tombstoned); + } + if (message.missed_blocks_counter !== 0) { + writer.uint32(48).int64(message.missed_blocks_counter); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ValidatorSigningInfo { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseValidatorSigningInfo(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.address = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.start_height = longToNumber(reader.int64()); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.index_offset = longToNumber(reader.int64()); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.jailed_until = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + continue; + case 5: + if (tag !== 40) { + break; + } + + message.tombstoned = reader.bool(); + continue; + case 6: + if (tag !== 48) { + break; + } + + message.missed_blocks_counter = longToNumber(reader.int64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ValidatorSigningInfo { + return { + address: isSet(object.address) ? globalThis.String(object.address) : "", + start_height: isSet(object.start_height) ? globalThis.Number(object.start_height) : 0, + index_offset: isSet(object.index_offset) ? globalThis.Number(object.index_offset) : 0, + jailed_until: isSet(object.jailed_until) ? fromJsonTimestamp(object.jailed_until) : undefined, + tombstoned: isSet(object.tombstoned) ? globalThis.Boolean(object.tombstoned) : false, + missed_blocks_counter: isSet(object.missed_blocks_counter) ? globalThis.Number(object.missed_blocks_counter) : 0, + }; + }, + + toJSON(message: ValidatorSigningInfo): unknown { + const obj: any = {}; + if (message.address !== "") { + obj.address = message.address; + } + if (message.start_height !== 0) { + obj.start_height = Math.round(message.start_height); + } + if (message.index_offset !== 0) { + obj.index_offset = Math.round(message.index_offset); + } + if (message.jailed_until !== undefined) { + obj.jailed_until = message.jailed_until.toISOString(); + } + if (message.tombstoned !== false) { + obj.tombstoned = message.tombstoned; + } + if (message.missed_blocks_counter !== 0) { + obj.missed_blocks_counter = Math.round(message.missed_blocks_counter); + } + return obj; + }, + + create, I>>(base?: I): ValidatorSigningInfo { + return ValidatorSigningInfo.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ValidatorSigningInfo { + const message = createBaseValidatorSigningInfo(); + message.address = object.address ?? ""; + message.start_height = object.start_height ?? 0; + message.index_offset = object.index_offset ?? 0; + message.jailed_until = object.jailed_until ?? undefined; + message.tombstoned = object.tombstoned ?? false; + message.missed_blocks_counter = object.missed_blocks_counter ?? 0; + return message; + }, +}; + +export const ValidatorMissedBlockArrayLegacyMissedHeights: MessageFns< + ValidatorMissedBlockArrayLegacyMissedHeights, + "cosmos.slashing.v1beta1.ValidatorMissedBlockArrayLegacyMissedHeights" +> = { + $type: "cosmos.slashing.v1beta1.ValidatorMissedBlockArrayLegacyMissedHeights" as const, + + encode(message: ValidatorMissedBlockArrayLegacyMissedHeights, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.address !== "") { + writer.uint32(10).string(message.address); + } + writer.uint32(18).fork(); + for (const v of message.missed_heights) { + writer.int64(v); + } + writer.join(); + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ValidatorMissedBlockArrayLegacyMissedHeights { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseValidatorMissedBlockArrayLegacyMissedHeights(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.address = reader.string(); + continue; + case 2: + if (tag === 16) { + message.missed_heights.push(longToNumber(reader.int64())); + + continue; + } + + if (tag === 18) { + const end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) { + message.missed_heights.push(longToNumber(reader.int64())); + } + + continue; + } + + break; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ValidatorMissedBlockArrayLegacyMissedHeights { + return { + address: isSet(object.address) ? globalThis.String(object.address) : "", + missed_heights: globalThis.Array.isArray(object?.missed_heights) ? object.missed_heights.map((e: any) => globalThis.Number(e)) : [], + }; + }, + + toJSON(message: ValidatorMissedBlockArrayLegacyMissedHeights): unknown { + const obj: any = {}; + if (message.address !== "") { + obj.address = message.address; + } + if (message.missed_heights?.length) { + obj.missed_heights = message.missed_heights.map((e) => Math.round(e)); + } + return obj; + }, + + create, I>>(base?: I): ValidatorMissedBlockArrayLegacyMissedHeights { + return ValidatorMissedBlockArrayLegacyMissedHeights.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ValidatorMissedBlockArrayLegacyMissedHeights { + const message = createBaseValidatorMissedBlockArrayLegacyMissedHeights(); + message.address = object.address ?? ""; + message.missed_heights = object.missed_heights?.map((e) => e) || []; + return message; + }, +}; + +export const ValidatorMissedBlockArray: MessageFns = { + $type: "cosmos.slashing.v1beta1.ValidatorMissedBlockArray" as const, + + encode(message: ValidatorMissedBlockArray, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.address !== "") { + writer.uint32(10).string(message.address); + } + if (message.window_size !== 0) { + writer.uint32(16).int64(message.window_size); + } + writer.uint32(26).fork(); + for (const v of message.missed_blocks) { + writer.uint64(v); + } + writer.join(); + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ValidatorMissedBlockArray { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseValidatorMissedBlockArray(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.address = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.window_size = longToNumber(reader.int64()); + continue; + case 3: + if (tag === 24) { + message.missed_blocks.push(longToNumber(reader.uint64())); + + continue; + } + + if (tag === 26) { + const end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) { + message.missed_blocks.push(longToNumber(reader.uint64())); + } + + continue; + } + + break; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ValidatorMissedBlockArray { + return { + address: isSet(object.address) ? globalThis.String(object.address) : "", + window_size: isSet(object.window_size) ? globalThis.Number(object.window_size) : 0, + missed_blocks: globalThis.Array.isArray(object?.missed_blocks) ? object.missed_blocks.map((e: any) => globalThis.Number(e)) : [], + }; + }, + + toJSON(message: ValidatorMissedBlockArray): unknown { + const obj: any = {}; + if (message.address !== "") { + obj.address = message.address; + } + if (message.window_size !== 0) { + obj.window_size = Math.round(message.window_size); + } + if (message.missed_blocks?.length) { + obj.missed_blocks = message.missed_blocks.map((e) => Math.round(e)); + } + return obj; + }, + + create, I>>(base?: I): ValidatorMissedBlockArray { + return ValidatorMissedBlockArray.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ValidatorMissedBlockArray { + const message = createBaseValidatorMissedBlockArray(); + message.address = object.address ?? ""; + message.window_size = object.window_size ?? 0; + message.missed_blocks = object.missed_blocks?.map((e) => e) || []; + return message; + }, +}; + +export const Params: MessageFns = { + $type: "cosmos.slashing.v1beta1.Params" as const, + + encode(message: Params, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.signed_blocks_window !== 0) { + writer.uint32(8).int64(message.signed_blocks_window); + } + if (message.min_signed_per_window.length !== 0) { + writer.uint32(18).bytes(message.min_signed_per_window); + } + if (message.downtime_jail_duration !== undefined) { + Duration.encode(message.downtime_jail_duration, writer.uint32(26).fork()).join(); + } + if (message.slash_fraction_double_sign.length !== 0) { + writer.uint32(34).bytes(message.slash_fraction_double_sign); + } + if (message.slash_fraction_downtime.length !== 0) { + writer.uint32(42).bytes(message.slash_fraction_downtime); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Params { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.signed_blocks_window = longToNumber(reader.int64()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.min_signed_per_window = reader.bytes(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.downtime_jail_duration = Duration.decode(reader, reader.uint32()); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.slash_fraction_double_sign = reader.bytes(); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.slash_fraction_downtime = reader.bytes(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Params { + return { + signed_blocks_window: isSet(object.signed_blocks_window) ? globalThis.Number(object.signed_blocks_window) : 0, + min_signed_per_window: isSet(object.min_signed_per_window) ? bytesFromBase64(object.min_signed_per_window) : new Uint8Array(0), + downtime_jail_duration: isSet(object.downtime_jail_duration) ? Duration.fromJSON(object.downtime_jail_duration) : undefined, + slash_fraction_double_sign: isSet(object.slash_fraction_double_sign) ? bytesFromBase64(object.slash_fraction_double_sign) : new Uint8Array(0), + slash_fraction_downtime: isSet(object.slash_fraction_downtime) ? bytesFromBase64(object.slash_fraction_downtime) : new Uint8Array(0), + }; + }, + + toJSON(message: Params): unknown { + const obj: any = {}; + if (message.signed_blocks_window !== 0) { + obj.signed_blocks_window = Math.round(message.signed_blocks_window); + } + if (message.min_signed_per_window.length !== 0) { + obj.min_signed_per_window = base64FromBytes(message.min_signed_per_window); + } + if (message.downtime_jail_duration !== undefined) { + obj.downtime_jail_duration = Duration.toJSON(message.downtime_jail_duration); + } + if (message.slash_fraction_double_sign.length !== 0) { + obj.slash_fraction_double_sign = base64FromBytes(message.slash_fraction_double_sign); + } + if (message.slash_fraction_downtime.length !== 0) { + obj.slash_fraction_downtime = base64FromBytes(message.slash_fraction_downtime); + } + return obj; + }, + + create, I>>(base?: I): Params { + return Params.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Params { + const message = createBaseParams(); + message.signed_blocks_window = object.signed_blocks_window ?? 0; + message.min_signed_per_window = object.min_signed_per_window ?? new Uint8Array(0); + message.downtime_jail_duration = + object.downtime_jail_duration !== undefined && object.downtime_jail_duration !== null ? Duration.fromPartial(object.downtime_jail_duration) : undefined; + message.slash_fraction_double_sign = object.slash_fraction_double_sign ?? new Uint8Array(0); + message.slash_fraction_downtime = object.slash_fraction_downtime ?? new Uint8Array(0); + return message; + }, +}; + +function createBaseValidatorSigningInfoLegacyMissedHeights(): ValidatorSigningInfoLegacyMissedHeights { + return { address: "", start_height: 0, jailed_until: undefined, tombstoned: false, missed_blocks_counter: 0 }; +} + +function createBaseValidatorSigningInfo(): ValidatorSigningInfo { + return { + address: "", + start_height: 0, + index_offset: 0, + jailed_until: undefined, + tombstoned: false, + missed_blocks_counter: 0, + }; +} + +function createBaseValidatorMissedBlockArrayLegacyMissedHeights(): ValidatorMissedBlockArrayLegacyMissedHeights { + return { address: "", missed_heights: [] }; +} + +function createBaseValidatorMissedBlockArray(): ValidatorMissedBlockArray { + return { address: "", window_size: 0, missed_blocks: [] }; +} + +function createBaseParams(): Params { + return { + signed_blocks_window: 0, + min_signed_per_window: new Uint8Array(0), + downtime_jail_duration: undefined, + slash_fraction_double_sign: new Uint8Array(0), + slash_fraction_downtime: new Uint8Array(0), + }; +} + +function bytesFromBase64(b64: string): Uint8Array { + if ((globalThis as any).Buffer) { + return Uint8Array.from(globalThis.Buffer.from(b64, "base64")); + } else { + const bin = globalThis.atob(b64); + const arr = new Uint8Array(bin.length); + for (let i = 0; i < bin.length; ++i) { + arr[i] = bin.charCodeAt(i); + } + return arr; + } +} + +function base64FromBytes(arr: Uint8Array): string { + if ((globalThis as any).Buffer) { + return globalThis.Buffer.from(arr).toString("base64"); + } else { + const bin: string[] = []; + arr.forEach((byte) => { + bin.push(globalThis.String.fromCharCode(byte)); + }); + return globalThis.btoa(bin.join("")); + } +} + +function toTimestamp(date: Date): Timestamp { + const seconds = Math.trunc(date.getTime() / 1_000); + const nanos = (date.getTime() % 1_000) * 1_000_000; + return { seconds, nanos }; +} + +function fromTimestamp(t: Timestamp): Date { + let millis = (t.seconds || 0) * 1_000; + millis += (t.nanos || 0) / 1_000_000; + return new globalThis.Date(millis); +} + +function fromJsonTimestamp(o: any): Date { + if (o instanceof globalThis.Date) { + return o; + } else if (typeof o === "string") { + return new globalThis.Date(o); + } else { + return fromTimestamp(Timestamp.fromJSON(o)); + } +} + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} +export const registry: Array<[string, GeneratedType]> = [ + ["/cosmos.slashing.v1beta1.ValidatorSigningInfo", ValidatorSigningInfo as never], + ["/cosmos.slashing.v1beta1.Params", Params as never], +]; +export const aminoConverters = { + "/cosmos.slashing.v1beta1.ValidatorSigningInfo": { + aminoType: "cosmos-sdk/ValidatorSigningInfo", + toAmino: (message: ValidatorSigningInfo) => ({ ...message }), + fromAmino: (object: ValidatorSigningInfo) => ({ ...object }), + }, + + "/cosmos.slashing.v1beta1.Params": { + aminoType: "cosmos-sdk/Params", + toAmino: (message: Params) => ({ ...message }), + fromAmino: (object: Params) => ({ ...object }), + }, +}; diff --git a/packages/cosmos/generated/encoding/cosmos/slashing/v1beta1/tx.ts b/packages/cosmos/generated/encoding/cosmos/slashing/v1beta1/tx.ts new file mode 100644 index 000000000..57fa00dda --- /dev/null +++ b/packages/cosmos/generated/encoding/cosmos/slashing/v1beta1/tx.ts @@ -0,0 +1,135 @@ +import type { GeneratedType } from "@cosmjs/proto-signing"; + +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +import type { MsgUnjailResponse as MsgUnjailResponse_type, MsgUnjail as MsgUnjail_type } from "../../../../types/cosmos/slashing/v1beta1"; + +import type { DeepPartial, Exact, MessageFns } from "../../../common"; + +export interface MsgUnjail extends MsgUnjail_type {} +export interface MsgUnjailResponse extends MsgUnjailResponse_type {} + +export const MsgUnjail: MessageFns = { + $type: "cosmos.slashing.v1beta1.MsgUnjail" as const, + + encode(message: MsgUnjail, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.validator_addr !== "") { + writer.uint32(10).string(message.validator_addr); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgUnjail { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUnjail(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.validator_addr = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgUnjail { + return { validator_addr: isSet(object.validator_addr) ? globalThis.String(object.validator_addr) : "" }; + }, + + toJSON(message: MsgUnjail): unknown { + const obj: any = {}; + if (message.validator_addr !== "") { + obj.validator_addr = message.validator_addr; + } + return obj; + }, + + create, I>>(base?: I): MsgUnjail { + return MsgUnjail.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgUnjail { + const message = createBaseMsgUnjail(); + message.validator_addr = object.validator_addr ?? ""; + return message; + }, +}; + +export const MsgUnjailResponse: MessageFns = { + $type: "cosmos.slashing.v1beta1.MsgUnjailResponse" as const, + + encode(_: MsgUnjailResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgUnjailResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUnjailResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgUnjailResponse { + return {}; + }, + + toJSON(_: MsgUnjailResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgUnjailResponse { + return MsgUnjailResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgUnjailResponse { + const message = createBaseMsgUnjailResponse(); + return message; + }, +}; + +function createBaseMsgUnjail(): MsgUnjail { + return { validator_addr: "" }; +} + +function createBaseMsgUnjailResponse(): MsgUnjailResponse { + return {}; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} +export const registry: Array<[string, GeneratedType]> = [ + ["/cosmos.slashing.v1beta1.MsgUnjail", MsgUnjail as never], + ["/cosmos.slashing.v1beta1.MsgUnjailResponse", MsgUnjailResponse as never], +]; +export const aminoConverters = { + "/cosmos.slashing.v1beta1.MsgUnjail": { + aminoType: "cosmos-sdk/MsgUnjail", + toAmino: (message: MsgUnjail) => ({ ...message }), + fromAmino: (object: MsgUnjail) => ({ ...object }), + }, + + "/cosmos.slashing.v1beta1.MsgUnjailResponse": { + aminoType: "cosmos-sdk/MsgUnjailResponse", + toAmino: (message: MsgUnjailResponse) => ({ ...message }), + fromAmino: (object: MsgUnjailResponse) => ({ ...object }), + }, +}; diff --git a/packages/cosmos/generated/encoding/cosmos/staking/v1beta1/authz.ts b/packages/cosmos/generated/encoding/cosmos/staking/v1beta1/authz.ts new file mode 100644 index 000000000..1a48772e0 --- /dev/null +++ b/packages/cosmos/generated/encoding/cosmos/staking/v1beta1/authz.ts @@ -0,0 +1,234 @@ +import type { GeneratedType } from "@cosmjs/proto-signing"; + +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +import { Coin } from "../../base/v1beta1/coin"; + +import type { + StakeAuthorizationValidators as StakeAuthorizationValidators_type, + StakeAuthorization as StakeAuthorization_type, +} from "../../../../types/cosmos/staking/v1beta1"; + +import { AuthorizationType } from "../../../../types/cosmos/staking/v1beta1"; + +import type { DeepPartial, Exact, MessageFns } from "../../../common"; + +export interface StakeAuthorization extends StakeAuthorization_type {} +export interface StakeAuthorizationValidators extends StakeAuthorizationValidators_type {} + +export const StakeAuthorization: MessageFns = { + $type: "cosmos.staking.v1beta1.StakeAuthorization" as const, + + encode(message: StakeAuthorization, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.max_tokens !== undefined) { + Coin.encode(message.max_tokens, writer.uint32(10).fork()).join(); + } + if (message.allow_list !== undefined) { + StakeAuthorizationValidators.encode(message.allow_list, writer.uint32(18).fork()).join(); + } + if (message.deny_list !== undefined) { + StakeAuthorizationValidators.encode(message.deny_list, writer.uint32(26).fork()).join(); + } + if (message.authorization_type !== 0) { + writer.uint32(32).int32(message.authorization_type); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): StakeAuthorization { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseStakeAuthorization(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.max_tokens = Coin.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.allow_list = StakeAuthorizationValidators.decode(reader, reader.uint32()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.deny_list = StakeAuthorizationValidators.decode(reader, reader.uint32()); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.authorization_type = reader.int32() as any; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): StakeAuthorization { + return { + max_tokens: isSet(object.max_tokens) ? Coin.fromJSON(object.max_tokens) : undefined, + allow_list: isSet(object.allow_list) ? StakeAuthorizationValidators.fromJSON(object.allow_list) : undefined, + deny_list: isSet(object.deny_list) ? StakeAuthorizationValidators.fromJSON(object.deny_list) : undefined, + authorization_type: isSet(object.authorization_type) ? authorizationTypeFromJSON(object.authorization_type) : 0, + }; + }, + + toJSON(message: StakeAuthorization): unknown { + const obj: any = {}; + if (message.max_tokens !== undefined) { + obj.max_tokens = Coin.toJSON(message.max_tokens); + } + if (message.allow_list !== undefined) { + obj.allow_list = StakeAuthorizationValidators.toJSON(message.allow_list); + } + if (message.deny_list !== undefined) { + obj.deny_list = StakeAuthorizationValidators.toJSON(message.deny_list); + } + if (message.authorization_type !== 0) { + obj.authorization_type = authorizationTypeToJSON(message.authorization_type); + } + return obj; + }, + + create, I>>(base?: I): StakeAuthorization { + return StakeAuthorization.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): StakeAuthorization { + const message = createBaseStakeAuthorization(); + message.max_tokens = object.max_tokens !== undefined && object.max_tokens !== null ? Coin.fromPartial(object.max_tokens) : undefined; + message.allow_list = + object.allow_list !== undefined && object.allow_list !== null ? StakeAuthorizationValidators.fromPartial(object.allow_list) : undefined; + message.deny_list = object.deny_list !== undefined && object.deny_list !== null ? StakeAuthorizationValidators.fromPartial(object.deny_list) : undefined; + message.authorization_type = object.authorization_type ?? 0; + return message; + }, +}; + +export const StakeAuthorizationValidators: MessageFns = { + $type: "cosmos.staking.v1beta1.StakeAuthorization.Validators" as const, + + encode(message: StakeAuthorizationValidators, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.address) { + writer.uint32(10).string(v!); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): StakeAuthorizationValidators { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseStakeAuthorizationValidators(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.address.push(reader.string()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): StakeAuthorizationValidators { + return { + address: globalThis.Array.isArray(object?.address) ? object.address.map((e: any) => globalThis.String(e)) : [], + }; + }, + + toJSON(message: StakeAuthorizationValidators): unknown { + const obj: any = {}; + if (message.address?.length) { + obj.address = message.address; + } + return obj; + }, + + create, I>>(base?: I): StakeAuthorizationValidators { + return StakeAuthorizationValidators.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): StakeAuthorizationValidators { + const message = createBaseStakeAuthorizationValidators(); + message.address = object.address?.map((e) => e) || []; + return message; + }, +}; + +export function authorizationTypeFromJSON(object: any): AuthorizationType { + switch (object) { + case 0: + case "AUTHORIZATION_TYPE_UNSPECIFIED": + return AuthorizationType.AUTHORIZATION_TYPE_UNSPECIFIED; + case 1: + case "AUTHORIZATION_TYPE_DELEGATE": + return AuthorizationType.AUTHORIZATION_TYPE_DELEGATE; + case 2: + case "AUTHORIZATION_TYPE_UNDELEGATE": + return AuthorizationType.AUTHORIZATION_TYPE_UNDELEGATE; + case 3: + case "AUTHORIZATION_TYPE_REDELEGATE": + return AuthorizationType.AUTHORIZATION_TYPE_REDELEGATE; + case -1: + case "UNRECOGNIZED": + default: + return AuthorizationType.UNRECOGNIZED; + } +} + +export function authorizationTypeToJSON(object: AuthorizationType): string { + switch (object) { + case AuthorizationType.AUTHORIZATION_TYPE_UNSPECIFIED: + return "AUTHORIZATION_TYPE_UNSPECIFIED"; + case AuthorizationType.AUTHORIZATION_TYPE_DELEGATE: + return "AUTHORIZATION_TYPE_DELEGATE"; + case AuthorizationType.AUTHORIZATION_TYPE_UNDELEGATE: + return "AUTHORIZATION_TYPE_UNDELEGATE"; + case AuthorizationType.AUTHORIZATION_TYPE_REDELEGATE: + return "AUTHORIZATION_TYPE_REDELEGATE"; + case AuthorizationType.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +function createBaseStakeAuthorization(): StakeAuthorization { + return { max_tokens: undefined, allow_list: undefined, deny_list: undefined, authorization_type: 0 }; +} + +function createBaseStakeAuthorizationValidators(): StakeAuthorizationValidators { + return { address: [] }; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} +export const registry: Array<[string, GeneratedType]> = [["/cosmos.staking.v1beta1.StakeAuthorization", StakeAuthorization as never]]; +export const aminoConverters = { + "/cosmos.staking.v1beta1.StakeAuthorization": { + aminoType: "cosmos-sdk/StakeAuthorization", + toAmino: (message: StakeAuthorization) => ({ ...message }), + fromAmino: (object: StakeAuthorization) => ({ ...object }), + }, +}; diff --git a/packages/cosmos/generated/encoding/cosmos/staking/v1beta1/genesis.ts b/packages/cosmos/generated/encoding/cosmos/staking/v1beta1/genesis.ts new file mode 100644 index 000000000..7a861cdcc --- /dev/null +++ b/packages/cosmos/generated/encoding/cosmos/staking/v1beta1/genesis.ts @@ -0,0 +1,324 @@ +import type { GeneratedType } from "@cosmjs/proto-signing"; + +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +import { Delegation, Params, Redelegation, UnbondingDelegation, Validator } from "./staking"; + +import type { GenesisState as GenesisState_type, LastValidatorPower as LastValidatorPower_type } from "../../../../types/cosmos/staking/v1beta1"; + +import type { DeepPartial, Exact, MessageFns } from "../../../common"; + +export interface GenesisState extends GenesisState_type {} +export interface LastValidatorPower extends LastValidatorPower_type {} + +export const GenesisState: MessageFns = { + $type: "cosmos.staking.v1beta1.GenesisState" as const, + + encode(message: GenesisState, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(10).fork()).join(); + } + if (message.last_total_power.length !== 0) { + writer.uint32(18).bytes(message.last_total_power); + } + for (const v of message.last_validator_powers) { + LastValidatorPower.encode(v!, writer.uint32(26).fork()).join(); + } + for (const v of message.validators) { + Validator.encode(v!, writer.uint32(34).fork()).join(); + } + for (const v of message.delegations) { + Delegation.encode(v!, writer.uint32(42).fork()).join(); + } + for (const v of message.unbonding_delegations) { + UnbondingDelegation.encode(v!, writer.uint32(50).fork()).join(); + } + for (const v of message.redelegations) { + Redelegation.encode(v!, writer.uint32(58).fork()).join(); + } + if (message.exported !== false) { + writer.uint32(64).bool(message.exported); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GenesisState { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGenesisState(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.params = Params.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.last_total_power = reader.bytes(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.last_validator_powers.push(LastValidatorPower.decode(reader, reader.uint32())); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.validators.push(Validator.decode(reader, reader.uint32())); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.delegations.push(Delegation.decode(reader, reader.uint32())); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.unbonding_delegations.push(UnbondingDelegation.decode(reader, reader.uint32())); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.redelegations.push(Redelegation.decode(reader, reader.uint32())); + continue; + case 8: + if (tag !== 64) { + break; + } + + message.exported = reader.bool(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GenesisState { + return { + params: isSet(object.params) ? Params.fromJSON(object.params) : undefined, + last_total_power: isSet(object.last_total_power) ? bytesFromBase64(object.last_total_power) : new Uint8Array(0), + last_validator_powers: globalThis.Array.isArray(object?.last_validator_powers) + ? object.last_validator_powers.map((e: any) => LastValidatorPower.fromJSON(e)) + : [], + validators: globalThis.Array.isArray(object?.validators) ? object.validators.map((e: any) => Validator.fromJSON(e)) : [], + delegations: globalThis.Array.isArray(object?.delegations) ? object.delegations.map((e: any) => Delegation.fromJSON(e)) : [], + unbonding_delegations: globalThis.Array.isArray(object?.unbonding_delegations) + ? object.unbonding_delegations.map((e: any) => UnbondingDelegation.fromJSON(e)) + : [], + redelegations: globalThis.Array.isArray(object?.redelegations) ? object.redelegations.map((e: any) => Redelegation.fromJSON(e)) : [], + exported: isSet(object.exported) ? globalThis.Boolean(object.exported) : false, + }; + }, + + toJSON(message: GenesisState): unknown { + const obj: any = {}; + if (message.params !== undefined) { + obj.params = Params.toJSON(message.params); + } + if (message.last_total_power.length !== 0) { + obj.last_total_power = base64FromBytes(message.last_total_power); + } + if (message.last_validator_powers?.length) { + obj.last_validator_powers = message.last_validator_powers.map((e) => LastValidatorPower.toJSON(e)); + } + if (message.validators?.length) { + obj.validators = message.validators.map((e) => Validator.toJSON(e)); + } + if (message.delegations?.length) { + obj.delegations = message.delegations.map((e) => Delegation.toJSON(e)); + } + if (message.unbonding_delegations?.length) { + obj.unbonding_delegations = message.unbonding_delegations.map((e) => UnbondingDelegation.toJSON(e)); + } + if (message.redelegations?.length) { + obj.redelegations = message.redelegations.map((e) => Redelegation.toJSON(e)); + } + if (message.exported !== false) { + obj.exported = message.exported; + } + return obj; + }, + + create, I>>(base?: I): GenesisState { + return GenesisState.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): GenesisState { + const message = createBaseGenesisState(); + message.params = object.params !== undefined && object.params !== null ? Params.fromPartial(object.params) : undefined; + message.last_total_power = object.last_total_power ?? new Uint8Array(0); + message.last_validator_powers = object.last_validator_powers?.map((e) => LastValidatorPower.fromPartial(e)) || []; + message.validators = object.validators?.map((e) => Validator.fromPartial(e)) || []; + message.delegations = object.delegations?.map((e) => Delegation.fromPartial(e)) || []; + message.unbonding_delegations = object.unbonding_delegations?.map((e) => UnbondingDelegation.fromPartial(e)) || []; + message.redelegations = object.redelegations?.map((e) => Redelegation.fromPartial(e)) || []; + message.exported = object.exported ?? false; + return message; + }, +}; + +export const LastValidatorPower: MessageFns = { + $type: "cosmos.staking.v1beta1.LastValidatorPower" as const, + + encode(message: LastValidatorPower, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.address !== "") { + writer.uint32(10).string(message.address); + } + if (message.power !== 0) { + writer.uint32(16).int64(message.power); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): LastValidatorPower { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseLastValidatorPower(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.address = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.power = longToNumber(reader.int64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): LastValidatorPower { + return { + address: isSet(object.address) ? globalThis.String(object.address) : "", + power: isSet(object.power) ? globalThis.Number(object.power) : 0, + }; + }, + + toJSON(message: LastValidatorPower): unknown { + const obj: any = {}; + if (message.address !== "") { + obj.address = message.address; + } + if (message.power !== 0) { + obj.power = Math.round(message.power); + } + return obj; + }, + + create, I>>(base?: I): LastValidatorPower { + return LastValidatorPower.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): LastValidatorPower { + const message = createBaseLastValidatorPower(); + message.address = object.address ?? ""; + message.power = object.power ?? 0; + return message; + }, +}; + +function createBaseGenesisState(): GenesisState { + return { + params: undefined, + last_total_power: new Uint8Array(0), + last_validator_powers: [], + validators: [], + delegations: [], + unbonding_delegations: [], + redelegations: [], + exported: false, + }; +} + +function createBaseLastValidatorPower(): LastValidatorPower { + return { address: "", power: 0 }; +} + +function bytesFromBase64(b64: string): Uint8Array { + if ((globalThis as any).Buffer) { + return Uint8Array.from(globalThis.Buffer.from(b64, "base64")); + } else { + const bin = globalThis.atob(b64); + const arr = new Uint8Array(bin.length); + for (let i = 0; i < bin.length; ++i) { + arr[i] = bin.charCodeAt(i); + } + return arr; + } +} + +function base64FromBytes(arr: Uint8Array): string { + if ((globalThis as any).Buffer) { + return globalThis.Buffer.from(arr).toString("base64"); + } else { + const bin: string[] = []; + arr.forEach((byte) => { + bin.push(globalThis.String.fromCharCode(byte)); + }); + return globalThis.btoa(bin.join("")); + } +} + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} +export const registry: Array<[string, GeneratedType]> = [ + ["/cosmos.staking.v1beta1.GenesisState", GenesisState as never], + ["/cosmos.staking.v1beta1.LastValidatorPower", LastValidatorPower as never], +]; +export const aminoConverters = { + "/cosmos.staking.v1beta1.GenesisState": { + aminoType: "cosmos-sdk/GenesisState", + toAmino: (message: GenesisState) => ({ ...message }), + fromAmino: (object: GenesisState) => ({ ...object }), + }, + + "/cosmos.staking.v1beta1.LastValidatorPower": { + aminoType: "cosmos-sdk/LastValidatorPower", + toAmino: (message: LastValidatorPower) => ({ ...message }), + fromAmino: (object: LastValidatorPower) => ({ ...object }), + }, +}; diff --git a/packages/cosmos/generated/encoding/cosmos/staking/v1beta1/index.ts b/packages/cosmos/generated/encoding/cosmos/staking/v1beta1/index.ts new file mode 100644 index 000000000..d785a094d --- /dev/null +++ b/packages/cosmos/generated/encoding/cosmos/staking/v1beta1/index.ts @@ -0,0 +1,7 @@ +// @ts-nocheck + +export * from './authz'; +export * from './genesis'; +export * from './query'; +export * from './staking'; +export * from './tx'; \ No newline at end of file diff --git a/packages/cosmos/generated/encoding/cosmos/staking/v1beta1/query.ts b/packages/cosmos/generated/encoding/cosmos/staking/v1beta1/query.ts new file mode 100644 index 000000000..fc9c1d783 --- /dev/null +++ b/packages/cosmos/generated/encoding/cosmos/staking/v1beta1/query.ts @@ -0,0 +1,2090 @@ +import type { GeneratedType } from "@cosmjs/proto-signing"; + +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +import { PageRequest, PageResponse } from "../../base/query/v1beta1/pagination"; + +import { DelegationResponse, HistoricalInfo, Params, Pool, RedelegationResponse, UnbondingDelegation, Validator } from "./staking"; + +import type { + QueryDelegationRequest as QueryDelegationRequest_type, + QueryDelegationResponse as QueryDelegationResponse_type, + QueryDelegatorDelegationsRequest as QueryDelegatorDelegationsRequest_type, + QueryDelegatorDelegationsResponse as QueryDelegatorDelegationsResponse_type, + QueryDelegatorUnbondingDelegationsRequest as QueryDelegatorUnbondingDelegationsRequest_type, + QueryDelegatorUnbondingDelegationsResponse as QueryDelegatorUnbondingDelegationsResponse_type, + QueryDelegatorValidatorRequest as QueryDelegatorValidatorRequest_type, + QueryDelegatorValidatorResponse as QueryDelegatorValidatorResponse_type, + QueryDelegatorValidatorsRequest as QueryDelegatorValidatorsRequest_type, + QueryDelegatorValidatorsResponse as QueryDelegatorValidatorsResponse_type, + QueryHistoricalInfoRequest as QueryHistoricalInfoRequest_type, + QueryHistoricalInfoResponse as QueryHistoricalInfoResponse_type, + QueryParamsRequest as QueryParamsRequest_type, + QueryParamsResponse as QueryParamsResponse_type, + QueryPoolRequest as QueryPoolRequest_type, + QueryPoolResponse as QueryPoolResponse_type, + QueryRedelegationsRequest as QueryRedelegationsRequest_type, + QueryRedelegationsResponse as QueryRedelegationsResponse_type, + QueryUnbondingDelegationRequest as QueryUnbondingDelegationRequest_type, + QueryUnbondingDelegationResponse as QueryUnbondingDelegationResponse_type, + QueryValidatorDelegationsRequest as QueryValidatorDelegationsRequest_type, + QueryValidatorDelegationsResponse as QueryValidatorDelegationsResponse_type, + QueryValidatorRequest as QueryValidatorRequest_type, + QueryValidatorResponse as QueryValidatorResponse_type, + QueryValidatorUnbondingDelegationsRequest as QueryValidatorUnbondingDelegationsRequest_type, + QueryValidatorUnbondingDelegationsResponse as QueryValidatorUnbondingDelegationsResponse_type, + QueryValidatorsRequest as QueryValidatorsRequest_type, + QueryValidatorsResponse as QueryValidatorsResponse_type, +} from "../../../../types/cosmos/staking/v1beta1"; + +import type { DeepPartial, Exact, MessageFns } from "../../../common"; + +export interface QueryValidatorsRequest extends QueryValidatorsRequest_type {} +export interface QueryValidatorsResponse extends QueryValidatorsResponse_type {} +export interface QueryValidatorRequest extends QueryValidatorRequest_type {} +export interface QueryValidatorResponse extends QueryValidatorResponse_type {} +export interface QueryValidatorDelegationsRequest extends QueryValidatorDelegationsRequest_type {} +export interface QueryValidatorDelegationsResponse extends QueryValidatorDelegationsResponse_type {} +export interface QueryValidatorUnbondingDelegationsRequest extends QueryValidatorUnbondingDelegationsRequest_type {} +export interface QueryValidatorUnbondingDelegationsResponse extends QueryValidatorUnbondingDelegationsResponse_type {} +export interface QueryDelegationRequest extends QueryDelegationRequest_type {} +export interface QueryDelegationResponse extends QueryDelegationResponse_type {} +export interface QueryUnbondingDelegationRequest extends QueryUnbondingDelegationRequest_type {} +export interface QueryUnbondingDelegationResponse extends QueryUnbondingDelegationResponse_type {} +export interface QueryDelegatorDelegationsRequest extends QueryDelegatorDelegationsRequest_type {} +export interface QueryDelegatorDelegationsResponse extends QueryDelegatorDelegationsResponse_type {} +export interface QueryDelegatorUnbondingDelegationsRequest extends QueryDelegatorUnbondingDelegationsRequest_type {} +export interface QueryDelegatorUnbondingDelegationsResponse extends QueryDelegatorUnbondingDelegationsResponse_type {} +export interface QueryRedelegationsRequest extends QueryRedelegationsRequest_type {} +export interface QueryRedelegationsResponse extends QueryRedelegationsResponse_type {} +export interface QueryDelegatorValidatorsRequest extends QueryDelegatorValidatorsRequest_type {} +export interface QueryDelegatorValidatorsResponse extends QueryDelegatorValidatorsResponse_type {} +export interface QueryDelegatorValidatorRequest extends QueryDelegatorValidatorRequest_type {} +export interface QueryDelegatorValidatorResponse extends QueryDelegatorValidatorResponse_type {} +export interface QueryHistoricalInfoRequest extends QueryHistoricalInfoRequest_type {} +export interface QueryHistoricalInfoResponse extends QueryHistoricalInfoResponse_type {} +export interface QueryPoolRequest extends QueryPoolRequest_type {} +export interface QueryPoolResponse extends QueryPoolResponse_type {} +export interface QueryParamsRequest extends QueryParamsRequest_type {} +export interface QueryParamsResponse extends QueryParamsResponse_type {} + +export const QueryValidatorsRequest: MessageFns = { + $type: "cosmos.staking.v1beta1.QueryValidatorsRequest" as const, + + encode(message: QueryValidatorsRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.status !== "") { + writer.uint32(10).string(message.status); + } + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryValidatorsRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryValidatorsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.status = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryValidatorsRequest { + return { + status: isSet(object.status) ? globalThis.String(object.status) : "", + pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryValidatorsRequest): unknown { + const obj: any = {}; + if (message.status !== "") { + obj.status = message.status; + } + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryValidatorsRequest { + return QueryValidatorsRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryValidatorsRequest { + const message = createBaseQueryValidatorsRequest(); + message.status = object.status ?? ""; + message.pagination = object.pagination !== undefined && object.pagination !== null ? PageRequest.fromPartial(object.pagination) : undefined; + return message; + }, +}; + +export const QueryValidatorsResponse: MessageFns = { + $type: "cosmos.staking.v1beta1.QueryValidatorsResponse" as const, + + encode(message: QueryValidatorsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.validators) { + Validator.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryValidatorsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryValidatorsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.validators.push(Validator.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryValidatorsResponse { + return { + validators: globalThis.Array.isArray(object?.validators) ? object.validators.map((e: any) => Validator.fromJSON(e)) : [], + pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryValidatorsResponse): unknown { + const obj: any = {}; + if (message.validators?.length) { + obj.validators = message.validators.map((e) => Validator.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryValidatorsResponse { + return QueryValidatorsResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryValidatorsResponse { + const message = createBaseQueryValidatorsResponse(); + message.validators = object.validators?.map((e) => Validator.fromPartial(e)) || []; + message.pagination = object.pagination !== undefined && object.pagination !== null ? PageResponse.fromPartial(object.pagination) : undefined; + return message; + }, +}; + +export const QueryValidatorRequest: MessageFns = { + $type: "cosmos.staking.v1beta1.QueryValidatorRequest" as const, + + encode(message: QueryValidatorRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.validator_addr !== "") { + writer.uint32(10).string(message.validator_addr); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryValidatorRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryValidatorRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.validator_addr = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryValidatorRequest { + return { validator_addr: isSet(object.validator_addr) ? globalThis.String(object.validator_addr) : "" }; + }, + + toJSON(message: QueryValidatorRequest): unknown { + const obj: any = {}; + if (message.validator_addr !== "") { + obj.validator_addr = message.validator_addr; + } + return obj; + }, + + create, I>>(base?: I): QueryValidatorRequest { + return QueryValidatorRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryValidatorRequest { + const message = createBaseQueryValidatorRequest(); + message.validator_addr = object.validator_addr ?? ""; + return message; + }, +}; + +export const QueryValidatorResponse: MessageFns = { + $type: "cosmos.staking.v1beta1.QueryValidatorResponse" as const, + + encode(message: QueryValidatorResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.validator !== undefined) { + Validator.encode(message.validator, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryValidatorResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryValidatorResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.validator = Validator.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryValidatorResponse { + return { validator: isSet(object.validator) ? Validator.fromJSON(object.validator) : undefined }; + }, + + toJSON(message: QueryValidatorResponse): unknown { + const obj: any = {}; + if (message.validator !== undefined) { + obj.validator = Validator.toJSON(message.validator); + } + return obj; + }, + + create, I>>(base?: I): QueryValidatorResponse { + return QueryValidatorResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryValidatorResponse { + const message = createBaseQueryValidatorResponse(); + message.validator = object.validator !== undefined && object.validator !== null ? Validator.fromPartial(object.validator) : undefined; + return message; + }, +}; + +export const QueryValidatorDelegationsRequest: MessageFns = { + $type: "cosmos.staking.v1beta1.QueryValidatorDelegationsRequest" as const, + + encode(message: QueryValidatorDelegationsRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.validator_addr !== "") { + writer.uint32(10).string(message.validator_addr); + } + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryValidatorDelegationsRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryValidatorDelegationsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.validator_addr = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryValidatorDelegationsRequest { + return { + validator_addr: isSet(object.validator_addr) ? globalThis.String(object.validator_addr) : "", + pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryValidatorDelegationsRequest): unknown { + const obj: any = {}; + if (message.validator_addr !== "") { + obj.validator_addr = message.validator_addr; + } + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryValidatorDelegationsRequest { + return QueryValidatorDelegationsRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryValidatorDelegationsRequest { + const message = createBaseQueryValidatorDelegationsRequest(); + message.validator_addr = object.validator_addr ?? ""; + message.pagination = object.pagination !== undefined && object.pagination !== null ? PageRequest.fromPartial(object.pagination) : undefined; + return message; + }, +}; + +export const QueryValidatorDelegationsResponse: MessageFns = { + $type: "cosmos.staking.v1beta1.QueryValidatorDelegationsResponse" as const, + + encode(message: QueryValidatorDelegationsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.delegation_responses) { + DelegationResponse.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryValidatorDelegationsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryValidatorDelegationsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.delegation_responses.push(DelegationResponse.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryValidatorDelegationsResponse { + return { + delegation_responses: globalThis.Array.isArray(object?.delegation_responses) + ? object.delegation_responses.map((e: any) => DelegationResponse.fromJSON(e)) + : [], + pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryValidatorDelegationsResponse): unknown { + const obj: any = {}; + if (message.delegation_responses?.length) { + obj.delegation_responses = message.delegation_responses.map((e) => DelegationResponse.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryValidatorDelegationsResponse { + return QueryValidatorDelegationsResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryValidatorDelegationsResponse { + const message = createBaseQueryValidatorDelegationsResponse(); + message.delegation_responses = object.delegation_responses?.map((e) => DelegationResponse.fromPartial(e)) || []; + message.pagination = object.pagination !== undefined && object.pagination !== null ? PageResponse.fromPartial(object.pagination) : undefined; + return message; + }, +}; + +export const QueryValidatorUnbondingDelegationsRequest: MessageFns< + QueryValidatorUnbondingDelegationsRequest, + "cosmos.staking.v1beta1.QueryValidatorUnbondingDelegationsRequest" +> = { + $type: "cosmos.staking.v1beta1.QueryValidatorUnbondingDelegationsRequest" as const, + + encode(message: QueryValidatorUnbondingDelegationsRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.validator_addr !== "") { + writer.uint32(10).string(message.validator_addr); + } + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryValidatorUnbondingDelegationsRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryValidatorUnbondingDelegationsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.validator_addr = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryValidatorUnbondingDelegationsRequest { + return { + validator_addr: isSet(object.validator_addr) ? globalThis.String(object.validator_addr) : "", + pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryValidatorUnbondingDelegationsRequest): unknown { + const obj: any = {}; + if (message.validator_addr !== "") { + obj.validator_addr = message.validator_addr; + } + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryValidatorUnbondingDelegationsRequest { + return QueryValidatorUnbondingDelegationsRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryValidatorUnbondingDelegationsRequest { + const message = createBaseQueryValidatorUnbondingDelegationsRequest(); + message.validator_addr = object.validator_addr ?? ""; + message.pagination = object.pagination !== undefined && object.pagination !== null ? PageRequest.fromPartial(object.pagination) : undefined; + return message; + }, +}; + +export const QueryValidatorUnbondingDelegationsResponse: MessageFns< + QueryValidatorUnbondingDelegationsResponse, + "cosmos.staking.v1beta1.QueryValidatorUnbondingDelegationsResponse" +> = { + $type: "cosmos.staking.v1beta1.QueryValidatorUnbondingDelegationsResponse" as const, + + encode(message: QueryValidatorUnbondingDelegationsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.unbonding_responses) { + UnbondingDelegation.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryValidatorUnbondingDelegationsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryValidatorUnbondingDelegationsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.unbonding_responses.push(UnbondingDelegation.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryValidatorUnbondingDelegationsResponse { + return { + unbonding_responses: globalThis.Array.isArray(object?.unbonding_responses) + ? object.unbonding_responses.map((e: any) => UnbondingDelegation.fromJSON(e)) + : [], + pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryValidatorUnbondingDelegationsResponse): unknown { + const obj: any = {}; + if (message.unbonding_responses?.length) { + obj.unbonding_responses = message.unbonding_responses.map((e) => UnbondingDelegation.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryValidatorUnbondingDelegationsResponse { + return QueryValidatorUnbondingDelegationsResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryValidatorUnbondingDelegationsResponse { + const message = createBaseQueryValidatorUnbondingDelegationsResponse(); + message.unbonding_responses = object.unbonding_responses?.map((e) => UnbondingDelegation.fromPartial(e)) || []; + message.pagination = object.pagination !== undefined && object.pagination !== null ? PageResponse.fromPartial(object.pagination) : undefined; + return message; + }, +}; + +export const QueryDelegationRequest: MessageFns = { + $type: "cosmos.staking.v1beta1.QueryDelegationRequest" as const, + + encode(message: QueryDelegationRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.delegator_addr !== "") { + writer.uint32(10).string(message.delegator_addr); + } + if (message.validator_addr !== "") { + writer.uint32(18).string(message.validator_addr); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryDelegationRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDelegationRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.delegator_addr = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.validator_addr = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDelegationRequest { + return { + delegator_addr: isSet(object.delegator_addr) ? globalThis.String(object.delegator_addr) : "", + validator_addr: isSet(object.validator_addr) ? globalThis.String(object.validator_addr) : "", + }; + }, + + toJSON(message: QueryDelegationRequest): unknown { + const obj: any = {}; + if (message.delegator_addr !== "") { + obj.delegator_addr = message.delegator_addr; + } + if (message.validator_addr !== "") { + obj.validator_addr = message.validator_addr; + } + return obj; + }, + + create, I>>(base?: I): QueryDelegationRequest { + return QueryDelegationRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryDelegationRequest { + const message = createBaseQueryDelegationRequest(); + message.delegator_addr = object.delegator_addr ?? ""; + message.validator_addr = object.validator_addr ?? ""; + return message; + }, +}; + +export const QueryDelegationResponse: MessageFns = { + $type: "cosmos.staking.v1beta1.QueryDelegationResponse" as const, + + encode(message: QueryDelegationResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.delegation_response !== undefined) { + DelegationResponse.encode(message.delegation_response, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryDelegationResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDelegationResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.delegation_response = DelegationResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDelegationResponse { + return { + delegation_response: isSet(object.delegation_response) ? DelegationResponse.fromJSON(object.delegation_response) : undefined, + }; + }, + + toJSON(message: QueryDelegationResponse): unknown { + const obj: any = {}; + if (message.delegation_response !== undefined) { + obj.delegation_response = DelegationResponse.toJSON(message.delegation_response); + } + return obj; + }, + + create, I>>(base?: I): QueryDelegationResponse { + return QueryDelegationResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryDelegationResponse { + const message = createBaseQueryDelegationResponse(); + message.delegation_response = + object.delegation_response !== undefined && object.delegation_response !== null ? DelegationResponse.fromPartial(object.delegation_response) : undefined; + return message; + }, +}; + +export const QueryUnbondingDelegationRequest: MessageFns = { + $type: "cosmos.staking.v1beta1.QueryUnbondingDelegationRequest" as const, + + encode(message: QueryUnbondingDelegationRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.delegator_addr !== "") { + writer.uint32(10).string(message.delegator_addr); + } + if (message.validator_addr !== "") { + writer.uint32(18).string(message.validator_addr); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryUnbondingDelegationRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryUnbondingDelegationRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.delegator_addr = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.validator_addr = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryUnbondingDelegationRequest { + return { + delegator_addr: isSet(object.delegator_addr) ? globalThis.String(object.delegator_addr) : "", + validator_addr: isSet(object.validator_addr) ? globalThis.String(object.validator_addr) : "", + }; + }, + + toJSON(message: QueryUnbondingDelegationRequest): unknown { + const obj: any = {}; + if (message.delegator_addr !== "") { + obj.delegator_addr = message.delegator_addr; + } + if (message.validator_addr !== "") { + obj.validator_addr = message.validator_addr; + } + return obj; + }, + + create, I>>(base?: I): QueryUnbondingDelegationRequest { + return QueryUnbondingDelegationRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryUnbondingDelegationRequest { + const message = createBaseQueryUnbondingDelegationRequest(); + message.delegator_addr = object.delegator_addr ?? ""; + message.validator_addr = object.validator_addr ?? ""; + return message; + }, +}; + +export const QueryUnbondingDelegationResponse: MessageFns = { + $type: "cosmos.staking.v1beta1.QueryUnbondingDelegationResponse" as const, + + encode(message: QueryUnbondingDelegationResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.unbond !== undefined) { + UnbondingDelegation.encode(message.unbond, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryUnbondingDelegationResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryUnbondingDelegationResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.unbond = UnbondingDelegation.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryUnbondingDelegationResponse { + return { unbond: isSet(object.unbond) ? UnbondingDelegation.fromJSON(object.unbond) : undefined }; + }, + + toJSON(message: QueryUnbondingDelegationResponse): unknown { + const obj: any = {}; + if (message.unbond !== undefined) { + obj.unbond = UnbondingDelegation.toJSON(message.unbond); + } + return obj; + }, + + create, I>>(base?: I): QueryUnbondingDelegationResponse { + return QueryUnbondingDelegationResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryUnbondingDelegationResponse { + const message = createBaseQueryUnbondingDelegationResponse(); + message.unbond = object.unbond !== undefined && object.unbond !== null ? UnbondingDelegation.fromPartial(object.unbond) : undefined; + return message; + }, +}; + +export const QueryDelegatorDelegationsRequest: MessageFns = { + $type: "cosmos.staking.v1beta1.QueryDelegatorDelegationsRequest" as const, + + encode(message: QueryDelegatorDelegationsRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.delegator_addr !== "") { + writer.uint32(10).string(message.delegator_addr); + } + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryDelegatorDelegationsRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDelegatorDelegationsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.delegator_addr = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDelegatorDelegationsRequest { + return { + delegator_addr: isSet(object.delegator_addr) ? globalThis.String(object.delegator_addr) : "", + pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryDelegatorDelegationsRequest): unknown { + const obj: any = {}; + if (message.delegator_addr !== "") { + obj.delegator_addr = message.delegator_addr; + } + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryDelegatorDelegationsRequest { + return QueryDelegatorDelegationsRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryDelegatorDelegationsRequest { + const message = createBaseQueryDelegatorDelegationsRequest(); + message.delegator_addr = object.delegator_addr ?? ""; + message.pagination = object.pagination !== undefined && object.pagination !== null ? PageRequest.fromPartial(object.pagination) : undefined; + return message; + }, +}; + +export const QueryDelegatorDelegationsResponse: MessageFns = { + $type: "cosmos.staking.v1beta1.QueryDelegatorDelegationsResponse" as const, + + encode(message: QueryDelegatorDelegationsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.delegation_responses) { + DelegationResponse.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryDelegatorDelegationsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDelegatorDelegationsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.delegation_responses.push(DelegationResponse.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDelegatorDelegationsResponse { + return { + delegation_responses: globalThis.Array.isArray(object?.delegation_responses) + ? object.delegation_responses.map((e: any) => DelegationResponse.fromJSON(e)) + : [], + pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryDelegatorDelegationsResponse): unknown { + const obj: any = {}; + if (message.delegation_responses?.length) { + obj.delegation_responses = message.delegation_responses.map((e) => DelegationResponse.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryDelegatorDelegationsResponse { + return QueryDelegatorDelegationsResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryDelegatorDelegationsResponse { + const message = createBaseQueryDelegatorDelegationsResponse(); + message.delegation_responses = object.delegation_responses?.map((e) => DelegationResponse.fromPartial(e)) || []; + message.pagination = object.pagination !== undefined && object.pagination !== null ? PageResponse.fromPartial(object.pagination) : undefined; + return message; + }, +}; + +export const QueryDelegatorUnbondingDelegationsRequest: MessageFns< + QueryDelegatorUnbondingDelegationsRequest, + "cosmos.staking.v1beta1.QueryDelegatorUnbondingDelegationsRequest" +> = { + $type: "cosmos.staking.v1beta1.QueryDelegatorUnbondingDelegationsRequest" as const, + + encode(message: QueryDelegatorUnbondingDelegationsRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.delegator_addr !== "") { + writer.uint32(10).string(message.delegator_addr); + } + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryDelegatorUnbondingDelegationsRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDelegatorUnbondingDelegationsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.delegator_addr = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDelegatorUnbondingDelegationsRequest { + return { + delegator_addr: isSet(object.delegator_addr) ? globalThis.String(object.delegator_addr) : "", + pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryDelegatorUnbondingDelegationsRequest): unknown { + const obj: any = {}; + if (message.delegator_addr !== "") { + obj.delegator_addr = message.delegator_addr; + } + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryDelegatorUnbondingDelegationsRequest { + return QueryDelegatorUnbondingDelegationsRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryDelegatorUnbondingDelegationsRequest { + const message = createBaseQueryDelegatorUnbondingDelegationsRequest(); + message.delegator_addr = object.delegator_addr ?? ""; + message.pagination = object.pagination !== undefined && object.pagination !== null ? PageRequest.fromPartial(object.pagination) : undefined; + return message; + }, +}; + +export const QueryDelegatorUnbondingDelegationsResponse: MessageFns< + QueryDelegatorUnbondingDelegationsResponse, + "cosmos.staking.v1beta1.QueryDelegatorUnbondingDelegationsResponse" +> = { + $type: "cosmos.staking.v1beta1.QueryDelegatorUnbondingDelegationsResponse" as const, + + encode(message: QueryDelegatorUnbondingDelegationsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.unbonding_responses) { + UnbondingDelegation.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryDelegatorUnbondingDelegationsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDelegatorUnbondingDelegationsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.unbonding_responses.push(UnbondingDelegation.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDelegatorUnbondingDelegationsResponse { + return { + unbonding_responses: globalThis.Array.isArray(object?.unbonding_responses) + ? object.unbonding_responses.map((e: any) => UnbondingDelegation.fromJSON(e)) + : [], + pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryDelegatorUnbondingDelegationsResponse): unknown { + const obj: any = {}; + if (message.unbonding_responses?.length) { + obj.unbonding_responses = message.unbonding_responses.map((e) => UnbondingDelegation.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryDelegatorUnbondingDelegationsResponse { + return QueryDelegatorUnbondingDelegationsResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryDelegatorUnbondingDelegationsResponse { + const message = createBaseQueryDelegatorUnbondingDelegationsResponse(); + message.unbonding_responses = object.unbonding_responses?.map((e) => UnbondingDelegation.fromPartial(e)) || []; + message.pagination = object.pagination !== undefined && object.pagination !== null ? PageResponse.fromPartial(object.pagination) : undefined; + return message; + }, +}; + +export const QueryRedelegationsRequest: MessageFns = { + $type: "cosmos.staking.v1beta1.QueryRedelegationsRequest" as const, + + encode(message: QueryRedelegationsRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.delegator_addr !== "") { + writer.uint32(10).string(message.delegator_addr); + } + if (message.src_validator_addr !== "") { + writer.uint32(18).string(message.src_validator_addr); + } + if (message.dst_validator_addr !== "") { + writer.uint32(26).string(message.dst_validator_addr); + } + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(34).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryRedelegationsRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryRedelegationsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.delegator_addr = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.src_validator_addr = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.dst_validator_addr = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryRedelegationsRequest { + return { + delegator_addr: isSet(object.delegator_addr) ? globalThis.String(object.delegator_addr) : "", + src_validator_addr: isSet(object.src_validator_addr) ? globalThis.String(object.src_validator_addr) : "", + dst_validator_addr: isSet(object.dst_validator_addr) ? globalThis.String(object.dst_validator_addr) : "", + pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryRedelegationsRequest): unknown { + const obj: any = {}; + if (message.delegator_addr !== "") { + obj.delegator_addr = message.delegator_addr; + } + if (message.src_validator_addr !== "") { + obj.src_validator_addr = message.src_validator_addr; + } + if (message.dst_validator_addr !== "") { + obj.dst_validator_addr = message.dst_validator_addr; + } + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryRedelegationsRequest { + return QueryRedelegationsRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryRedelegationsRequest { + const message = createBaseQueryRedelegationsRequest(); + message.delegator_addr = object.delegator_addr ?? ""; + message.src_validator_addr = object.src_validator_addr ?? ""; + message.dst_validator_addr = object.dst_validator_addr ?? ""; + message.pagination = object.pagination !== undefined && object.pagination !== null ? PageRequest.fromPartial(object.pagination) : undefined; + return message; + }, +}; + +export const QueryRedelegationsResponse: MessageFns = { + $type: "cosmos.staking.v1beta1.QueryRedelegationsResponse" as const, + + encode(message: QueryRedelegationsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.redelegation_responses) { + RedelegationResponse.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryRedelegationsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryRedelegationsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.redelegation_responses.push(RedelegationResponse.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryRedelegationsResponse { + return { + redelegation_responses: globalThis.Array.isArray(object?.redelegation_responses) + ? object.redelegation_responses.map((e: any) => RedelegationResponse.fromJSON(e)) + : [], + pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryRedelegationsResponse): unknown { + const obj: any = {}; + if (message.redelegation_responses?.length) { + obj.redelegation_responses = message.redelegation_responses.map((e) => RedelegationResponse.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryRedelegationsResponse { + return QueryRedelegationsResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryRedelegationsResponse { + const message = createBaseQueryRedelegationsResponse(); + message.redelegation_responses = object.redelegation_responses?.map((e) => RedelegationResponse.fromPartial(e)) || []; + message.pagination = object.pagination !== undefined && object.pagination !== null ? PageResponse.fromPartial(object.pagination) : undefined; + return message; + }, +}; + +export const QueryDelegatorValidatorsRequest: MessageFns = { + $type: "cosmos.staking.v1beta1.QueryDelegatorValidatorsRequest" as const, + + encode(message: QueryDelegatorValidatorsRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.delegator_addr !== "") { + writer.uint32(10).string(message.delegator_addr); + } + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryDelegatorValidatorsRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDelegatorValidatorsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.delegator_addr = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDelegatorValidatorsRequest { + return { + delegator_addr: isSet(object.delegator_addr) ? globalThis.String(object.delegator_addr) : "", + pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryDelegatorValidatorsRequest): unknown { + const obj: any = {}; + if (message.delegator_addr !== "") { + obj.delegator_addr = message.delegator_addr; + } + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryDelegatorValidatorsRequest { + return QueryDelegatorValidatorsRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryDelegatorValidatorsRequest { + const message = createBaseQueryDelegatorValidatorsRequest(); + message.delegator_addr = object.delegator_addr ?? ""; + message.pagination = object.pagination !== undefined && object.pagination !== null ? PageRequest.fromPartial(object.pagination) : undefined; + return message; + }, +}; + +export const QueryDelegatorValidatorsResponse: MessageFns = { + $type: "cosmos.staking.v1beta1.QueryDelegatorValidatorsResponse" as const, + + encode(message: QueryDelegatorValidatorsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.validators) { + Validator.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryDelegatorValidatorsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDelegatorValidatorsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.validators.push(Validator.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDelegatorValidatorsResponse { + return { + validators: globalThis.Array.isArray(object?.validators) ? object.validators.map((e: any) => Validator.fromJSON(e)) : [], + pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: QueryDelegatorValidatorsResponse): unknown { + const obj: any = {}; + if (message.validators?.length) { + obj.validators = message.validators.map((e) => Validator.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): QueryDelegatorValidatorsResponse { + return QueryDelegatorValidatorsResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryDelegatorValidatorsResponse { + const message = createBaseQueryDelegatorValidatorsResponse(); + message.validators = object.validators?.map((e) => Validator.fromPartial(e)) || []; + message.pagination = object.pagination !== undefined && object.pagination !== null ? PageResponse.fromPartial(object.pagination) : undefined; + return message; + }, +}; + +export const QueryDelegatorValidatorRequest: MessageFns = { + $type: "cosmos.staking.v1beta1.QueryDelegatorValidatorRequest" as const, + + encode(message: QueryDelegatorValidatorRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.delegator_addr !== "") { + writer.uint32(10).string(message.delegator_addr); + } + if (message.validator_addr !== "") { + writer.uint32(18).string(message.validator_addr); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryDelegatorValidatorRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDelegatorValidatorRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.delegator_addr = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.validator_addr = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDelegatorValidatorRequest { + return { + delegator_addr: isSet(object.delegator_addr) ? globalThis.String(object.delegator_addr) : "", + validator_addr: isSet(object.validator_addr) ? globalThis.String(object.validator_addr) : "", + }; + }, + + toJSON(message: QueryDelegatorValidatorRequest): unknown { + const obj: any = {}; + if (message.delegator_addr !== "") { + obj.delegator_addr = message.delegator_addr; + } + if (message.validator_addr !== "") { + obj.validator_addr = message.validator_addr; + } + return obj; + }, + + create, I>>(base?: I): QueryDelegatorValidatorRequest { + return QueryDelegatorValidatorRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryDelegatorValidatorRequest { + const message = createBaseQueryDelegatorValidatorRequest(); + message.delegator_addr = object.delegator_addr ?? ""; + message.validator_addr = object.validator_addr ?? ""; + return message; + }, +}; + +export const QueryDelegatorValidatorResponse: MessageFns = { + $type: "cosmos.staking.v1beta1.QueryDelegatorValidatorResponse" as const, + + encode(message: QueryDelegatorValidatorResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.validator !== undefined) { + Validator.encode(message.validator, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryDelegatorValidatorResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDelegatorValidatorResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.validator = Validator.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDelegatorValidatorResponse { + return { validator: isSet(object.validator) ? Validator.fromJSON(object.validator) : undefined }; + }, + + toJSON(message: QueryDelegatorValidatorResponse): unknown { + const obj: any = {}; + if (message.validator !== undefined) { + obj.validator = Validator.toJSON(message.validator); + } + return obj; + }, + + create, I>>(base?: I): QueryDelegatorValidatorResponse { + return QueryDelegatorValidatorResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryDelegatorValidatorResponse { + const message = createBaseQueryDelegatorValidatorResponse(); + message.validator = object.validator !== undefined && object.validator !== null ? Validator.fromPartial(object.validator) : undefined; + return message; + }, +}; + +export const QueryHistoricalInfoRequest: MessageFns = { + $type: "cosmos.staking.v1beta1.QueryHistoricalInfoRequest" as const, + + encode(message: QueryHistoricalInfoRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.height !== 0) { + writer.uint32(8).int64(message.height); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryHistoricalInfoRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryHistoricalInfoRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.height = longToNumber(reader.int64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryHistoricalInfoRequest { + return { height: isSet(object.height) ? globalThis.Number(object.height) : 0 }; + }, + + toJSON(message: QueryHistoricalInfoRequest): unknown { + const obj: any = {}; + if (message.height !== 0) { + obj.height = Math.round(message.height); + } + return obj; + }, + + create, I>>(base?: I): QueryHistoricalInfoRequest { + return QueryHistoricalInfoRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryHistoricalInfoRequest { + const message = createBaseQueryHistoricalInfoRequest(); + message.height = object.height ?? 0; + return message; + }, +}; + +export const QueryHistoricalInfoResponse: MessageFns = { + $type: "cosmos.staking.v1beta1.QueryHistoricalInfoResponse" as const, + + encode(message: QueryHistoricalInfoResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.hist !== undefined) { + HistoricalInfo.encode(message.hist, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryHistoricalInfoResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryHistoricalInfoResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.hist = HistoricalInfo.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryHistoricalInfoResponse { + return { hist: isSet(object.hist) ? HistoricalInfo.fromJSON(object.hist) : undefined }; + }, + + toJSON(message: QueryHistoricalInfoResponse): unknown { + const obj: any = {}; + if (message.hist !== undefined) { + obj.hist = HistoricalInfo.toJSON(message.hist); + } + return obj; + }, + + create, I>>(base?: I): QueryHistoricalInfoResponse { + return QueryHistoricalInfoResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryHistoricalInfoResponse { + const message = createBaseQueryHistoricalInfoResponse(); + message.hist = object.hist !== undefined && object.hist !== null ? HistoricalInfo.fromPartial(object.hist) : undefined; + return message; + }, +}; + +export const QueryPoolRequest: MessageFns = { + $type: "cosmos.staking.v1beta1.QueryPoolRequest" as const, + + encode(_: QueryPoolRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryPoolRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryPoolRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): QueryPoolRequest { + return {}; + }, + + toJSON(_: QueryPoolRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): QueryPoolRequest { + return QueryPoolRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): QueryPoolRequest { + const message = createBaseQueryPoolRequest(); + return message; + }, +}; + +export const QueryPoolResponse: MessageFns = { + $type: "cosmos.staking.v1beta1.QueryPoolResponse" as const, + + encode(message: QueryPoolResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.pool !== undefined) { + Pool.encode(message.pool, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryPoolResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryPoolResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.pool = Pool.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryPoolResponse { + return { pool: isSet(object.pool) ? Pool.fromJSON(object.pool) : undefined }; + }, + + toJSON(message: QueryPoolResponse): unknown { + const obj: any = {}; + if (message.pool !== undefined) { + obj.pool = Pool.toJSON(message.pool); + } + return obj; + }, + + create, I>>(base?: I): QueryPoolResponse { + return QueryPoolResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryPoolResponse { + const message = createBaseQueryPoolResponse(); + message.pool = object.pool !== undefined && object.pool !== null ? Pool.fromPartial(object.pool) : undefined; + return message; + }, +}; + +export const QueryParamsRequest: MessageFns = { + $type: "cosmos.staking.v1beta1.QueryParamsRequest" as const, + + encode(_: QueryParamsRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryParamsRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryParamsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): QueryParamsRequest { + return {}; + }, + + toJSON(_: QueryParamsRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): QueryParamsRequest { + return QueryParamsRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): QueryParamsRequest { + const message = createBaseQueryParamsRequest(); + return message; + }, +}; + +export const QueryParamsResponse: MessageFns = { + $type: "cosmos.staking.v1beta1.QueryParamsResponse" as const, + + encode(message: QueryParamsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryParamsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryParamsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.params = Params.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryParamsResponse { + return { params: isSet(object.params) ? Params.fromJSON(object.params) : undefined }; + }, + + toJSON(message: QueryParamsResponse): unknown { + const obj: any = {}; + if (message.params !== undefined) { + obj.params = Params.toJSON(message.params); + } + return obj; + }, + + create, I>>(base?: I): QueryParamsResponse { + return QueryParamsResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryParamsResponse { + const message = createBaseQueryParamsResponse(); + message.params = object.params !== undefined && object.params !== null ? Params.fromPartial(object.params) : undefined; + return message; + }, +}; + +function createBaseQueryValidatorsRequest(): QueryValidatorsRequest { + return { status: "", pagination: undefined }; +} + +function createBaseQueryValidatorsResponse(): QueryValidatorsResponse { + return { validators: [], pagination: undefined }; +} + +function createBaseQueryValidatorRequest(): QueryValidatorRequest { + return { validator_addr: "" }; +} + +function createBaseQueryValidatorResponse(): QueryValidatorResponse { + return { validator: undefined }; +} + +function createBaseQueryValidatorDelegationsRequest(): QueryValidatorDelegationsRequest { + return { validator_addr: "", pagination: undefined }; +} + +function createBaseQueryValidatorDelegationsResponse(): QueryValidatorDelegationsResponse { + return { delegation_responses: [], pagination: undefined }; +} + +function createBaseQueryValidatorUnbondingDelegationsRequest(): QueryValidatorUnbondingDelegationsRequest { + return { validator_addr: "", pagination: undefined }; +} + +function createBaseQueryValidatorUnbondingDelegationsResponse(): QueryValidatorUnbondingDelegationsResponse { + return { unbonding_responses: [], pagination: undefined }; +} + +function createBaseQueryDelegationRequest(): QueryDelegationRequest { + return { delegator_addr: "", validator_addr: "" }; +} + +function createBaseQueryDelegationResponse(): QueryDelegationResponse { + return { delegation_response: undefined }; +} + +function createBaseQueryUnbondingDelegationRequest(): QueryUnbondingDelegationRequest { + return { delegator_addr: "", validator_addr: "" }; +} + +function createBaseQueryUnbondingDelegationResponse(): QueryUnbondingDelegationResponse { + return { unbond: undefined }; +} + +function createBaseQueryDelegatorDelegationsRequest(): QueryDelegatorDelegationsRequest { + return { delegator_addr: "", pagination: undefined }; +} + +function createBaseQueryDelegatorDelegationsResponse(): QueryDelegatorDelegationsResponse { + return { delegation_responses: [], pagination: undefined }; +} + +function createBaseQueryDelegatorUnbondingDelegationsRequest(): QueryDelegatorUnbondingDelegationsRequest { + return { delegator_addr: "", pagination: undefined }; +} + +function createBaseQueryDelegatorUnbondingDelegationsResponse(): QueryDelegatorUnbondingDelegationsResponse { + return { unbonding_responses: [], pagination: undefined }; +} + +function createBaseQueryRedelegationsRequest(): QueryRedelegationsRequest { + return { delegator_addr: "", src_validator_addr: "", dst_validator_addr: "", pagination: undefined }; +} + +function createBaseQueryRedelegationsResponse(): QueryRedelegationsResponse { + return { redelegation_responses: [], pagination: undefined }; +} + +function createBaseQueryDelegatorValidatorsRequest(): QueryDelegatorValidatorsRequest { + return { delegator_addr: "", pagination: undefined }; +} + +function createBaseQueryDelegatorValidatorsResponse(): QueryDelegatorValidatorsResponse { + return { validators: [], pagination: undefined }; +} + +function createBaseQueryDelegatorValidatorRequest(): QueryDelegatorValidatorRequest { + return { delegator_addr: "", validator_addr: "" }; +} + +function createBaseQueryDelegatorValidatorResponse(): QueryDelegatorValidatorResponse { + return { validator: undefined }; +} + +function createBaseQueryHistoricalInfoRequest(): QueryHistoricalInfoRequest { + return { height: 0 }; +} + +function createBaseQueryHistoricalInfoResponse(): QueryHistoricalInfoResponse { + return { hist: undefined }; +} + +function createBaseQueryPoolRequest(): QueryPoolRequest { + return {}; +} + +function createBaseQueryPoolResponse(): QueryPoolResponse { + return { pool: undefined }; +} + +function createBaseQueryParamsRequest(): QueryParamsRequest { + return {}; +} + +function createBaseQueryParamsResponse(): QueryParamsResponse { + return { params: undefined }; +} + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} +export const registry: Array<[string, GeneratedType]> = [ + ["/cosmos.staking.v1beta1.QueryValidatorRequest", QueryValidatorRequest as never], + ["/cosmos.staking.v1beta1.QueryPoolRequest", QueryPoolRequest as never], + ["/cosmos.staking.v1beta1.QueryPoolResponse", QueryPoolResponse as never], + ["/cosmos.staking.v1beta1.QueryParamsRequest", QueryParamsRequest as never], + ["/cosmos.staking.v1beta1.QueryParamsResponse", QueryParamsResponse as never], +]; +export const aminoConverters = { + "/cosmos.staking.v1beta1.QueryValidatorRequest": { + aminoType: "cosmos-sdk/QueryValidatorRequest", + toAmino: (message: QueryValidatorRequest) => ({ ...message }), + fromAmino: (object: QueryValidatorRequest) => ({ ...object }), + }, + + "/cosmos.staking.v1beta1.QueryPoolRequest": { + aminoType: "cosmos-sdk/QueryPoolRequest", + toAmino: (message: QueryPoolRequest) => ({ ...message }), + fromAmino: (object: QueryPoolRequest) => ({ ...object }), + }, + + "/cosmos.staking.v1beta1.QueryPoolResponse": { + aminoType: "cosmos-sdk/QueryPoolResponse", + toAmino: (message: QueryPoolResponse) => ({ ...message }), + fromAmino: (object: QueryPoolResponse) => ({ ...object }), + }, + + "/cosmos.staking.v1beta1.QueryParamsRequest": { + aminoType: "cosmos-sdk/QueryParamsRequest", + toAmino: (message: QueryParamsRequest) => ({ ...message }), + fromAmino: (object: QueryParamsRequest) => ({ ...object }), + }, + + "/cosmos.staking.v1beta1.QueryParamsResponse": { + aminoType: "cosmos-sdk/QueryParamsResponse", + toAmino: (message: QueryParamsResponse) => ({ ...message }), + fromAmino: (object: QueryParamsResponse) => ({ ...object }), + }, +}; diff --git a/packages/cosmos/generated/encoding/cosmos/staking/v1beta1/staking.ts b/packages/cosmos/generated/encoding/cosmos/staking/v1beta1/staking.ts new file mode 100644 index 000000000..636ae8a7f --- /dev/null +++ b/packages/cosmos/generated/encoding/cosmos/staking/v1beta1/staking.ts @@ -0,0 +1,2182 @@ +import type { GeneratedType } from "@cosmjs/proto-signing"; + +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +import { Any } from "../../../google/protobuf/any"; + +import { Duration } from "../../../google/protobuf/duration"; + +import { Timestamp } from "../../../google/protobuf/timestamp"; + +import { Header } from "../../../tendermint/types/types"; + +import { Coin } from "../../base/v1beta1/coin"; + +import type { + CommissionRates as CommissionRates_type, + Commission as Commission_type, + DVPair as DVPair_type, + DVPairs as DVPairs_type, + DVVTriplet as DVVTriplet_type, + DVVTriplets as DVVTriplets_type, + DelegationResponse as DelegationResponse_type, + Delegation as Delegation_type, + Description as Description_type, + HistoricalInfo as HistoricalInfo_type, + Params as Params_type, + Pool as Pool_type, + RedelegationEntryResponse as RedelegationEntryResponse_type, + RedelegationEntry as RedelegationEntry_type, + RedelegationResponse as RedelegationResponse_type, + Redelegation as Redelegation_type, + UnbondingDelegationEntry as UnbondingDelegationEntry_type, + UnbondingDelegation as UnbondingDelegation_type, + ValAddresses as ValAddresses_type, + Validator as Validator_type, +} from "../../../../types/cosmos/staking/v1beta1"; + +import { BondStatus } from "../../../../types/cosmos/staking/v1beta1"; + +import type { DeepPartial, Exact, MessageFns } from "../../../common"; + +export interface HistoricalInfo extends HistoricalInfo_type {} +export interface CommissionRates extends CommissionRates_type {} +export interface Commission extends Commission_type {} +export interface Description extends Description_type {} +export interface Validator extends Validator_type {} +export interface ValAddresses extends ValAddresses_type {} +export interface DVPair extends DVPair_type {} +export interface DVPairs extends DVPairs_type {} +export interface DVVTriplet extends DVVTriplet_type {} +export interface DVVTriplets extends DVVTriplets_type {} +export interface Delegation extends Delegation_type {} +export interface UnbondingDelegation extends UnbondingDelegation_type {} +export interface UnbondingDelegationEntry extends UnbondingDelegationEntry_type {} +export interface RedelegationEntry extends RedelegationEntry_type {} +export interface Redelegation extends Redelegation_type {} +export interface Params extends Params_type {} +export interface DelegationResponse extends DelegationResponse_type {} +export interface RedelegationEntryResponse extends RedelegationEntryResponse_type {} +export interface RedelegationResponse extends RedelegationResponse_type {} +export interface Pool extends Pool_type {} + +export const HistoricalInfo: MessageFns = { + $type: "cosmos.staking.v1beta1.HistoricalInfo" as const, + + encode(message: HistoricalInfo, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.header !== undefined) { + Header.encode(message.header, writer.uint32(10).fork()).join(); + } + for (const v of message.valset) { + Validator.encode(v!, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): HistoricalInfo { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseHistoricalInfo(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.header = Header.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.valset.push(Validator.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): HistoricalInfo { + return { + header: isSet(object.header) ? Header.fromJSON(object.header) : undefined, + valset: globalThis.Array.isArray(object?.valset) ? object.valset.map((e: any) => Validator.fromJSON(e)) : [], + }; + }, + + toJSON(message: HistoricalInfo): unknown { + const obj: any = {}; + if (message.header !== undefined) { + obj.header = Header.toJSON(message.header); + } + if (message.valset?.length) { + obj.valset = message.valset.map((e) => Validator.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): HistoricalInfo { + return HistoricalInfo.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): HistoricalInfo { + const message = createBaseHistoricalInfo(); + message.header = object.header !== undefined && object.header !== null ? Header.fromPartial(object.header) : undefined; + message.valset = object.valset?.map((e) => Validator.fromPartial(e)) || []; + return message; + }, +}; + +export const CommissionRates: MessageFns = { + $type: "cosmos.staking.v1beta1.CommissionRates" as const, + + encode(message: CommissionRates, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.rate !== "") { + writer.uint32(10).string(message.rate); + } + if (message.max_rate !== "") { + writer.uint32(18).string(message.max_rate); + } + if (message.max_change_rate !== "") { + writer.uint32(26).string(message.max_change_rate); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): CommissionRates { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseCommissionRates(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.rate = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.max_rate = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.max_change_rate = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): CommissionRates { + return { + rate: isSet(object.rate) ? globalThis.String(object.rate) : "", + max_rate: isSet(object.max_rate) ? globalThis.String(object.max_rate) : "", + max_change_rate: isSet(object.max_change_rate) ? globalThis.String(object.max_change_rate) : "", + }; + }, + + toJSON(message: CommissionRates): unknown { + const obj: any = {}; + if (message.rate !== "") { + obj.rate = message.rate; + } + if (message.max_rate !== "") { + obj.max_rate = message.max_rate; + } + if (message.max_change_rate !== "") { + obj.max_change_rate = message.max_change_rate; + } + return obj; + }, + + create, I>>(base?: I): CommissionRates { + return CommissionRates.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): CommissionRates { + const message = createBaseCommissionRates(); + message.rate = object.rate ?? ""; + message.max_rate = object.max_rate ?? ""; + message.max_change_rate = object.max_change_rate ?? ""; + return message; + }, +}; + +export const Commission: MessageFns = { + $type: "cosmos.staking.v1beta1.Commission" as const, + + encode(message: Commission, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.commission_rates !== undefined) { + CommissionRates.encode(message.commission_rates, writer.uint32(10).fork()).join(); + } + if (message.update_time !== undefined) { + Timestamp.encode(toTimestamp(message.update_time), writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Commission { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseCommission(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.commission_rates = CommissionRates.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.update_time = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Commission { + return { + commission_rates: isSet(object.commission_rates) ? CommissionRates.fromJSON(object.commission_rates) : undefined, + update_time: isSet(object.update_time) ? fromJsonTimestamp(object.update_time) : undefined, + }; + }, + + toJSON(message: Commission): unknown { + const obj: any = {}; + if (message.commission_rates !== undefined) { + obj.commission_rates = CommissionRates.toJSON(message.commission_rates); + } + if (message.update_time !== undefined) { + obj.update_time = message.update_time.toISOString(); + } + return obj; + }, + + create, I>>(base?: I): Commission { + return Commission.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Commission { + const message = createBaseCommission(); + message.commission_rates = + object.commission_rates !== undefined && object.commission_rates !== null ? CommissionRates.fromPartial(object.commission_rates) : undefined; + message.update_time = object.update_time ?? undefined; + return message; + }, +}; + +export const Description: MessageFns = { + $type: "cosmos.staking.v1beta1.Description" as const, + + encode(message: Description, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.moniker !== "") { + writer.uint32(10).string(message.moniker); + } + if (message.identity !== "") { + writer.uint32(18).string(message.identity); + } + if (message.website !== "") { + writer.uint32(26).string(message.website); + } + if (message.security_contact !== "") { + writer.uint32(34).string(message.security_contact); + } + if (message.details !== "") { + writer.uint32(42).string(message.details); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Description { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDescription(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.moniker = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.identity = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.website = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.security_contact = reader.string(); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.details = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Description { + return { + moniker: isSet(object.moniker) ? globalThis.String(object.moniker) : "", + identity: isSet(object.identity) ? globalThis.String(object.identity) : "", + website: isSet(object.website) ? globalThis.String(object.website) : "", + security_contact: isSet(object.security_contact) ? globalThis.String(object.security_contact) : "", + details: isSet(object.details) ? globalThis.String(object.details) : "", + }; + }, + + toJSON(message: Description): unknown { + const obj: any = {}; + if (message.moniker !== "") { + obj.moniker = message.moniker; + } + if (message.identity !== "") { + obj.identity = message.identity; + } + if (message.website !== "") { + obj.website = message.website; + } + if (message.security_contact !== "") { + obj.security_contact = message.security_contact; + } + if (message.details !== "") { + obj.details = message.details; + } + return obj; + }, + + create, I>>(base?: I): Description { + return Description.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Description { + const message = createBaseDescription(); + message.moniker = object.moniker ?? ""; + message.identity = object.identity ?? ""; + message.website = object.website ?? ""; + message.security_contact = object.security_contact ?? ""; + message.details = object.details ?? ""; + return message; + }, +}; + +export const Validator: MessageFns = { + $type: "cosmos.staking.v1beta1.Validator" as const, + + encode(message: Validator, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.operator_address !== "") { + writer.uint32(10).string(message.operator_address); + } + if (message.consensus_pubkey !== undefined) { + Any.encode(message.consensus_pubkey, writer.uint32(18).fork()).join(); + } + if (message.jailed !== false) { + writer.uint32(24).bool(message.jailed); + } + if (message.status !== 0) { + writer.uint32(32).int32(message.status); + } + if (message.tokens !== "") { + writer.uint32(42).string(message.tokens); + } + if (message.delegator_shares !== "") { + writer.uint32(50).string(message.delegator_shares); + } + if (message.description !== undefined) { + Description.encode(message.description, writer.uint32(58).fork()).join(); + } + if (message.unbonding_height !== 0) { + writer.uint32(64).int64(message.unbonding_height); + } + if (message.unbonding_time !== undefined) { + Timestamp.encode(toTimestamp(message.unbonding_time), writer.uint32(74).fork()).join(); + } + if (message.commission !== undefined) { + Commission.encode(message.commission, writer.uint32(82).fork()).join(); + } + if (message.min_self_delegation !== "") { + writer.uint32(90).string(message.min_self_delegation); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Validator { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseValidator(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.operator_address = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.consensus_pubkey = Any.decode(reader, reader.uint32()); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.jailed = reader.bool(); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.status = reader.int32() as any; + continue; + case 5: + if (tag !== 42) { + break; + } + + message.tokens = reader.string(); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.delegator_shares = reader.string(); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.description = Description.decode(reader, reader.uint32()); + continue; + case 8: + if (tag !== 64) { + break; + } + + message.unbonding_height = longToNumber(reader.int64()); + continue; + case 9: + if (tag !== 74) { + break; + } + + message.unbonding_time = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + continue; + case 10: + if (tag !== 82) { + break; + } + + message.commission = Commission.decode(reader, reader.uint32()); + continue; + case 11: + if (tag !== 90) { + break; + } + + message.min_self_delegation = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Validator { + return { + operator_address: isSet(object.operator_address) ? globalThis.String(object.operator_address) : "", + consensus_pubkey: isSet(object.consensus_pubkey) ? Any.fromJSON(object.consensus_pubkey) : undefined, + jailed: isSet(object.jailed) ? globalThis.Boolean(object.jailed) : false, + status: isSet(object.status) ? bondStatusFromJSON(object.status) : 0, + tokens: isSet(object.tokens) ? globalThis.String(object.tokens) : "", + delegator_shares: isSet(object.delegator_shares) ? globalThis.String(object.delegator_shares) : "", + description: isSet(object.description) ? Description.fromJSON(object.description) : undefined, + unbonding_height: isSet(object.unbonding_height) ? globalThis.Number(object.unbonding_height) : 0, + unbonding_time: isSet(object.unbonding_time) ? fromJsonTimestamp(object.unbonding_time) : undefined, + commission: isSet(object.commission) ? Commission.fromJSON(object.commission) : undefined, + min_self_delegation: isSet(object.min_self_delegation) ? globalThis.String(object.min_self_delegation) : "", + }; + }, + + toJSON(message: Validator): unknown { + const obj: any = {}; + if (message.operator_address !== "") { + obj.operator_address = message.operator_address; + } + if (message.consensus_pubkey !== undefined) { + obj.consensus_pubkey = Any.toJSON(message.consensus_pubkey); + } + if (message.jailed !== false) { + obj.jailed = message.jailed; + } + if (message.status !== 0) { + obj.status = bondStatusToJSON(message.status); + } + if (message.tokens !== "") { + obj.tokens = message.tokens; + } + if (message.delegator_shares !== "") { + obj.delegator_shares = message.delegator_shares; + } + if (message.description !== undefined) { + obj.description = Description.toJSON(message.description); + } + if (message.unbonding_height !== 0) { + obj.unbonding_height = Math.round(message.unbonding_height); + } + if (message.unbonding_time !== undefined) { + obj.unbonding_time = message.unbonding_time.toISOString(); + } + if (message.commission !== undefined) { + obj.commission = Commission.toJSON(message.commission); + } + if (message.min_self_delegation !== "") { + obj.min_self_delegation = message.min_self_delegation; + } + return obj; + }, + + create, I>>(base?: I): Validator { + return Validator.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Validator { + const message = createBaseValidator(); + message.operator_address = object.operator_address ?? ""; + message.consensus_pubkey = object.consensus_pubkey !== undefined && object.consensus_pubkey !== null ? Any.fromPartial(object.consensus_pubkey) : undefined; + message.jailed = object.jailed ?? false; + message.status = object.status ?? 0; + message.tokens = object.tokens ?? ""; + message.delegator_shares = object.delegator_shares ?? ""; + message.description = object.description !== undefined && object.description !== null ? Description.fromPartial(object.description) : undefined; + message.unbonding_height = object.unbonding_height ?? 0; + message.unbonding_time = object.unbonding_time ?? undefined; + message.commission = object.commission !== undefined && object.commission !== null ? Commission.fromPartial(object.commission) : undefined; + message.min_self_delegation = object.min_self_delegation ?? ""; + return message; + }, +}; + +export const ValAddresses: MessageFns = { + $type: "cosmos.staking.v1beta1.ValAddresses" as const, + + encode(message: ValAddresses, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.addresses) { + writer.uint32(10).string(v!); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ValAddresses { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseValAddresses(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.addresses.push(reader.string()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ValAddresses { + return { + addresses: globalThis.Array.isArray(object?.addresses) ? object.addresses.map((e: any) => globalThis.String(e)) : [], + }; + }, + + toJSON(message: ValAddresses): unknown { + const obj: any = {}; + if (message.addresses?.length) { + obj.addresses = message.addresses; + } + return obj; + }, + + create, I>>(base?: I): ValAddresses { + return ValAddresses.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ValAddresses { + const message = createBaseValAddresses(); + message.addresses = object.addresses?.map((e) => e) || []; + return message; + }, +}; + +export const DVPair: MessageFns = { + $type: "cosmos.staking.v1beta1.DVPair" as const, + + encode(message: DVPair, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.delegator_address !== "") { + writer.uint32(10).string(message.delegator_address); + } + if (message.validator_address !== "") { + writer.uint32(18).string(message.validator_address); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): DVPair { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDVPair(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.delegator_address = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.validator_address = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): DVPair { + return { + delegator_address: isSet(object.delegator_address) ? globalThis.String(object.delegator_address) : "", + validator_address: isSet(object.validator_address) ? globalThis.String(object.validator_address) : "", + }; + }, + + toJSON(message: DVPair): unknown { + const obj: any = {}; + if (message.delegator_address !== "") { + obj.delegator_address = message.delegator_address; + } + if (message.validator_address !== "") { + obj.validator_address = message.validator_address; + } + return obj; + }, + + create, I>>(base?: I): DVPair { + return DVPair.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): DVPair { + const message = createBaseDVPair(); + message.delegator_address = object.delegator_address ?? ""; + message.validator_address = object.validator_address ?? ""; + return message; + }, +}; + +export const DVPairs: MessageFns = { + $type: "cosmos.staking.v1beta1.DVPairs" as const, + + encode(message: DVPairs, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.pairs) { + DVPair.encode(v!, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): DVPairs { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDVPairs(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.pairs.push(DVPair.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): DVPairs { + return { pairs: globalThis.Array.isArray(object?.pairs) ? object.pairs.map((e: any) => DVPair.fromJSON(e)) : [] }; + }, + + toJSON(message: DVPairs): unknown { + const obj: any = {}; + if (message.pairs?.length) { + obj.pairs = message.pairs.map((e) => DVPair.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): DVPairs { + return DVPairs.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): DVPairs { + const message = createBaseDVPairs(); + message.pairs = object.pairs?.map((e) => DVPair.fromPartial(e)) || []; + return message; + }, +}; + +export const DVVTriplet: MessageFns = { + $type: "cosmos.staking.v1beta1.DVVTriplet" as const, + + encode(message: DVVTriplet, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.delegator_address !== "") { + writer.uint32(10).string(message.delegator_address); + } + if (message.validator_src_address !== "") { + writer.uint32(18).string(message.validator_src_address); + } + if (message.validator_dst_address !== "") { + writer.uint32(26).string(message.validator_dst_address); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): DVVTriplet { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDVVTriplet(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.delegator_address = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.validator_src_address = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.validator_dst_address = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): DVVTriplet { + return { + delegator_address: isSet(object.delegator_address) ? globalThis.String(object.delegator_address) : "", + validator_src_address: isSet(object.validator_src_address) ? globalThis.String(object.validator_src_address) : "", + validator_dst_address: isSet(object.validator_dst_address) ? globalThis.String(object.validator_dst_address) : "", + }; + }, + + toJSON(message: DVVTriplet): unknown { + const obj: any = {}; + if (message.delegator_address !== "") { + obj.delegator_address = message.delegator_address; + } + if (message.validator_src_address !== "") { + obj.validator_src_address = message.validator_src_address; + } + if (message.validator_dst_address !== "") { + obj.validator_dst_address = message.validator_dst_address; + } + return obj; + }, + + create, I>>(base?: I): DVVTriplet { + return DVVTriplet.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): DVVTriplet { + const message = createBaseDVVTriplet(); + message.delegator_address = object.delegator_address ?? ""; + message.validator_src_address = object.validator_src_address ?? ""; + message.validator_dst_address = object.validator_dst_address ?? ""; + return message; + }, +}; + +export const DVVTriplets: MessageFns = { + $type: "cosmos.staking.v1beta1.DVVTriplets" as const, + + encode(message: DVVTriplets, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.triplets) { + DVVTriplet.encode(v!, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): DVVTriplets { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDVVTriplets(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.triplets.push(DVVTriplet.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): DVVTriplets { + return { + triplets: globalThis.Array.isArray(object?.triplets) ? object.triplets.map((e: any) => DVVTriplet.fromJSON(e)) : [], + }; + }, + + toJSON(message: DVVTriplets): unknown { + const obj: any = {}; + if (message.triplets?.length) { + obj.triplets = message.triplets.map((e) => DVVTriplet.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): DVVTriplets { + return DVVTriplets.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): DVVTriplets { + const message = createBaseDVVTriplets(); + message.triplets = object.triplets?.map((e) => DVVTriplet.fromPartial(e)) || []; + return message; + }, +}; + +export const Delegation: MessageFns = { + $type: "cosmos.staking.v1beta1.Delegation" as const, + + encode(message: Delegation, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.delegator_address !== "") { + writer.uint32(10).string(message.delegator_address); + } + if (message.validator_address !== "") { + writer.uint32(18).string(message.validator_address); + } + if (message.shares !== "") { + writer.uint32(26).string(message.shares); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Delegation { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDelegation(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.delegator_address = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.validator_address = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.shares = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Delegation { + return { + delegator_address: isSet(object.delegator_address) ? globalThis.String(object.delegator_address) : "", + validator_address: isSet(object.validator_address) ? globalThis.String(object.validator_address) : "", + shares: isSet(object.shares) ? globalThis.String(object.shares) : "", + }; + }, + + toJSON(message: Delegation): unknown { + const obj: any = {}; + if (message.delegator_address !== "") { + obj.delegator_address = message.delegator_address; + } + if (message.validator_address !== "") { + obj.validator_address = message.validator_address; + } + if (message.shares !== "") { + obj.shares = message.shares; + } + return obj; + }, + + create, I>>(base?: I): Delegation { + return Delegation.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Delegation { + const message = createBaseDelegation(); + message.delegator_address = object.delegator_address ?? ""; + message.validator_address = object.validator_address ?? ""; + message.shares = object.shares ?? ""; + return message; + }, +}; + +export const UnbondingDelegation: MessageFns = { + $type: "cosmos.staking.v1beta1.UnbondingDelegation" as const, + + encode(message: UnbondingDelegation, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.delegator_address !== "") { + writer.uint32(10).string(message.delegator_address); + } + if (message.validator_address !== "") { + writer.uint32(18).string(message.validator_address); + } + for (const v of message.entries) { + UnbondingDelegationEntry.encode(v!, writer.uint32(26).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): UnbondingDelegation { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseUnbondingDelegation(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.delegator_address = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.validator_address = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.entries.push(UnbondingDelegationEntry.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): UnbondingDelegation { + return { + delegator_address: isSet(object.delegator_address) ? globalThis.String(object.delegator_address) : "", + validator_address: isSet(object.validator_address) ? globalThis.String(object.validator_address) : "", + entries: globalThis.Array.isArray(object?.entries) ? object.entries.map((e: any) => UnbondingDelegationEntry.fromJSON(e)) : [], + }; + }, + + toJSON(message: UnbondingDelegation): unknown { + const obj: any = {}; + if (message.delegator_address !== "") { + obj.delegator_address = message.delegator_address; + } + if (message.validator_address !== "") { + obj.validator_address = message.validator_address; + } + if (message.entries?.length) { + obj.entries = message.entries.map((e) => UnbondingDelegationEntry.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): UnbondingDelegation { + return UnbondingDelegation.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): UnbondingDelegation { + const message = createBaseUnbondingDelegation(); + message.delegator_address = object.delegator_address ?? ""; + message.validator_address = object.validator_address ?? ""; + message.entries = object.entries?.map((e) => UnbondingDelegationEntry.fromPartial(e)) || []; + return message; + }, +}; + +export const UnbondingDelegationEntry: MessageFns = { + $type: "cosmos.staking.v1beta1.UnbondingDelegationEntry" as const, + + encode(message: UnbondingDelegationEntry, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creation_height !== 0) { + writer.uint32(8).int64(message.creation_height); + } + if (message.completion_time !== undefined) { + Timestamp.encode(toTimestamp(message.completion_time), writer.uint32(18).fork()).join(); + } + if (message.initial_balance !== "") { + writer.uint32(26).string(message.initial_balance); + } + if (message.balance !== "") { + writer.uint32(34).string(message.balance); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): UnbondingDelegationEntry { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseUnbondingDelegationEntry(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.creation_height = longToNumber(reader.int64()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.completion_time = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.initial_balance = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.balance = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): UnbondingDelegationEntry { + return { + creation_height: isSet(object.creation_height) ? globalThis.Number(object.creation_height) : 0, + completion_time: isSet(object.completion_time) ? fromJsonTimestamp(object.completion_time) : undefined, + initial_balance: isSet(object.initial_balance) ? globalThis.String(object.initial_balance) : "", + balance: isSet(object.balance) ? globalThis.String(object.balance) : "", + }; + }, + + toJSON(message: UnbondingDelegationEntry): unknown { + const obj: any = {}; + if (message.creation_height !== 0) { + obj.creation_height = Math.round(message.creation_height); + } + if (message.completion_time !== undefined) { + obj.completion_time = message.completion_time.toISOString(); + } + if (message.initial_balance !== "") { + obj.initial_balance = message.initial_balance; + } + if (message.balance !== "") { + obj.balance = message.balance; + } + return obj; + }, + + create, I>>(base?: I): UnbondingDelegationEntry { + return UnbondingDelegationEntry.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): UnbondingDelegationEntry { + const message = createBaseUnbondingDelegationEntry(); + message.creation_height = object.creation_height ?? 0; + message.completion_time = object.completion_time ?? undefined; + message.initial_balance = object.initial_balance ?? ""; + message.balance = object.balance ?? ""; + return message; + }, +}; + +export const RedelegationEntry: MessageFns = { + $type: "cosmos.staking.v1beta1.RedelegationEntry" as const, + + encode(message: RedelegationEntry, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creation_height !== 0) { + writer.uint32(8).int64(message.creation_height); + } + if (message.completion_time !== undefined) { + Timestamp.encode(toTimestamp(message.completion_time), writer.uint32(18).fork()).join(); + } + if (message.initial_balance !== "") { + writer.uint32(26).string(message.initial_balance); + } + if (message.shares_dst !== "") { + writer.uint32(34).string(message.shares_dst); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): RedelegationEntry { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRedelegationEntry(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.creation_height = longToNumber(reader.int64()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.completion_time = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.initial_balance = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.shares_dst = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): RedelegationEntry { + return { + creation_height: isSet(object.creation_height) ? globalThis.Number(object.creation_height) : 0, + completion_time: isSet(object.completion_time) ? fromJsonTimestamp(object.completion_time) : undefined, + initial_balance: isSet(object.initial_balance) ? globalThis.String(object.initial_balance) : "", + shares_dst: isSet(object.shares_dst) ? globalThis.String(object.shares_dst) : "", + }; + }, + + toJSON(message: RedelegationEntry): unknown { + const obj: any = {}; + if (message.creation_height !== 0) { + obj.creation_height = Math.round(message.creation_height); + } + if (message.completion_time !== undefined) { + obj.completion_time = message.completion_time.toISOString(); + } + if (message.initial_balance !== "") { + obj.initial_balance = message.initial_balance; + } + if (message.shares_dst !== "") { + obj.shares_dst = message.shares_dst; + } + return obj; + }, + + create, I>>(base?: I): RedelegationEntry { + return RedelegationEntry.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): RedelegationEntry { + const message = createBaseRedelegationEntry(); + message.creation_height = object.creation_height ?? 0; + message.completion_time = object.completion_time ?? undefined; + message.initial_balance = object.initial_balance ?? ""; + message.shares_dst = object.shares_dst ?? ""; + return message; + }, +}; + +export const Redelegation: MessageFns = { + $type: "cosmos.staking.v1beta1.Redelegation" as const, + + encode(message: Redelegation, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.delegator_address !== "") { + writer.uint32(10).string(message.delegator_address); + } + if (message.validator_src_address !== "") { + writer.uint32(18).string(message.validator_src_address); + } + if (message.validator_dst_address !== "") { + writer.uint32(26).string(message.validator_dst_address); + } + for (const v of message.entries) { + RedelegationEntry.encode(v!, writer.uint32(34).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Redelegation { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRedelegation(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.delegator_address = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.validator_src_address = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.validator_dst_address = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.entries.push(RedelegationEntry.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Redelegation { + return { + delegator_address: isSet(object.delegator_address) ? globalThis.String(object.delegator_address) : "", + validator_src_address: isSet(object.validator_src_address) ? globalThis.String(object.validator_src_address) : "", + validator_dst_address: isSet(object.validator_dst_address) ? globalThis.String(object.validator_dst_address) : "", + entries: globalThis.Array.isArray(object?.entries) ? object.entries.map((e: any) => RedelegationEntry.fromJSON(e)) : [], + }; + }, + + toJSON(message: Redelegation): unknown { + const obj: any = {}; + if (message.delegator_address !== "") { + obj.delegator_address = message.delegator_address; + } + if (message.validator_src_address !== "") { + obj.validator_src_address = message.validator_src_address; + } + if (message.validator_dst_address !== "") { + obj.validator_dst_address = message.validator_dst_address; + } + if (message.entries?.length) { + obj.entries = message.entries.map((e) => RedelegationEntry.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): Redelegation { + return Redelegation.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Redelegation { + const message = createBaseRedelegation(); + message.delegator_address = object.delegator_address ?? ""; + message.validator_src_address = object.validator_src_address ?? ""; + message.validator_dst_address = object.validator_dst_address ?? ""; + message.entries = object.entries?.map((e) => RedelegationEntry.fromPartial(e)) || []; + return message; + }, +}; + +export const Params: MessageFns = { + $type: "cosmos.staking.v1beta1.Params" as const, + + encode(message: Params, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.unbonding_time !== undefined) { + Duration.encode(message.unbonding_time, writer.uint32(10).fork()).join(); + } + if (message.max_validators !== 0) { + writer.uint32(16).uint32(message.max_validators); + } + if (message.max_entries !== 0) { + writer.uint32(24).uint32(message.max_entries); + } + if (message.historical_entries !== 0) { + writer.uint32(32).uint32(message.historical_entries); + } + if (message.bond_denom !== "") { + writer.uint32(42).string(message.bond_denom); + } + if (message.min_commission_rate !== "") { + writer.uint32(50).string(message.min_commission_rate); + } + if (message.max_voting_power_ratio !== "") { + writer.uint32(58).string(message.max_voting_power_ratio); + } + if (message.max_voting_power_enforcement_threshold !== "") { + writer.uint32(66).string(message.max_voting_power_enforcement_threshold); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Params { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.unbonding_time = Duration.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.max_validators = reader.uint32(); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.max_entries = reader.uint32(); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.historical_entries = reader.uint32(); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.bond_denom = reader.string(); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.min_commission_rate = reader.string(); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.max_voting_power_ratio = reader.string(); + continue; + case 8: + if (tag !== 66) { + break; + } + + message.max_voting_power_enforcement_threshold = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Params { + return { + unbonding_time: isSet(object.unbonding_time) ? Duration.fromJSON(object.unbonding_time) : undefined, + max_validators: isSet(object.max_validators) ? globalThis.Number(object.max_validators) : 0, + max_entries: isSet(object.max_entries) ? globalThis.Number(object.max_entries) : 0, + historical_entries: isSet(object.historical_entries) ? globalThis.Number(object.historical_entries) : 0, + bond_denom: isSet(object.bond_denom) ? globalThis.String(object.bond_denom) : "", + min_commission_rate: isSet(object.min_commission_rate) ? globalThis.String(object.min_commission_rate) : "", + max_voting_power_ratio: isSet(object.max_voting_power_ratio) ? globalThis.String(object.max_voting_power_ratio) : "", + max_voting_power_enforcement_threshold: isSet(object.max_voting_power_enforcement_threshold) + ? globalThis.String(object.max_voting_power_enforcement_threshold) + : "", + }; + }, + + toJSON(message: Params): unknown { + const obj: any = {}; + if (message.unbonding_time !== undefined) { + obj.unbonding_time = Duration.toJSON(message.unbonding_time); + } + if (message.max_validators !== 0) { + obj.max_validators = Math.round(message.max_validators); + } + if (message.max_entries !== 0) { + obj.max_entries = Math.round(message.max_entries); + } + if (message.historical_entries !== 0) { + obj.historical_entries = Math.round(message.historical_entries); + } + if (message.bond_denom !== "") { + obj.bond_denom = message.bond_denom; + } + if (message.min_commission_rate !== "") { + obj.min_commission_rate = message.min_commission_rate; + } + if (message.max_voting_power_ratio !== "") { + obj.max_voting_power_ratio = message.max_voting_power_ratio; + } + if (message.max_voting_power_enforcement_threshold !== "") { + obj.max_voting_power_enforcement_threshold = message.max_voting_power_enforcement_threshold; + } + return obj; + }, + + create, I>>(base?: I): Params { + return Params.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Params { + const message = createBaseParams(); + message.unbonding_time = object.unbonding_time !== undefined && object.unbonding_time !== null ? Duration.fromPartial(object.unbonding_time) : undefined; + message.max_validators = object.max_validators ?? 0; + message.max_entries = object.max_entries ?? 0; + message.historical_entries = object.historical_entries ?? 0; + message.bond_denom = object.bond_denom ?? ""; + message.min_commission_rate = object.min_commission_rate ?? ""; + message.max_voting_power_ratio = object.max_voting_power_ratio ?? ""; + message.max_voting_power_enforcement_threshold = object.max_voting_power_enforcement_threshold ?? ""; + return message; + }, +}; + +export const DelegationResponse: MessageFns = { + $type: "cosmos.staking.v1beta1.DelegationResponse" as const, + + encode(message: DelegationResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.delegation !== undefined) { + Delegation.encode(message.delegation, writer.uint32(10).fork()).join(); + } + if (message.balance !== undefined) { + Coin.encode(message.balance, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): DelegationResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDelegationResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.delegation = Delegation.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.balance = Coin.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): DelegationResponse { + return { + delegation: isSet(object.delegation) ? Delegation.fromJSON(object.delegation) : undefined, + balance: isSet(object.balance) ? Coin.fromJSON(object.balance) : undefined, + }; + }, + + toJSON(message: DelegationResponse): unknown { + const obj: any = {}; + if (message.delegation !== undefined) { + obj.delegation = Delegation.toJSON(message.delegation); + } + if (message.balance !== undefined) { + obj.balance = Coin.toJSON(message.balance); + } + return obj; + }, + + create, I>>(base?: I): DelegationResponse { + return DelegationResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): DelegationResponse { + const message = createBaseDelegationResponse(); + message.delegation = object.delegation !== undefined && object.delegation !== null ? Delegation.fromPartial(object.delegation) : undefined; + message.balance = object.balance !== undefined && object.balance !== null ? Coin.fromPartial(object.balance) : undefined; + return message; + }, +}; + +export const RedelegationEntryResponse: MessageFns = { + $type: "cosmos.staking.v1beta1.RedelegationEntryResponse" as const, + + encode(message: RedelegationEntryResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.redelegation_entry !== undefined) { + RedelegationEntry.encode(message.redelegation_entry, writer.uint32(10).fork()).join(); + } + if (message.balance !== "") { + writer.uint32(34).string(message.balance); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): RedelegationEntryResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRedelegationEntryResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.redelegation_entry = RedelegationEntry.decode(reader, reader.uint32()); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.balance = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): RedelegationEntryResponse { + return { + redelegation_entry: isSet(object.redelegation_entry) ? RedelegationEntry.fromJSON(object.redelegation_entry) : undefined, + balance: isSet(object.balance) ? globalThis.String(object.balance) : "", + }; + }, + + toJSON(message: RedelegationEntryResponse): unknown { + const obj: any = {}; + if (message.redelegation_entry !== undefined) { + obj.redelegation_entry = RedelegationEntry.toJSON(message.redelegation_entry); + } + if (message.balance !== "") { + obj.balance = message.balance; + } + return obj; + }, + + create, I>>(base?: I): RedelegationEntryResponse { + return RedelegationEntryResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): RedelegationEntryResponse { + const message = createBaseRedelegationEntryResponse(); + message.redelegation_entry = + object.redelegation_entry !== undefined && object.redelegation_entry !== null ? RedelegationEntry.fromPartial(object.redelegation_entry) : undefined; + message.balance = object.balance ?? ""; + return message; + }, +}; + +export const RedelegationResponse: MessageFns = { + $type: "cosmos.staking.v1beta1.RedelegationResponse" as const, + + encode(message: RedelegationResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.redelegation !== undefined) { + Redelegation.encode(message.redelegation, writer.uint32(10).fork()).join(); + } + for (const v of message.entries) { + RedelegationEntryResponse.encode(v!, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): RedelegationResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRedelegationResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.redelegation = Redelegation.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.entries.push(RedelegationEntryResponse.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): RedelegationResponse { + return { + redelegation: isSet(object.redelegation) ? Redelegation.fromJSON(object.redelegation) : undefined, + entries: globalThis.Array.isArray(object?.entries) ? object.entries.map((e: any) => RedelegationEntryResponse.fromJSON(e)) : [], + }; + }, + + toJSON(message: RedelegationResponse): unknown { + const obj: any = {}; + if (message.redelegation !== undefined) { + obj.redelegation = Redelegation.toJSON(message.redelegation); + } + if (message.entries?.length) { + obj.entries = message.entries.map((e) => RedelegationEntryResponse.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): RedelegationResponse { + return RedelegationResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): RedelegationResponse { + const message = createBaseRedelegationResponse(); + message.redelegation = object.redelegation !== undefined && object.redelegation !== null ? Redelegation.fromPartial(object.redelegation) : undefined; + message.entries = object.entries?.map((e) => RedelegationEntryResponse.fromPartial(e)) || []; + return message; + }, +}; + +export const Pool: MessageFns = { + $type: "cosmos.staking.v1beta1.Pool" as const, + + encode(message: Pool, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.not_bonded_tokens !== "") { + writer.uint32(10).string(message.not_bonded_tokens); + } + if (message.bonded_tokens !== "") { + writer.uint32(18).string(message.bonded_tokens); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Pool { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePool(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.not_bonded_tokens = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.bonded_tokens = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Pool { + return { + not_bonded_tokens: isSet(object.not_bonded_tokens) ? globalThis.String(object.not_bonded_tokens) : "", + bonded_tokens: isSet(object.bonded_tokens) ? globalThis.String(object.bonded_tokens) : "", + }; + }, + + toJSON(message: Pool): unknown { + const obj: any = {}; + if (message.not_bonded_tokens !== "") { + obj.not_bonded_tokens = message.not_bonded_tokens; + } + if (message.bonded_tokens !== "") { + obj.bonded_tokens = message.bonded_tokens; + } + return obj; + }, + + create, I>>(base?: I): Pool { + return Pool.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Pool { + const message = createBasePool(); + message.not_bonded_tokens = object.not_bonded_tokens ?? ""; + message.bonded_tokens = object.bonded_tokens ?? ""; + return message; + }, +}; + +export function bondStatusFromJSON(object: any): BondStatus { + switch (object) { + case 0: + case "BOND_STATUS_UNSPECIFIED": + return BondStatus.BOND_STATUS_UNSPECIFIED; + case 1: + case "BOND_STATUS_UNBONDED": + return BondStatus.BOND_STATUS_UNBONDED; + case 2: + case "BOND_STATUS_UNBONDING": + return BondStatus.BOND_STATUS_UNBONDING; + case 3: + case "BOND_STATUS_BONDED": + return BondStatus.BOND_STATUS_BONDED; + case -1: + case "UNRECOGNIZED": + default: + return BondStatus.UNRECOGNIZED; + } +} + +export function bondStatusToJSON(object: BondStatus): string { + switch (object) { + case BondStatus.BOND_STATUS_UNSPECIFIED: + return "BOND_STATUS_UNSPECIFIED"; + case BondStatus.BOND_STATUS_UNBONDED: + return "BOND_STATUS_UNBONDED"; + case BondStatus.BOND_STATUS_UNBONDING: + return "BOND_STATUS_UNBONDING"; + case BondStatus.BOND_STATUS_BONDED: + return "BOND_STATUS_BONDED"; + case BondStatus.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +function createBaseHistoricalInfo(): HistoricalInfo { + return { header: undefined, valset: [] }; +} + +function createBaseCommissionRates(): CommissionRates { + return { rate: "", max_rate: "", max_change_rate: "" }; +} + +function createBaseCommission(): Commission { + return { commission_rates: undefined, update_time: undefined }; +} + +function createBaseDescription(): Description { + return { moniker: "", identity: "", website: "", security_contact: "", details: "" }; +} + +function createBaseValidator(): Validator { + return { + operator_address: "", + consensus_pubkey: undefined, + jailed: false, + status: 0, + tokens: "", + delegator_shares: "", + description: undefined, + unbonding_height: 0, + unbonding_time: undefined, + commission: undefined, + min_self_delegation: "", + }; +} + +function createBaseValAddresses(): ValAddresses { + return { addresses: [] }; +} + +function createBaseDVPair(): DVPair { + return { delegator_address: "", validator_address: "" }; +} + +function createBaseDVPairs(): DVPairs { + return { pairs: [] }; +} + +function createBaseDVVTriplet(): DVVTriplet { + return { delegator_address: "", validator_src_address: "", validator_dst_address: "" }; +} + +function createBaseDVVTriplets(): DVVTriplets { + return { triplets: [] }; +} + +function createBaseDelegation(): Delegation { + return { delegator_address: "", validator_address: "", shares: "" }; +} + +function createBaseUnbondingDelegation(): UnbondingDelegation { + return { delegator_address: "", validator_address: "", entries: [] }; +} + +function createBaseUnbondingDelegationEntry(): UnbondingDelegationEntry { + return { creation_height: 0, completion_time: undefined, initial_balance: "", balance: "" }; +} + +function createBaseRedelegationEntry(): RedelegationEntry { + return { creation_height: 0, completion_time: undefined, initial_balance: "", shares_dst: "" }; +} + +function createBaseRedelegation(): Redelegation { + return { delegator_address: "", validator_src_address: "", validator_dst_address: "", entries: [] }; +} + +function createBaseParams(): Params { + return { + unbonding_time: undefined, + max_validators: 0, + max_entries: 0, + historical_entries: 0, + bond_denom: "", + min_commission_rate: "", + max_voting_power_ratio: "", + max_voting_power_enforcement_threshold: "", + }; +} + +function createBaseDelegationResponse(): DelegationResponse { + return { delegation: undefined, balance: undefined }; +} + +function createBaseRedelegationEntryResponse(): RedelegationEntryResponse { + return { redelegation_entry: undefined, balance: "" }; +} + +function createBaseRedelegationResponse(): RedelegationResponse { + return { redelegation: undefined, entries: [] }; +} + +function createBasePool(): Pool { + return { not_bonded_tokens: "", bonded_tokens: "" }; +} + +function toTimestamp(date: Date): Timestamp { + const seconds = Math.trunc(date.getTime() / 1_000); + const nanos = (date.getTime() % 1_000) * 1_000_000; + return { seconds, nanos }; +} + +function fromTimestamp(t: Timestamp): Date { + let millis = (t.seconds || 0) * 1_000; + millis += (t.nanos || 0) / 1_000_000; + return new globalThis.Date(millis); +} + +function fromJsonTimestamp(o: any): Date { + if (o instanceof globalThis.Date) { + return o; + } else if (typeof o === "string") { + return new globalThis.Date(o); + } else { + return fromTimestamp(Timestamp.fromJSON(o)); + } +} + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} +export const registry: Array<[string, GeneratedType]> = [ + ["/cosmos.staking.v1beta1.HistoricalInfo", HistoricalInfo as never], + ["/cosmos.staking.v1beta1.CommissionRates", CommissionRates as never], + ["/cosmos.staking.v1beta1.Commission", Commission as never], + ["/cosmos.staking.v1beta1.Description", Description as never], + ["/cosmos.staking.v1beta1.Validator", Validator as never], + ["/cosmos.staking.v1beta1.ValAddresses", ValAddresses as never], + ["/cosmos.staking.v1beta1.DVPair", DVPair as never], + ["/cosmos.staking.v1beta1.DVPairs", DVPairs as never], + ["/cosmos.staking.v1beta1.DVVTriplet", DVVTriplet as never], + ["/cosmos.staking.v1beta1.DVVTriplets", DVVTriplets as never], + ["/cosmos.staking.v1beta1.Delegation", Delegation as never], + ["/cosmos.staking.v1beta1.UnbondingDelegation", UnbondingDelegation as never], + ["/cosmos.staking.v1beta1.RedelegationEntry", RedelegationEntry as never], + ["/cosmos.staking.v1beta1.Redelegation", Redelegation as never], + ["/cosmos.staking.v1beta1.Params", Params as never], + ["/cosmos.staking.v1beta1.DelegationResponse", DelegationResponse as never], + ["/cosmos.staking.v1beta1.RedelegationResponse", RedelegationResponse as never], + ["/cosmos.staking.v1beta1.Pool", Pool as never], +]; +export const aminoConverters = { + "/cosmos.staking.v1beta1.HistoricalInfo": { + aminoType: "cosmos-sdk/HistoricalInfo", + toAmino: (message: HistoricalInfo) => ({ ...message }), + fromAmino: (object: HistoricalInfo) => ({ ...object }), + }, + + "/cosmos.staking.v1beta1.CommissionRates": { + aminoType: "cosmos-sdk/CommissionRates", + toAmino: (message: CommissionRates) => ({ ...message }), + fromAmino: (object: CommissionRates) => ({ ...object }), + }, + + "/cosmos.staking.v1beta1.Commission": { + aminoType: "cosmos-sdk/Commission", + toAmino: (message: Commission) => ({ ...message }), + fromAmino: (object: Commission) => ({ ...object }), + }, + + "/cosmos.staking.v1beta1.Description": { + aminoType: "cosmos-sdk/Description", + toAmino: (message: Description) => ({ ...message }), + fromAmino: (object: Description) => ({ ...object }), + }, + + "/cosmos.staking.v1beta1.Validator": { + aminoType: "cosmos-sdk/Validator", + toAmino: (message: Validator) => ({ ...message }), + fromAmino: (object: Validator) => ({ ...object }), + }, + + "/cosmos.staking.v1beta1.ValAddresses": { + aminoType: "cosmos-sdk/ValAddresses", + toAmino: (message: ValAddresses) => ({ ...message }), + fromAmino: (object: ValAddresses) => ({ ...object }), + }, + + "/cosmos.staking.v1beta1.DVPair": { + aminoType: "cosmos-sdk/DVPair", + toAmino: (message: DVPair) => ({ ...message }), + fromAmino: (object: DVPair) => ({ ...object }), + }, + + "/cosmos.staking.v1beta1.DVPairs": { + aminoType: "cosmos-sdk/DVPairs", + toAmino: (message: DVPairs) => ({ ...message }), + fromAmino: (object: DVPairs) => ({ ...object }), + }, + + "/cosmos.staking.v1beta1.DVVTriplet": { + aminoType: "cosmos-sdk/DVVTriplet", + toAmino: (message: DVVTriplet) => ({ ...message }), + fromAmino: (object: DVVTriplet) => ({ ...object }), + }, + + "/cosmos.staking.v1beta1.DVVTriplets": { + aminoType: "cosmos-sdk/DVVTriplets", + toAmino: (message: DVVTriplets) => ({ ...message }), + fromAmino: (object: DVVTriplets) => ({ ...object }), + }, + + "/cosmos.staking.v1beta1.Delegation": { + aminoType: "cosmos-sdk/Delegation", + toAmino: (message: Delegation) => ({ ...message }), + fromAmino: (object: Delegation) => ({ ...object }), + }, + + "/cosmos.staking.v1beta1.UnbondingDelegation": { + aminoType: "cosmos-sdk/UnbondingDelegation", + toAmino: (message: UnbondingDelegation) => ({ ...message }), + fromAmino: (object: UnbondingDelegation) => ({ ...object }), + }, + + "/cosmos.staking.v1beta1.RedelegationEntry": { + aminoType: "cosmos-sdk/RedelegationEntry", + toAmino: (message: RedelegationEntry) => ({ ...message }), + fromAmino: (object: RedelegationEntry) => ({ ...object }), + }, + + "/cosmos.staking.v1beta1.Redelegation": { + aminoType: "cosmos-sdk/Redelegation", + toAmino: (message: Redelegation) => ({ ...message }), + fromAmino: (object: Redelegation) => ({ ...object }), + }, + + "/cosmos.staking.v1beta1.Params": { + aminoType: "cosmos-sdk/Params", + toAmino: (message: Params) => ({ ...message }), + fromAmino: (object: Params) => ({ ...object }), + }, + + "/cosmos.staking.v1beta1.DelegationResponse": { + aminoType: "cosmos-sdk/DelegationResponse", + toAmino: (message: DelegationResponse) => ({ ...message }), + fromAmino: (object: DelegationResponse) => ({ ...object }), + }, + + "/cosmos.staking.v1beta1.RedelegationResponse": { + aminoType: "cosmos-sdk/RedelegationResponse", + toAmino: (message: RedelegationResponse) => ({ ...message }), + fromAmino: (object: RedelegationResponse) => ({ ...object }), + }, + + "/cosmos.staking.v1beta1.Pool": { + aminoType: "cosmos-sdk/Pool", + toAmino: (message: Pool) => ({ ...message }), + fromAmino: (object: Pool) => ({ ...object }), + }, +}; diff --git a/packages/cosmos/generated/encoding/cosmos/staking/v1beta1/tx.ts b/packages/cosmos/generated/encoding/cosmos/staking/v1beta1/tx.ts new file mode 100644 index 000000000..021759900 --- /dev/null +++ b/packages/cosmos/generated/encoding/cosmos/staking/v1beta1/tx.ts @@ -0,0 +1,921 @@ +import type { GeneratedType } from "@cosmjs/proto-signing"; + +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +import { Any } from "../../../google/protobuf/any"; + +import { Timestamp } from "../../../google/protobuf/timestamp"; + +import { Coin } from "../../base/v1beta1/coin"; + +import { CommissionRates, Description } from "./staking"; + +import type { + MsgBeginRedelegateResponse as MsgBeginRedelegateResponse_type, + MsgBeginRedelegate as MsgBeginRedelegate_type, + MsgCreateValidatorResponse as MsgCreateValidatorResponse_type, + MsgCreateValidator as MsgCreateValidator_type, + MsgDelegateResponse as MsgDelegateResponse_type, + MsgDelegate as MsgDelegate_type, + MsgEditValidatorResponse as MsgEditValidatorResponse_type, + MsgEditValidator as MsgEditValidator_type, + MsgUndelegateResponse as MsgUndelegateResponse_type, + MsgUndelegate as MsgUndelegate_type, +} from "../../../../types/cosmos/staking/v1beta1"; + +import type { DeepPartial, Exact, MessageFns } from "../../../common"; + +export interface MsgCreateValidator extends MsgCreateValidator_type {} +export interface MsgCreateValidatorResponse extends MsgCreateValidatorResponse_type {} +export interface MsgEditValidator extends MsgEditValidator_type {} +export interface MsgEditValidatorResponse extends MsgEditValidatorResponse_type {} +export interface MsgDelegate extends MsgDelegate_type {} +export interface MsgDelegateResponse extends MsgDelegateResponse_type {} +export interface MsgBeginRedelegate extends MsgBeginRedelegate_type {} +export interface MsgBeginRedelegateResponse extends MsgBeginRedelegateResponse_type {} +export interface MsgUndelegate extends MsgUndelegate_type {} +export interface MsgUndelegateResponse extends MsgUndelegateResponse_type {} + +export const MsgCreateValidator: MessageFns = { + $type: "cosmos.staking.v1beta1.MsgCreateValidator" as const, + + encode(message: MsgCreateValidator, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.description !== undefined) { + Description.encode(message.description, writer.uint32(10).fork()).join(); + } + if (message.commission !== undefined) { + CommissionRates.encode(message.commission, writer.uint32(18).fork()).join(); + } + if (message.min_self_delegation !== "") { + writer.uint32(26).string(message.min_self_delegation); + } + if (message.delegator_address !== "") { + writer.uint32(34).string(message.delegator_address); + } + if (message.validator_address !== "") { + writer.uint32(42).string(message.validator_address); + } + if (message.pubkey !== undefined) { + Any.encode(message.pubkey, writer.uint32(50).fork()).join(); + } + if (message.value !== undefined) { + Coin.encode(message.value, writer.uint32(58).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgCreateValidator { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgCreateValidator(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.description = Description.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.commission = CommissionRates.decode(reader, reader.uint32()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.min_self_delegation = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.delegator_address = reader.string(); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.validator_address = reader.string(); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.pubkey = Any.decode(reader, reader.uint32()); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.value = Coin.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgCreateValidator { + return { + description: isSet(object.description) ? Description.fromJSON(object.description) : undefined, + commission: isSet(object.commission) ? CommissionRates.fromJSON(object.commission) : undefined, + min_self_delegation: isSet(object.min_self_delegation) ? globalThis.String(object.min_self_delegation) : "", + delegator_address: isSet(object.delegator_address) ? globalThis.String(object.delegator_address) : "", + validator_address: isSet(object.validator_address) ? globalThis.String(object.validator_address) : "", + pubkey: isSet(object.pubkey) ? Any.fromJSON(object.pubkey) : undefined, + value: isSet(object.value) ? Coin.fromJSON(object.value) : undefined, + }; + }, + + toJSON(message: MsgCreateValidator): unknown { + const obj: any = {}; + if (message.description !== undefined) { + obj.description = Description.toJSON(message.description); + } + if (message.commission !== undefined) { + obj.commission = CommissionRates.toJSON(message.commission); + } + if (message.min_self_delegation !== "") { + obj.min_self_delegation = message.min_self_delegation; + } + if (message.delegator_address !== "") { + obj.delegator_address = message.delegator_address; + } + if (message.validator_address !== "") { + obj.validator_address = message.validator_address; + } + if (message.pubkey !== undefined) { + obj.pubkey = Any.toJSON(message.pubkey); + } + if (message.value !== undefined) { + obj.value = Coin.toJSON(message.value); + } + return obj; + }, + + create, I>>(base?: I): MsgCreateValidator { + return MsgCreateValidator.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgCreateValidator { + const message = createBaseMsgCreateValidator(); + message.description = object.description !== undefined && object.description !== null ? Description.fromPartial(object.description) : undefined; + message.commission = object.commission !== undefined && object.commission !== null ? CommissionRates.fromPartial(object.commission) : undefined; + message.min_self_delegation = object.min_self_delegation ?? ""; + message.delegator_address = object.delegator_address ?? ""; + message.validator_address = object.validator_address ?? ""; + message.pubkey = object.pubkey !== undefined && object.pubkey !== null ? Any.fromPartial(object.pubkey) : undefined; + message.value = object.value !== undefined && object.value !== null ? Coin.fromPartial(object.value) : undefined; + return message; + }, +}; + +export const MsgCreateValidatorResponse: MessageFns = { + $type: "cosmos.staking.v1beta1.MsgCreateValidatorResponse" as const, + + encode(_: MsgCreateValidatorResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgCreateValidatorResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgCreateValidatorResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgCreateValidatorResponse { + return {}; + }, + + toJSON(_: MsgCreateValidatorResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgCreateValidatorResponse { + return MsgCreateValidatorResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgCreateValidatorResponse { + const message = createBaseMsgCreateValidatorResponse(); + return message; + }, +}; + +export const MsgEditValidator: MessageFns = { + $type: "cosmos.staking.v1beta1.MsgEditValidator" as const, + + encode(message: MsgEditValidator, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.description !== undefined) { + Description.encode(message.description, writer.uint32(10).fork()).join(); + } + if (message.validator_address !== "") { + writer.uint32(18).string(message.validator_address); + } + if (message.commission_rate !== "") { + writer.uint32(26).string(message.commission_rate); + } + if (message.min_self_delegation !== "") { + writer.uint32(34).string(message.min_self_delegation); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgEditValidator { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgEditValidator(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.description = Description.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.validator_address = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.commission_rate = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.min_self_delegation = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgEditValidator { + return { + description: isSet(object.description) ? Description.fromJSON(object.description) : undefined, + validator_address: isSet(object.validator_address) ? globalThis.String(object.validator_address) : "", + commission_rate: isSet(object.commission_rate) ? globalThis.String(object.commission_rate) : "", + min_self_delegation: isSet(object.min_self_delegation) ? globalThis.String(object.min_self_delegation) : "", + }; + }, + + toJSON(message: MsgEditValidator): unknown { + const obj: any = {}; + if (message.description !== undefined) { + obj.description = Description.toJSON(message.description); + } + if (message.validator_address !== "") { + obj.validator_address = message.validator_address; + } + if (message.commission_rate !== "") { + obj.commission_rate = message.commission_rate; + } + if (message.min_self_delegation !== "") { + obj.min_self_delegation = message.min_self_delegation; + } + return obj; + }, + + create, I>>(base?: I): MsgEditValidator { + return MsgEditValidator.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgEditValidator { + const message = createBaseMsgEditValidator(); + message.description = object.description !== undefined && object.description !== null ? Description.fromPartial(object.description) : undefined; + message.validator_address = object.validator_address ?? ""; + message.commission_rate = object.commission_rate ?? ""; + message.min_self_delegation = object.min_self_delegation ?? ""; + return message; + }, +}; + +export const MsgEditValidatorResponse: MessageFns = { + $type: "cosmos.staking.v1beta1.MsgEditValidatorResponse" as const, + + encode(_: MsgEditValidatorResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgEditValidatorResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgEditValidatorResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgEditValidatorResponse { + return {}; + }, + + toJSON(_: MsgEditValidatorResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgEditValidatorResponse { + return MsgEditValidatorResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgEditValidatorResponse { + const message = createBaseMsgEditValidatorResponse(); + return message; + }, +}; + +export const MsgDelegate: MessageFns = { + $type: "cosmos.staking.v1beta1.MsgDelegate" as const, + + encode(message: MsgDelegate, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.delegator_address !== "") { + writer.uint32(10).string(message.delegator_address); + } + if (message.validator_address !== "") { + writer.uint32(18).string(message.validator_address); + } + if (message.amount !== undefined) { + Coin.encode(message.amount, writer.uint32(26).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgDelegate { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgDelegate(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.delegator_address = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.validator_address = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.amount = Coin.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgDelegate { + return { + delegator_address: isSet(object.delegator_address) ? globalThis.String(object.delegator_address) : "", + validator_address: isSet(object.validator_address) ? globalThis.String(object.validator_address) : "", + amount: isSet(object.amount) ? Coin.fromJSON(object.amount) : undefined, + }; + }, + + toJSON(message: MsgDelegate): unknown { + const obj: any = {}; + if (message.delegator_address !== "") { + obj.delegator_address = message.delegator_address; + } + if (message.validator_address !== "") { + obj.validator_address = message.validator_address; + } + if (message.amount !== undefined) { + obj.amount = Coin.toJSON(message.amount); + } + return obj; + }, + + create, I>>(base?: I): MsgDelegate { + return MsgDelegate.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgDelegate { + const message = createBaseMsgDelegate(); + message.delegator_address = object.delegator_address ?? ""; + message.validator_address = object.validator_address ?? ""; + message.amount = object.amount !== undefined && object.amount !== null ? Coin.fromPartial(object.amount) : undefined; + return message; + }, +}; + +export const MsgDelegateResponse: MessageFns = { + $type: "cosmos.staking.v1beta1.MsgDelegateResponse" as const, + + encode(_: MsgDelegateResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgDelegateResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgDelegateResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgDelegateResponse { + return {}; + }, + + toJSON(_: MsgDelegateResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgDelegateResponse { + return MsgDelegateResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgDelegateResponse { + const message = createBaseMsgDelegateResponse(); + return message; + }, +}; + +export const MsgBeginRedelegate: MessageFns = { + $type: "cosmos.staking.v1beta1.MsgBeginRedelegate" as const, + + encode(message: MsgBeginRedelegate, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.delegator_address !== "") { + writer.uint32(10).string(message.delegator_address); + } + if (message.validator_src_address !== "") { + writer.uint32(18).string(message.validator_src_address); + } + if (message.validator_dst_address !== "") { + writer.uint32(26).string(message.validator_dst_address); + } + if (message.amount !== undefined) { + Coin.encode(message.amount, writer.uint32(34).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgBeginRedelegate { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgBeginRedelegate(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.delegator_address = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.validator_src_address = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.validator_dst_address = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.amount = Coin.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgBeginRedelegate { + return { + delegator_address: isSet(object.delegator_address) ? globalThis.String(object.delegator_address) : "", + validator_src_address: isSet(object.validator_src_address) ? globalThis.String(object.validator_src_address) : "", + validator_dst_address: isSet(object.validator_dst_address) ? globalThis.String(object.validator_dst_address) : "", + amount: isSet(object.amount) ? Coin.fromJSON(object.amount) : undefined, + }; + }, + + toJSON(message: MsgBeginRedelegate): unknown { + const obj: any = {}; + if (message.delegator_address !== "") { + obj.delegator_address = message.delegator_address; + } + if (message.validator_src_address !== "") { + obj.validator_src_address = message.validator_src_address; + } + if (message.validator_dst_address !== "") { + obj.validator_dst_address = message.validator_dst_address; + } + if (message.amount !== undefined) { + obj.amount = Coin.toJSON(message.amount); + } + return obj; + }, + + create, I>>(base?: I): MsgBeginRedelegate { + return MsgBeginRedelegate.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgBeginRedelegate { + const message = createBaseMsgBeginRedelegate(); + message.delegator_address = object.delegator_address ?? ""; + message.validator_src_address = object.validator_src_address ?? ""; + message.validator_dst_address = object.validator_dst_address ?? ""; + message.amount = object.amount !== undefined && object.amount !== null ? Coin.fromPartial(object.amount) : undefined; + return message; + }, +}; + +export const MsgBeginRedelegateResponse: MessageFns = { + $type: "cosmos.staking.v1beta1.MsgBeginRedelegateResponse" as const, + + encode(message: MsgBeginRedelegateResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.completion_time !== undefined) { + Timestamp.encode(toTimestamp(message.completion_time), writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgBeginRedelegateResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgBeginRedelegateResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.completion_time = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgBeginRedelegateResponse { + return { completion_time: isSet(object.completion_time) ? fromJsonTimestamp(object.completion_time) : undefined }; + }, + + toJSON(message: MsgBeginRedelegateResponse): unknown { + const obj: any = {}; + if (message.completion_time !== undefined) { + obj.completion_time = message.completion_time.toISOString(); + } + return obj; + }, + + create, I>>(base?: I): MsgBeginRedelegateResponse { + return MsgBeginRedelegateResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgBeginRedelegateResponse { + const message = createBaseMsgBeginRedelegateResponse(); + message.completion_time = object.completion_time ?? undefined; + return message; + }, +}; + +export const MsgUndelegate: MessageFns = { + $type: "cosmos.staking.v1beta1.MsgUndelegate" as const, + + encode(message: MsgUndelegate, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.delegator_address !== "") { + writer.uint32(10).string(message.delegator_address); + } + if (message.validator_address !== "") { + writer.uint32(18).string(message.validator_address); + } + if (message.amount !== undefined) { + Coin.encode(message.amount, writer.uint32(26).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgUndelegate { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUndelegate(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.delegator_address = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.validator_address = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.amount = Coin.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgUndelegate { + return { + delegator_address: isSet(object.delegator_address) ? globalThis.String(object.delegator_address) : "", + validator_address: isSet(object.validator_address) ? globalThis.String(object.validator_address) : "", + amount: isSet(object.amount) ? Coin.fromJSON(object.amount) : undefined, + }; + }, + + toJSON(message: MsgUndelegate): unknown { + const obj: any = {}; + if (message.delegator_address !== "") { + obj.delegator_address = message.delegator_address; + } + if (message.validator_address !== "") { + obj.validator_address = message.validator_address; + } + if (message.amount !== undefined) { + obj.amount = Coin.toJSON(message.amount); + } + return obj; + }, + + create, I>>(base?: I): MsgUndelegate { + return MsgUndelegate.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgUndelegate { + const message = createBaseMsgUndelegate(); + message.delegator_address = object.delegator_address ?? ""; + message.validator_address = object.validator_address ?? ""; + message.amount = object.amount !== undefined && object.amount !== null ? Coin.fromPartial(object.amount) : undefined; + return message; + }, +}; + +export const MsgUndelegateResponse: MessageFns = { + $type: "cosmos.staking.v1beta1.MsgUndelegateResponse" as const, + + encode(message: MsgUndelegateResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.completion_time !== undefined) { + Timestamp.encode(toTimestamp(message.completion_time), writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgUndelegateResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUndelegateResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.completion_time = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgUndelegateResponse { + return { completion_time: isSet(object.completion_time) ? fromJsonTimestamp(object.completion_time) : undefined }; + }, + + toJSON(message: MsgUndelegateResponse): unknown { + const obj: any = {}; + if (message.completion_time !== undefined) { + obj.completion_time = message.completion_time.toISOString(); + } + return obj; + }, + + create, I>>(base?: I): MsgUndelegateResponse { + return MsgUndelegateResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgUndelegateResponse { + const message = createBaseMsgUndelegateResponse(); + message.completion_time = object.completion_time ?? undefined; + return message; + }, +}; + +function createBaseMsgCreateValidator(): MsgCreateValidator { + return { + description: undefined, + commission: undefined, + min_self_delegation: "", + delegator_address: "", + validator_address: "", + pubkey: undefined, + value: undefined, + }; +} + +function createBaseMsgCreateValidatorResponse(): MsgCreateValidatorResponse { + return {}; +} + +function createBaseMsgEditValidator(): MsgEditValidator { + return { description: undefined, validator_address: "", commission_rate: "", min_self_delegation: "" }; +} + +function createBaseMsgEditValidatorResponse(): MsgEditValidatorResponse { + return {}; +} + +function createBaseMsgDelegate(): MsgDelegate { + return { delegator_address: "", validator_address: "", amount: undefined }; +} + +function createBaseMsgDelegateResponse(): MsgDelegateResponse { + return {}; +} + +function createBaseMsgBeginRedelegate(): MsgBeginRedelegate { + return { delegator_address: "", validator_src_address: "", validator_dst_address: "", amount: undefined }; +} + +function createBaseMsgBeginRedelegateResponse(): MsgBeginRedelegateResponse { + return { completion_time: undefined }; +} + +function createBaseMsgUndelegate(): MsgUndelegate { + return { delegator_address: "", validator_address: "", amount: undefined }; +} + +function createBaseMsgUndelegateResponse(): MsgUndelegateResponse { + return { completion_time: undefined }; +} + +function toTimestamp(date: Date): Timestamp { + const seconds = Math.trunc(date.getTime() / 1_000); + const nanos = (date.getTime() % 1_000) * 1_000_000; + return { seconds, nanos }; +} + +function fromTimestamp(t: Timestamp): Date { + let millis = (t.seconds || 0) * 1_000; + millis += (t.nanos || 0) / 1_000_000; + return new globalThis.Date(millis); +} + +function fromJsonTimestamp(o: any): Date { + if (o instanceof globalThis.Date) { + return o; + } else if (typeof o === "string") { + return new globalThis.Date(o); + } else { + return fromTimestamp(Timestamp.fromJSON(o)); + } +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} +export const registry: Array<[string, GeneratedType]> = [ + ["/cosmos.staking.v1beta1.MsgCreateValidator", MsgCreateValidator as never], + ["/cosmos.staking.v1beta1.MsgEditValidator", MsgEditValidator as never], + ["/cosmos.staking.v1beta1.MsgDelegate", MsgDelegate as never], + ["/cosmos.staking.v1beta1.MsgDelegateResponse", MsgDelegateResponse as never], + ["/cosmos.staking.v1beta1.MsgBeginRedelegate", MsgBeginRedelegate as never], + ["/cosmos.staking.v1beta1.MsgUndelegate", MsgUndelegate as never], + ["/cosmos.staking.v1beta1.MsgUndelegateResponse", MsgUndelegateResponse as never], +]; +export const aminoConverters = { + "/cosmos.staking.v1beta1.MsgCreateValidator": { + aminoType: "cosmos-sdk/MsgCreateValidator", + toAmino: (message: MsgCreateValidator) => ({ ...message }), + fromAmino: (object: MsgCreateValidator) => ({ ...object }), + }, + + "/cosmos.staking.v1beta1.MsgEditValidator": { + aminoType: "cosmos-sdk/MsgEditValidator", + toAmino: (message: MsgEditValidator) => ({ ...message }), + fromAmino: (object: MsgEditValidator) => ({ ...object }), + }, + + "/cosmos.staking.v1beta1.MsgDelegate": { + aminoType: "cosmos-sdk/MsgDelegate", + toAmino: (message: MsgDelegate) => ({ ...message }), + fromAmino: (object: MsgDelegate) => ({ ...object }), + }, + + "/cosmos.staking.v1beta1.MsgDelegateResponse": { + aminoType: "cosmos-sdk/MsgDelegateResponse", + toAmino: (message: MsgDelegateResponse) => ({ ...message }), + fromAmino: (object: MsgDelegateResponse) => ({ ...object }), + }, + + "/cosmos.staking.v1beta1.MsgBeginRedelegate": { + aminoType: "cosmos-sdk/MsgBeginRedelegate", + toAmino: (message: MsgBeginRedelegate) => ({ ...message }), + fromAmino: (object: MsgBeginRedelegate) => ({ ...object }), + }, + + "/cosmos.staking.v1beta1.MsgUndelegate": { + aminoType: "cosmos-sdk/MsgUndelegate", + toAmino: (message: MsgUndelegate) => ({ ...message }), + fromAmino: (object: MsgUndelegate) => ({ ...object }), + }, + + "/cosmos.staking.v1beta1.MsgUndelegateResponse": { + aminoType: "cosmos-sdk/MsgUndelegateResponse", + toAmino: (message: MsgUndelegateResponse) => ({ ...message }), + fromAmino: (object: MsgUndelegateResponse) => ({ ...object }), + }, +}; diff --git a/packages/cosmos/generated/encoding/cosmos/tx/signing/v1beta1/index.ts b/packages/cosmos/generated/encoding/cosmos/tx/signing/v1beta1/index.ts new file mode 100644 index 000000000..3bdf902ad --- /dev/null +++ b/packages/cosmos/generated/encoding/cosmos/tx/signing/v1beta1/index.ts @@ -0,0 +1,3 @@ +// @ts-nocheck + +export * from './signing'; \ No newline at end of file diff --git a/packages/cosmos/generated/encoding/cosmos/tx/signing/v1beta1/signing.ts b/packages/cosmos/generated/encoding/cosmos/tx/signing/v1beta1/signing.ts new file mode 100644 index 000000000..ebd6958e9 --- /dev/null +++ b/packages/cosmos/generated/encoding/cosmos/tx/signing/v1beta1/signing.ts @@ -0,0 +1,504 @@ +import type { GeneratedType } from "@cosmjs/proto-signing"; + +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +import { Any } from "../../../../google/protobuf/any"; + +import { CompactBitArray } from "../../../crypto/multisig/v1beta1/multisig"; + +import type { + SignatureDescriptorDataMulti as SignatureDescriptorDataMulti_type, + SignatureDescriptorDataSingle as SignatureDescriptorDataSingle_type, + SignatureDescriptorData as SignatureDescriptorData_type, + SignatureDescriptor as SignatureDescriptor_type, + SignatureDescriptors as SignatureDescriptors_type, +} from "../../../../../types/cosmos/tx/signing/v1beta1"; + +import { SignMode } from "../../../../../types/cosmos/tx/signing/v1beta1"; + +import type { DeepPartial, Exact, MessageFns } from "../../../../common"; + +export interface SignatureDescriptors extends SignatureDescriptors_type {} +export interface SignatureDescriptor extends SignatureDescriptor_type {} +export interface SignatureDescriptorData extends SignatureDescriptorData_type {} +export interface SignatureDescriptorDataSingle extends SignatureDescriptorDataSingle_type {} +export interface SignatureDescriptorDataMulti extends SignatureDescriptorDataMulti_type {} + +export const SignatureDescriptors: MessageFns = { + $type: "cosmos.tx.signing.v1beta1.SignatureDescriptors" as const, + + encode(message: SignatureDescriptors, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.signatures) { + SignatureDescriptor.encode(v!, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): SignatureDescriptors { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseSignatureDescriptors(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.signatures.push(SignatureDescriptor.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): SignatureDescriptors { + return { + signatures: globalThis.Array.isArray(object?.signatures) ? object.signatures.map((e: any) => SignatureDescriptor.fromJSON(e)) : [], + }; + }, + + toJSON(message: SignatureDescriptors): unknown { + const obj: any = {}; + if (message.signatures?.length) { + obj.signatures = message.signatures.map((e) => SignatureDescriptor.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): SignatureDescriptors { + return SignatureDescriptors.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): SignatureDescriptors { + const message = createBaseSignatureDescriptors(); + message.signatures = object.signatures?.map((e) => SignatureDescriptor.fromPartial(e)) || []; + return message; + }, +}; + +export const SignatureDescriptor: MessageFns = { + $type: "cosmos.tx.signing.v1beta1.SignatureDescriptor" as const, + + encode(message: SignatureDescriptor, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.public_key !== undefined) { + Any.encode(message.public_key, writer.uint32(10).fork()).join(); + } + if (message.data !== undefined) { + SignatureDescriptorData.encode(message.data, writer.uint32(18).fork()).join(); + } + if (message.sequence !== 0) { + writer.uint32(24).uint64(message.sequence); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): SignatureDescriptor { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseSignatureDescriptor(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.public_key = Any.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.data = SignatureDescriptorData.decode(reader, reader.uint32()); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.sequence = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): SignatureDescriptor { + return { + public_key: isSet(object.public_key) ? Any.fromJSON(object.public_key) : undefined, + data: isSet(object.data) ? SignatureDescriptorData.fromJSON(object.data) : undefined, + sequence: isSet(object.sequence) ? globalThis.Number(object.sequence) : 0, + }; + }, + + toJSON(message: SignatureDescriptor): unknown { + const obj: any = {}; + if (message.public_key !== undefined) { + obj.public_key = Any.toJSON(message.public_key); + } + if (message.data !== undefined) { + obj.data = SignatureDescriptorData.toJSON(message.data); + } + if (message.sequence !== 0) { + obj.sequence = Math.round(message.sequence); + } + return obj; + }, + + create, I>>(base?: I): SignatureDescriptor { + return SignatureDescriptor.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): SignatureDescriptor { + const message = createBaseSignatureDescriptor(); + message.public_key = object.public_key !== undefined && object.public_key !== null ? Any.fromPartial(object.public_key) : undefined; + message.data = object.data !== undefined && object.data !== null ? SignatureDescriptorData.fromPartial(object.data) : undefined; + message.sequence = object.sequence ?? 0; + return message; + }, +}; + +export const SignatureDescriptorData: MessageFns = { + $type: "cosmos.tx.signing.v1beta1.SignatureDescriptor.Data" as const, + + encode(message: SignatureDescriptorData, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.single !== undefined) { + SignatureDescriptorDataSingle.encode(message.single, writer.uint32(10).fork()).join(); + } + if (message.multi !== undefined) { + SignatureDescriptorDataMulti.encode(message.multi, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): SignatureDescriptorData { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseSignatureDescriptorData(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.single = SignatureDescriptorDataSingle.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.multi = SignatureDescriptorDataMulti.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): SignatureDescriptorData { + return { + single: isSet(object.single) ? SignatureDescriptorDataSingle.fromJSON(object.single) : undefined, + multi: isSet(object.multi) ? SignatureDescriptorDataMulti.fromJSON(object.multi) : undefined, + }; + }, + + toJSON(message: SignatureDescriptorData): unknown { + const obj: any = {}; + if (message.single !== undefined) { + obj.single = SignatureDescriptorDataSingle.toJSON(message.single); + } + if (message.multi !== undefined) { + obj.multi = SignatureDescriptorDataMulti.toJSON(message.multi); + } + return obj; + }, + + create, I>>(base?: I): SignatureDescriptorData { + return SignatureDescriptorData.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): SignatureDescriptorData { + const message = createBaseSignatureDescriptorData(); + message.single = object.single !== undefined && object.single !== null ? SignatureDescriptorDataSingle.fromPartial(object.single) : undefined; + message.multi = object.multi !== undefined && object.multi !== null ? SignatureDescriptorDataMulti.fromPartial(object.multi) : undefined; + return message; + }, +}; + +export const SignatureDescriptorDataSingle: MessageFns = { + $type: "cosmos.tx.signing.v1beta1.SignatureDescriptor.Data.Single" as const, + + encode(message: SignatureDescriptorDataSingle, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.mode !== 0) { + writer.uint32(8).int32(message.mode); + } + if (message.signature.length !== 0) { + writer.uint32(18).bytes(message.signature); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): SignatureDescriptorDataSingle { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseSignatureDescriptorDataSingle(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.mode = reader.int32() as any; + continue; + case 2: + if (tag !== 18) { + break; + } + + message.signature = reader.bytes(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): SignatureDescriptorDataSingle { + return { + mode: isSet(object.mode) ? signModeFromJSON(object.mode) : 0, + signature: isSet(object.signature) ? bytesFromBase64(object.signature) : new Uint8Array(0), + }; + }, + + toJSON(message: SignatureDescriptorDataSingle): unknown { + const obj: any = {}; + if (message.mode !== 0) { + obj.mode = signModeToJSON(message.mode); + } + if (message.signature.length !== 0) { + obj.signature = base64FromBytes(message.signature); + } + return obj; + }, + + create, I>>(base?: I): SignatureDescriptorDataSingle { + return SignatureDescriptorDataSingle.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): SignatureDescriptorDataSingle { + const message = createBaseSignatureDescriptorDataSingle(); + message.mode = object.mode ?? 0; + message.signature = object.signature ?? new Uint8Array(0); + return message; + }, +}; + +export const SignatureDescriptorDataMulti: MessageFns = { + $type: "cosmos.tx.signing.v1beta1.SignatureDescriptor.Data.Multi" as const, + + encode(message: SignatureDescriptorDataMulti, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.bitarray !== undefined) { + CompactBitArray.encode(message.bitarray, writer.uint32(10).fork()).join(); + } + for (const v of message.signatures) { + SignatureDescriptorData.encode(v!, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): SignatureDescriptorDataMulti { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseSignatureDescriptorDataMulti(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.bitarray = CompactBitArray.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.signatures.push(SignatureDescriptorData.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): SignatureDescriptorDataMulti { + return { + bitarray: isSet(object.bitarray) ? CompactBitArray.fromJSON(object.bitarray) : undefined, + signatures: globalThis.Array.isArray(object?.signatures) ? object.signatures.map((e: any) => SignatureDescriptorData.fromJSON(e)) : [], + }; + }, + + toJSON(message: SignatureDescriptorDataMulti): unknown { + const obj: any = {}; + if (message.bitarray !== undefined) { + obj.bitarray = CompactBitArray.toJSON(message.bitarray); + } + if (message.signatures?.length) { + obj.signatures = message.signatures.map((e) => SignatureDescriptorData.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): SignatureDescriptorDataMulti { + return SignatureDescriptorDataMulti.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): SignatureDescriptorDataMulti { + const message = createBaseSignatureDescriptorDataMulti(); + message.bitarray = object.bitarray !== undefined && object.bitarray !== null ? CompactBitArray.fromPartial(object.bitarray) : undefined; + message.signatures = object.signatures?.map((e) => SignatureDescriptorData.fromPartial(e)) || []; + return message; + }, +}; + +export function signModeFromJSON(object: any): SignMode { + switch (object) { + case 0: + case "SIGN_MODE_UNSPECIFIED": + return SignMode.SIGN_MODE_UNSPECIFIED; + case 1: + case "SIGN_MODE_DIRECT": + return SignMode.SIGN_MODE_DIRECT; + case 2: + case "SIGN_MODE_TEXTUAL": + return SignMode.SIGN_MODE_TEXTUAL; + 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: + return SignMode.UNRECOGNIZED; + } +} + +export function signModeToJSON(object: SignMode): string { + switch (object) { + case SignMode.SIGN_MODE_UNSPECIFIED: + return "SIGN_MODE_UNSPECIFIED"; + case SignMode.SIGN_MODE_DIRECT: + return "SIGN_MODE_DIRECT"; + case SignMode.SIGN_MODE_TEXTUAL: + return "SIGN_MODE_TEXTUAL"; + 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"; + } +} + +function createBaseSignatureDescriptors(): SignatureDescriptors { + return { signatures: [] }; +} + +function createBaseSignatureDescriptor(): SignatureDescriptor { + return { public_key: undefined, data: undefined, sequence: 0 }; +} + +function createBaseSignatureDescriptorData(): SignatureDescriptorData { + return { single: undefined, multi: undefined }; +} + +function createBaseSignatureDescriptorDataSingle(): SignatureDescriptorDataSingle { + return { mode: 0, signature: new Uint8Array(0) }; +} + +function createBaseSignatureDescriptorDataMulti(): SignatureDescriptorDataMulti { + return { bitarray: undefined, signatures: [] }; +} + +function bytesFromBase64(b64: string): Uint8Array { + if ((globalThis as any).Buffer) { + return Uint8Array.from(globalThis.Buffer.from(b64, "base64")); + } else { + const bin = globalThis.atob(b64); + const arr = new Uint8Array(bin.length); + for (let i = 0; i < bin.length; ++i) { + arr[i] = bin.charCodeAt(i); + } + return arr; + } +} + +function base64FromBytes(arr: Uint8Array): string { + if ((globalThis as any).Buffer) { + return globalThis.Buffer.from(arr).toString("base64"); + } else { + const bin: string[] = []; + arr.forEach((byte) => { + bin.push(globalThis.String.fromCharCode(byte)); + }); + return globalThis.btoa(bin.join("")); + } +} + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} +export const registry: Array<[string, GeneratedType]> = [ + ["/cosmos.tx.signing.v1beta1.SignatureDescriptors", SignatureDescriptors as never], + ["/cosmos.tx.signing.v1beta1.SignatureDescriptor", SignatureDescriptor as never], +]; +export const aminoConverters = { + "/cosmos.tx.signing.v1beta1.SignatureDescriptors": { + aminoType: "cosmos-sdk/SignatureDescriptors", + toAmino: (message: SignatureDescriptors) => ({ ...message }), + fromAmino: (object: SignatureDescriptors) => ({ ...object }), + }, + + "/cosmos.tx.signing.v1beta1.SignatureDescriptor": { + aminoType: "cosmos-sdk/SignatureDescriptor", + toAmino: (message: SignatureDescriptor) => ({ ...message }), + fromAmino: (object: SignatureDescriptor) => ({ ...object }), + }, +}; diff --git a/packages/cosmos/generated/encoding/cosmos/tx/v1beta1/index.ts b/packages/cosmos/generated/encoding/cosmos/tx/v1beta1/index.ts new file mode 100644 index 000000000..eca32bb6f --- /dev/null +++ b/packages/cosmos/generated/encoding/cosmos/tx/v1beta1/index.ts @@ -0,0 +1,4 @@ +// @ts-nocheck + +export * from './service'; +export * from './tx'; \ No newline at end of file diff --git a/packages/cosmos/generated/encoding/cosmos/tx/v1beta1/service.ts b/packages/cosmos/generated/encoding/cosmos/tx/v1beta1/service.ts new file mode 100644 index 000000000..72a282df8 --- /dev/null +++ b/packages/cosmos/generated/encoding/cosmos/tx/v1beta1/service.ts @@ -0,0 +1,1009 @@ +import type { GeneratedType } from "@cosmjs/proto-signing"; + +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +import { Block } from "../../../tendermint/types/block"; + +import { BlockID } from "../../../tendermint/types/types"; + +import { GasInfo, Result, TxResponse } from "../../base/abci/v1beta1/abci"; + +import { PageRequest, PageResponse } from "../../base/query/v1beta1/pagination"; + +import { Tx } from "./tx"; + +import type { + BroadcastTxRequest as BroadcastTxRequest_type, + BroadcastTxResponse as BroadcastTxResponse_type, + GetBlockWithTxsRequest as GetBlockWithTxsRequest_type, + GetBlockWithTxsResponse as GetBlockWithTxsResponse_type, + GetTxRequest as GetTxRequest_type, + GetTxResponse as GetTxResponse_type, + GetTxsEventRequest as GetTxsEventRequest_type, + GetTxsEventResponse as GetTxsEventResponse_type, + SimulateRequest as SimulateRequest_type, + SimulateResponse as SimulateResponse_type, +} from "../../../../types/cosmos/tx/v1beta1"; + +import { BroadcastMode, OrderBy } from "../../../../types/cosmos/tx/v1beta1"; + +import type { DeepPartial, Exact, MessageFns } from "../../../common"; + +export interface GetTxsEventRequest extends GetTxsEventRequest_type {} +export interface GetTxsEventResponse extends GetTxsEventResponse_type {} +export interface BroadcastTxRequest extends BroadcastTxRequest_type {} +export interface BroadcastTxResponse extends BroadcastTxResponse_type {} +export interface SimulateRequest extends SimulateRequest_type {} +export interface SimulateResponse extends SimulateResponse_type {} +export interface GetTxRequest extends GetTxRequest_type {} +export interface GetTxResponse extends GetTxResponse_type {} +export interface GetBlockWithTxsRequest extends GetBlockWithTxsRequest_type {} +export interface GetBlockWithTxsResponse extends GetBlockWithTxsResponse_type {} + +export const GetTxsEventRequest: MessageFns = { + $type: "cosmos.tx.v1beta1.GetTxsEventRequest" as const, + + encode(message: GetTxsEventRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.events) { + writer.uint32(10).string(v!); + } + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(18).fork()).join(); + } + if (message.order_by !== 0) { + writer.uint32(24).int32(message.order_by); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetTxsEventRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetTxsEventRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.events.push(reader.string()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.order_by = reader.int32() as any; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GetTxsEventRequest { + return { + events: globalThis.Array.isArray(object?.events) ? object.events.map((e: any) => globalThis.String(e)) : [], + pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined, + order_by: isSet(object.order_by) ? orderByFromJSON(object.order_by) : 0, + }; + }, + + toJSON(message: GetTxsEventRequest): unknown { + const obj: any = {}; + if (message.events?.length) { + obj.events = message.events; + } + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + if (message.order_by !== 0) { + obj.order_by = orderByToJSON(message.order_by); + } + return obj; + }, + + create, I>>(base?: I): GetTxsEventRequest { + return GetTxsEventRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): GetTxsEventRequest { + const message = createBaseGetTxsEventRequest(); + message.events = object.events?.map((e) => e) || []; + message.pagination = object.pagination !== undefined && object.pagination !== null ? PageRequest.fromPartial(object.pagination) : undefined; + message.order_by = object.order_by ?? 0; + return message; + }, +}; + +export const GetTxsEventResponse: MessageFns = { + $type: "cosmos.tx.v1beta1.GetTxsEventResponse" as const, + + encode(message: GetTxsEventResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.txs) { + Tx.encode(v!, writer.uint32(10).fork()).join(); + } + for (const v of message.tx_responses) { + TxResponse.encode(v!, writer.uint32(18).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(26).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetTxsEventResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetTxsEventResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.txs.push(Tx.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.tx_responses.push(TxResponse.decode(reader, reader.uint32())); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GetTxsEventResponse { + return { + txs: globalThis.Array.isArray(object?.txs) ? object.txs.map((e: any) => Tx.fromJSON(e)) : [], + tx_responses: globalThis.Array.isArray(object?.tx_responses) ? object.tx_responses.map((e: any) => TxResponse.fromJSON(e)) : [], + pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: GetTxsEventResponse): unknown { + const obj: any = {}; + if (message.txs?.length) { + obj.txs = message.txs.map((e) => Tx.toJSON(e)); + } + if (message.tx_responses?.length) { + obj.tx_responses = message.tx_responses.map((e) => TxResponse.toJSON(e)); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): GetTxsEventResponse { + return GetTxsEventResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): GetTxsEventResponse { + const message = createBaseGetTxsEventResponse(); + message.txs = object.txs?.map((e) => Tx.fromPartial(e)) || []; + message.tx_responses = object.tx_responses?.map((e) => TxResponse.fromPartial(e)) || []; + message.pagination = object.pagination !== undefined && object.pagination !== null ? PageResponse.fromPartial(object.pagination) : undefined; + return message; + }, +}; + +export const BroadcastTxRequest: MessageFns = { + $type: "cosmos.tx.v1beta1.BroadcastTxRequest" as const, + + encode(message: BroadcastTxRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.tx_bytes.length !== 0) { + writer.uint32(10).bytes(message.tx_bytes); + } + if (message.mode !== 0) { + writer.uint32(16).int32(message.mode); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): BroadcastTxRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseBroadcastTxRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.tx_bytes = reader.bytes(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.mode = reader.int32() as any; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): BroadcastTxRequest { + return { + tx_bytes: isSet(object.tx_bytes) ? bytesFromBase64(object.tx_bytes) : new Uint8Array(0), + mode: isSet(object.mode) ? broadcastModeFromJSON(object.mode) : 0, + }; + }, + + toJSON(message: BroadcastTxRequest): unknown { + const obj: any = {}; + if (message.tx_bytes.length !== 0) { + obj.tx_bytes = base64FromBytes(message.tx_bytes); + } + if (message.mode !== 0) { + obj.mode = broadcastModeToJSON(message.mode); + } + return obj; + }, + + create, I>>(base?: I): BroadcastTxRequest { + return BroadcastTxRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): BroadcastTxRequest { + const message = createBaseBroadcastTxRequest(); + message.tx_bytes = object.tx_bytes ?? new Uint8Array(0); + message.mode = object.mode ?? 0; + return message; + }, +}; + +export const BroadcastTxResponse: MessageFns = { + $type: "cosmos.tx.v1beta1.BroadcastTxResponse" as const, + + encode(message: BroadcastTxResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.tx_response !== undefined) { + TxResponse.encode(message.tx_response, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): BroadcastTxResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseBroadcastTxResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.tx_response = TxResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): BroadcastTxResponse { + return { tx_response: isSet(object.tx_response) ? TxResponse.fromJSON(object.tx_response) : undefined }; + }, + + toJSON(message: BroadcastTxResponse): unknown { + const obj: any = {}; + if (message.tx_response !== undefined) { + obj.tx_response = TxResponse.toJSON(message.tx_response); + } + return obj; + }, + + create, I>>(base?: I): BroadcastTxResponse { + return BroadcastTxResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): BroadcastTxResponse { + const message = createBaseBroadcastTxResponse(); + message.tx_response = object.tx_response !== undefined && object.tx_response !== null ? TxResponse.fromPartial(object.tx_response) : undefined; + return message; + }, +}; + +export const SimulateRequest: MessageFns = { + $type: "cosmos.tx.v1beta1.SimulateRequest" as const, + + encode(message: SimulateRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.tx !== undefined) { + Tx.encode(message.tx, writer.uint32(10).fork()).join(); + } + if (message.tx_bytes.length !== 0) { + writer.uint32(18).bytes(message.tx_bytes); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): SimulateRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseSimulateRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.tx = Tx.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.tx_bytes = reader.bytes(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): SimulateRequest { + return { + tx: isSet(object.tx) ? Tx.fromJSON(object.tx) : undefined, + tx_bytes: isSet(object.tx_bytes) ? bytesFromBase64(object.tx_bytes) : new Uint8Array(0), + }; + }, + + toJSON(message: SimulateRequest): unknown { + const obj: any = {}; + if (message.tx !== undefined) { + obj.tx = Tx.toJSON(message.tx); + } + if (message.tx_bytes.length !== 0) { + obj.tx_bytes = base64FromBytes(message.tx_bytes); + } + return obj; + }, + + create, I>>(base?: I): SimulateRequest { + return SimulateRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): SimulateRequest { + const message = createBaseSimulateRequest(); + message.tx = object.tx !== undefined && object.tx !== null ? Tx.fromPartial(object.tx) : undefined; + message.tx_bytes = object.tx_bytes ?? new Uint8Array(0); + return message; + }, +}; + +export const SimulateResponse: MessageFns = { + $type: "cosmos.tx.v1beta1.SimulateResponse" as const, + + encode(message: SimulateResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.gas_info !== undefined) { + GasInfo.encode(message.gas_info, writer.uint32(10).fork()).join(); + } + if (message.result !== undefined) { + Result.encode(message.result, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): SimulateResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseSimulateResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.gas_info = GasInfo.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.result = Result.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): SimulateResponse { + return { + gas_info: isSet(object.gas_info) ? GasInfo.fromJSON(object.gas_info) : undefined, + result: isSet(object.result) ? Result.fromJSON(object.result) : undefined, + }; + }, + + toJSON(message: SimulateResponse): unknown { + const obj: any = {}; + if (message.gas_info !== undefined) { + obj.gas_info = GasInfo.toJSON(message.gas_info); + } + if (message.result !== undefined) { + obj.result = Result.toJSON(message.result); + } + return obj; + }, + + create, I>>(base?: I): SimulateResponse { + return SimulateResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): SimulateResponse { + const message = createBaseSimulateResponse(); + message.gas_info = object.gas_info !== undefined && object.gas_info !== null ? GasInfo.fromPartial(object.gas_info) : undefined; + message.result = object.result !== undefined && object.result !== null ? Result.fromPartial(object.result) : undefined; + return message; + }, +}; + +export const GetTxRequest: MessageFns = { + $type: "cosmos.tx.v1beta1.GetTxRequest" as const, + + encode(message: GetTxRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.hash !== "") { + writer.uint32(10).string(message.hash); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetTxRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetTxRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.hash = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GetTxRequest { + return { hash: isSet(object.hash) ? globalThis.String(object.hash) : "" }; + }, + + toJSON(message: GetTxRequest): unknown { + const obj: any = {}; + if (message.hash !== "") { + obj.hash = message.hash; + } + return obj; + }, + + create, I>>(base?: I): GetTxRequest { + return GetTxRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): GetTxRequest { + const message = createBaseGetTxRequest(); + message.hash = object.hash ?? ""; + return message; + }, +}; + +export const GetTxResponse: MessageFns = { + $type: "cosmos.tx.v1beta1.GetTxResponse" as const, + + encode(message: GetTxResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.tx !== undefined) { + Tx.encode(message.tx, writer.uint32(10).fork()).join(); + } + if (message.tx_response !== undefined) { + TxResponse.encode(message.tx_response, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetTxResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetTxResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.tx = Tx.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.tx_response = TxResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GetTxResponse { + return { + tx: isSet(object.tx) ? Tx.fromJSON(object.tx) : undefined, + tx_response: isSet(object.tx_response) ? TxResponse.fromJSON(object.tx_response) : undefined, + }; + }, + + toJSON(message: GetTxResponse): unknown { + const obj: any = {}; + if (message.tx !== undefined) { + obj.tx = Tx.toJSON(message.tx); + } + if (message.tx_response !== undefined) { + obj.tx_response = TxResponse.toJSON(message.tx_response); + } + return obj; + }, + + create, I>>(base?: I): GetTxResponse { + return GetTxResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): GetTxResponse { + const message = createBaseGetTxResponse(); + message.tx = object.tx !== undefined && object.tx !== null ? Tx.fromPartial(object.tx) : undefined; + message.tx_response = object.tx_response !== undefined && object.tx_response !== null ? TxResponse.fromPartial(object.tx_response) : undefined; + return message; + }, +}; + +export const GetBlockWithTxsRequest: MessageFns = { + $type: "cosmos.tx.v1beta1.GetBlockWithTxsRequest" as const, + + encode(message: GetBlockWithTxsRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.height !== 0) { + writer.uint32(8).int64(message.height); + } + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetBlockWithTxsRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetBlockWithTxsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.height = longToNumber(reader.int64()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pagination = PageRequest.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GetBlockWithTxsRequest { + return { + height: isSet(object.height) ? globalThis.Number(object.height) : 0, + pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: GetBlockWithTxsRequest): unknown { + const obj: any = {}; + if (message.height !== 0) { + obj.height = Math.round(message.height); + } + if (message.pagination !== undefined) { + obj.pagination = PageRequest.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): GetBlockWithTxsRequest { + return GetBlockWithTxsRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): GetBlockWithTxsRequest { + const message = createBaseGetBlockWithTxsRequest(); + message.height = object.height ?? 0; + message.pagination = object.pagination !== undefined && object.pagination !== null ? PageRequest.fromPartial(object.pagination) : undefined; + return message; + }, +}; + +export const GetBlockWithTxsResponse: MessageFns = { + $type: "cosmos.tx.v1beta1.GetBlockWithTxsResponse" as const, + + encode(message: GetBlockWithTxsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.txs) { + Tx.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.block_id !== undefined) { + BlockID.encode(message.block_id, writer.uint32(18).fork()).join(); + } + if (message.block !== undefined) { + Block.encode(message.block, writer.uint32(26).fork()).join(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(34).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GetBlockWithTxsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetBlockWithTxsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.txs.push(Tx.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.block_id = BlockID.decode(reader, reader.uint32()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.block = Block.decode(reader, reader.uint32()); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.pagination = PageResponse.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GetBlockWithTxsResponse { + return { + txs: globalThis.Array.isArray(object?.txs) ? object.txs.map((e: any) => Tx.fromJSON(e)) : [], + block_id: isSet(object.block_id) ? BlockID.fromJSON(object.block_id) : undefined, + block: isSet(object.block) ? Block.fromJSON(object.block) : undefined, + pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined, + }; + }, + + toJSON(message: GetBlockWithTxsResponse): unknown { + const obj: any = {}; + if (message.txs?.length) { + obj.txs = message.txs.map((e) => Tx.toJSON(e)); + } + if (message.block_id !== undefined) { + obj.block_id = BlockID.toJSON(message.block_id); + } + if (message.block !== undefined) { + obj.block = Block.toJSON(message.block); + } + if (message.pagination !== undefined) { + obj.pagination = PageResponse.toJSON(message.pagination); + } + return obj; + }, + + create, I>>(base?: I): GetBlockWithTxsResponse { + return GetBlockWithTxsResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): GetBlockWithTxsResponse { + const message = createBaseGetBlockWithTxsResponse(); + message.txs = object.txs?.map((e) => Tx.fromPartial(e)) || []; + message.block_id = object.block_id !== undefined && object.block_id !== null ? BlockID.fromPartial(object.block_id) : undefined; + message.block = object.block !== undefined && object.block !== null ? Block.fromPartial(object.block) : undefined; + message.pagination = object.pagination !== undefined && object.pagination !== null ? PageResponse.fromPartial(object.pagination) : undefined; + return message; + }, +}; + +export function orderByFromJSON(object: any): OrderBy { + switch (object) { + case 0: + case "ORDER_BY_UNSPECIFIED": + return OrderBy.ORDER_BY_UNSPECIFIED; + case 1: + case "ORDER_BY_ASC": + return OrderBy.ORDER_BY_ASC; + case 2: + case "ORDER_BY_DESC": + return OrderBy.ORDER_BY_DESC; + case -1: + case "UNRECOGNIZED": + default: + return OrderBy.UNRECOGNIZED; + } +} + +export function orderByToJSON(object: OrderBy): string { + switch (object) { + case OrderBy.ORDER_BY_UNSPECIFIED: + return "ORDER_BY_UNSPECIFIED"; + case OrderBy.ORDER_BY_ASC: + return "ORDER_BY_ASC"; + case OrderBy.ORDER_BY_DESC: + return "ORDER_BY_DESC"; + case OrderBy.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +export function broadcastModeFromJSON(object: any): BroadcastMode { + switch (object) { + case 0: + case "BROADCAST_MODE_UNSPECIFIED": + return BroadcastMode.BROADCAST_MODE_UNSPECIFIED; + case 1: + case "BROADCAST_MODE_BLOCK": + return BroadcastMode.BROADCAST_MODE_BLOCK; + case 2: + case "BROADCAST_MODE_SYNC": + return BroadcastMode.BROADCAST_MODE_SYNC; + case 3: + case "BROADCAST_MODE_ASYNC": + return BroadcastMode.BROADCAST_MODE_ASYNC; + case -1: + case "UNRECOGNIZED": + default: + return BroadcastMode.UNRECOGNIZED; + } +} + +export function broadcastModeToJSON(object: BroadcastMode): string { + switch (object) { + case BroadcastMode.BROADCAST_MODE_UNSPECIFIED: + return "BROADCAST_MODE_UNSPECIFIED"; + case BroadcastMode.BROADCAST_MODE_BLOCK: + return "BROADCAST_MODE_BLOCK"; + case BroadcastMode.BROADCAST_MODE_SYNC: + return "BROADCAST_MODE_SYNC"; + case BroadcastMode.BROADCAST_MODE_ASYNC: + return "BROADCAST_MODE_ASYNC"; + case BroadcastMode.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +function createBaseGetTxsEventRequest(): GetTxsEventRequest { + return { events: [], pagination: undefined, order_by: 0 }; +} + +function createBaseGetTxsEventResponse(): GetTxsEventResponse { + return { txs: [], tx_responses: [], pagination: undefined }; +} + +function createBaseBroadcastTxRequest(): BroadcastTxRequest { + return { tx_bytes: new Uint8Array(0), mode: 0 }; +} + +function createBaseBroadcastTxResponse(): BroadcastTxResponse { + return { tx_response: undefined }; +} + +function createBaseSimulateRequest(): SimulateRequest { + return { tx: undefined, tx_bytes: new Uint8Array(0) }; +} + +function createBaseSimulateResponse(): SimulateResponse { + return { gas_info: undefined, result: undefined }; +} + +function createBaseGetTxRequest(): GetTxRequest { + return { hash: "" }; +} + +function createBaseGetTxResponse(): GetTxResponse { + return { tx: undefined, tx_response: undefined }; +} + +function createBaseGetBlockWithTxsRequest(): GetBlockWithTxsRequest { + return { height: 0, pagination: undefined }; +} + +function createBaseGetBlockWithTxsResponse(): GetBlockWithTxsResponse { + return { txs: [], block_id: undefined, block: undefined, pagination: undefined }; +} + +function bytesFromBase64(b64: string): Uint8Array { + if ((globalThis as any).Buffer) { + return Uint8Array.from(globalThis.Buffer.from(b64, "base64")); + } else { + const bin = globalThis.atob(b64); + const arr = new Uint8Array(bin.length); + for (let i = 0; i < bin.length; ++i) { + arr[i] = bin.charCodeAt(i); + } + return arr; + } +} + +function base64FromBytes(arr: Uint8Array): string { + if ((globalThis as any).Buffer) { + return globalThis.Buffer.from(arr).toString("base64"); + } else { + const bin: string[] = []; + arr.forEach((byte) => { + bin.push(globalThis.String.fromCharCode(byte)); + }); + return globalThis.btoa(bin.join("")); + } +} + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} +export const registry: Array<[string, GeneratedType]> = [ + ["/cosmos.tx.v1beta1.GetTxsEventRequest", GetTxsEventRequest as never], + ["/cosmos.tx.v1beta1.GetTxsEventResponse", GetTxsEventResponse as never], + ["/cosmos.tx.v1beta1.BroadcastTxRequest", BroadcastTxRequest as never], + ["/cosmos.tx.v1beta1.BroadcastTxResponse", BroadcastTxResponse as never], + ["/cosmos.tx.v1beta1.SimulateRequest", SimulateRequest as never], + ["/cosmos.tx.v1beta1.SimulateResponse", SimulateResponse as never], + ["/cosmos.tx.v1beta1.GetTxRequest", GetTxRequest as never], + ["/cosmos.tx.v1beta1.GetTxResponse", GetTxResponse as never], + ["/cosmos.tx.v1beta1.GetBlockWithTxsRequest", GetBlockWithTxsRequest as never], + ["/cosmos.tx.v1beta1.GetBlockWithTxsResponse", GetBlockWithTxsResponse as never], +]; +export const aminoConverters = { + "/cosmos.tx.v1beta1.GetTxsEventRequest": { + aminoType: "cosmos-sdk/GetTxsEventRequest", + toAmino: (message: GetTxsEventRequest) => ({ ...message }), + fromAmino: (object: GetTxsEventRequest) => ({ ...object }), + }, + + "/cosmos.tx.v1beta1.GetTxsEventResponse": { + aminoType: "cosmos-sdk/GetTxsEventResponse", + toAmino: (message: GetTxsEventResponse) => ({ ...message }), + fromAmino: (object: GetTxsEventResponse) => ({ ...object }), + }, + + "/cosmos.tx.v1beta1.BroadcastTxRequest": { + aminoType: "cosmos-sdk/BroadcastTxRequest", + toAmino: (message: BroadcastTxRequest) => ({ ...message }), + fromAmino: (object: BroadcastTxRequest) => ({ ...object }), + }, + + "/cosmos.tx.v1beta1.BroadcastTxResponse": { + aminoType: "cosmos-sdk/BroadcastTxResponse", + toAmino: (message: BroadcastTxResponse) => ({ ...message }), + fromAmino: (object: BroadcastTxResponse) => ({ ...object }), + }, + + "/cosmos.tx.v1beta1.SimulateRequest": { + aminoType: "cosmos-sdk/SimulateRequest", + toAmino: (message: SimulateRequest) => ({ ...message }), + fromAmino: (object: SimulateRequest) => ({ ...object }), + }, + + "/cosmos.tx.v1beta1.SimulateResponse": { + aminoType: "cosmos-sdk/SimulateResponse", + toAmino: (message: SimulateResponse) => ({ ...message }), + fromAmino: (object: SimulateResponse) => ({ ...object }), + }, + + "/cosmos.tx.v1beta1.GetTxRequest": { + aminoType: "cosmos-sdk/GetTxRequest", + toAmino: (message: GetTxRequest) => ({ ...message }), + fromAmino: (object: GetTxRequest) => ({ ...object }), + }, + + "/cosmos.tx.v1beta1.GetTxResponse": { + aminoType: "cosmos-sdk/GetTxResponse", + toAmino: (message: GetTxResponse) => ({ ...message }), + fromAmino: (object: GetTxResponse) => ({ ...object }), + }, + + "/cosmos.tx.v1beta1.GetBlockWithTxsRequest": { + aminoType: "cosmos-sdk/GetBlockWithTxsRequest", + toAmino: (message: GetBlockWithTxsRequest) => ({ ...message }), + fromAmino: (object: GetBlockWithTxsRequest) => ({ ...object }), + }, + + "/cosmos.tx.v1beta1.GetBlockWithTxsResponse": { + aminoType: "cosmos-sdk/GetBlockWithTxsResponse", + toAmino: (message: GetBlockWithTxsResponse) => ({ ...message }), + fromAmino: (object: GetBlockWithTxsResponse) => ({ ...object }), + }, +}; diff --git a/packages/cosmos/generated/encoding/cosmos/tx/v1beta1/tx.ts b/packages/cosmos/generated/encoding/cosmos/tx/v1beta1/tx.ts new file mode 100644 index 000000000..ad5df5243 --- /dev/null +++ b/packages/cosmos/generated/encoding/cosmos/tx/v1beta1/tx.ts @@ -0,0 +1,1045 @@ +import type { GeneratedType } from "@cosmjs/proto-signing"; + +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +import { Any } from "../../../google/protobuf/any"; + +import { Coin } from "../../base/v1beta1/coin"; + +import { CompactBitArray } from "../../crypto/multisig/v1beta1/multisig"; + +import { signModeFromJSON, signModeToJSON } from "../signing/v1beta1/signing"; + +import type { + AuthInfo as AuthInfo_type, + Fee as Fee_type, + ModeInfoMulti as ModeInfoMulti_type, + ModeInfoSingle as ModeInfoSingle_type, + ModeInfo as ModeInfo_type, + SignDoc as SignDoc_type, + SignerInfo as SignerInfo_type, + TxBody as TxBody_type, + TxRaw as TxRaw_type, + Tx as Tx_type, +} from "../../../../types/cosmos/tx/v1beta1"; + +import type { DeepPartial, Exact, MessageFns } from "../../../common"; + +export interface Tx extends Tx_type {} +export interface TxRaw extends TxRaw_type {} +export interface SignDoc extends SignDoc_type {} +export interface TxBody extends TxBody_type {} +export interface AuthInfo extends AuthInfo_type {} +export interface SignerInfo extends SignerInfo_type {} +export interface ModeInfo extends ModeInfo_type {} +export interface ModeInfoSingle extends ModeInfoSingle_type {} +export interface ModeInfoMulti extends ModeInfoMulti_type {} +export interface Fee extends Fee_type {} + +export const Tx: MessageFns = { + $type: "cosmos.tx.v1beta1.Tx" as const, + + encode(message: Tx, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.body !== undefined) { + TxBody.encode(message.body, writer.uint32(10).fork()).join(); + } + if (message.auth_info !== undefined) { + AuthInfo.encode(message.auth_info, writer.uint32(18).fork()).join(); + } + for (const v of message.signatures) { + writer.uint32(26).bytes(v!); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Tx { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseTx(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.body = TxBody.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.auth_info = AuthInfo.decode(reader, reader.uint32()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.signatures.push(reader.bytes()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Tx { + return { + body: isSet(object.body) ? TxBody.fromJSON(object.body) : undefined, + auth_info: isSet(object.auth_info) ? AuthInfo.fromJSON(object.auth_info) : undefined, + signatures: globalThis.Array.isArray(object?.signatures) ? object.signatures.map((e: any) => bytesFromBase64(e)) : [], + }; + }, + + toJSON(message: Tx): unknown { + const obj: any = {}; + if (message.body !== undefined) { + obj.body = TxBody.toJSON(message.body); + } + if (message.auth_info !== undefined) { + obj.auth_info = AuthInfo.toJSON(message.auth_info); + } + if (message.signatures?.length) { + obj.signatures = message.signatures.map((e) => base64FromBytes(e)); + } + return obj; + }, + + create, I>>(base?: I): Tx { + return Tx.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Tx { + const message = createBaseTx(); + message.body = object.body !== undefined && object.body !== null ? TxBody.fromPartial(object.body) : undefined; + message.auth_info = object.auth_info !== undefined && object.auth_info !== null ? AuthInfo.fromPartial(object.auth_info) : undefined; + message.signatures = object.signatures?.map((e) => e) || []; + return message; + }, +}; + +export const TxRaw: MessageFns = { + $type: "cosmos.tx.v1beta1.TxRaw" as const, + + encode(message: TxRaw, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.body_bytes.length !== 0) { + writer.uint32(10).bytes(message.body_bytes); + } + if (message.auth_info_bytes.length !== 0) { + writer.uint32(18).bytes(message.auth_info_bytes); + } + for (const v of message.signatures) { + writer.uint32(26).bytes(v!); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): TxRaw { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseTxRaw(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.body_bytes = reader.bytes(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.auth_info_bytes = reader.bytes(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.signatures.push(reader.bytes()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): TxRaw { + return { + body_bytes: isSet(object.body_bytes) ? bytesFromBase64(object.body_bytes) : new Uint8Array(0), + auth_info_bytes: isSet(object.auth_info_bytes) ? bytesFromBase64(object.auth_info_bytes) : new Uint8Array(0), + signatures: globalThis.Array.isArray(object?.signatures) ? object.signatures.map((e: any) => bytesFromBase64(e)) : [], + }; + }, + + toJSON(message: TxRaw): unknown { + const obj: any = {}; + if (message.body_bytes.length !== 0) { + obj.body_bytes = base64FromBytes(message.body_bytes); + } + if (message.auth_info_bytes.length !== 0) { + obj.auth_info_bytes = base64FromBytes(message.auth_info_bytes); + } + if (message.signatures?.length) { + obj.signatures = message.signatures.map((e) => base64FromBytes(e)); + } + return obj; + }, + + create, I>>(base?: I): TxRaw { + return TxRaw.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): TxRaw { + const message = createBaseTxRaw(); + message.body_bytes = object.body_bytes ?? new Uint8Array(0); + message.auth_info_bytes = object.auth_info_bytes ?? new Uint8Array(0); + message.signatures = object.signatures?.map((e) => e) || []; + return message; + }, +}; + +export const SignDoc: MessageFns = { + $type: "cosmos.tx.v1beta1.SignDoc" as const, + + encode(message: SignDoc, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.body_bytes.length !== 0) { + writer.uint32(10).bytes(message.body_bytes); + } + if (message.auth_info_bytes.length !== 0) { + writer.uint32(18).bytes(message.auth_info_bytes); + } + if (message.chain_id !== "") { + writer.uint32(26).string(message.chain_id); + } + if (message.account_number !== 0) { + writer.uint32(32).uint64(message.account_number); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): SignDoc { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseSignDoc(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.body_bytes = reader.bytes(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.auth_info_bytes = reader.bytes(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.chain_id = reader.string(); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.account_number = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): SignDoc { + return { + body_bytes: isSet(object.body_bytes) ? bytesFromBase64(object.body_bytes) : new Uint8Array(0), + auth_info_bytes: isSet(object.auth_info_bytes) ? bytesFromBase64(object.auth_info_bytes) : new Uint8Array(0), + chain_id: isSet(object.chain_id) ? globalThis.String(object.chain_id) : "", + account_number: isSet(object.account_number) ? globalThis.Number(object.account_number) : 0, + }; + }, + + toJSON(message: SignDoc): unknown { + const obj: any = {}; + if (message.body_bytes.length !== 0) { + obj.body_bytes = base64FromBytes(message.body_bytes); + } + if (message.auth_info_bytes.length !== 0) { + obj.auth_info_bytes = base64FromBytes(message.auth_info_bytes); + } + if (message.chain_id !== "") { + obj.chain_id = message.chain_id; + } + if (message.account_number !== 0) { + obj.account_number = Math.round(message.account_number); + } + return obj; + }, + + create, I>>(base?: I): SignDoc { + return SignDoc.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): SignDoc { + const message = createBaseSignDoc(); + message.body_bytes = object.body_bytes ?? new Uint8Array(0); + message.auth_info_bytes = object.auth_info_bytes ?? new Uint8Array(0); + message.chain_id = object.chain_id ?? ""; + message.account_number = object.account_number ?? 0; + return message; + }, +}; + +export const TxBody: MessageFns = { + $type: "cosmos.tx.v1beta1.TxBody" as const, + + encode(message: TxBody, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.messages) { + Any.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.memo !== "") { + writer.uint32(18).string(message.memo); + } + if (message.timeout_height !== 0) { + writer.uint32(24).uint64(message.timeout_height); + } + for (const v of message.extension_options) { + Any.encode(v!, writer.uint32(8186).fork()).join(); + } + for (const v of message.non_critical_extension_options) { + Any.encode(v!, writer.uint32(16378).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): TxBody { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseTxBody(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.messages.push(Any.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.memo = reader.string(); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.timeout_height = longToNumber(reader.uint64()); + continue; + case 1023: + if (tag !== 8186) { + break; + } + + message.extension_options.push(Any.decode(reader, reader.uint32())); + continue; + case 2047: + if (tag !== 16378) { + break; + } + + message.non_critical_extension_options.push(Any.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): TxBody { + return { + messages: globalThis.Array.isArray(object?.messages) ? object.messages.map((e: any) => Any.fromJSON(e)) : [], + memo: isSet(object.memo) ? globalThis.String(object.memo) : "", + timeout_height: isSet(object.timeout_height) ? globalThis.Number(object.timeout_height) : 0, + extension_options: globalThis.Array.isArray(object?.extension_options) ? object.extension_options.map((e: any) => Any.fromJSON(e)) : [], + non_critical_extension_options: globalThis.Array.isArray(object?.non_critical_extension_options) + ? object.non_critical_extension_options.map((e: any) => Any.fromJSON(e)) + : [], + }; + }, + + toJSON(message: TxBody): unknown { + const obj: any = {}; + if (message.messages?.length) { + obj.messages = message.messages.map((e) => Any.toJSON(e)); + } + if (message.memo !== "") { + obj.memo = message.memo; + } + if (message.timeout_height !== 0) { + obj.timeout_height = Math.round(message.timeout_height); + } + if (message.extension_options?.length) { + obj.extension_options = message.extension_options.map((e) => Any.toJSON(e)); + } + if (message.non_critical_extension_options?.length) { + obj.non_critical_extension_options = message.non_critical_extension_options.map((e) => Any.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): TxBody { + return TxBody.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): TxBody { + const message = createBaseTxBody(); + message.messages = object.messages?.map((e) => Any.fromPartial(e)) || []; + message.memo = object.memo ?? ""; + message.timeout_height = object.timeout_height ?? 0; + message.extension_options = object.extension_options?.map((e) => Any.fromPartial(e)) || []; + message.non_critical_extension_options = object.non_critical_extension_options?.map((e) => Any.fromPartial(e)) || []; + return message; + }, +}; + +export const AuthInfo: MessageFns = { + $type: "cosmos.tx.v1beta1.AuthInfo" as const, + + encode(message: AuthInfo, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.signer_infos) { + SignerInfo.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.fee !== undefined) { + Fee.encode(message.fee, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): AuthInfo { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseAuthInfo(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.signer_infos.push(SignerInfo.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.fee = Fee.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): AuthInfo { + return { + signer_infos: globalThis.Array.isArray(object?.signer_infos) ? object.signer_infos.map((e: any) => SignerInfo.fromJSON(e)) : [], + fee: isSet(object.fee) ? Fee.fromJSON(object.fee) : undefined, + }; + }, + + toJSON(message: AuthInfo): unknown { + const obj: any = {}; + if (message.signer_infos?.length) { + obj.signer_infos = message.signer_infos.map((e) => SignerInfo.toJSON(e)); + } + if (message.fee !== undefined) { + obj.fee = Fee.toJSON(message.fee); + } + return obj; + }, + + create, I>>(base?: I): AuthInfo { + return AuthInfo.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): AuthInfo { + const message = createBaseAuthInfo(); + message.signer_infos = object.signer_infos?.map((e) => SignerInfo.fromPartial(e)) || []; + message.fee = object.fee !== undefined && object.fee !== null ? Fee.fromPartial(object.fee) : undefined; + return message; + }, +}; + +export const SignerInfo: MessageFns = { + $type: "cosmos.tx.v1beta1.SignerInfo" as const, + + encode(message: SignerInfo, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.public_key !== undefined) { + Any.encode(message.public_key, writer.uint32(10).fork()).join(); + } + if (message.mode_info !== undefined) { + ModeInfo.encode(message.mode_info, writer.uint32(18).fork()).join(); + } + if (message.sequence !== 0) { + writer.uint32(24).uint64(message.sequence); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): SignerInfo { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseSignerInfo(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.public_key = Any.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.mode_info = ModeInfo.decode(reader, reader.uint32()); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.sequence = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): SignerInfo { + return { + public_key: isSet(object.public_key) ? Any.fromJSON(object.public_key) : undefined, + mode_info: isSet(object.mode_info) ? ModeInfo.fromJSON(object.mode_info) : undefined, + sequence: isSet(object.sequence) ? globalThis.Number(object.sequence) : 0, + }; + }, + + toJSON(message: SignerInfo): unknown { + const obj: any = {}; + if (message.public_key !== undefined) { + obj.public_key = Any.toJSON(message.public_key); + } + if (message.mode_info !== undefined) { + obj.mode_info = ModeInfo.toJSON(message.mode_info); + } + if (message.sequence !== 0) { + obj.sequence = Math.round(message.sequence); + } + return obj; + }, + + create, I>>(base?: I): SignerInfo { + return SignerInfo.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): SignerInfo { + const message = createBaseSignerInfo(); + message.public_key = object.public_key !== undefined && object.public_key !== null ? Any.fromPartial(object.public_key) : undefined; + message.mode_info = object.mode_info !== undefined && object.mode_info !== null ? ModeInfo.fromPartial(object.mode_info) : undefined; + message.sequence = object.sequence ?? 0; + return message; + }, +}; + +export const ModeInfo: MessageFns = { + $type: "cosmos.tx.v1beta1.ModeInfo" as const, + + encode(message: ModeInfo, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.single !== undefined) { + ModeInfoSingle.encode(message.single, writer.uint32(10).fork()).join(); + } + if (message.multi !== undefined) { + ModeInfoMulti.encode(message.multi, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ModeInfo { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseModeInfo(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.single = ModeInfoSingle.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.multi = ModeInfoMulti.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ModeInfo { + return { + single: isSet(object.single) ? ModeInfoSingle.fromJSON(object.single) : undefined, + multi: isSet(object.multi) ? ModeInfoMulti.fromJSON(object.multi) : undefined, + }; + }, + + toJSON(message: ModeInfo): unknown { + const obj: any = {}; + if (message.single !== undefined) { + obj.single = ModeInfoSingle.toJSON(message.single); + } + if (message.multi !== undefined) { + obj.multi = ModeInfoMulti.toJSON(message.multi); + } + return obj; + }, + + create, I>>(base?: I): ModeInfo { + return ModeInfo.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ModeInfo { + const message = createBaseModeInfo(); + message.single = object.single !== undefined && object.single !== null ? ModeInfoSingle.fromPartial(object.single) : undefined; + message.multi = object.multi !== undefined && object.multi !== null ? ModeInfoMulti.fromPartial(object.multi) : undefined; + return message; + }, +}; + +export const ModeInfoSingle: MessageFns = { + $type: "cosmos.tx.v1beta1.ModeInfo.Single" as const, + + encode(message: ModeInfoSingle, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.mode !== 0) { + writer.uint32(8).int32(message.mode); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ModeInfoSingle { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseModeInfoSingle(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.mode = reader.int32() as any; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ModeInfoSingle { + return { mode: isSet(object.mode) ? signModeFromJSON(object.mode) : 0 }; + }, + + toJSON(message: ModeInfoSingle): unknown { + const obj: any = {}; + if (message.mode !== 0) { + obj.mode = signModeToJSON(message.mode); + } + return obj; + }, + + create, I>>(base?: I): ModeInfoSingle { + return ModeInfoSingle.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ModeInfoSingle { + const message = createBaseModeInfoSingle(); + message.mode = object.mode ?? 0; + return message; + }, +}; + +export const ModeInfoMulti: MessageFns = { + $type: "cosmos.tx.v1beta1.ModeInfo.Multi" as const, + + encode(message: ModeInfoMulti, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.bitarray !== undefined) { + CompactBitArray.encode(message.bitarray, writer.uint32(10).fork()).join(); + } + for (const v of message.mode_infos) { + ModeInfo.encode(v!, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ModeInfoMulti { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseModeInfoMulti(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.bitarray = CompactBitArray.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.mode_infos.push(ModeInfo.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ModeInfoMulti { + return { + bitarray: isSet(object.bitarray) ? CompactBitArray.fromJSON(object.bitarray) : undefined, + mode_infos: globalThis.Array.isArray(object?.mode_infos) ? object.mode_infos.map((e: any) => ModeInfo.fromJSON(e)) : [], + }; + }, + + toJSON(message: ModeInfoMulti): unknown { + const obj: any = {}; + if (message.bitarray !== undefined) { + obj.bitarray = CompactBitArray.toJSON(message.bitarray); + } + if (message.mode_infos?.length) { + obj.mode_infos = message.mode_infos.map((e) => ModeInfo.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): ModeInfoMulti { + return ModeInfoMulti.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ModeInfoMulti { + const message = createBaseModeInfoMulti(); + message.bitarray = object.bitarray !== undefined && object.bitarray !== null ? CompactBitArray.fromPartial(object.bitarray) : undefined; + message.mode_infos = object.mode_infos?.map((e) => ModeInfo.fromPartial(e)) || []; + return message; + }, +}; + +export const Fee: MessageFns = { + $type: "cosmos.tx.v1beta1.Fee" as const, + + encode(message: Fee, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.amount) { + Coin.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.gas_limit !== 0) { + writer.uint32(16).uint64(message.gas_limit); + } + if (message.payer !== "") { + writer.uint32(26).string(message.payer); + } + if (message.granter !== "") { + writer.uint32(34).string(message.granter); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Fee { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseFee(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.amount.push(Coin.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.gas_limit = longToNumber(reader.uint64()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.payer = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.granter = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Fee { + return { + amount: globalThis.Array.isArray(object?.amount) ? object.amount.map((e: any) => Coin.fromJSON(e)) : [], + gas_limit: isSet(object.gas_limit) ? globalThis.Number(object.gas_limit) : 0, + payer: isSet(object.payer) ? globalThis.String(object.payer) : "", + granter: isSet(object.granter) ? globalThis.String(object.granter) : "", + }; + }, + + toJSON(message: Fee): unknown { + const obj: any = {}; + if (message.amount?.length) { + obj.amount = message.amount.map((e) => Coin.toJSON(e)); + } + if (message.gas_limit !== 0) { + obj.gas_limit = Math.round(message.gas_limit); + } + if (message.payer !== "") { + obj.payer = message.payer; + } + if (message.granter !== "") { + obj.granter = message.granter; + } + return obj; + }, + + create, I>>(base?: I): Fee { + return Fee.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Fee { + const message = createBaseFee(); + message.amount = object.amount?.map((e) => Coin.fromPartial(e)) || []; + message.gas_limit = object.gas_limit ?? 0; + message.payer = object.payer ?? ""; + message.granter = object.granter ?? ""; + return message; + }, +}; + +function createBaseTx(): Tx { + return { body: undefined, auth_info: undefined, signatures: [] }; +} + +function createBaseTxRaw(): TxRaw { + return { body_bytes: new Uint8Array(0), auth_info_bytes: new Uint8Array(0), signatures: [] }; +} + +function createBaseSignDoc(): SignDoc { + return { body_bytes: new Uint8Array(0), auth_info_bytes: new Uint8Array(0), chain_id: "", account_number: 0 }; +} + +function createBaseTxBody(): TxBody { + return { messages: [], memo: "", timeout_height: 0, extension_options: [], non_critical_extension_options: [] }; +} + +function createBaseAuthInfo(): AuthInfo { + return { signer_infos: [], fee: undefined }; +} + +function createBaseSignerInfo(): SignerInfo { + return { public_key: undefined, mode_info: undefined, sequence: 0 }; +} + +function createBaseModeInfo(): ModeInfo { + return { single: undefined, multi: undefined }; +} + +function createBaseModeInfoSingle(): ModeInfoSingle { + return { mode: 0 }; +} + +function createBaseModeInfoMulti(): ModeInfoMulti { + return { bitarray: undefined, mode_infos: [] }; +} + +function createBaseFee(): Fee { + return { amount: [], gas_limit: 0, payer: "", granter: "" }; +} + +function bytesFromBase64(b64: string): Uint8Array { + if ((globalThis as any).Buffer) { + return Uint8Array.from(globalThis.Buffer.from(b64, "base64")); + } else { + const bin = globalThis.atob(b64); + const arr = new Uint8Array(bin.length); + for (let i = 0; i < bin.length; ++i) { + arr[i] = bin.charCodeAt(i); + } + return arr; + } +} + +function base64FromBytes(arr: Uint8Array): string { + if ((globalThis as any).Buffer) { + return globalThis.Buffer.from(arr).toString("base64"); + } else { + const bin: string[] = []; + arr.forEach((byte) => { + bin.push(globalThis.String.fromCharCode(byte)); + }); + return globalThis.btoa(bin.join("")); + } +} + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} +export const registry: Array<[string, GeneratedType]> = [ + ["/cosmos.tx.v1beta1.Tx", Tx as never], + ["/cosmos.tx.v1beta1.TxRaw", TxRaw as never], + ["/cosmos.tx.v1beta1.SignDoc", SignDoc as never], + ["/cosmos.tx.v1beta1.TxBody", TxBody as never], + ["/cosmos.tx.v1beta1.AuthInfo", AuthInfo as never], + ["/cosmos.tx.v1beta1.SignerInfo", SignerInfo as never], + ["/cosmos.tx.v1beta1.ModeInfo", ModeInfo as never], + ["/cosmos.tx.v1beta1.ModeInfo.Single", ModeInfoSingle as never], + ["/cosmos.tx.v1beta1.ModeInfo.Multi", ModeInfoMulti as never], + ["/cosmos.tx.v1beta1.Fee", Fee as never], +]; +export const aminoConverters = { + "/cosmos.tx.v1beta1.Tx": { + aminoType: "cosmos-sdk/Tx", + toAmino: (message: Tx) => ({ ...message }), + fromAmino: (object: Tx) => ({ ...object }), + }, + + "/cosmos.tx.v1beta1.TxRaw": { + aminoType: "cosmos-sdk/TxRaw", + toAmino: (message: TxRaw) => ({ ...message }), + fromAmino: (object: TxRaw) => ({ ...object }), + }, + + "/cosmos.tx.v1beta1.SignDoc": { + aminoType: "cosmos-sdk/SignDoc", + toAmino: (message: SignDoc) => ({ ...message }), + fromAmino: (object: SignDoc) => ({ ...object }), + }, + + "/cosmos.tx.v1beta1.TxBody": { + aminoType: "cosmos-sdk/TxBody", + toAmino: (message: TxBody) => ({ ...message }), + fromAmino: (object: TxBody) => ({ ...object }), + }, + + "/cosmos.tx.v1beta1.AuthInfo": { + aminoType: "cosmos-sdk/AuthInfo", + toAmino: (message: AuthInfo) => ({ ...message }), + fromAmino: (object: AuthInfo) => ({ ...object }), + }, + + "/cosmos.tx.v1beta1.SignerInfo": { + aminoType: "cosmos-sdk/SignerInfo", + toAmino: (message: SignerInfo) => ({ ...message }), + fromAmino: (object: SignerInfo) => ({ ...object }), + }, + + "/cosmos.tx.v1beta1.ModeInfo": { + aminoType: "cosmos-sdk/ModeInfo", + toAmino: (message: ModeInfo) => ({ ...message }), + fromAmino: (object: ModeInfo) => ({ ...object }), + }, + + "/cosmos.tx.v1beta1.ModeInfo.Single": { + aminoType: "cosmos-sdk/Single", + toAmino: (message: ModeInfoSingle) => ({ ...message }), + fromAmino: (object: ModeInfoSingle) => ({ ...object }), + }, + + "/cosmos.tx.v1beta1.ModeInfo.Multi": { + aminoType: "cosmos-sdk/Multi", + toAmino: (message: ModeInfoMulti) => ({ ...message }), + fromAmino: (object: ModeInfoMulti) => ({ ...object }), + }, + + "/cosmos.tx.v1beta1.Fee": { + aminoType: "cosmos-sdk/Fee", + toAmino: (message: Fee) => ({ ...message }), + fromAmino: (object: Fee) => ({ ...object }), + }, +}; diff --git a/packages/cosmos/generated/encoding/cosmos/upgrade/v1beta1/index.ts b/packages/cosmos/generated/encoding/cosmos/upgrade/v1beta1/index.ts new file mode 100644 index 000000000..5c6725ec2 --- /dev/null +++ b/packages/cosmos/generated/encoding/cosmos/upgrade/v1beta1/index.ts @@ -0,0 +1,4 @@ +// @ts-nocheck + +export * from './query'; +export * from './upgrade'; \ No newline at end of file diff --git a/packages/cosmos/generated/encoding/cosmos/upgrade/v1beta1/query.ts b/packages/cosmos/generated/encoding/cosmos/upgrade/v1beta1/query.ts new file mode 100644 index 000000000..b6fd129ec --- /dev/null +++ b/packages/cosmos/generated/encoding/cosmos/upgrade/v1beta1/query.ts @@ -0,0 +1,530 @@ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +import { ModuleVersion, Plan } from "./upgrade"; + +import type { + QueryAppliedPlanRequest as QueryAppliedPlanRequest_type, + QueryAppliedPlanResponse as QueryAppliedPlanResponse_type, + QueryCurrentPlanRequest as QueryCurrentPlanRequest_type, + QueryCurrentPlanResponse as QueryCurrentPlanResponse_type, + QueryModuleVersionsRequest as QueryModuleVersionsRequest_type, + QueryModuleVersionsResponse as QueryModuleVersionsResponse_type, + QueryUpgradedConsensusStateRequest as QueryUpgradedConsensusStateRequest_type, + QueryUpgradedConsensusStateResponse as QueryUpgradedConsensusStateResponse_type, +} from "../../../../types/cosmos/upgrade/v1beta1"; + +import type { DeepPartial, Exact, MessageFns } from "../../../common"; + +export interface QueryCurrentPlanRequest extends QueryCurrentPlanRequest_type {} +export interface QueryCurrentPlanResponse extends QueryCurrentPlanResponse_type {} +export interface QueryAppliedPlanRequest extends QueryAppliedPlanRequest_type {} +export interface QueryAppliedPlanResponse extends QueryAppliedPlanResponse_type {} +export interface QueryUpgradedConsensusStateRequest extends QueryUpgradedConsensusStateRequest_type {} +export interface QueryUpgradedConsensusStateResponse extends QueryUpgradedConsensusStateResponse_type {} +export interface QueryModuleVersionsRequest extends QueryModuleVersionsRequest_type {} +export interface QueryModuleVersionsResponse extends QueryModuleVersionsResponse_type {} + +export const QueryCurrentPlanRequest: MessageFns = { + $type: "cosmos.upgrade.v1beta1.QueryCurrentPlanRequest" as const, + + encode(_: QueryCurrentPlanRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryCurrentPlanRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryCurrentPlanRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): QueryCurrentPlanRequest { + return {}; + }, + + toJSON(_: QueryCurrentPlanRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): QueryCurrentPlanRequest { + return QueryCurrentPlanRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): QueryCurrentPlanRequest { + const message = createBaseQueryCurrentPlanRequest(); + return message; + }, +}; + +export const QueryCurrentPlanResponse: MessageFns = { + $type: "cosmos.upgrade.v1beta1.QueryCurrentPlanResponse" as const, + + encode(message: QueryCurrentPlanResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.plan !== undefined) { + Plan.encode(message.plan, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryCurrentPlanResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryCurrentPlanResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.plan = Plan.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryCurrentPlanResponse { + return { plan: isSet(object.plan) ? Plan.fromJSON(object.plan) : undefined }; + }, + + toJSON(message: QueryCurrentPlanResponse): unknown { + const obj: any = {}; + if (message.plan !== undefined) { + obj.plan = Plan.toJSON(message.plan); + } + return obj; + }, + + create, I>>(base?: I): QueryCurrentPlanResponse { + return QueryCurrentPlanResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryCurrentPlanResponse { + const message = createBaseQueryCurrentPlanResponse(); + message.plan = object.plan !== undefined && object.plan !== null ? Plan.fromPartial(object.plan) : undefined; + return message; + }, +}; + +export const QueryAppliedPlanRequest: MessageFns = { + $type: "cosmos.upgrade.v1beta1.QueryAppliedPlanRequest" as const, + + encode(message: QueryAppliedPlanRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== "") { + writer.uint32(10).string(message.name); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryAppliedPlanRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryAppliedPlanRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.name = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryAppliedPlanRequest { + return { name: isSet(object.name) ? globalThis.String(object.name) : "" }; + }, + + toJSON(message: QueryAppliedPlanRequest): unknown { + const obj: any = {}; + if (message.name !== "") { + obj.name = message.name; + } + return obj; + }, + + create, I>>(base?: I): QueryAppliedPlanRequest { + return QueryAppliedPlanRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryAppliedPlanRequest { + const message = createBaseQueryAppliedPlanRequest(); + message.name = object.name ?? ""; + return message; + }, +}; + +export const QueryAppliedPlanResponse: MessageFns = { + $type: "cosmos.upgrade.v1beta1.QueryAppliedPlanResponse" as const, + + encode(message: QueryAppliedPlanResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.height !== 0) { + writer.uint32(8).int64(message.height); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryAppliedPlanResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryAppliedPlanResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.height = longToNumber(reader.int64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryAppliedPlanResponse { + return { height: isSet(object.height) ? globalThis.Number(object.height) : 0 }; + }, + + toJSON(message: QueryAppliedPlanResponse): unknown { + const obj: any = {}; + if (message.height !== 0) { + obj.height = Math.round(message.height); + } + return obj; + }, + + create, I>>(base?: I): QueryAppliedPlanResponse { + return QueryAppliedPlanResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryAppliedPlanResponse { + const message = createBaseQueryAppliedPlanResponse(); + message.height = object.height ?? 0; + return message; + }, +}; + +export const QueryUpgradedConsensusStateRequest: MessageFns = { + $type: "cosmos.upgrade.v1beta1.QueryUpgradedConsensusStateRequest" as const, + + encode(message: QueryUpgradedConsensusStateRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.last_height !== 0) { + writer.uint32(8).int64(message.last_height); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryUpgradedConsensusStateRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryUpgradedConsensusStateRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.last_height = longToNumber(reader.int64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryUpgradedConsensusStateRequest { + return { last_height: isSet(object.last_height) ? globalThis.Number(object.last_height) : 0 }; + }, + + toJSON(message: QueryUpgradedConsensusStateRequest): unknown { + const obj: any = {}; + if (message.last_height !== 0) { + obj.last_height = Math.round(message.last_height); + } + return obj; + }, + + create, I>>(base?: I): QueryUpgradedConsensusStateRequest { + return QueryUpgradedConsensusStateRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryUpgradedConsensusStateRequest { + const message = createBaseQueryUpgradedConsensusStateRequest(); + message.last_height = object.last_height ?? 0; + return message; + }, +}; + +export const QueryUpgradedConsensusStateResponse: MessageFns< + QueryUpgradedConsensusStateResponse, + "cosmos.upgrade.v1beta1.QueryUpgradedConsensusStateResponse" +> = { + $type: "cosmos.upgrade.v1beta1.QueryUpgradedConsensusStateResponse" as const, + + encode(message: QueryUpgradedConsensusStateResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.upgraded_consensus_state.length !== 0) { + writer.uint32(18).bytes(message.upgraded_consensus_state); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryUpgradedConsensusStateResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryUpgradedConsensusStateResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 2: + if (tag !== 18) { + break; + } + + message.upgraded_consensus_state = reader.bytes(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryUpgradedConsensusStateResponse { + return { + upgraded_consensus_state: isSet(object.upgraded_consensus_state) ? bytesFromBase64(object.upgraded_consensus_state) : new Uint8Array(0), + }; + }, + + toJSON(message: QueryUpgradedConsensusStateResponse): unknown { + const obj: any = {}; + if (message.upgraded_consensus_state.length !== 0) { + obj.upgraded_consensus_state = base64FromBytes(message.upgraded_consensus_state); + } + return obj; + }, + + create, I>>(base?: I): QueryUpgradedConsensusStateResponse { + return QueryUpgradedConsensusStateResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryUpgradedConsensusStateResponse { + const message = createBaseQueryUpgradedConsensusStateResponse(); + message.upgraded_consensus_state = object.upgraded_consensus_state ?? new Uint8Array(0); + return message; + }, +}; + +export const QueryModuleVersionsRequest: MessageFns = { + $type: "cosmos.upgrade.v1beta1.QueryModuleVersionsRequest" as const, + + encode(message: QueryModuleVersionsRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.module_name !== "") { + writer.uint32(10).string(message.module_name); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryModuleVersionsRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryModuleVersionsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.module_name = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryModuleVersionsRequest { + return { module_name: isSet(object.module_name) ? globalThis.String(object.module_name) : "" }; + }, + + toJSON(message: QueryModuleVersionsRequest): unknown { + const obj: any = {}; + if (message.module_name !== "") { + obj.module_name = message.module_name; + } + return obj; + }, + + create, I>>(base?: I): QueryModuleVersionsRequest { + return QueryModuleVersionsRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryModuleVersionsRequest { + const message = createBaseQueryModuleVersionsRequest(); + message.module_name = object.module_name ?? ""; + return message; + }, +}; + +export const QueryModuleVersionsResponse: MessageFns = { + $type: "cosmos.upgrade.v1beta1.QueryModuleVersionsResponse" as const, + + encode(message: QueryModuleVersionsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.module_versions) { + ModuleVersion.encode(v!, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryModuleVersionsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryModuleVersionsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.module_versions.push(ModuleVersion.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryModuleVersionsResponse { + return { + module_versions: globalThis.Array.isArray(object?.module_versions) ? object.module_versions.map((e: any) => ModuleVersion.fromJSON(e)) : [], + }; + }, + + toJSON(message: QueryModuleVersionsResponse): unknown { + const obj: any = {}; + if (message.module_versions?.length) { + obj.module_versions = message.module_versions.map((e) => ModuleVersion.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): QueryModuleVersionsResponse { + return QueryModuleVersionsResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryModuleVersionsResponse { + const message = createBaseQueryModuleVersionsResponse(); + message.module_versions = object.module_versions?.map((e) => ModuleVersion.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseQueryCurrentPlanRequest(): QueryCurrentPlanRequest { + return {}; +} + +function createBaseQueryCurrentPlanResponse(): QueryCurrentPlanResponse { + return { plan: undefined }; +} + +function createBaseQueryAppliedPlanRequest(): QueryAppliedPlanRequest { + return { name: "" }; +} + +function createBaseQueryAppliedPlanResponse(): QueryAppliedPlanResponse { + return { height: 0 }; +} + +function createBaseQueryUpgradedConsensusStateRequest(): QueryUpgradedConsensusStateRequest { + return { last_height: 0 }; +} + +function createBaseQueryUpgradedConsensusStateResponse(): QueryUpgradedConsensusStateResponse { + return { upgraded_consensus_state: new Uint8Array(0) }; +} + +function createBaseQueryModuleVersionsRequest(): QueryModuleVersionsRequest { + return { module_name: "" }; +} + +function createBaseQueryModuleVersionsResponse(): QueryModuleVersionsResponse { + return { module_versions: [] }; +} + +function bytesFromBase64(b64: string): Uint8Array { + if ((globalThis as any).Buffer) { + return Uint8Array.from(globalThis.Buffer.from(b64, "base64")); + } else { + const bin = globalThis.atob(b64); + const arr = new Uint8Array(bin.length); + for (let i = 0; i < bin.length; ++i) { + arr[i] = bin.charCodeAt(i); + } + return arr; + } +} + +function base64FromBytes(arr: Uint8Array): string { + if ((globalThis as any).Buffer) { + return globalThis.Buffer.from(arr).toString("base64"); + } else { + const bin: string[] = []; + arr.forEach((byte) => { + bin.push(globalThis.String.fromCharCode(byte)); + }); + return globalThis.btoa(bin.join("")); + } +} + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} diff --git a/packages/cosmos/generated/encoding/cosmos/upgrade/v1beta1/upgrade.ts b/packages/cosmos/generated/encoding/cosmos/upgrade/v1beta1/upgrade.ts new file mode 100644 index 000000000..ce24d14f2 --- /dev/null +++ b/packages/cosmos/generated/encoding/cosmos/upgrade/v1beta1/upgrade.ts @@ -0,0 +1,440 @@ +import type { GeneratedType } from "@cosmjs/proto-signing"; + +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +import { Any } from "../../../google/protobuf/any"; + +import { Timestamp } from "../../../google/protobuf/timestamp"; + +import type { + CancelSoftwareUpgradeProposal as CancelSoftwareUpgradeProposal_type, + ModuleVersion as ModuleVersion_type, + Plan as Plan_type, + SoftwareUpgradeProposal as SoftwareUpgradeProposal_type, +} from "../../../../types/cosmos/upgrade/v1beta1"; + +import type { DeepPartial, Exact, MessageFns } from "../../../common"; + +export interface Plan extends Plan_type {} +export interface SoftwareUpgradeProposal extends SoftwareUpgradeProposal_type {} +export interface CancelSoftwareUpgradeProposal extends CancelSoftwareUpgradeProposal_type {} +export interface ModuleVersion extends ModuleVersion_type {} + +export const Plan: MessageFns = { + $type: "cosmos.upgrade.v1beta1.Plan" as const, + + encode(message: Plan, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== "") { + writer.uint32(10).string(message.name); + } + if (message.time !== undefined) { + Timestamp.encode(toTimestamp(message.time), writer.uint32(18).fork()).join(); + } + if (message.height !== 0) { + writer.uint32(24).int64(message.height); + } + if (message.info !== "") { + writer.uint32(34).string(message.info); + } + if (message.upgraded_client_state !== undefined) { + Any.encode(message.upgraded_client_state, writer.uint32(42).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Plan { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePlan(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.name = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.time = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.height = longToNumber(reader.int64()); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.info = reader.string(); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.upgraded_client_state = Any.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Plan { + return { + name: isSet(object.name) ? globalThis.String(object.name) : "", + time: isSet(object.time) ? fromJsonTimestamp(object.time) : undefined, + height: isSet(object.height) ? globalThis.Number(object.height) : 0, + info: isSet(object.info) ? globalThis.String(object.info) : "", + upgraded_client_state: isSet(object.upgraded_client_state) ? Any.fromJSON(object.upgraded_client_state) : undefined, + }; + }, + + toJSON(message: Plan): unknown { + const obj: any = {}; + if (message.name !== "") { + obj.name = message.name; + } + if (message.time !== undefined) { + obj.time = message.time.toISOString(); + } + if (message.height !== 0) { + obj.height = Math.round(message.height); + } + if (message.info !== "") { + obj.info = message.info; + } + if (message.upgraded_client_state !== undefined) { + obj.upgraded_client_state = Any.toJSON(message.upgraded_client_state); + } + return obj; + }, + + create, I>>(base?: I): Plan { + return Plan.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Plan { + const message = createBasePlan(); + message.name = object.name ?? ""; + message.time = object.time ?? undefined; + message.height = object.height ?? 0; + message.info = object.info ?? ""; + message.upgraded_client_state = + object.upgraded_client_state !== undefined && object.upgraded_client_state !== null ? Any.fromPartial(object.upgraded_client_state) : undefined; + return message; + }, +}; + +export const SoftwareUpgradeProposal: MessageFns = { + $type: "cosmos.upgrade.v1beta1.SoftwareUpgradeProposal" as const, + + encode(message: SoftwareUpgradeProposal, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.title !== "") { + writer.uint32(10).string(message.title); + } + if (message.description !== "") { + writer.uint32(18).string(message.description); + } + if (message.plan !== undefined) { + Plan.encode(message.plan, writer.uint32(26).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): SoftwareUpgradeProposal { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseSoftwareUpgradeProposal(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.title = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.description = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.plan = Plan.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): SoftwareUpgradeProposal { + return { + title: isSet(object.title) ? globalThis.String(object.title) : "", + description: isSet(object.description) ? globalThis.String(object.description) : "", + plan: isSet(object.plan) ? Plan.fromJSON(object.plan) : undefined, + }; + }, + + toJSON(message: SoftwareUpgradeProposal): unknown { + const obj: any = {}; + if (message.title !== "") { + obj.title = message.title; + } + if (message.description !== "") { + obj.description = message.description; + } + if (message.plan !== undefined) { + obj.plan = Plan.toJSON(message.plan); + } + return obj; + }, + + create, I>>(base?: I): SoftwareUpgradeProposal { + return SoftwareUpgradeProposal.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): SoftwareUpgradeProposal { + const message = createBaseSoftwareUpgradeProposal(); + message.title = object.title ?? ""; + message.description = object.description ?? ""; + message.plan = object.plan !== undefined && object.plan !== null ? Plan.fromPartial(object.plan) : undefined; + return message; + }, +}; + +export const CancelSoftwareUpgradeProposal: MessageFns = { + $type: "cosmos.upgrade.v1beta1.CancelSoftwareUpgradeProposal" as const, + + encode(message: CancelSoftwareUpgradeProposal, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.title !== "") { + writer.uint32(10).string(message.title); + } + if (message.description !== "") { + writer.uint32(18).string(message.description); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): CancelSoftwareUpgradeProposal { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseCancelSoftwareUpgradeProposal(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.title = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.description = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): CancelSoftwareUpgradeProposal { + return { + title: isSet(object.title) ? globalThis.String(object.title) : "", + description: isSet(object.description) ? globalThis.String(object.description) : "", + }; + }, + + toJSON(message: CancelSoftwareUpgradeProposal): unknown { + const obj: any = {}; + if (message.title !== "") { + obj.title = message.title; + } + if (message.description !== "") { + obj.description = message.description; + } + return obj; + }, + + create, I>>(base?: I): CancelSoftwareUpgradeProposal { + return CancelSoftwareUpgradeProposal.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): CancelSoftwareUpgradeProposal { + const message = createBaseCancelSoftwareUpgradeProposal(); + message.title = object.title ?? ""; + message.description = object.description ?? ""; + return message; + }, +}; + +export const ModuleVersion: MessageFns = { + $type: "cosmos.upgrade.v1beta1.ModuleVersion" as const, + + encode(message: ModuleVersion, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== "") { + writer.uint32(10).string(message.name); + } + if (message.version !== 0) { + writer.uint32(16).uint64(message.version); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ModuleVersion { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseModuleVersion(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.name = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.version = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ModuleVersion { + return { + name: isSet(object.name) ? globalThis.String(object.name) : "", + version: isSet(object.version) ? globalThis.Number(object.version) : 0, + }; + }, + + toJSON(message: ModuleVersion): unknown { + const obj: any = {}; + if (message.name !== "") { + obj.name = message.name; + } + if (message.version !== 0) { + obj.version = Math.round(message.version); + } + return obj; + }, + + create, I>>(base?: I): ModuleVersion { + return ModuleVersion.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ModuleVersion { + const message = createBaseModuleVersion(); + message.name = object.name ?? ""; + message.version = object.version ?? 0; + return message; + }, +}; + +function createBasePlan(): Plan { + return { name: "", time: undefined, height: 0, info: "", upgraded_client_state: undefined }; +} + +function createBaseSoftwareUpgradeProposal(): SoftwareUpgradeProposal { + return { title: "", description: "", plan: undefined }; +} + +function createBaseCancelSoftwareUpgradeProposal(): CancelSoftwareUpgradeProposal { + return { title: "", description: "" }; +} + +function createBaseModuleVersion(): ModuleVersion { + return { name: "", version: 0 }; +} + +function toTimestamp(date: Date): Timestamp { + const seconds = Math.trunc(date.getTime() / 1_000); + const nanos = (date.getTime() % 1_000) * 1_000_000; + return { seconds, nanos }; +} + +function fromTimestamp(t: Timestamp): Date { + let millis = (t.seconds || 0) * 1_000; + millis += (t.nanos || 0) / 1_000_000; + return new globalThis.Date(millis); +} + +function fromJsonTimestamp(o: any): Date { + if (o instanceof globalThis.Date) { + return o; + } else if (typeof o === "string") { + return new globalThis.Date(o); + } else { + return fromTimestamp(Timestamp.fromJSON(o)); + } +} + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} +export const registry: Array<[string, GeneratedType]> = [ + ["/cosmos.upgrade.v1beta1.Plan", Plan as never], + ["/cosmos.upgrade.v1beta1.ModuleVersion", ModuleVersion as never], +]; +export const aminoConverters = { + "/cosmos.upgrade.v1beta1.Plan": { + aminoType: "cosmos-sdk/Plan", + toAmino: (message: Plan) => ({ ...message }), + fromAmino: (object: Plan) => ({ ...object }), + }, + + "/cosmos.upgrade.v1beta1.ModuleVersion": { + aminoType: "cosmos-sdk/ModuleVersion", + toAmino: (message: ModuleVersion) => ({ ...message }), + fromAmino: (object: ModuleVersion) => ({ ...object }), + }, +}; diff --git a/packages/cosmos/generated/encoding/cosmos/vesting/v1beta1/index.ts b/packages/cosmos/generated/encoding/cosmos/vesting/v1beta1/index.ts new file mode 100644 index 000000000..9239ccfa1 --- /dev/null +++ b/packages/cosmos/generated/encoding/cosmos/vesting/v1beta1/index.ts @@ -0,0 +1,4 @@ +// @ts-nocheck + +export * from './tx'; +export * from './vesting'; \ No newline at end of file diff --git a/packages/cosmos/generated/encoding/cosmos/vesting/v1beta1/tx.ts b/packages/cosmos/generated/encoding/cosmos/vesting/v1beta1/tx.ts new file mode 100644 index 000000000..68037d1c0 --- /dev/null +++ b/packages/cosmos/generated/encoding/cosmos/vesting/v1beta1/tx.ts @@ -0,0 +1,209 @@ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +import { Coin } from "../../base/v1beta1/coin"; + +import type { + MsgCreateVestingAccountResponse as MsgCreateVestingAccountResponse_type, + MsgCreateVestingAccount as MsgCreateVestingAccount_type, +} from "../../../../types/cosmos/vesting/v1beta1"; + +import type { DeepPartial, Exact, MessageFns } from "../../../common"; + +export interface MsgCreateVestingAccount extends MsgCreateVestingAccount_type {} +export interface MsgCreateVestingAccountResponse extends MsgCreateVestingAccountResponse_type {} + +export const MsgCreateVestingAccount: MessageFns = { + $type: "cosmos.vesting.v1beta1.MsgCreateVestingAccount" as const, + + encode(message: MsgCreateVestingAccount, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.from_address !== "") { + writer.uint32(10).string(message.from_address); + } + if (message.to_address !== "") { + writer.uint32(18).string(message.to_address); + } + for (const v of message.amount) { + Coin.encode(v!, writer.uint32(26).fork()).join(); + } + if (message.end_time !== 0) { + writer.uint32(32).int64(message.end_time); + } + if (message.delayed !== false) { + writer.uint32(40).bool(message.delayed); + } + if (message.admin !== "") { + writer.uint32(50).string(message.admin); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgCreateVestingAccount { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgCreateVestingAccount(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.from_address = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.to_address = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.amount.push(Coin.decode(reader, reader.uint32())); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.end_time = longToNumber(reader.int64()); + continue; + case 5: + if (tag !== 40) { + break; + } + + message.delayed = reader.bool(); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.admin = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgCreateVestingAccount { + return { + from_address: isSet(object.from_address) ? globalThis.String(object.from_address) : "", + to_address: isSet(object.to_address) ? globalThis.String(object.to_address) : "", + amount: globalThis.Array.isArray(object?.amount) ? object.amount.map((e: any) => Coin.fromJSON(e)) : [], + end_time: isSet(object.end_time) ? globalThis.Number(object.end_time) : 0, + delayed: isSet(object.delayed) ? globalThis.Boolean(object.delayed) : false, + admin: isSet(object.admin) ? globalThis.String(object.admin) : "", + }; + }, + + toJSON(message: MsgCreateVestingAccount): unknown { + const obj: any = {}; + if (message.from_address !== "") { + obj.from_address = message.from_address; + } + if (message.to_address !== "") { + obj.to_address = message.to_address; + } + if (message.amount?.length) { + obj.amount = message.amount.map((e) => Coin.toJSON(e)); + } + if (message.end_time !== 0) { + obj.end_time = Math.round(message.end_time); + } + if (message.delayed !== false) { + obj.delayed = message.delayed; + } + if (message.admin !== "") { + obj.admin = message.admin; + } + return obj; + }, + + create, I>>(base?: I): MsgCreateVestingAccount { + return MsgCreateVestingAccount.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgCreateVestingAccount { + const message = createBaseMsgCreateVestingAccount(); + message.from_address = object.from_address ?? ""; + message.to_address = object.to_address ?? ""; + message.amount = object.amount?.map((e) => Coin.fromPartial(e)) || []; + message.end_time = object.end_time ?? 0; + message.delayed = object.delayed ?? false; + message.admin = object.admin ?? ""; + return message; + }, +}; + +export const MsgCreateVestingAccountResponse: MessageFns = { + $type: "cosmos.vesting.v1beta1.MsgCreateVestingAccountResponse" as const, + + encode(_: MsgCreateVestingAccountResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgCreateVestingAccountResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgCreateVestingAccountResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgCreateVestingAccountResponse { + return {}; + }, + + toJSON(_: MsgCreateVestingAccountResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgCreateVestingAccountResponse { + return MsgCreateVestingAccountResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgCreateVestingAccountResponse { + const message = createBaseMsgCreateVestingAccountResponse(); + return message; + }, +}; + +function createBaseMsgCreateVestingAccount(): MsgCreateVestingAccount { + return { from_address: "", to_address: "", amount: [], end_time: 0, delayed: false, admin: "" }; +} + +function createBaseMsgCreateVestingAccountResponse(): MsgCreateVestingAccountResponse { + return {}; +} + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} diff --git a/packages/cosmos/generated/encoding/cosmos/vesting/v1beta1/vesting.ts b/packages/cosmos/generated/encoding/cosmos/vesting/v1beta1/vesting.ts new file mode 100644 index 000000000..0b91b896f --- /dev/null +++ b/packages/cosmos/generated/encoding/cosmos/vesting/v1beta1/vesting.ts @@ -0,0 +1,600 @@ +import type { GeneratedType } from "@cosmjs/proto-signing"; + +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +import { BaseAccount } from "../../auth/v1beta1/auth"; + +import { Coin } from "../../base/v1beta1/coin"; + +import type { + BaseVestingAccount as BaseVestingAccount_type, + ContinuousVestingAccount as ContinuousVestingAccount_type, + DelayedVestingAccount as DelayedVestingAccount_type, + Period as Period_type, + PeriodicVestingAccount as PeriodicVestingAccount_type, + PermanentLockedAccount as PermanentLockedAccount_type, +} from "../../../../types/cosmos/vesting/v1beta1"; + +import type { DeepPartial, Exact, MessageFns } from "../../../common"; + +export interface BaseVestingAccount extends BaseVestingAccount_type {} +export interface ContinuousVestingAccount extends ContinuousVestingAccount_type {} +export interface DelayedVestingAccount extends DelayedVestingAccount_type {} +export interface Period extends Period_type {} +export interface PeriodicVestingAccount extends PeriodicVestingAccount_type {} +export interface PermanentLockedAccount extends PermanentLockedAccount_type {} + +export const BaseVestingAccount: MessageFns = { + $type: "cosmos.vesting.v1beta1.BaseVestingAccount" as const, + + encode(message: BaseVestingAccount, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.base_account !== undefined) { + BaseAccount.encode(message.base_account, writer.uint32(10).fork()).join(); + } + for (const v of message.original_vesting) { + Coin.encode(v!, writer.uint32(18).fork()).join(); + } + for (const v of message.delegated_free) { + Coin.encode(v!, writer.uint32(26).fork()).join(); + } + for (const v of message.delegated_vesting) { + Coin.encode(v!, writer.uint32(34).fork()).join(); + } + if (message.end_time !== 0) { + writer.uint32(40).int64(message.end_time); + } + if (message.admin !== "") { + writer.uint32(50).string(message.admin); + } + if (message.cancelled_time !== 0) { + writer.uint32(56).int64(message.cancelled_time); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): BaseVestingAccount { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseBaseVestingAccount(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.base_account = BaseAccount.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.original_vesting.push(Coin.decode(reader, reader.uint32())); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.delegated_free.push(Coin.decode(reader, reader.uint32())); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.delegated_vesting.push(Coin.decode(reader, reader.uint32())); + continue; + case 5: + if (tag !== 40) { + break; + } + + message.end_time = longToNumber(reader.int64()); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.admin = reader.string(); + continue; + case 7: + if (tag !== 56) { + break; + } + + message.cancelled_time = longToNumber(reader.int64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): BaseVestingAccount { + return { + base_account: isSet(object.base_account) ? BaseAccount.fromJSON(object.base_account) : undefined, + original_vesting: globalThis.Array.isArray(object?.original_vesting) ? object.original_vesting.map((e: any) => Coin.fromJSON(e)) : [], + delegated_free: globalThis.Array.isArray(object?.delegated_free) ? object.delegated_free.map((e: any) => Coin.fromJSON(e)) : [], + delegated_vesting: globalThis.Array.isArray(object?.delegated_vesting) ? object.delegated_vesting.map((e: any) => Coin.fromJSON(e)) : [], + end_time: isSet(object.end_time) ? globalThis.Number(object.end_time) : 0, + admin: isSet(object.admin) ? globalThis.String(object.admin) : "", + cancelled_time: isSet(object.cancelled_time) ? globalThis.Number(object.cancelled_time) : 0, + }; + }, + + toJSON(message: BaseVestingAccount): unknown { + const obj: any = {}; + if (message.base_account !== undefined) { + obj.base_account = BaseAccount.toJSON(message.base_account); + } + if (message.original_vesting?.length) { + obj.original_vesting = message.original_vesting.map((e) => Coin.toJSON(e)); + } + if (message.delegated_free?.length) { + obj.delegated_free = message.delegated_free.map((e) => Coin.toJSON(e)); + } + if (message.delegated_vesting?.length) { + obj.delegated_vesting = message.delegated_vesting.map((e) => Coin.toJSON(e)); + } + if (message.end_time !== 0) { + obj.end_time = Math.round(message.end_time); + } + if (message.admin !== "") { + obj.admin = message.admin; + } + if (message.cancelled_time !== 0) { + obj.cancelled_time = Math.round(message.cancelled_time); + } + return obj; + }, + + create, I>>(base?: I): BaseVestingAccount { + return BaseVestingAccount.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): BaseVestingAccount { + const message = createBaseBaseVestingAccount(); + message.base_account = object.base_account !== undefined && object.base_account !== null ? BaseAccount.fromPartial(object.base_account) : undefined; + message.original_vesting = object.original_vesting?.map((e) => Coin.fromPartial(e)) || []; + message.delegated_free = object.delegated_free?.map((e) => Coin.fromPartial(e)) || []; + message.delegated_vesting = object.delegated_vesting?.map((e) => Coin.fromPartial(e)) || []; + message.end_time = object.end_time ?? 0; + message.admin = object.admin ?? ""; + message.cancelled_time = object.cancelled_time ?? 0; + return message; + }, +}; + +export const ContinuousVestingAccount: MessageFns = { + $type: "cosmos.vesting.v1beta1.ContinuousVestingAccount" as const, + + encode(message: ContinuousVestingAccount, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.base_vesting_account !== undefined) { + BaseVestingAccount.encode(message.base_vesting_account, writer.uint32(10).fork()).join(); + } + if (message.start_time !== 0) { + writer.uint32(16).int64(message.start_time); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ContinuousVestingAccount { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseContinuousVestingAccount(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.base_vesting_account = BaseVestingAccount.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.start_time = longToNumber(reader.int64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ContinuousVestingAccount { + return { + base_vesting_account: isSet(object.base_vesting_account) ? BaseVestingAccount.fromJSON(object.base_vesting_account) : undefined, + start_time: isSet(object.start_time) ? globalThis.Number(object.start_time) : 0, + }; + }, + + toJSON(message: ContinuousVestingAccount): unknown { + const obj: any = {}; + if (message.base_vesting_account !== undefined) { + obj.base_vesting_account = BaseVestingAccount.toJSON(message.base_vesting_account); + } + if (message.start_time !== 0) { + obj.start_time = Math.round(message.start_time); + } + return obj; + }, + + create, I>>(base?: I): ContinuousVestingAccount { + return ContinuousVestingAccount.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ContinuousVestingAccount { + const message = createBaseContinuousVestingAccount(); + message.base_vesting_account = + object.base_vesting_account !== undefined && object.base_vesting_account !== null + ? BaseVestingAccount.fromPartial(object.base_vesting_account) + : undefined; + message.start_time = object.start_time ?? 0; + return message; + }, +}; + +export const DelayedVestingAccount: MessageFns = { + $type: "cosmos.vesting.v1beta1.DelayedVestingAccount" as const, + + encode(message: DelayedVestingAccount, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.base_vesting_account !== undefined) { + BaseVestingAccount.encode(message.base_vesting_account, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): DelayedVestingAccount { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDelayedVestingAccount(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.base_vesting_account = BaseVestingAccount.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): DelayedVestingAccount { + return { + base_vesting_account: isSet(object.base_vesting_account) ? BaseVestingAccount.fromJSON(object.base_vesting_account) : undefined, + }; + }, + + toJSON(message: DelayedVestingAccount): unknown { + const obj: any = {}; + if (message.base_vesting_account !== undefined) { + obj.base_vesting_account = BaseVestingAccount.toJSON(message.base_vesting_account); + } + return obj; + }, + + create, I>>(base?: I): DelayedVestingAccount { + return DelayedVestingAccount.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): DelayedVestingAccount { + const message = createBaseDelayedVestingAccount(); + message.base_vesting_account = + object.base_vesting_account !== undefined && object.base_vesting_account !== null + ? BaseVestingAccount.fromPartial(object.base_vesting_account) + : undefined; + return message; + }, +}; + +export const Period: MessageFns = { + $type: "cosmos.vesting.v1beta1.Period" as const, + + encode(message: Period, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.length !== 0) { + writer.uint32(8).int64(message.length); + } + for (const v of message.amount) { + Coin.encode(v!, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Period { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePeriod(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.length = longToNumber(reader.int64()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.amount.push(Coin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Period { + return { + length: isSet(object.length) ? globalThis.Number(object.length) : 0, + amount: globalThis.Array.isArray(object?.amount) ? object.amount.map((e: any) => Coin.fromJSON(e)) : [], + }; + }, + + toJSON(message: Period): unknown { + const obj: any = {}; + if (message.length !== 0) { + obj.length = Math.round(message.length); + } + if (message.amount?.length) { + obj.amount = message.amount.map((e) => Coin.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): Period { + return Period.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Period { + const message = createBasePeriod(); + message.length = object.length ?? 0; + message.amount = object.amount?.map((e) => Coin.fromPartial(e)) || []; + return message; + }, +}; + +export const PeriodicVestingAccount: MessageFns = { + $type: "cosmos.vesting.v1beta1.PeriodicVestingAccount" as const, + + encode(message: PeriodicVestingAccount, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.base_vesting_account !== undefined) { + BaseVestingAccount.encode(message.base_vesting_account, writer.uint32(10).fork()).join(); + } + if (message.start_time !== 0) { + writer.uint32(16).int64(message.start_time); + } + for (const v of message.vesting_periods) { + Period.encode(v!, writer.uint32(26).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): PeriodicVestingAccount { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePeriodicVestingAccount(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.base_vesting_account = BaseVestingAccount.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.start_time = longToNumber(reader.int64()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.vesting_periods.push(Period.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): PeriodicVestingAccount { + return { + base_vesting_account: isSet(object.base_vesting_account) ? BaseVestingAccount.fromJSON(object.base_vesting_account) : undefined, + start_time: isSet(object.start_time) ? globalThis.Number(object.start_time) : 0, + vesting_periods: globalThis.Array.isArray(object?.vesting_periods) ? object.vesting_periods.map((e: any) => Period.fromJSON(e)) : [], + }; + }, + + toJSON(message: PeriodicVestingAccount): unknown { + const obj: any = {}; + if (message.base_vesting_account !== undefined) { + obj.base_vesting_account = BaseVestingAccount.toJSON(message.base_vesting_account); + } + if (message.start_time !== 0) { + obj.start_time = Math.round(message.start_time); + } + if (message.vesting_periods?.length) { + obj.vesting_periods = message.vesting_periods.map((e) => Period.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): PeriodicVestingAccount { + return PeriodicVestingAccount.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): PeriodicVestingAccount { + const message = createBasePeriodicVestingAccount(); + message.base_vesting_account = + object.base_vesting_account !== undefined && object.base_vesting_account !== null + ? BaseVestingAccount.fromPartial(object.base_vesting_account) + : undefined; + message.start_time = object.start_time ?? 0; + message.vesting_periods = object.vesting_periods?.map((e) => Period.fromPartial(e)) || []; + return message; + }, +}; + +export const PermanentLockedAccount: MessageFns = { + $type: "cosmos.vesting.v1beta1.PermanentLockedAccount" as const, + + encode(message: PermanentLockedAccount, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.base_vesting_account !== undefined) { + BaseVestingAccount.encode(message.base_vesting_account, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): PermanentLockedAccount { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePermanentLockedAccount(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.base_vesting_account = BaseVestingAccount.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): PermanentLockedAccount { + return { + base_vesting_account: isSet(object.base_vesting_account) ? BaseVestingAccount.fromJSON(object.base_vesting_account) : undefined, + }; + }, + + toJSON(message: PermanentLockedAccount): unknown { + const obj: any = {}; + if (message.base_vesting_account !== undefined) { + obj.base_vesting_account = BaseVestingAccount.toJSON(message.base_vesting_account); + } + return obj; + }, + + create, I>>(base?: I): PermanentLockedAccount { + return PermanentLockedAccount.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): PermanentLockedAccount { + const message = createBasePermanentLockedAccount(); + message.base_vesting_account = + object.base_vesting_account !== undefined && object.base_vesting_account !== null + ? BaseVestingAccount.fromPartial(object.base_vesting_account) + : undefined; + return message; + }, +}; + +function createBaseBaseVestingAccount(): BaseVestingAccount { + return { + base_account: undefined, + original_vesting: [], + delegated_free: [], + delegated_vesting: [], + end_time: 0, + admin: "", + cancelled_time: 0, + }; +} + +function createBaseContinuousVestingAccount(): ContinuousVestingAccount { + return { base_vesting_account: undefined, start_time: 0 }; +} + +function createBaseDelayedVestingAccount(): DelayedVestingAccount { + return { base_vesting_account: undefined }; +} + +function createBasePeriod(): Period { + return { length: 0, amount: [] }; +} + +function createBasePeriodicVestingAccount(): PeriodicVestingAccount { + return { base_vesting_account: undefined, start_time: 0, vesting_periods: [] }; +} + +function createBasePermanentLockedAccount(): PermanentLockedAccount { + return { base_vesting_account: undefined }; +} + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} +export const registry: Array<[string, GeneratedType]> = [ + ["/cosmos.vesting.v1beta1.BaseVestingAccount", BaseVestingAccount as never], + ["/cosmos.vesting.v1beta1.DelayedVestingAccount", DelayedVestingAccount as never], + ["/cosmos.vesting.v1beta1.Period", Period as never], +]; +export const aminoConverters = { + "/cosmos.vesting.v1beta1.BaseVestingAccount": { + aminoType: "cosmos-sdk/BaseVestingAccount", + toAmino: (message: BaseVestingAccount) => ({ ...message }), + fromAmino: (object: BaseVestingAccount) => ({ ...object }), + }, + + "/cosmos.vesting.v1beta1.DelayedVestingAccount": { + aminoType: "cosmos-sdk/DelayedVestingAccount", + toAmino: (message: DelayedVestingAccount) => ({ ...message }), + fromAmino: (object: DelayedVestingAccount) => ({ ...object }), + }, + + "/cosmos.vesting.v1beta1.Period": { + aminoType: "cosmos-sdk/Period", + toAmino: (message: Period) => ({ ...message }), + fromAmino: (object: Period) => ({ ...object }), + }, +}; diff --git a/packages/cosmos/generated/encoding/epoch/epoch.ts b/packages/cosmos/generated/encoding/epoch/epoch.ts new file mode 100644 index 000000000..c542e6673 --- /dev/null +++ b/packages/cosmos/generated/encoding/epoch/epoch.ts @@ -0,0 +1,185 @@ +import type { GeneratedType } from "@cosmjs/proto-signing"; + +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +import { Duration } from "../google/protobuf/duration"; + +import { Timestamp } from "../google/protobuf/timestamp"; + +import type { Epoch as Epoch_type } from "../../types/epoch"; + +import type { DeepPartial, Exact, MessageFns } from "../common"; + +export interface Epoch extends Epoch_type {} + +export const Epoch: MessageFns = { + $type: "seiprotocol.seichain.epoch.Epoch" as const, + + encode(message: Epoch, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.genesis_time !== undefined) { + Timestamp.encode(toTimestamp(message.genesis_time), writer.uint32(10).fork()).join(); + } + if (message.epoch_duration !== undefined) { + Duration.encode(message.epoch_duration, writer.uint32(18).fork()).join(); + } + if (message.current_epoch !== 0) { + writer.uint32(24).uint64(message.current_epoch); + } + if (message.current_epoch_start_time !== undefined) { + Timestamp.encode(toTimestamp(message.current_epoch_start_time), writer.uint32(34).fork()).join(); + } + if (message.current_epoch_height !== 0) { + writer.uint32(40).int64(message.current_epoch_height); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Epoch { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEpoch(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.genesis_time = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.epoch_duration = Duration.decode(reader, reader.uint32()); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.current_epoch = longToNumber(reader.uint64()); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.current_epoch_start_time = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + continue; + case 5: + if (tag !== 40) { + break; + } + + message.current_epoch_height = longToNumber(reader.int64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Epoch { + return { + genesis_time: isSet(object.genesis_time) ? fromJsonTimestamp(object.genesis_time) : undefined, + epoch_duration: isSet(object.epoch_duration) ? Duration.fromJSON(object.epoch_duration) : undefined, + current_epoch: isSet(object.current_epoch) ? globalThis.Number(object.current_epoch) : 0, + current_epoch_start_time: isSet(object.current_epoch_start_time) ? fromJsonTimestamp(object.current_epoch_start_time) : undefined, + current_epoch_height: isSet(object.current_epoch_height) ? globalThis.Number(object.current_epoch_height) : 0, + }; + }, + + toJSON(message: Epoch): unknown { + const obj: any = {}; + if (message.genesis_time !== undefined) { + obj.genesis_time = message.genesis_time.toISOString(); + } + if (message.epoch_duration !== undefined) { + obj.epoch_duration = Duration.toJSON(message.epoch_duration); + } + if (message.current_epoch !== 0) { + obj.current_epoch = Math.round(message.current_epoch); + } + if (message.current_epoch_start_time !== undefined) { + obj.current_epoch_start_time = message.current_epoch_start_time.toISOString(); + } + if (message.current_epoch_height !== 0) { + obj.current_epoch_height = Math.round(message.current_epoch_height); + } + return obj; + }, + + create, I>>(base?: I): Epoch { + return Epoch.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Epoch { + const message = createBaseEpoch(); + message.genesis_time = object.genesis_time ?? undefined; + message.epoch_duration = object.epoch_duration !== undefined && object.epoch_duration !== null ? Duration.fromPartial(object.epoch_duration) : undefined; + message.current_epoch = object.current_epoch ?? 0; + message.current_epoch_start_time = object.current_epoch_start_time ?? undefined; + message.current_epoch_height = object.current_epoch_height ?? 0; + return message; + }, +}; + +function createBaseEpoch(): Epoch { + return { + genesis_time: undefined, + epoch_duration: undefined, + current_epoch: 0, + current_epoch_start_time: undefined, + current_epoch_height: 0, + }; +} + +function toTimestamp(date: Date): Timestamp { + const seconds = Math.trunc(date.getTime() / 1_000); + const nanos = (date.getTime() % 1_000) * 1_000_000; + return { seconds, nanos }; +} + +function fromTimestamp(t: Timestamp): Date { + let millis = (t.seconds || 0) * 1_000; + millis += (t.nanos || 0) / 1_000_000; + return new globalThis.Date(millis); +} + +function fromJsonTimestamp(o: any): Date { + if (o instanceof globalThis.Date) { + return o; + } else if (typeof o === "string") { + return new globalThis.Date(o); + } else { + return fromTimestamp(Timestamp.fromJSON(o)); + } +} + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} +export const registry: Array<[string, GeneratedType]> = [["/seiprotocol.seichain.epoch.Epoch", Epoch as never]]; +export const aminoConverters = { + "/seiprotocol.seichain.epoch.Epoch": { + aminoType: "epoch/Epoch", + toAmino: (message: Epoch) => ({ ...message }), + fromAmino: (object: Epoch) => ({ ...object }), + }, +}; diff --git a/packages/cosmos/generated/encoding/epoch/genesis.ts b/packages/cosmos/generated/encoding/epoch/genesis.ts new file mode 100644 index 000000000..34f153580 --- /dev/null +++ b/packages/cosmos/generated/encoding/epoch/genesis.ts @@ -0,0 +1,101 @@ +import type { GeneratedType } from "@cosmjs/proto-signing"; + +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +import { Epoch } from "./epoch"; + +import { Params } from "./params"; + +import type { GenesisState as GenesisState_type } from "../../types/epoch"; + +import type { DeepPartial, Exact, MessageFns } from "../common"; + +export interface GenesisState extends GenesisState_type {} + +export const GenesisState: MessageFns = { + $type: "seiprotocol.seichain.epoch.GenesisState" as const, + + encode(message: GenesisState, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(10).fork()).join(); + } + if (message.epoch !== undefined) { + Epoch.encode(message.epoch, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GenesisState { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGenesisState(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.params = Params.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.epoch = Epoch.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GenesisState { + return { + params: isSet(object.params) ? Params.fromJSON(object.params) : undefined, + epoch: isSet(object.epoch) ? Epoch.fromJSON(object.epoch) : undefined, + }; + }, + + toJSON(message: GenesisState): unknown { + const obj: any = {}; + if (message.params !== undefined) { + obj.params = Params.toJSON(message.params); + } + if (message.epoch !== undefined) { + obj.epoch = Epoch.toJSON(message.epoch); + } + return obj; + }, + + create, I>>(base?: I): GenesisState { + return GenesisState.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): GenesisState { + const message = createBaseGenesisState(); + message.params = object.params !== undefined && object.params !== null ? Params.fromPartial(object.params) : undefined; + message.epoch = object.epoch !== undefined && object.epoch !== null ? Epoch.fromPartial(object.epoch) : undefined; + return message; + }, +}; + +function createBaseGenesisState(): GenesisState { + return { params: undefined, epoch: undefined }; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} +export const registry: Array<[string, GeneratedType]> = [["/seiprotocol.seichain.epoch.GenesisState", GenesisState as never]]; +export const aminoConverters = { + "/seiprotocol.seichain.epoch.GenesisState": { + aminoType: "epoch/GenesisState", + toAmino: (message: GenesisState) => ({ ...message }), + fromAmino: (object: GenesisState) => ({ ...object }), + }, +}; diff --git a/packages/cosmos/generated/encoding/epoch/index.ts b/packages/cosmos/generated/encoding/epoch/index.ts new file mode 100644 index 000000000..9d682d321 --- /dev/null +++ b/packages/cosmos/generated/encoding/epoch/index.ts @@ -0,0 +1,6 @@ +// @ts-nocheck + +export * from './epoch'; +export * from './genesis'; +export * from './params'; +export * from './query'; \ No newline at end of file diff --git a/packages/cosmos/generated/encoding/epoch/params.ts b/packages/cosmos/generated/encoding/epoch/params.ts new file mode 100644 index 000000000..1a8b3646e --- /dev/null +++ b/packages/cosmos/generated/encoding/epoch/params.ts @@ -0,0 +1,62 @@ +import type { GeneratedType } from "@cosmjs/proto-signing"; + +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +import type { Params as Params_type } from "../../types/epoch"; + +import type { DeepPartial, Exact, MessageFns } from "../common"; + +export interface Params extends Params_type {} + +export const Params: MessageFns = { + $type: "seiprotocol.seichain.epoch.Params" as const, + + encode(_: Params, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Params { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): Params { + return {}; + }, + + toJSON(_: Params): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): Params { + return Params.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): Params { + const message = createBaseParams(); + return message; + }, +}; + +function createBaseParams(): Params { + return {}; +} +export const registry: Array<[string, GeneratedType]> = [["/seiprotocol.seichain.epoch.Params", Params as never]]; +export const aminoConverters = { + "/seiprotocol.seichain.epoch.Params": { + aminoType: "epoch/Params", + toAmino: (message: Params) => ({ ...message }), + fromAmino: (object: Params) => ({ ...object }), + }, +}; diff --git a/packages/cosmos/generated/encoding/epoch/query.ts b/packages/cosmos/generated/encoding/epoch/query.ts new file mode 100644 index 000000000..b312caca8 --- /dev/null +++ b/packages/cosmos/generated/encoding/epoch/query.ts @@ -0,0 +1,264 @@ +import type { GeneratedType } from "@cosmjs/proto-signing"; + +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +import { Epoch } from "./epoch"; + +import { Params } from "./params"; + +import type { + QueryEpochRequest as QueryEpochRequest_type, + QueryEpochResponse as QueryEpochResponse_type, + QueryParamsRequest as QueryParamsRequest_type, + QueryParamsResponse as QueryParamsResponse_type, +} from "../../types/epoch"; + +import type { DeepPartial, Exact, MessageFns } from "../common"; + +export interface QueryParamsRequest extends QueryParamsRequest_type {} +export interface QueryParamsResponse extends QueryParamsResponse_type {} +export interface QueryEpochRequest extends QueryEpochRequest_type {} +export interface QueryEpochResponse extends QueryEpochResponse_type {} + +export const QueryParamsRequest: MessageFns = { + $type: "seiprotocol.seichain.epoch.QueryParamsRequest" as const, + + encode(_: QueryParamsRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryParamsRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryParamsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): QueryParamsRequest { + return {}; + }, + + toJSON(_: QueryParamsRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): QueryParamsRequest { + return QueryParamsRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): QueryParamsRequest { + const message = createBaseQueryParamsRequest(); + return message; + }, +}; + +export const QueryParamsResponse: MessageFns = { + $type: "seiprotocol.seichain.epoch.QueryParamsResponse" as const, + + encode(message: QueryParamsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryParamsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryParamsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.params = Params.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryParamsResponse { + return { params: isSet(object.params) ? Params.fromJSON(object.params) : undefined }; + }, + + toJSON(message: QueryParamsResponse): unknown { + const obj: any = {}; + if (message.params !== undefined) { + obj.params = Params.toJSON(message.params); + } + return obj; + }, + + create, I>>(base?: I): QueryParamsResponse { + return QueryParamsResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryParamsResponse { + const message = createBaseQueryParamsResponse(); + message.params = object.params !== undefined && object.params !== null ? Params.fromPartial(object.params) : undefined; + return message; + }, +}; + +export const QueryEpochRequest: MessageFns = { + $type: "seiprotocol.seichain.epoch.QueryEpochRequest" as const, + + encode(_: QueryEpochRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryEpochRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryEpochRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): QueryEpochRequest { + return {}; + }, + + toJSON(_: QueryEpochRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): QueryEpochRequest { + return QueryEpochRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): QueryEpochRequest { + const message = createBaseQueryEpochRequest(); + return message; + }, +}; + +export const QueryEpochResponse: MessageFns = { + $type: "seiprotocol.seichain.epoch.QueryEpochResponse" as const, + + encode(message: QueryEpochResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.epoch !== undefined) { + Epoch.encode(message.epoch, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryEpochResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryEpochResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.epoch = Epoch.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryEpochResponse { + return { epoch: isSet(object.epoch) ? Epoch.fromJSON(object.epoch) : undefined }; + }, + + toJSON(message: QueryEpochResponse): unknown { + const obj: any = {}; + if (message.epoch !== undefined) { + obj.epoch = Epoch.toJSON(message.epoch); + } + return obj; + }, + + create, I>>(base?: I): QueryEpochResponse { + return QueryEpochResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryEpochResponse { + const message = createBaseQueryEpochResponse(); + message.epoch = object.epoch !== undefined && object.epoch !== null ? Epoch.fromPartial(object.epoch) : undefined; + return message; + }, +}; + +function createBaseQueryParamsRequest(): QueryParamsRequest { + return {}; +} + +function createBaseQueryParamsResponse(): QueryParamsResponse { + return { params: undefined }; +} + +function createBaseQueryEpochRequest(): QueryEpochRequest { + return {}; +} + +function createBaseQueryEpochResponse(): QueryEpochResponse { + return { epoch: undefined }; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} +export const registry: Array<[string, GeneratedType]> = [ + ["/seiprotocol.seichain.epoch.QueryParamsRequest", QueryParamsRequest as never], + ["/seiprotocol.seichain.epoch.QueryParamsResponse", QueryParamsResponse as never], + ["/seiprotocol.seichain.epoch.QueryEpochRequest", QueryEpochRequest as never], + ["/seiprotocol.seichain.epoch.QueryEpochResponse", QueryEpochResponse as never], +]; +export const aminoConverters = { + "/seiprotocol.seichain.epoch.QueryParamsRequest": { + aminoType: "epoch/QueryParamsRequest", + toAmino: (message: QueryParamsRequest) => ({ ...message }), + fromAmino: (object: QueryParamsRequest) => ({ ...object }), + }, + + "/seiprotocol.seichain.epoch.QueryParamsResponse": { + aminoType: "epoch/QueryParamsResponse", + toAmino: (message: QueryParamsResponse) => ({ ...message }), + fromAmino: (object: QueryParamsResponse) => ({ ...object }), + }, + + "/seiprotocol.seichain.epoch.QueryEpochRequest": { + aminoType: "epoch/QueryEpochRequest", + toAmino: (message: QueryEpochRequest) => ({ ...message }), + fromAmino: (object: QueryEpochRequest) => ({ ...object }), + }, + + "/seiprotocol.seichain.epoch.QueryEpochResponse": { + aminoType: "epoch/QueryEpochResponse", + toAmino: (message: QueryEpochResponse) => ({ ...message }), + fromAmino: (object: QueryEpochResponse) => ({ ...object }), + }, +}; diff --git a/packages/cosmos/generated/encoding/eth/index.ts b/packages/cosmos/generated/encoding/eth/index.ts new file mode 100644 index 000000000..a549f9f69 --- /dev/null +++ b/packages/cosmos/generated/encoding/eth/index.ts @@ -0,0 +1,3 @@ +// @ts-nocheck + +export * from './tx'; \ No newline at end of file diff --git a/packages/cosmos/generated/encoding/eth/tx.ts b/packages/cosmos/generated/encoding/eth/tx.ts new file mode 100644 index 000000000..b565ebf1b --- /dev/null +++ b/packages/cosmos/generated/encoding/eth/tx.ts @@ -0,0 +1,1375 @@ +import type { GeneratedType } from "@cosmjs/proto-signing"; + +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +import type { + AccessListTx as AccessListTx_type, + AccessTuple as AccessTuple_type, + AssociateTx as AssociateTx_type, + BlobTxSidecar as BlobTxSidecar_type, + BlobTx as BlobTx_type, + DynamicFeeTx as DynamicFeeTx_type, + ExtensionOptionsEthereumTx as ExtensionOptionsEthereumTx_type, + LegacyTx as LegacyTx_type, +} from "../../types/eth"; + +import type { DeepPartial, Exact, MessageFns } from "../common"; + +export interface AccessTuple extends AccessTuple_type {} +export interface AssociateTx extends AssociateTx_type {} +export interface LegacyTx extends LegacyTx_type {} +export interface AccessListTx extends AccessListTx_type {} +export interface DynamicFeeTx extends DynamicFeeTx_type {} +export interface BlobTx extends BlobTx_type {} +export interface BlobTxSidecar extends BlobTxSidecar_type {} +export interface ExtensionOptionsEthereumTx extends ExtensionOptionsEthereumTx_type {} + +export const AccessTuple: MessageFns = { + $type: "seiprotocol.seichain.eth.AccessTuple" as const, + + encode(message: AccessTuple, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.address !== "") { + writer.uint32(10).string(message.address); + } + for (const v of message.storage_keys) { + writer.uint32(18).string(v!); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): AccessTuple { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseAccessTuple(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.address = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.storage_keys.push(reader.string()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): AccessTuple { + return { + address: isSet(object.address) ? globalThis.String(object.address) : "", + storage_keys: globalThis.Array.isArray(object?.storage_keys) ? object.storage_keys.map((e: any) => globalThis.String(e)) : [], + }; + }, + + toJSON(message: AccessTuple): unknown { + const obj: any = {}; + if (message.address !== "") { + obj.address = message.address; + } + if (message.storage_keys?.length) { + obj.storage_keys = message.storage_keys; + } + return obj; + }, + + create, I>>(base?: I): AccessTuple { + return AccessTuple.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): AccessTuple { + const message = createBaseAccessTuple(); + message.address = object.address ?? ""; + message.storage_keys = object.storage_keys?.map((e) => e) || []; + return message; + }, +}; + +export const AssociateTx: MessageFns = { + $type: "seiprotocol.seichain.eth.AssociateTx" as const, + + encode(message: AssociateTx, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.v.length !== 0) { + writer.uint32(10).bytes(message.v); + } + if (message.r.length !== 0) { + writer.uint32(18).bytes(message.r); + } + if (message.s.length !== 0) { + writer.uint32(26).bytes(message.s); + } + if (message.custom_message !== "") { + writer.uint32(34).string(message.custom_message); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): AssociateTx { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseAssociateTx(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.v = reader.bytes(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.r = reader.bytes(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.s = reader.bytes(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.custom_message = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): AssociateTx { + return { + v: isSet(object.v) ? bytesFromBase64(object.v) : new Uint8Array(0), + r: isSet(object.r) ? bytesFromBase64(object.r) : new Uint8Array(0), + s: isSet(object.s) ? bytesFromBase64(object.s) : new Uint8Array(0), + custom_message: isSet(object.custom_message) ? globalThis.String(object.custom_message) : "", + }; + }, + + toJSON(message: AssociateTx): unknown { + const obj: any = {}; + if (message.v.length !== 0) { + obj.v = base64FromBytes(message.v); + } + if (message.r.length !== 0) { + obj.r = base64FromBytes(message.r); + } + if (message.s.length !== 0) { + obj.s = base64FromBytes(message.s); + } + if (message.custom_message !== "") { + obj.custom_message = message.custom_message; + } + return obj; + }, + + create, I>>(base?: I): AssociateTx { + return AssociateTx.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): AssociateTx { + const message = createBaseAssociateTx(); + message.v = object.v ?? new Uint8Array(0); + message.r = object.r ?? new Uint8Array(0); + message.s = object.s ?? new Uint8Array(0); + message.custom_message = object.custom_message ?? ""; + return message; + }, +}; + +export const LegacyTx: MessageFns = { + $type: "seiprotocol.seichain.eth.LegacyTx" as const, + + encode(message: LegacyTx, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.nonce !== 0) { + writer.uint32(8).uint64(message.nonce); + } + if (message.gas_price !== "") { + writer.uint32(18).string(message.gas_price); + } + if (message.gas_limit !== 0) { + writer.uint32(24).uint64(message.gas_limit); + } + if (message.to !== "") { + writer.uint32(34).string(message.to); + } + if (message.value !== "") { + writer.uint32(42).string(message.value); + } + if (message.data.length !== 0) { + writer.uint32(50).bytes(message.data); + } + if (message.v.length !== 0) { + writer.uint32(58).bytes(message.v); + } + if (message.r.length !== 0) { + writer.uint32(66).bytes(message.r); + } + if (message.s.length !== 0) { + writer.uint32(74).bytes(message.s); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): LegacyTx { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseLegacyTx(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.nonce = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.gas_price = reader.string(); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.gas_limit = longToNumber(reader.uint64()); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.to = reader.string(); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.value = reader.string(); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.data = reader.bytes(); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.v = reader.bytes(); + continue; + case 8: + if (tag !== 66) { + break; + } + + message.r = reader.bytes(); + continue; + case 9: + if (tag !== 74) { + break; + } + + message.s = reader.bytes(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): LegacyTx { + return { + nonce: isSet(object.nonce) ? globalThis.Number(object.nonce) : 0, + gas_price: isSet(object.gas_price) ? globalThis.String(object.gas_price) : "", + gas_limit: isSet(object.gas_limit) ? globalThis.Number(object.gas_limit) : 0, + to: isSet(object.to) ? globalThis.String(object.to) : "", + value: isSet(object.value) ? globalThis.String(object.value) : "", + data: isSet(object.data) ? bytesFromBase64(object.data) : new Uint8Array(0), + v: isSet(object.v) ? bytesFromBase64(object.v) : new Uint8Array(0), + r: isSet(object.r) ? bytesFromBase64(object.r) : new Uint8Array(0), + s: isSet(object.s) ? bytesFromBase64(object.s) : new Uint8Array(0), + }; + }, + + toJSON(message: LegacyTx): unknown { + const obj: any = {}; + if (message.nonce !== 0) { + obj.nonce = Math.round(message.nonce); + } + if (message.gas_price !== "") { + obj.gas_price = message.gas_price; + } + if (message.gas_limit !== 0) { + obj.gas_limit = Math.round(message.gas_limit); + } + if (message.to !== "") { + obj.to = message.to; + } + if (message.value !== "") { + obj.value = message.value; + } + if (message.data.length !== 0) { + obj.data = base64FromBytes(message.data); + } + if (message.v.length !== 0) { + obj.v = base64FromBytes(message.v); + } + if (message.r.length !== 0) { + obj.r = base64FromBytes(message.r); + } + if (message.s.length !== 0) { + obj.s = base64FromBytes(message.s); + } + return obj; + }, + + create, I>>(base?: I): LegacyTx { + return LegacyTx.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): LegacyTx { + const message = createBaseLegacyTx(); + message.nonce = object.nonce ?? 0; + message.gas_price = object.gas_price ?? ""; + message.gas_limit = object.gas_limit ?? 0; + message.to = object.to ?? ""; + message.value = object.value ?? ""; + message.data = object.data ?? new Uint8Array(0); + message.v = object.v ?? new Uint8Array(0); + message.r = object.r ?? new Uint8Array(0); + message.s = object.s ?? new Uint8Array(0); + return message; + }, +}; + +export const AccessListTx: MessageFns = { + $type: "seiprotocol.seichain.eth.AccessListTx" as const, + + encode(message: AccessListTx, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.chain_id !== "") { + writer.uint32(10).string(message.chain_id); + } + if (message.nonce !== 0) { + writer.uint32(16).uint64(message.nonce); + } + if (message.gas_price !== "") { + writer.uint32(26).string(message.gas_price); + } + if (message.gas_limit !== 0) { + writer.uint32(32).uint64(message.gas_limit); + } + if (message.to !== "") { + writer.uint32(42).string(message.to); + } + if (message.value !== "") { + writer.uint32(50).string(message.value); + } + if (message.data.length !== 0) { + writer.uint32(58).bytes(message.data); + } + for (const v of message.accesses) { + AccessTuple.encode(v!, writer.uint32(66).fork()).join(); + } + if (message.v.length !== 0) { + writer.uint32(74).bytes(message.v); + } + if (message.r.length !== 0) { + writer.uint32(82).bytes(message.r); + } + if (message.s.length !== 0) { + writer.uint32(90).bytes(message.s); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): AccessListTx { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseAccessListTx(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.chain_id = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.nonce = longToNumber(reader.uint64()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.gas_price = reader.string(); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.gas_limit = longToNumber(reader.uint64()); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.to = reader.string(); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.value = reader.string(); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.data = reader.bytes(); + continue; + case 8: + if (tag !== 66) { + break; + } + + message.accesses.push(AccessTuple.decode(reader, reader.uint32())); + continue; + case 9: + if (tag !== 74) { + break; + } + + message.v = reader.bytes(); + continue; + case 10: + if (tag !== 82) { + break; + } + + message.r = reader.bytes(); + continue; + case 11: + if (tag !== 90) { + break; + } + + message.s = reader.bytes(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): AccessListTx { + return { + chain_id: isSet(object.chain_id) ? globalThis.String(object.chain_id) : "", + nonce: isSet(object.nonce) ? globalThis.Number(object.nonce) : 0, + gas_price: isSet(object.gas_price) ? globalThis.String(object.gas_price) : "", + gas_limit: isSet(object.gas_limit) ? globalThis.Number(object.gas_limit) : 0, + to: isSet(object.to) ? globalThis.String(object.to) : "", + value: isSet(object.value) ? globalThis.String(object.value) : "", + data: isSet(object.data) ? bytesFromBase64(object.data) : new Uint8Array(0), + accesses: globalThis.Array.isArray(object?.accesses) ? object.accesses.map((e: any) => AccessTuple.fromJSON(e)) : [], + v: isSet(object.v) ? bytesFromBase64(object.v) : new Uint8Array(0), + r: isSet(object.r) ? bytesFromBase64(object.r) : new Uint8Array(0), + s: isSet(object.s) ? bytesFromBase64(object.s) : new Uint8Array(0), + }; + }, + + toJSON(message: AccessListTx): unknown { + const obj: any = {}; + if (message.chain_id !== "") { + obj.chain_id = message.chain_id; + } + if (message.nonce !== 0) { + obj.nonce = Math.round(message.nonce); + } + if (message.gas_price !== "") { + obj.gas_price = message.gas_price; + } + if (message.gas_limit !== 0) { + obj.gas_limit = Math.round(message.gas_limit); + } + if (message.to !== "") { + obj.to = message.to; + } + if (message.value !== "") { + obj.value = message.value; + } + if (message.data.length !== 0) { + obj.data = base64FromBytes(message.data); + } + if (message.accesses?.length) { + obj.accesses = message.accesses.map((e) => AccessTuple.toJSON(e)); + } + if (message.v.length !== 0) { + obj.v = base64FromBytes(message.v); + } + if (message.r.length !== 0) { + obj.r = base64FromBytes(message.r); + } + if (message.s.length !== 0) { + obj.s = base64FromBytes(message.s); + } + return obj; + }, + + create, I>>(base?: I): AccessListTx { + return AccessListTx.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): AccessListTx { + const message = createBaseAccessListTx(); + message.chain_id = object.chain_id ?? ""; + message.nonce = object.nonce ?? 0; + message.gas_price = object.gas_price ?? ""; + message.gas_limit = object.gas_limit ?? 0; + message.to = object.to ?? ""; + message.value = object.value ?? ""; + message.data = object.data ?? new Uint8Array(0); + message.accesses = object.accesses?.map((e) => AccessTuple.fromPartial(e)) || []; + message.v = object.v ?? new Uint8Array(0); + message.r = object.r ?? new Uint8Array(0); + message.s = object.s ?? new Uint8Array(0); + return message; + }, +}; + +export const DynamicFeeTx: MessageFns = { + $type: "seiprotocol.seichain.eth.DynamicFeeTx" as const, + + encode(message: DynamicFeeTx, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.chain_id !== "") { + writer.uint32(10).string(message.chain_id); + } + if (message.nonce !== 0) { + writer.uint32(16).uint64(message.nonce); + } + if (message.gas_tip_cap !== "") { + writer.uint32(26).string(message.gas_tip_cap); + } + if (message.gas_fee_cap !== "") { + writer.uint32(34).string(message.gas_fee_cap); + } + if (message.gas_limit !== 0) { + writer.uint32(40).uint64(message.gas_limit); + } + if (message.to !== "") { + writer.uint32(50).string(message.to); + } + if (message.value !== "") { + writer.uint32(58).string(message.value); + } + if (message.data.length !== 0) { + writer.uint32(66).bytes(message.data); + } + for (const v of message.accesses) { + AccessTuple.encode(v!, writer.uint32(74).fork()).join(); + } + if (message.v.length !== 0) { + writer.uint32(82).bytes(message.v); + } + if (message.r.length !== 0) { + writer.uint32(90).bytes(message.r); + } + if (message.s.length !== 0) { + writer.uint32(98).bytes(message.s); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): DynamicFeeTx { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDynamicFeeTx(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.chain_id = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.nonce = longToNumber(reader.uint64()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.gas_tip_cap = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.gas_fee_cap = reader.string(); + continue; + case 5: + if (tag !== 40) { + break; + } + + message.gas_limit = longToNumber(reader.uint64()); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.to = reader.string(); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.value = reader.string(); + continue; + case 8: + if (tag !== 66) { + break; + } + + message.data = reader.bytes(); + continue; + case 9: + if (tag !== 74) { + break; + } + + message.accesses.push(AccessTuple.decode(reader, reader.uint32())); + continue; + case 10: + if (tag !== 82) { + break; + } + + message.v = reader.bytes(); + continue; + case 11: + if (tag !== 90) { + break; + } + + message.r = reader.bytes(); + continue; + case 12: + if (tag !== 98) { + break; + } + + message.s = reader.bytes(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): DynamicFeeTx { + return { + chain_id: isSet(object.chain_id) ? globalThis.String(object.chain_id) : "", + nonce: isSet(object.nonce) ? globalThis.Number(object.nonce) : 0, + gas_tip_cap: isSet(object.gas_tip_cap) ? globalThis.String(object.gas_tip_cap) : "", + gas_fee_cap: isSet(object.gas_fee_cap) ? globalThis.String(object.gas_fee_cap) : "", + gas_limit: isSet(object.gas_limit) ? globalThis.Number(object.gas_limit) : 0, + to: isSet(object.to) ? globalThis.String(object.to) : "", + value: isSet(object.value) ? globalThis.String(object.value) : "", + data: isSet(object.data) ? bytesFromBase64(object.data) : new Uint8Array(0), + accesses: globalThis.Array.isArray(object?.accesses) ? object.accesses.map((e: any) => AccessTuple.fromJSON(e)) : [], + v: isSet(object.v) ? bytesFromBase64(object.v) : new Uint8Array(0), + r: isSet(object.r) ? bytesFromBase64(object.r) : new Uint8Array(0), + s: isSet(object.s) ? bytesFromBase64(object.s) : new Uint8Array(0), + }; + }, + + toJSON(message: DynamicFeeTx): unknown { + const obj: any = {}; + if (message.chain_id !== "") { + obj.chain_id = message.chain_id; + } + if (message.nonce !== 0) { + obj.nonce = Math.round(message.nonce); + } + if (message.gas_tip_cap !== "") { + obj.gas_tip_cap = message.gas_tip_cap; + } + if (message.gas_fee_cap !== "") { + obj.gas_fee_cap = message.gas_fee_cap; + } + if (message.gas_limit !== 0) { + obj.gas_limit = Math.round(message.gas_limit); + } + if (message.to !== "") { + obj.to = message.to; + } + if (message.value !== "") { + obj.value = message.value; + } + if (message.data.length !== 0) { + obj.data = base64FromBytes(message.data); + } + if (message.accesses?.length) { + obj.accesses = message.accesses.map((e) => AccessTuple.toJSON(e)); + } + if (message.v.length !== 0) { + obj.v = base64FromBytes(message.v); + } + if (message.r.length !== 0) { + obj.r = base64FromBytes(message.r); + } + if (message.s.length !== 0) { + obj.s = base64FromBytes(message.s); + } + return obj; + }, + + create, I>>(base?: I): DynamicFeeTx { + return DynamicFeeTx.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): DynamicFeeTx { + const message = createBaseDynamicFeeTx(); + message.chain_id = object.chain_id ?? ""; + message.nonce = object.nonce ?? 0; + message.gas_tip_cap = object.gas_tip_cap ?? ""; + message.gas_fee_cap = object.gas_fee_cap ?? ""; + message.gas_limit = object.gas_limit ?? 0; + message.to = object.to ?? ""; + message.value = object.value ?? ""; + message.data = object.data ?? new Uint8Array(0); + message.accesses = object.accesses?.map((e) => AccessTuple.fromPartial(e)) || []; + message.v = object.v ?? new Uint8Array(0); + message.r = object.r ?? new Uint8Array(0); + message.s = object.s ?? new Uint8Array(0); + return message; + }, +}; + +export const BlobTx: MessageFns = { + $type: "seiprotocol.seichain.eth.BlobTx" as const, + + encode(message: BlobTx, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.chain_id !== "") { + writer.uint32(10).string(message.chain_id); + } + if (message.nonce !== 0) { + writer.uint32(16).uint64(message.nonce); + } + if (message.gas_tip_cap !== "") { + writer.uint32(26).string(message.gas_tip_cap); + } + if (message.gas_fee_cap !== "") { + writer.uint32(34).string(message.gas_fee_cap); + } + if (message.gas_limit !== 0) { + writer.uint32(40).uint64(message.gas_limit); + } + if (message.to !== "") { + writer.uint32(50).string(message.to); + } + if (message.value !== "") { + writer.uint32(58).string(message.value); + } + if (message.data.length !== 0) { + writer.uint32(66).bytes(message.data); + } + for (const v of message.accesses) { + AccessTuple.encode(v!, writer.uint32(74).fork()).join(); + } + if (message.blob_fee_cap !== "") { + writer.uint32(82).string(message.blob_fee_cap); + } + for (const v of message.blob_hashes) { + writer.uint32(90).bytes(v!); + } + if (message.sidecar !== undefined) { + BlobTxSidecar.encode(message.sidecar, writer.uint32(98).fork()).join(); + } + if (message.v.length !== 0) { + writer.uint32(106).bytes(message.v); + } + if (message.r.length !== 0) { + writer.uint32(114).bytes(message.r); + } + if (message.s.length !== 0) { + writer.uint32(122).bytes(message.s); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): BlobTx { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseBlobTx(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.chain_id = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.nonce = longToNumber(reader.uint64()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.gas_tip_cap = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.gas_fee_cap = reader.string(); + continue; + case 5: + if (tag !== 40) { + break; + } + + message.gas_limit = longToNumber(reader.uint64()); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.to = reader.string(); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.value = reader.string(); + continue; + case 8: + if (tag !== 66) { + break; + } + + message.data = reader.bytes(); + continue; + case 9: + if (tag !== 74) { + break; + } + + message.accesses.push(AccessTuple.decode(reader, reader.uint32())); + continue; + case 10: + if (tag !== 82) { + break; + } + + message.blob_fee_cap = reader.string(); + continue; + case 11: + if (tag !== 90) { + break; + } + + message.blob_hashes.push(reader.bytes()); + continue; + case 12: + if (tag !== 98) { + break; + } + + message.sidecar = BlobTxSidecar.decode(reader, reader.uint32()); + continue; + case 13: + if (tag !== 106) { + break; + } + + message.v = reader.bytes(); + continue; + case 14: + if (tag !== 114) { + break; + } + + message.r = reader.bytes(); + continue; + case 15: + if (tag !== 122) { + break; + } + + message.s = reader.bytes(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): BlobTx { + return { + chain_id: isSet(object.chain_id) ? globalThis.String(object.chain_id) : "", + nonce: isSet(object.nonce) ? globalThis.Number(object.nonce) : 0, + gas_tip_cap: isSet(object.gas_tip_cap) ? globalThis.String(object.gas_tip_cap) : "", + gas_fee_cap: isSet(object.gas_fee_cap) ? globalThis.String(object.gas_fee_cap) : "", + gas_limit: isSet(object.gas_limit) ? globalThis.Number(object.gas_limit) : 0, + to: isSet(object.to) ? globalThis.String(object.to) : "", + value: isSet(object.value) ? globalThis.String(object.value) : "", + data: isSet(object.data) ? bytesFromBase64(object.data) : new Uint8Array(0), + accesses: globalThis.Array.isArray(object?.accesses) ? object.accesses.map((e: any) => AccessTuple.fromJSON(e)) : [], + blob_fee_cap: isSet(object.blob_fee_cap) ? globalThis.String(object.blob_fee_cap) : "", + blob_hashes: globalThis.Array.isArray(object?.blob_hashes) ? object.blob_hashes.map((e: any) => bytesFromBase64(e)) : [], + sidecar: isSet(object.sidecar) ? BlobTxSidecar.fromJSON(object.sidecar) : undefined, + v: isSet(object.v) ? bytesFromBase64(object.v) : new Uint8Array(0), + r: isSet(object.r) ? bytesFromBase64(object.r) : new Uint8Array(0), + s: isSet(object.s) ? bytesFromBase64(object.s) : new Uint8Array(0), + }; + }, + + toJSON(message: BlobTx): unknown { + const obj: any = {}; + if (message.chain_id !== "") { + obj.chain_id = message.chain_id; + } + if (message.nonce !== 0) { + obj.nonce = Math.round(message.nonce); + } + if (message.gas_tip_cap !== "") { + obj.gas_tip_cap = message.gas_tip_cap; + } + if (message.gas_fee_cap !== "") { + obj.gas_fee_cap = message.gas_fee_cap; + } + if (message.gas_limit !== 0) { + obj.gas_limit = Math.round(message.gas_limit); + } + if (message.to !== "") { + obj.to = message.to; + } + if (message.value !== "") { + obj.value = message.value; + } + if (message.data.length !== 0) { + obj.data = base64FromBytes(message.data); + } + if (message.accesses?.length) { + obj.accesses = message.accesses.map((e) => AccessTuple.toJSON(e)); + } + if (message.blob_fee_cap !== "") { + obj.blob_fee_cap = message.blob_fee_cap; + } + if (message.blob_hashes?.length) { + obj.blob_hashes = message.blob_hashes.map((e) => base64FromBytes(e)); + } + if (message.sidecar !== undefined) { + obj.sidecar = BlobTxSidecar.toJSON(message.sidecar); + } + if (message.v.length !== 0) { + obj.v = base64FromBytes(message.v); + } + if (message.r.length !== 0) { + obj.r = base64FromBytes(message.r); + } + if (message.s.length !== 0) { + obj.s = base64FromBytes(message.s); + } + return obj; + }, + + create, I>>(base?: I): BlobTx { + return BlobTx.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): BlobTx { + const message = createBaseBlobTx(); + message.chain_id = object.chain_id ?? ""; + message.nonce = object.nonce ?? 0; + message.gas_tip_cap = object.gas_tip_cap ?? ""; + message.gas_fee_cap = object.gas_fee_cap ?? ""; + message.gas_limit = object.gas_limit ?? 0; + message.to = object.to ?? ""; + message.value = object.value ?? ""; + message.data = object.data ?? new Uint8Array(0); + message.accesses = object.accesses?.map((e) => AccessTuple.fromPartial(e)) || []; + message.blob_fee_cap = object.blob_fee_cap ?? ""; + message.blob_hashes = object.blob_hashes?.map((e) => e) || []; + message.sidecar = object.sidecar !== undefined && object.sidecar !== null ? BlobTxSidecar.fromPartial(object.sidecar) : undefined; + message.v = object.v ?? new Uint8Array(0); + message.r = object.r ?? new Uint8Array(0); + message.s = object.s ?? new Uint8Array(0); + return message; + }, +}; + +export const BlobTxSidecar: MessageFns = { + $type: "seiprotocol.seichain.eth.BlobTxSidecar" as const, + + encode(message: BlobTxSidecar, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.blobs) { + writer.uint32(10).bytes(v!); + } + for (const v of message.commitments) { + writer.uint32(18).bytes(v!); + } + for (const v of message.proofs) { + writer.uint32(26).bytes(v!); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): BlobTxSidecar { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseBlobTxSidecar(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.blobs.push(reader.bytes()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.commitments.push(reader.bytes()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.proofs.push(reader.bytes()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): BlobTxSidecar { + return { + blobs: globalThis.Array.isArray(object?.blobs) ? object.blobs.map((e: any) => bytesFromBase64(e)) : [], + commitments: globalThis.Array.isArray(object?.commitments) ? object.commitments.map((e: any) => bytesFromBase64(e)) : [], + proofs: globalThis.Array.isArray(object?.proofs) ? object.proofs.map((e: any) => bytesFromBase64(e)) : [], + }; + }, + + toJSON(message: BlobTxSidecar): unknown { + const obj: any = {}; + if (message.blobs?.length) { + obj.blobs = message.blobs.map((e) => base64FromBytes(e)); + } + if (message.commitments?.length) { + obj.commitments = message.commitments.map((e) => base64FromBytes(e)); + } + if (message.proofs?.length) { + obj.proofs = message.proofs.map((e) => base64FromBytes(e)); + } + return obj; + }, + + create, I>>(base?: I): BlobTxSidecar { + return BlobTxSidecar.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): BlobTxSidecar { + const message = createBaseBlobTxSidecar(); + message.blobs = object.blobs?.map((e) => e) || []; + message.commitments = object.commitments?.map((e) => e) || []; + message.proofs = object.proofs?.map((e) => e) || []; + return message; + }, +}; + +export const ExtensionOptionsEthereumTx: MessageFns = { + $type: "seiprotocol.seichain.eth.ExtensionOptionsEthereumTx" as const, + + encode(_: ExtensionOptionsEthereumTx, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ExtensionOptionsEthereumTx { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseExtensionOptionsEthereumTx(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): ExtensionOptionsEthereumTx { + return {}; + }, + + toJSON(_: ExtensionOptionsEthereumTx): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): ExtensionOptionsEthereumTx { + return ExtensionOptionsEthereumTx.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): ExtensionOptionsEthereumTx { + const message = createBaseExtensionOptionsEthereumTx(); + return message; + }, +}; + +function createBaseAccessTuple(): AccessTuple { + return { address: "", storage_keys: [] }; +} + +function createBaseAssociateTx(): AssociateTx { + return { v: new Uint8Array(0), r: new Uint8Array(0), s: new Uint8Array(0), custom_message: "" }; +} + +function createBaseLegacyTx(): LegacyTx { + return { + nonce: 0, + gas_price: "", + gas_limit: 0, + to: "", + value: "", + data: new Uint8Array(0), + v: new Uint8Array(0), + r: new Uint8Array(0), + s: new Uint8Array(0), + }; +} + +function createBaseAccessListTx(): AccessListTx { + return { + chain_id: "", + nonce: 0, + gas_price: "", + gas_limit: 0, + to: "", + value: "", + data: new Uint8Array(0), + accesses: [], + v: new Uint8Array(0), + r: new Uint8Array(0), + s: new Uint8Array(0), + }; +} + +function createBaseDynamicFeeTx(): DynamicFeeTx { + return { + chain_id: "", + nonce: 0, + gas_tip_cap: "", + gas_fee_cap: "", + gas_limit: 0, + to: "", + value: "", + data: new Uint8Array(0), + accesses: [], + v: new Uint8Array(0), + r: new Uint8Array(0), + s: new Uint8Array(0), + }; +} + +function createBaseBlobTx(): BlobTx { + return { + chain_id: "", + nonce: 0, + gas_tip_cap: "", + gas_fee_cap: "", + gas_limit: 0, + to: "", + value: "", + data: new Uint8Array(0), + accesses: [], + blob_fee_cap: "", + blob_hashes: [], + sidecar: undefined, + v: new Uint8Array(0), + r: new Uint8Array(0), + s: new Uint8Array(0), + }; +} + +function createBaseBlobTxSidecar(): BlobTxSidecar { + return { blobs: [], commitments: [], proofs: [] }; +} + +function createBaseExtensionOptionsEthereumTx(): ExtensionOptionsEthereumTx { + return {}; +} + +function bytesFromBase64(b64: string): Uint8Array { + if ((globalThis as any).Buffer) { + return Uint8Array.from(globalThis.Buffer.from(b64, "base64")); + } else { + const bin = globalThis.atob(b64); + const arr = new Uint8Array(bin.length); + for (let i = 0; i < bin.length; ++i) { + arr[i] = bin.charCodeAt(i); + } + return arr; + } +} + +function base64FromBytes(arr: Uint8Array): string { + if ((globalThis as any).Buffer) { + return globalThis.Buffer.from(arr).toString("base64"); + } else { + const bin: string[] = []; + arr.forEach((byte) => { + bin.push(globalThis.String.fromCharCode(byte)); + }); + return globalThis.btoa(bin.join("")); + } +} + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} +export const registry: Array<[string, GeneratedType]> = [ + ["/seiprotocol.seichain.eth.AccessTuple", AccessTuple as never], + ["/seiprotocol.seichain.eth.AssociateTx", AssociateTx as never], + ["/seiprotocol.seichain.eth.LegacyTx", LegacyTx as never], + ["/seiprotocol.seichain.eth.AccessListTx", AccessListTx as never], + ["/seiprotocol.seichain.eth.DynamicFeeTx", DynamicFeeTx as never], + ["/seiprotocol.seichain.eth.BlobTx", BlobTx as never], + ["/seiprotocol.seichain.eth.BlobTxSidecar", BlobTxSidecar as never], +]; +export const aminoConverters = { + "/seiprotocol.seichain.eth.AccessTuple": { + aminoType: "eth/AccessTuple", + toAmino: (message: AccessTuple) => ({ ...message }), + fromAmino: (object: AccessTuple) => ({ ...object }), + }, + + "/seiprotocol.seichain.eth.AssociateTx": { + aminoType: "eth/AssociateTx", + toAmino: (message: AssociateTx) => ({ ...message }), + fromAmino: (object: AssociateTx) => ({ ...object }), + }, + + "/seiprotocol.seichain.eth.LegacyTx": { + aminoType: "eth/LegacyTx", + toAmino: (message: LegacyTx) => ({ ...message }), + fromAmino: (object: LegacyTx) => ({ ...object }), + }, + + "/seiprotocol.seichain.eth.AccessListTx": { + aminoType: "eth/AccessListTx", + toAmino: (message: AccessListTx) => ({ ...message }), + fromAmino: (object: AccessListTx) => ({ ...object }), + }, + + "/seiprotocol.seichain.eth.DynamicFeeTx": { + aminoType: "eth/DynamicFeeTx", + toAmino: (message: DynamicFeeTx) => ({ ...message }), + fromAmino: (object: DynamicFeeTx) => ({ ...object }), + }, + + "/seiprotocol.seichain.eth.BlobTx": { + aminoType: "eth/BlobTx", + toAmino: (message: BlobTx) => ({ ...message }), + fromAmino: (object: BlobTx) => ({ ...object }), + }, + + "/seiprotocol.seichain.eth.BlobTxSidecar": { + aminoType: "eth/BlobTxSidecar", + toAmino: (message: BlobTxSidecar) => ({ ...message }), + fromAmino: (object: BlobTxSidecar) => ({ ...object }), + }, +}; diff --git a/packages/cosmos/generated/encoding/evm/config.ts b/packages/cosmos/generated/encoding/evm/config.ts new file mode 100644 index 000000000..83b35eed4 --- /dev/null +++ b/packages/cosmos/generated/encoding/evm/config.ts @@ -0,0 +1,123 @@ +import type { GeneratedType } from "@cosmjs/proto-signing"; + +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +import type { ChainConfig as ChainConfig_type } from "../../types/evm"; + +import type { DeepPartial, Exact, MessageFns } from "../common"; + +export interface ChainConfig extends ChainConfig_type {} + +export const ChainConfig: MessageFns = { + $type: "seiprotocol.seichain.evm.ChainConfig" as const, + + encode(message: ChainConfig, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.cancun_time !== 0) { + writer.uint32(8).int64(message.cancun_time); + } + if (message.prague_time !== 0) { + writer.uint32(16).int64(message.prague_time); + } + if (message.verkle_time !== 0) { + writer.uint32(24).int64(message.verkle_time); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ChainConfig { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseChainConfig(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.cancun_time = longToNumber(reader.int64()); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.prague_time = longToNumber(reader.int64()); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.verkle_time = longToNumber(reader.int64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ChainConfig { + return { + cancun_time: isSet(object.cancun_time) ? globalThis.Number(object.cancun_time) : 0, + prague_time: isSet(object.prague_time) ? globalThis.Number(object.prague_time) : 0, + verkle_time: isSet(object.verkle_time) ? globalThis.Number(object.verkle_time) : 0, + }; + }, + + toJSON(message: ChainConfig): unknown { + const obj: any = {}; + if (message.cancun_time !== 0) { + obj.cancun_time = Math.round(message.cancun_time); + } + if (message.prague_time !== 0) { + obj.prague_time = Math.round(message.prague_time); + } + if (message.verkle_time !== 0) { + obj.verkle_time = Math.round(message.verkle_time); + } + return obj; + }, + + create, I>>(base?: I): ChainConfig { + return ChainConfig.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ChainConfig { + const message = createBaseChainConfig(); + message.cancun_time = object.cancun_time ?? 0; + message.prague_time = object.prague_time ?? 0; + message.verkle_time = object.verkle_time ?? 0; + return message; + }, +}; + +function createBaseChainConfig(): ChainConfig { + return { cancun_time: 0, prague_time: 0, verkle_time: 0 }; +} + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} +export const registry: Array<[string, GeneratedType]> = [["/seiprotocol.seichain.evm.ChainConfig", ChainConfig as never]]; +export const aminoConverters = { + "/seiprotocol.seichain.evm.ChainConfig": { + aminoType: "evm/ChainConfig", + toAmino: (message: ChainConfig) => ({ ...message }), + fromAmino: (object: ChainConfig) => ({ ...object }), + }, +}; diff --git a/packages/cosmos/generated/encoding/evm/enums.ts b/packages/cosmos/generated/encoding/evm/enums.ts new file mode 100644 index 000000000..ae7ef0da2 --- /dev/null +++ b/packages/cosmos/generated/encoding/evm/enums.ts @@ -0,0 +1,43 @@ +import { PointerType } from "../../types/evm"; + +export function pointerTypeFromJSON(object: any): PointerType { + switch (object) { + case 0: + case "ERC20": + return PointerType.ERC20; + case 1: + case "ERC721": + return PointerType.ERC721; + case 2: + case "NATIVE": + return PointerType.NATIVE; + case 3: + case "CW20": + return PointerType.CW20; + case 4: + case "CW721": + return PointerType.CW721; + case -1: + case "UNRECOGNIZED": + default: + return PointerType.UNRECOGNIZED; + } +} + +export function pointerTypeToJSON(object: PointerType): string { + switch (object) { + case PointerType.ERC20: + return "ERC20"; + case PointerType.ERC721: + return "ERC721"; + case PointerType.NATIVE: + return "NATIVE"; + case PointerType.CW20: + return "CW20"; + case PointerType.CW721: + return "CW721"; + case PointerType.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} diff --git a/packages/cosmos/generated/encoding/evm/genesis.ts b/packages/cosmos/generated/encoding/evm/genesis.ts new file mode 100644 index 000000000..ec26f79a0 --- /dev/null +++ b/packages/cosmos/generated/encoding/evm/genesis.ts @@ -0,0 +1,656 @@ +import type { GeneratedType } from "@cosmjs/proto-signing"; + +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +import { Params } from "./params"; + +import type { + AddressAssociation as AddressAssociation_type, + Code as Code_type, + ContractState as ContractState_type, + GenesisState as GenesisState_type, + Nonce as Nonce_type, + Serialized as Serialized_type, +} from "../../types/evm"; + +import type { DeepPartial, Exact, MessageFns } from "../common"; + +export interface AddressAssociation extends AddressAssociation_type {} +export interface Code extends Code_type {} +export interface ContractState extends ContractState_type {} +export interface Nonce extends Nonce_type {} +export interface Serialized extends Serialized_type {} +export interface GenesisState extends GenesisState_type {} + +export const AddressAssociation: MessageFns = { + $type: "seiprotocol.seichain.evm.AddressAssociation" as const, + + encode(message: AddressAssociation, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.sei_address !== "") { + writer.uint32(10).string(message.sei_address); + } + if (message.eth_address !== "") { + writer.uint32(18).string(message.eth_address); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): AddressAssociation { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseAddressAssociation(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.sei_address = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.eth_address = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): AddressAssociation { + return { + sei_address: isSet(object.sei_address) ? globalThis.String(object.sei_address) : "", + eth_address: isSet(object.eth_address) ? globalThis.String(object.eth_address) : "", + }; + }, + + toJSON(message: AddressAssociation): unknown { + const obj: any = {}; + if (message.sei_address !== "") { + obj.sei_address = message.sei_address; + } + if (message.eth_address !== "") { + obj.eth_address = message.eth_address; + } + return obj; + }, + + create, I>>(base?: I): AddressAssociation { + return AddressAssociation.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): AddressAssociation { + const message = createBaseAddressAssociation(); + message.sei_address = object.sei_address ?? ""; + message.eth_address = object.eth_address ?? ""; + return message; + }, +}; + +export const Code: MessageFns = { + $type: "seiprotocol.seichain.evm.Code" as const, + + encode(message: Code, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.address !== "") { + writer.uint32(10).string(message.address); + } + if (message.code.length !== 0) { + writer.uint32(18).bytes(message.code); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Code { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseCode(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.address = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.code = reader.bytes(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Code { + return { + address: isSet(object.address) ? globalThis.String(object.address) : "", + code: isSet(object.code) ? bytesFromBase64(object.code) : new Uint8Array(0), + }; + }, + + toJSON(message: Code): unknown { + const obj: any = {}; + if (message.address !== "") { + obj.address = message.address; + } + if (message.code.length !== 0) { + obj.code = base64FromBytes(message.code); + } + return obj; + }, + + create, I>>(base?: I): Code { + return Code.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Code { + const message = createBaseCode(); + message.address = object.address ?? ""; + message.code = object.code ?? new Uint8Array(0); + return message; + }, +}; + +export const ContractState: MessageFns = { + $type: "seiprotocol.seichain.evm.ContractState" as const, + + encode(message: ContractState, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.address !== "") { + writer.uint32(10).string(message.address); + } + if (message.key.length !== 0) { + writer.uint32(18).bytes(message.key); + } + if (message.value.length !== 0) { + writer.uint32(26).bytes(message.value); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ContractState { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseContractState(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.address = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.key = reader.bytes(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.value = reader.bytes(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ContractState { + return { + address: isSet(object.address) ? globalThis.String(object.address) : "", + key: isSet(object.key) ? bytesFromBase64(object.key) : new Uint8Array(0), + value: isSet(object.value) ? bytesFromBase64(object.value) : new Uint8Array(0), + }; + }, + + toJSON(message: ContractState): unknown { + const obj: any = {}; + if (message.address !== "") { + obj.address = message.address; + } + if (message.key.length !== 0) { + obj.key = base64FromBytes(message.key); + } + if (message.value.length !== 0) { + obj.value = base64FromBytes(message.value); + } + return obj; + }, + + create, I>>(base?: I): ContractState { + return ContractState.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ContractState { + const message = createBaseContractState(); + message.address = object.address ?? ""; + message.key = object.key ?? new Uint8Array(0); + message.value = object.value ?? new Uint8Array(0); + return message; + }, +}; + +export const Nonce: MessageFns = { + $type: "seiprotocol.seichain.evm.Nonce" as const, + + encode(message: Nonce, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.address !== "") { + writer.uint32(10).string(message.address); + } + if (message.nonce !== 0) { + writer.uint32(16).uint64(message.nonce); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Nonce { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseNonce(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.address = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.nonce = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Nonce { + return { + address: isSet(object.address) ? globalThis.String(object.address) : "", + nonce: isSet(object.nonce) ? globalThis.Number(object.nonce) : 0, + }; + }, + + toJSON(message: Nonce): unknown { + const obj: any = {}; + if (message.address !== "") { + obj.address = message.address; + } + if (message.nonce !== 0) { + obj.nonce = Math.round(message.nonce); + } + return obj; + }, + + create, I>>(base?: I): Nonce { + return Nonce.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Nonce { + const message = createBaseNonce(); + message.address = object.address ?? ""; + message.nonce = object.nonce ?? 0; + return message; + }, +}; + +export const Serialized: MessageFns = { + $type: "seiprotocol.seichain.evm.Serialized" as const, + + encode(message: Serialized, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.prefix.length !== 0) { + writer.uint32(10).bytes(message.prefix); + } + if (message.key.length !== 0) { + writer.uint32(18).bytes(message.key); + } + if (message.value.length !== 0) { + writer.uint32(26).bytes(message.value); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Serialized { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseSerialized(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.prefix = reader.bytes(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.key = reader.bytes(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.value = reader.bytes(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Serialized { + return { + prefix: isSet(object.prefix) ? bytesFromBase64(object.prefix) : new Uint8Array(0), + key: isSet(object.key) ? bytesFromBase64(object.key) : new Uint8Array(0), + value: isSet(object.value) ? bytesFromBase64(object.value) : new Uint8Array(0), + }; + }, + + toJSON(message: Serialized): unknown { + const obj: any = {}; + if (message.prefix.length !== 0) { + obj.prefix = base64FromBytes(message.prefix); + } + if (message.key.length !== 0) { + obj.key = base64FromBytes(message.key); + } + if (message.value.length !== 0) { + obj.value = base64FromBytes(message.value); + } + return obj; + }, + + create, I>>(base?: I): Serialized { + return Serialized.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Serialized { + const message = createBaseSerialized(); + message.prefix = object.prefix ?? new Uint8Array(0); + message.key = object.key ?? new Uint8Array(0); + message.value = object.value ?? new Uint8Array(0); + return message; + }, +}; + +export const GenesisState: MessageFns = { + $type: "seiprotocol.seichain.evm.GenesisState" as const, + + encode(message: GenesisState, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(10).fork()).join(); + } + for (const v of message.address_associations) { + AddressAssociation.encode(v!, writer.uint32(18).fork()).join(); + } + for (const v of message.codes) { + Code.encode(v!, writer.uint32(26).fork()).join(); + } + for (const v of message.states) { + ContractState.encode(v!, writer.uint32(34).fork()).join(); + } + for (const v of message.nonces) { + Nonce.encode(v!, writer.uint32(42).fork()).join(); + } + for (const v of message.serialized) { + Serialized.encode(v!, writer.uint32(50).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GenesisState { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGenesisState(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.params = Params.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.address_associations.push(AddressAssociation.decode(reader, reader.uint32())); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.codes.push(Code.decode(reader, reader.uint32())); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.states.push(ContractState.decode(reader, reader.uint32())); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.nonces.push(Nonce.decode(reader, reader.uint32())); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.serialized.push(Serialized.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GenesisState { + return { + params: isSet(object.params) ? Params.fromJSON(object.params) : undefined, + address_associations: globalThis.Array.isArray(object?.address_associations) + ? object.address_associations.map((e: any) => AddressAssociation.fromJSON(e)) + : [], + codes: globalThis.Array.isArray(object?.codes) ? object.codes.map((e: any) => Code.fromJSON(e)) : [], + states: globalThis.Array.isArray(object?.states) ? object.states.map((e: any) => ContractState.fromJSON(e)) : [], + nonces: globalThis.Array.isArray(object?.nonces) ? object.nonces.map((e: any) => Nonce.fromJSON(e)) : [], + serialized: globalThis.Array.isArray(object?.serialized) ? object.serialized.map((e: any) => Serialized.fromJSON(e)) : [], + }; + }, + + toJSON(message: GenesisState): unknown { + const obj: any = {}; + if (message.params !== undefined) { + obj.params = Params.toJSON(message.params); + } + if (message.address_associations?.length) { + obj.address_associations = message.address_associations.map((e) => AddressAssociation.toJSON(e)); + } + if (message.codes?.length) { + obj.codes = message.codes.map((e) => Code.toJSON(e)); + } + if (message.states?.length) { + obj.states = message.states.map((e) => ContractState.toJSON(e)); + } + if (message.nonces?.length) { + obj.nonces = message.nonces.map((e) => Nonce.toJSON(e)); + } + if (message.serialized?.length) { + obj.serialized = message.serialized.map((e) => Serialized.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): GenesisState { + return GenesisState.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): GenesisState { + const message = createBaseGenesisState(); + message.params = object.params !== undefined && object.params !== null ? Params.fromPartial(object.params) : undefined; + message.address_associations = object.address_associations?.map((e) => AddressAssociation.fromPartial(e)) || []; + message.codes = object.codes?.map((e) => Code.fromPartial(e)) || []; + message.states = object.states?.map((e) => ContractState.fromPartial(e)) || []; + message.nonces = object.nonces?.map((e) => Nonce.fromPartial(e)) || []; + message.serialized = object.serialized?.map((e) => Serialized.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseAddressAssociation(): AddressAssociation { + return { sei_address: "", eth_address: "" }; +} + +function createBaseCode(): Code { + return { address: "", code: new Uint8Array(0) }; +} + +function createBaseContractState(): ContractState { + return { address: "", key: new Uint8Array(0), value: new Uint8Array(0) }; +} + +function createBaseNonce(): Nonce { + return { address: "", nonce: 0 }; +} + +function createBaseSerialized(): Serialized { + return { prefix: new Uint8Array(0), key: new Uint8Array(0), value: new Uint8Array(0) }; +} + +function createBaseGenesisState(): GenesisState { + return { params: undefined, address_associations: [], codes: [], states: [], nonces: [], serialized: [] }; +} + +function bytesFromBase64(b64: string): Uint8Array { + if ((globalThis as any).Buffer) { + return Uint8Array.from(globalThis.Buffer.from(b64, "base64")); + } else { + const bin = globalThis.atob(b64); + const arr = new Uint8Array(bin.length); + for (let i = 0; i < bin.length; ++i) { + arr[i] = bin.charCodeAt(i); + } + return arr; + } +} + +function base64FromBytes(arr: Uint8Array): string { + if ((globalThis as any).Buffer) { + return globalThis.Buffer.from(arr).toString("base64"); + } else { + const bin: string[] = []; + arr.forEach((byte) => { + bin.push(globalThis.String.fromCharCode(byte)); + }); + return globalThis.btoa(bin.join("")); + } +} + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} +export const registry: Array<[string, GeneratedType]> = [ + ["/seiprotocol.seichain.evm.AddressAssociation", AddressAssociation as never], + ["/seiprotocol.seichain.evm.Code", Code as never], + ["/seiprotocol.seichain.evm.ContractState", ContractState as never], + ["/seiprotocol.seichain.evm.Nonce", Nonce as never], + ["/seiprotocol.seichain.evm.Serialized", Serialized as never], + ["/seiprotocol.seichain.evm.GenesisState", GenesisState as never], +]; +export const aminoConverters = { + "/seiprotocol.seichain.evm.AddressAssociation": { + aminoType: "evm/AddressAssociation", + toAmino: (message: AddressAssociation) => ({ ...message }), + fromAmino: (object: AddressAssociation) => ({ ...object }), + }, + + "/seiprotocol.seichain.evm.Code": { + aminoType: "evm/Code", + toAmino: (message: Code) => ({ ...message }), + fromAmino: (object: Code) => ({ ...object }), + }, + + "/seiprotocol.seichain.evm.ContractState": { + aminoType: "evm/ContractState", + toAmino: (message: ContractState) => ({ ...message }), + fromAmino: (object: ContractState) => ({ ...object }), + }, + + "/seiprotocol.seichain.evm.Nonce": { + aminoType: "evm/Nonce", + toAmino: (message: Nonce) => ({ ...message }), + fromAmino: (object: Nonce) => ({ ...object }), + }, + + "/seiprotocol.seichain.evm.Serialized": { + aminoType: "evm/Serialized", + toAmino: (message: Serialized) => ({ ...message }), + fromAmino: (object: Serialized) => ({ ...object }), + }, + + "/seiprotocol.seichain.evm.GenesisState": { + aminoType: "evm/GenesisState", + toAmino: (message: GenesisState) => ({ ...message }), + fromAmino: (object: GenesisState) => ({ ...object }), + }, +}; diff --git a/packages/cosmos/generated/encoding/evm/gov.ts b/packages/cosmos/generated/encoding/evm/gov.ts new file mode 100644 index 000000000..193eb3e99 --- /dev/null +++ b/packages/cosmos/generated/encoding/evm/gov.ts @@ -0,0 +1,764 @@ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +import type { + AddCWERC20PointerProposal as AddCWERC20PointerProposal_type, + AddCWERC721PointerProposal as AddCWERC721PointerProposal_type, + AddERCCW20PointerProposal as AddERCCW20PointerProposal_type, + AddERCCW721PointerProposal as AddERCCW721PointerProposal_type, + AddERCNativePointerProposalV2 as AddERCNativePointerProposalV2_type, + AddERCNativePointerProposal as AddERCNativePointerProposal_type, +} from "../../types/evm"; + +import type { DeepPartial, Exact, MessageFns } from "../common"; + +export interface AddERCNativePointerProposal extends AddERCNativePointerProposal_type {} +export interface AddERCCW20PointerProposal extends AddERCCW20PointerProposal_type {} +export interface AddERCCW721PointerProposal extends AddERCCW721PointerProposal_type {} +export interface AddCWERC20PointerProposal extends AddCWERC20PointerProposal_type {} +export interface AddCWERC721PointerProposal extends AddCWERC721PointerProposal_type {} +export interface AddERCNativePointerProposalV2 extends AddERCNativePointerProposalV2_type {} + +export const AddERCNativePointerProposal: MessageFns = { + $type: "seiprotocol.seichain.evm.AddERCNativePointerProposal" as const, + + encode(message: AddERCNativePointerProposal, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.title !== "") { + writer.uint32(10).string(message.title); + } + if (message.description !== "") { + writer.uint32(18).string(message.description); + } + if (message.token !== "") { + writer.uint32(26).string(message.token); + } + if (message.pointer !== "") { + writer.uint32(34).string(message.pointer); + } + if (message.version !== 0) { + writer.uint32(40).uint32(message.version); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): AddERCNativePointerProposal { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseAddERCNativePointerProposal(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.title = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.description = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.token = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.pointer = reader.string(); + continue; + case 5: + if (tag !== 40) { + break; + } + + message.version = reader.uint32(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): AddERCNativePointerProposal { + return { + title: isSet(object.title) ? globalThis.String(object.title) : "", + description: isSet(object.description) ? globalThis.String(object.description) : "", + token: isSet(object.token) ? globalThis.String(object.token) : "", + pointer: isSet(object.pointer) ? globalThis.String(object.pointer) : "", + version: isSet(object.version) ? globalThis.Number(object.version) : 0, + }; + }, + + toJSON(message: AddERCNativePointerProposal): unknown { + const obj: any = {}; + if (message.title !== "") { + obj.title = message.title; + } + if (message.description !== "") { + obj.description = message.description; + } + if (message.token !== "") { + obj.token = message.token; + } + if (message.pointer !== "") { + obj.pointer = message.pointer; + } + if (message.version !== 0) { + obj.version = Math.round(message.version); + } + return obj; + }, + + create, I>>(base?: I): AddERCNativePointerProposal { + return AddERCNativePointerProposal.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): AddERCNativePointerProposal { + const message = createBaseAddERCNativePointerProposal(); + message.title = object.title ?? ""; + message.description = object.description ?? ""; + message.token = object.token ?? ""; + message.pointer = object.pointer ?? ""; + message.version = object.version ?? 0; + return message; + }, +}; + +export const AddERCCW20PointerProposal: MessageFns = { + $type: "seiprotocol.seichain.evm.AddERCCW20PointerProposal" as const, + + encode(message: AddERCCW20PointerProposal, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.title !== "") { + writer.uint32(10).string(message.title); + } + if (message.description !== "") { + writer.uint32(18).string(message.description); + } + if (message.pointee !== "") { + writer.uint32(26).string(message.pointee); + } + if (message.pointer !== "") { + writer.uint32(34).string(message.pointer); + } + if (message.version !== 0) { + writer.uint32(40).uint32(message.version); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): AddERCCW20PointerProposal { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseAddERCCW20PointerProposal(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.title = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.description = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.pointee = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.pointer = reader.string(); + continue; + case 5: + if (tag !== 40) { + break; + } + + message.version = reader.uint32(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): AddERCCW20PointerProposal { + return { + title: isSet(object.title) ? globalThis.String(object.title) : "", + description: isSet(object.description) ? globalThis.String(object.description) : "", + pointee: isSet(object.pointee) ? globalThis.String(object.pointee) : "", + pointer: isSet(object.pointer) ? globalThis.String(object.pointer) : "", + version: isSet(object.version) ? globalThis.Number(object.version) : 0, + }; + }, + + toJSON(message: AddERCCW20PointerProposal): unknown { + const obj: any = {}; + if (message.title !== "") { + obj.title = message.title; + } + if (message.description !== "") { + obj.description = message.description; + } + if (message.pointee !== "") { + obj.pointee = message.pointee; + } + if (message.pointer !== "") { + obj.pointer = message.pointer; + } + if (message.version !== 0) { + obj.version = Math.round(message.version); + } + return obj; + }, + + create, I>>(base?: I): AddERCCW20PointerProposal { + return AddERCCW20PointerProposal.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): AddERCCW20PointerProposal { + const message = createBaseAddERCCW20PointerProposal(); + message.title = object.title ?? ""; + message.description = object.description ?? ""; + message.pointee = object.pointee ?? ""; + message.pointer = object.pointer ?? ""; + message.version = object.version ?? 0; + return message; + }, +}; + +export const AddERCCW721PointerProposal: MessageFns = { + $type: "seiprotocol.seichain.evm.AddERCCW721PointerProposal" as const, + + encode(message: AddERCCW721PointerProposal, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.title !== "") { + writer.uint32(10).string(message.title); + } + if (message.description !== "") { + writer.uint32(18).string(message.description); + } + if (message.pointee !== "") { + writer.uint32(26).string(message.pointee); + } + if (message.pointer !== "") { + writer.uint32(34).string(message.pointer); + } + if (message.version !== 0) { + writer.uint32(40).uint32(message.version); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): AddERCCW721PointerProposal { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseAddERCCW721PointerProposal(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.title = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.description = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.pointee = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.pointer = reader.string(); + continue; + case 5: + if (tag !== 40) { + break; + } + + message.version = reader.uint32(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): AddERCCW721PointerProposal { + return { + title: isSet(object.title) ? globalThis.String(object.title) : "", + description: isSet(object.description) ? globalThis.String(object.description) : "", + pointee: isSet(object.pointee) ? globalThis.String(object.pointee) : "", + pointer: isSet(object.pointer) ? globalThis.String(object.pointer) : "", + version: isSet(object.version) ? globalThis.Number(object.version) : 0, + }; + }, + + toJSON(message: AddERCCW721PointerProposal): unknown { + const obj: any = {}; + if (message.title !== "") { + obj.title = message.title; + } + if (message.description !== "") { + obj.description = message.description; + } + if (message.pointee !== "") { + obj.pointee = message.pointee; + } + if (message.pointer !== "") { + obj.pointer = message.pointer; + } + if (message.version !== 0) { + obj.version = Math.round(message.version); + } + return obj; + }, + + create, I>>(base?: I): AddERCCW721PointerProposal { + return AddERCCW721PointerProposal.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): AddERCCW721PointerProposal { + const message = createBaseAddERCCW721PointerProposal(); + message.title = object.title ?? ""; + message.description = object.description ?? ""; + message.pointee = object.pointee ?? ""; + message.pointer = object.pointer ?? ""; + message.version = object.version ?? 0; + return message; + }, +}; + +export const AddCWERC20PointerProposal: MessageFns = { + $type: "seiprotocol.seichain.evm.AddCWERC20PointerProposal" as const, + + encode(message: AddCWERC20PointerProposal, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.title !== "") { + writer.uint32(10).string(message.title); + } + if (message.description !== "") { + writer.uint32(18).string(message.description); + } + if (message.pointee !== "") { + writer.uint32(26).string(message.pointee); + } + if (message.pointer !== "") { + writer.uint32(34).string(message.pointer); + } + if (message.version !== 0) { + writer.uint32(40).uint32(message.version); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): AddCWERC20PointerProposal { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseAddCWERC20PointerProposal(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.title = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.description = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.pointee = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.pointer = reader.string(); + continue; + case 5: + if (tag !== 40) { + break; + } + + message.version = reader.uint32(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): AddCWERC20PointerProposal { + return { + title: isSet(object.title) ? globalThis.String(object.title) : "", + description: isSet(object.description) ? globalThis.String(object.description) : "", + pointee: isSet(object.pointee) ? globalThis.String(object.pointee) : "", + pointer: isSet(object.pointer) ? globalThis.String(object.pointer) : "", + version: isSet(object.version) ? globalThis.Number(object.version) : 0, + }; + }, + + toJSON(message: AddCWERC20PointerProposal): unknown { + const obj: any = {}; + if (message.title !== "") { + obj.title = message.title; + } + if (message.description !== "") { + obj.description = message.description; + } + if (message.pointee !== "") { + obj.pointee = message.pointee; + } + if (message.pointer !== "") { + obj.pointer = message.pointer; + } + if (message.version !== 0) { + obj.version = Math.round(message.version); + } + return obj; + }, + + create, I>>(base?: I): AddCWERC20PointerProposal { + return AddCWERC20PointerProposal.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): AddCWERC20PointerProposal { + const message = createBaseAddCWERC20PointerProposal(); + message.title = object.title ?? ""; + message.description = object.description ?? ""; + message.pointee = object.pointee ?? ""; + message.pointer = object.pointer ?? ""; + message.version = object.version ?? 0; + return message; + }, +}; + +export const AddCWERC721PointerProposal: MessageFns = { + $type: "seiprotocol.seichain.evm.AddCWERC721PointerProposal" as const, + + encode(message: AddCWERC721PointerProposal, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.title !== "") { + writer.uint32(10).string(message.title); + } + if (message.description !== "") { + writer.uint32(18).string(message.description); + } + if (message.pointee !== "") { + writer.uint32(26).string(message.pointee); + } + if (message.pointer !== "") { + writer.uint32(34).string(message.pointer); + } + if (message.version !== 0) { + writer.uint32(40).uint32(message.version); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): AddCWERC721PointerProposal { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseAddCWERC721PointerProposal(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.title = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.description = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.pointee = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.pointer = reader.string(); + continue; + case 5: + if (tag !== 40) { + break; + } + + message.version = reader.uint32(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): AddCWERC721PointerProposal { + return { + title: isSet(object.title) ? globalThis.String(object.title) : "", + description: isSet(object.description) ? globalThis.String(object.description) : "", + pointee: isSet(object.pointee) ? globalThis.String(object.pointee) : "", + pointer: isSet(object.pointer) ? globalThis.String(object.pointer) : "", + version: isSet(object.version) ? globalThis.Number(object.version) : 0, + }; + }, + + toJSON(message: AddCWERC721PointerProposal): unknown { + const obj: any = {}; + if (message.title !== "") { + obj.title = message.title; + } + if (message.description !== "") { + obj.description = message.description; + } + if (message.pointee !== "") { + obj.pointee = message.pointee; + } + if (message.pointer !== "") { + obj.pointer = message.pointer; + } + if (message.version !== 0) { + obj.version = Math.round(message.version); + } + return obj; + }, + + create, I>>(base?: I): AddCWERC721PointerProposal { + return AddCWERC721PointerProposal.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): AddCWERC721PointerProposal { + const message = createBaseAddCWERC721PointerProposal(); + message.title = object.title ?? ""; + message.description = object.description ?? ""; + message.pointee = object.pointee ?? ""; + message.pointer = object.pointer ?? ""; + message.version = object.version ?? 0; + return message; + }, +}; + +export const AddERCNativePointerProposalV2: MessageFns = { + $type: "seiprotocol.seichain.evm.AddERCNativePointerProposalV2" as const, + + encode(message: AddERCNativePointerProposalV2, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.title !== "") { + writer.uint32(10).string(message.title); + } + if (message.description !== "") { + writer.uint32(18).string(message.description); + } + if (message.token !== "") { + writer.uint32(26).string(message.token); + } + if (message.name !== "") { + writer.uint32(34).string(message.name); + } + if (message.symbol !== "") { + writer.uint32(42).string(message.symbol); + } + if (message.decimals !== 0) { + writer.uint32(48).uint32(message.decimals); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): AddERCNativePointerProposalV2 { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseAddERCNativePointerProposalV2(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.title = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.description = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.token = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.name = reader.string(); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.symbol = reader.string(); + continue; + case 6: + if (tag !== 48) { + break; + } + + message.decimals = reader.uint32(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): AddERCNativePointerProposalV2 { + return { + title: isSet(object.title) ? globalThis.String(object.title) : "", + description: isSet(object.description) ? globalThis.String(object.description) : "", + token: isSet(object.token) ? globalThis.String(object.token) : "", + name: isSet(object.name) ? globalThis.String(object.name) : "", + symbol: isSet(object.symbol) ? globalThis.String(object.symbol) : "", + decimals: isSet(object.decimals) ? globalThis.Number(object.decimals) : 0, + }; + }, + + toJSON(message: AddERCNativePointerProposalV2): unknown { + const obj: any = {}; + if (message.title !== "") { + obj.title = message.title; + } + if (message.description !== "") { + obj.description = message.description; + } + if (message.token !== "") { + obj.token = message.token; + } + if (message.name !== "") { + obj.name = message.name; + } + if (message.symbol !== "") { + obj.symbol = message.symbol; + } + if (message.decimals !== 0) { + obj.decimals = Math.round(message.decimals); + } + return obj; + }, + + create, I>>(base?: I): AddERCNativePointerProposalV2 { + return AddERCNativePointerProposalV2.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): AddERCNativePointerProposalV2 { + const message = createBaseAddERCNativePointerProposalV2(); + message.title = object.title ?? ""; + message.description = object.description ?? ""; + message.token = object.token ?? ""; + message.name = object.name ?? ""; + message.symbol = object.symbol ?? ""; + message.decimals = object.decimals ?? 0; + return message; + }, +}; + +function createBaseAddERCNativePointerProposal(): AddERCNativePointerProposal { + return { title: "", description: "", token: "", pointer: "", version: 0 }; +} + +function createBaseAddERCCW20PointerProposal(): AddERCCW20PointerProposal { + return { title: "", description: "", pointee: "", pointer: "", version: 0 }; +} + +function createBaseAddERCCW721PointerProposal(): AddERCCW721PointerProposal { + return { title: "", description: "", pointee: "", pointer: "", version: 0 }; +} + +function createBaseAddCWERC20PointerProposal(): AddCWERC20PointerProposal { + return { title: "", description: "", pointee: "", pointer: "", version: 0 }; +} + +function createBaseAddCWERC721PointerProposal(): AddCWERC721PointerProposal { + return { title: "", description: "", pointee: "", pointer: "", version: 0 }; +} + +function createBaseAddERCNativePointerProposalV2(): AddERCNativePointerProposalV2 { + return { title: "", description: "", token: "", name: "", symbol: "", decimals: 0 }; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} diff --git a/packages/cosmos/generated/encoding/evm/index.ts b/packages/cosmos/generated/encoding/evm/index.ts new file mode 100644 index 000000000..5a8252b19 --- /dev/null +++ b/packages/cosmos/generated/encoding/evm/index.ts @@ -0,0 +1,11 @@ +// @ts-nocheck + +export * from './config'; +export * from './enums'; +export * from './genesis'; +export * from './gov'; +export * from './params'; +export * from './query'; +export * from './receipt'; +export * from './tx'; +export * from './types'; \ No newline at end of file diff --git a/packages/cosmos/generated/encoding/evm/params.ts b/packages/cosmos/generated/encoding/evm/params.ts new file mode 100644 index 000000000..ff3624526 --- /dev/null +++ b/packages/cosmos/generated/encoding/evm/params.ts @@ -0,0 +1,377 @@ +import type { GeneratedType } from "@cosmjs/proto-signing"; + +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +import type { ParamsPreV580 as ParamsPreV580_type, Params as Params_type } from "../../types/evm"; + +import type { DeepPartial, Exact, MessageFns } from "../common"; + +export interface Params extends Params_type {} +export interface ParamsPreV580 extends ParamsPreV580_type {} + +export const Params: MessageFns = { + $type: "seiprotocol.seichain.evm.Params" as const, + + encode(message: Params, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.priority_normalizer !== "") { + writer.uint32(18).string(message.priority_normalizer); + } + if (message.base_fee_per_gas !== "") { + writer.uint32(26).string(message.base_fee_per_gas); + } + if (message.minimum_fee_per_gas !== "") { + writer.uint32(34).string(message.minimum_fee_per_gas); + } + for (const v of message.whitelisted_cw_code_hashes_for_delegate_call) { + writer.uint32(66).bytes(v!); + } + if (message.deliver_tx_hook_wasm_gas_limit !== 0) { + writer.uint32(72).uint64(message.deliver_tx_hook_wasm_gas_limit); + } + if (message.max_dynamic_base_fee_upward_adjustment !== "") { + writer.uint32(82).string(message.max_dynamic_base_fee_upward_adjustment); + } + if (message.max_dynamic_base_fee_downward_adjustment !== "") { + writer.uint32(90).string(message.max_dynamic_base_fee_downward_adjustment); + } + if (message.target_gas_used_per_block !== 0) { + writer.uint32(96).uint64(message.target_gas_used_per_block); + } + if (message.maximum_fee_per_gas !== "") { + writer.uint32(106).string(message.maximum_fee_per_gas); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Params { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 2: + if (tag !== 18) { + break; + } + + message.priority_normalizer = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.base_fee_per_gas = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.minimum_fee_per_gas = reader.string(); + continue; + case 8: + if (tag !== 66) { + break; + } + + message.whitelisted_cw_code_hashes_for_delegate_call.push(reader.bytes()); + continue; + case 9: + if (tag !== 72) { + break; + } + + message.deliver_tx_hook_wasm_gas_limit = longToNumber(reader.uint64()); + continue; + case 10: + if (tag !== 82) { + break; + } + + message.max_dynamic_base_fee_upward_adjustment = reader.string(); + continue; + case 11: + if (tag !== 90) { + break; + } + + message.max_dynamic_base_fee_downward_adjustment = reader.string(); + continue; + case 12: + if (tag !== 96) { + break; + } + + message.target_gas_used_per_block = longToNumber(reader.uint64()); + continue; + case 13: + if (tag !== 106) { + break; + } + + message.maximum_fee_per_gas = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Params { + return { + priority_normalizer: isSet(object.priority_normalizer) ? globalThis.String(object.priority_normalizer) : "", + base_fee_per_gas: isSet(object.base_fee_per_gas) ? globalThis.String(object.base_fee_per_gas) : "", + minimum_fee_per_gas: isSet(object.minimum_fee_per_gas) ? globalThis.String(object.minimum_fee_per_gas) : "", + whitelisted_cw_code_hashes_for_delegate_call: globalThis.Array.isArray(object?.whitelisted_cw_code_hashes_for_delegate_call) + ? object.whitelisted_cw_code_hashes_for_delegate_call.map((e: any) => bytesFromBase64(e)) + : [], + deliver_tx_hook_wasm_gas_limit: isSet(object.deliver_tx_hook_wasm_gas_limit) ? globalThis.Number(object.deliver_tx_hook_wasm_gas_limit) : 0, + max_dynamic_base_fee_upward_adjustment: isSet(object.max_dynamic_base_fee_upward_adjustment) + ? globalThis.String(object.max_dynamic_base_fee_upward_adjustment) + : "", + max_dynamic_base_fee_downward_adjustment: isSet(object.max_dynamic_base_fee_downward_adjustment) + ? globalThis.String(object.max_dynamic_base_fee_downward_adjustment) + : "", + target_gas_used_per_block: isSet(object.target_gas_used_per_block) ? globalThis.Number(object.target_gas_used_per_block) : 0, + maximum_fee_per_gas: isSet(object.maximum_fee_per_gas) ? globalThis.String(object.maximum_fee_per_gas) : "", + }; + }, + + toJSON(message: Params): unknown { + const obj: any = {}; + if (message.priority_normalizer !== "") { + obj.priority_normalizer = message.priority_normalizer; + } + if (message.base_fee_per_gas !== "") { + obj.base_fee_per_gas = message.base_fee_per_gas; + } + if (message.minimum_fee_per_gas !== "") { + obj.minimum_fee_per_gas = message.minimum_fee_per_gas; + } + if (message.whitelisted_cw_code_hashes_for_delegate_call?.length) { + obj.whitelisted_cw_code_hashes_for_delegate_call = message.whitelisted_cw_code_hashes_for_delegate_call.map((e) => base64FromBytes(e)); + } + if (message.deliver_tx_hook_wasm_gas_limit !== 0) { + obj.deliver_tx_hook_wasm_gas_limit = Math.round(message.deliver_tx_hook_wasm_gas_limit); + } + if (message.max_dynamic_base_fee_upward_adjustment !== "") { + obj.max_dynamic_base_fee_upward_adjustment = message.max_dynamic_base_fee_upward_adjustment; + } + if (message.max_dynamic_base_fee_downward_adjustment !== "") { + obj.max_dynamic_base_fee_downward_adjustment = message.max_dynamic_base_fee_downward_adjustment; + } + if (message.target_gas_used_per_block !== 0) { + obj.target_gas_used_per_block = Math.round(message.target_gas_used_per_block); + } + if (message.maximum_fee_per_gas !== "") { + obj.maximum_fee_per_gas = message.maximum_fee_per_gas; + } + return obj; + }, + + create, I>>(base?: I): Params { + return Params.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Params { + const message = createBaseParams(); + message.priority_normalizer = object.priority_normalizer ?? ""; + message.base_fee_per_gas = object.base_fee_per_gas ?? ""; + message.minimum_fee_per_gas = object.minimum_fee_per_gas ?? ""; + message.whitelisted_cw_code_hashes_for_delegate_call = object.whitelisted_cw_code_hashes_for_delegate_call?.map((e) => e) || []; + message.deliver_tx_hook_wasm_gas_limit = object.deliver_tx_hook_wasm_gas_limit ?? 0; + message.max_dynamic_base_fee_upward_adjustment = object.max_dynamic_base_fee_upward_adjustment ?? ""; + message.max_dynamic_base_fee_downward_adjustment = object.max_dynamic_base_fee_downward_adjustment ?? ""; + message.target_gas_used_per_block = object.target_gas_used_per_block ?? 0; + message.maximum_fee_per_gas = object.maximum_fee_per_gas ?? ""; + return message; + }, +}; + +export const ParamsPreV580: MessageFns = { + $type: "seiprotocol.seichain.evm.ParamsPreV580" as const, + + encode(message: ParamsPreV580, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.priority_normalizer !== "") { + writer.uint32(18).string(message.priority_normalizer); + } + if (message.base_fee_per_gas !== "") { + writer.uint32(26).string(message.base_fee_per_gas); + } + if (message.minimum_fee_per_gas !== "") { + writer.uint32(34).string(message.minimum_fee_per_gas); + } + for (const v of message.whitelisted_cw_code_hashes_for_delegate_call) { + writer.uint32(66).bytes(v!); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ParamsPreV580 { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseParamsPreV580(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 2: + if (tag !== 18) { + break; + } + + message.priority_normalizer = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.base_fee_per_gas = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.minimum_fee_per_gas = reader.string(); + continue; + case 8: + if (tag !== 66) { + break; + } + + message.whitelisted_cw_code_hashes_for_delegate_call.push(reader.bytes()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ParamsPreV580 { + return { + priority_normalizer: isSet(object.priority_normalizer) ? globalThis.String(object.priority_normalizer) : "", + base_fee_per_gas: isSet(object.base_fee_per_gas) ? globalThis.String(object.base_fee_per_gas) : "", + minimum_fee_per_gas: isSet(object.minimum_fee_per_gas) ? globalThis.String(object.minimum_fee_per_gas) : "", + whitelisted_cw_code_hashes_for_delegate_call: globalThis.Array.isArray(object?.whitelisted_cw_code_hashes_for_delegate_call) + ? object.whitelisted_cw_code_hashes_for_delegate_call.map((e: any) => bytesFromBase64(e)) + : [], + }; + }, + + toJSON(message: ParamsPreV580): unknown { + const obj: any = {}; + if (message.priority_normalizer !== "") { + obj.priority_normalizer = message.priority_normalizer; + } + if (message.base_fee_per_gas !== "") { + obj.base_fee_per_gas = message.base_fee_per_gas; + } + if (message.minimum_fee_per_gas !== "") { + obj.minimum_fee_per_gas = message.minimum_fee_per_gas; + } + if (message.whitelisted_cw_code_hashes_for_delegate_call?.length) { + obj.whitelisted_cw_code_hashes_for_delegate_call = message.whitelisted_cw_code_hashes_for_delegate_call.map((e) => base64FromBytes(e)); + } + return obj; + }, + + create, I>>(base?: I): ParamsPreV580 { + return ParamsPreV580.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ParamsPreV580 { + const message = createBaseParamsPreV580(); + message.priority_normalizer = object.priority_normalizer ?? ""; + message.base_fee_per_gas = object.base_fee_per_gas ?? ""; + message.minimum_fee_per_gas = object.minimum_fee_per_gas ?? ""; + message.whitelisted_cw_code_hashes_for_delegate_call = object.whitelisted_cw_code_hashes_for_delegate_call?.map((e) => e) || []; + return message; + }, +}; + +function createBaseParams(): Params { + return { + priority_normalizer: "", + base_fee_per_gas: "", + minimum_fee_per_gas: "", + whitelisted_cw_code_hashes_for_delegate_call: [], + deliver_tx_hook_wasm_gas_limit: 0, + max_dynamic_base_fee_upward_adjustment: "", + max_dynamic_base_fee_downward_adjustment: "", + target_gas_used_per_block: 0, + maximum_fee_per_gas: "", + }; +} + +function createBaseParamsPreV580(): ParamsPreV580 { + return { + priority_normalizer: "", + base_fee_per_gas: "", + minimum_fee_per_gas: "", + whitelisted_cw_code_hashes_for_delegate_call: [], + }; +} + +function bytesFromBase64(b64: string): Uint8Array { + if ((globalThis as any).Buffer) { + return Uint8Array.from(globalThis.Buffer.from(b64, "base64")); + } else { + const bin = globalThis.atob(b64); + const arr = new Uint8Array(bin.length); + for (let i = 0; i < bin.length; ++i) { + arr[i] = bin.charCodeAt(i); + } + return arr; + } +} + +function base64FromBytes(arr: Uint8Array): string { + if ((globalThis as any).Buffer) { + return globalThis.Buffer.from(arr).toString("base64"); + } else { + const bin: string[] = []; + arr.forEach((byte) => { + bin.push(globalThis.String.fromCharCode(byte)); + }); + return globalThis.btoa(bin.join("")); + } +} + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} +export const registry: Array<[string, GeneratedType]> = [ + ["/seiprotocol.seichain.evm.Params", Params as never], + ["/seiprotocol.seichain.evm.ParamsPreV580", ParamsPreV580 as never], +]; +export const aminoConverters = { + "/seiprotocol.seichain.evm.Params": { + aminoType: "evm/Params", + toAmino: (message: Params) => ({ ...message }), + fromAmino: (object: Params) => ({ ...object }), + }, + + "/seiprotocol.seichain.evm.ParamsPreV580": { + aminoType: "evm/ParamsPreV580", + toAmino: (message: ParamsPreV580) => ({ ...message }), + fromAmino: (object: ParamsPreV580) => ({ ...object }), + }, +}; diff --git a/packages/cosmos/generated/encoding/evm/query.ts b/packages/cosmos/generated/encoding/evm/query.ts new file mode 100644 index 000000000..9ef153250 --- /dev/null +++ b/packages/cosmos/generated/encoding/evm/query.ts @@ -0,0 +1,988 @@ +import type { GeneratedType } from "@cosmjs/proto-signing"; + +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +import { pointerTypeFromJSON, pointerTypeToJSON } from "./enums"; + +import type { + QueryEVMAddressBySeiAddressRequest as QueryEVMAddressBySeiAddressRequest_type, + QueryEVMAddressBySeiAddressResponse as QueryEVMAddressBySeiAddressResponse_type, + QueryPointeeRequest as QueryPointeeRequest_type, + QueryPointeeResponse as QueryPointeeResponse_type, + QueryPointerRequest as QueryPointerRequest_type, + QueryPointerResponse as QueryPointerResponse_type, + QueryPointerVersionRequest as QueryPointerVersionRequest_type, + QueryPointerVersionResponse as QueryPointerVersionResponse_type, + QuerySeiAddressByEVMAddressRequest as QuerySeiAddressByEVMAddressRequest_type, + QuerySeiAddressByEVMAddressResponse as QuerySeiAddressByEVMAddressResponse_type, + QueryStaticCallRequest as QueryStaticCallRequest_type, + QueryStaticCallResponse as QueryStaticCallResponse_type, +} from "../../types/evm"; + +import type { DeepPartial, Exact, MessageFns } from "../common"; + +export interface QuerySeiAddressByEVMAddressRequest extends QuerySeiAddressByEVMAddressRequest_type {} +export interface QuerySeiAddressByEVMAddressResponse extends QuerySeiAddressByEVMAddressResponse_type {} +export interface QueryEVMAddressBySeiAddressRequest extends QueryEVMAddressBySeiAddressRequest_type {} +export interface QueryEVMAddressBySeiAddressResponse extends QueryEVMAddressBySeiAddressResponse_type {} +export interface QueryStaticCallRequest extends QueryStaticCallRequest_type {} +export interface QueryStaticCallResponse extends QueryStaticCallResponse_type {} +export interface QueryPointerRequest extends QueryPointerRequest_type {} +export interface QueryPointerResponse extends QueryPointerResponse_type {} +export interface QueryPointerVersionRequest extends QueryPointerVersionRequest_type {} +export interface QueryPointerVersionResponse extends QueryPointerVersionResponse_type {} +export interface QueryPointeeRequest extends QueryPointeeRequest_type {} +export interface QueryPointeeResponse extends QueryPointeeResponse_type {} + +export const QuerySeiAddressByEVMAddressRequest: MessageFns = + { + $type: "seiprotocol.seichain.evm.QuerySeiAddressByEVMAddressRequest" as const, + + encode(message: QuerySeiAddressByEVMAddressRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.evm_address !== "") { + writer.uint32(10).string(message.evm_address); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QuerySeiAddressByEVMAddressRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQuerySeiAddressByEVMAddressRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.evm_address = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QuerySeiAddressByEVMAddressRequest { + return { evm_address: isSet(object.evm_address) ? globalThis.String(object.evm_address) : "" }; + }, + + toJSON(message: QuerySeiAddressByEVMAddressRequest): unknown { + const obj: any = {}; + if (message.evm_address !== "") { + obj.evm_address = message.evm_address; + } + return obj; + }, + + create, I>>(base?: I): QuerySeiAddressByEVMAddressRequest { + return QuerySeiAddressByEVMAddressRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QuerySeiAddressByEVMAddressRequest { + const message = createBaseQuerySeiAddressByEVMAddressRequest(); + message.evm_address = object.evm_address ?? ""; + return message; + }, + }; + +export const QuerySeiAddressByEVMAddressResponse: MessageFns< + QuerySeiAddressByEVMAddressResponse, + "seiprotocol.seichain.evm.QuerySeiAddressByEVMAddressResponse" +> = { + $type: "seiprotocol.seichain.evm.QuerySeiAddressByEVMAddressResponse" as const, + + encode(message: QuerySeiAddressByEVMAddressResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.sei_address !== "") { + writer.uint32(10).string(message.sei_address); + } + if (message.associated !== false) { + writer.uint32(16).bool(message.associated); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QuerySeiAddressByEVMAddressResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQuerySeiAddressByEVMAddressResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.sei_address = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.associated = reader.bool(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QuerySeiAddressByEVMAddressResponse { + return { + sei_address: isSet(object.sei_address) ? globalThis.String(object.sei_address) : "", + associated: isSet(object.associated) ? globalThis.Boolean(object.associated) : false, + }; + }, + + toJSON(message: QuerySeiAddressByEVMAddressResponse): unknown { + const obj: any = {}; + if (message.sei_address !== "") { + obj.sei_address = message.sei_address; + } + if (message.associated !== false) { + obj.associated = message.associated; + } + return obj; + }, + + create, I>>(base?: I): QuerySeiAddressByEVMAddressResponse { + return QuerySeiAddressByEVMAddressResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QuerySeiAddressByEVMAddressResponse { + const message = createBaseQuerySeiAddressByEVMAddressResponse(); + message.sei_address = object.sei_address ?? ""; + message.associated = object.associated ?? false; + return message; + }, +}; + +export const QueryEVMAddressBySeiAddressRequest: MessageFns = + { + $type: "seiprotocol.seichain.evm.QueryEVMAddressBySeiAddressRequest" as const, + + encode(message: QueryEVMAddressBySeiAddressRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.sei_address !== "") { + writer.uint32(10).string(message.sei_address); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryEVMAddressBySeiAddressRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryEVMAddressBySeiAddressRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.sei_address = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryEVMAddressBySeiAddressRequest { + return { sei_address: isSet(object.sei_address) ? globalThis.String(object.sei_address) : "" }; + }, + + toJSON(message: QueryEVMAddressBySeiAddressRequest): unknown { + const obj: any = {}; + if (message.sei_address !== "") { + obj.sei_address = message.sei_address; + } + return obj; + }, + + create, I>>(base?: I): QueryEVMAddressBySeiAddressRequest { + return QueryEVMAddressBySeiAddressRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryEVMAddressBySeiAddressRequest { + const message = createBaseQueryEVMAddressBySeiAddressRequest(); + message.sei_address = object.sei_address ?? ""; + return message; + }, + }; + +export const QueryEVMAddressBySeiAddressResponse: MessageFns< + QueryEVMAddressBySeiAddressResponse, + "seiprotocol.seichain.evm.QueryEVMAddressBySeiAddressResponse" +> = { + $type: "seiprotocol.seichain.evm.QueryEVMAddressBySeiAddressResponse" as const, + + encode(message: QueryEVMAddressBySeiAddressResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.evm_address !== "") { + writer.uint32(10).string(message.evm_address); + } + if (message.associated !== false) { + writer.uint32(16).bool(message.associated); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryEVMAddressBySeiAddressResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryEVMAddressBySeiAddressResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.evm_address = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.associated = reader.bool(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryEVMAddressBySeiAddressResponse { + return { + evm_address: isSet(object.evm_address) ? globalThis.String(object.evm_address) : "", + associated: isSet(object.associated) ? globalThis.Boolean(object.associated) : false, + }; + }, + + toJSON(message: QueryEVMAddressBySeiAddressResponse): unknown { + const obj: any = {}; + if (message.evm_address !== "") { + obj.evm_address = message.evm_address; + } + if (message.associated !== false) { + obj.associated = message.associated; + } + return obj; + }, + + create, I>>(base?: I): QueryEVMAddressBySeiAddressResponse { + return QueryEVMAddressBySeiAddressResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryEVMAddressBySeiAddressResponse { + const message = createBaseQueryEVMAddressBySeiAddressResponse(); + message.evm_address = object.evm_address ?? ""; + message.associated = object.associated ?? false; + return message; + }, +}; + +export const QueryStaticCallRequest: MessageFns = { + $type: "seiprotocol.seichain.evm.QueryStaticCallRequest" as const, + + encode(message: QueryStaticCallRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.data.length !== 0) { + writer.uint32(10).bytes(message.data); + } + if (message.to !== "") { + writer.uint32(18).string(message.to); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryStaticCallRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryStaticCallRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.data = reader.bytes(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.to = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryStaticCallRequest { + return { + data: isSet(object.data) ? bytesFromBase64(object.data) : new Uint8Array(0), + to: isSet(object.to) ? globalThis.String(object.to) : "", + }; + }, + + toJSON(message: QueryStaticCallRequest): unknown { + const obj: any = {}; + if (message.data.length !== 0) { + obj.data = base64FromBytes(message.data); + } + if (message.to !== "") { + obj.to = message.to; + } + return obj; + }, + + create, I>>(base?: I): QueryStaticCallRequest { + return QueryStaticCallRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryStaticCallRequest { + const message = createBaseQueryStaticCallRequest(); + message.data = object.data ?? new Uint8Array(0); + message.to = object.to ?? ""; + return message; + }, +}; + +export const QueryStaticCallResponse: MessageFns = { + $type: "seiprotocol.seichain.evm.QueryStaticCallResponse" as const, + + encode(message: QueryStaticCallResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.data.length !== 0) { + writer.uint32(10).bytes(message.data); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryStaticCallResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryStaticCallResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.data = reader.bytes(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryStaticCallResponse { + return { data: isSet(object.data) ? bytesFromBase64(object.data) : new Uint8Array(0) }; + }, + + toJSON(message: QueryStaticCallResponse): unknown { + const obj: any = {}; + if (message.data.length !== 0) { + obj.data = base64FromBytes(message.data); + } + return obj; + }, + + create, I>>(base?: I): QueryStaticCallResponse { + return QueryStaticCallResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryStaticCallResponse { + const message = createBaseQueryStaticCallResponse(); + message.data = object.data ?? new Uint8Array(0); + return message; + }, +}; + +export const QueryPointerRequest: MessageFns = { + $type: "seiprotocol.seichain.evm.QueryPointerRequest" as const, + + encode(message: QueryPointerRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.pointer_type !== 0) { + writer.uint32(8).int32(message.pointer_type); + } + if (message.pointee !== "") { + writer.uint32(18).string(message.pointee); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryPointerRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryPointerRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.pointer_type = reader.int32() as any; + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pointee = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryPointerRequest { + return { + pointer_type: isSet(object.pointer_type) ? pointerTypeFromJSON(object.pointer_type) : 0, + pointee: isSet(object.pointee) ? globalThis.String(object.pointee) : "", + }; + }, + + toJSON(message: QueryPointerRequest): unknown { + const obj: any = {}; + if (message.pointer_type !== 0) { + obj.pointer_type = pointerTypeToJSON(message.pointer_type); + } + if (message.pointee !== "") { + obj.pointee = message.pointee; + } + return obj; + }, + + create, I>>(base?: I): QueryPointerRequest { + return QueryPointerRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryPointerRequest { + const message = createBaseQueryPointerRequest(); + message.pointer_type = object.pointer_type ?? 0; + message.pointee = object.pointee ?? ""; + return message; + }, +}; + +export const QueryPointerResponse: MessageFns = { + $type: "seiprotocol.seichain.evm.QueryPointerResponse" as const, + + encode(message: QueryPointerResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.pointer !== "") { + writer.uint32(10).string(message.pointer); + } + if (message.version !== 0) { + writer.uint32(16).uint32(message.version); + } + if (message.exists !== false) { + writer.uint32(24).bool(message.exists); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryPointerResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryPointerResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.pointer = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.version = reader.uint32(); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.exists = reader.bool(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryPointerResponse { + return { + pointer: isSet(object.pointer) ? globalThis.String(object.pointer) : "", + version: isSet(object.version) ? globalThis.Number(object.version) : 0, + exists: isSet(object.exists) ? globalThis.Boolean(object.exists) : false, + }; + }, + + toJSON(message: QueryPointerResponse): unknown { + const obj: any = {}; + if (message.pointer !== "") { + obj.pointer = message.pointer; + } + if (message.version !== 0) { + obj.version = Math.round(message.version); + } + if (message.exists !== false) { + obj.exists = message.exists; + } + return obj; + }, + + create, I>>(base?: I): QueryPointerResponse { + return QueryPointerResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryPointerResponse { + const message = createBaseQueryPointerResponse(); + message.pointer = object.pointer ?? ""; + message.version = object.version ?? 0; + message.exists = object.exists ?? false; + return message; + }, +}; + +export const QueryPointerVersionRequest: MessageFns = { + $type: "seiprotocol.seichain.evm.QueryPointerVersionRequest" as const, + + encode(message: QueryPointerVersionRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.pointer_type !== 0) { + writer.uint32(8).int32(message.pointer_type); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryPointerVersionRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryPointerVersionRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.pointer_type = reader.int32() as any; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryPointerVersionRequest { + return { pointer_type: isSet(object.pointer_type) ? pointerTypeFromJSON(object.pointer_type) : 0 }; + }, + + toJSON(message: QueryPointerVersionRequest): unknown { + const obj: any = {}; + if (message.pointer_type !== 0) { + obj.pointer_type = pointerTypeToJSON(message.pointer_type); + } + return obj; + }, + + create, I>>(base?: I): QueryPointerVersionRequest { + return QueryPointerVersionRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryPointerVersionRequest { + const message = createBaseQueryPointerVersionRequest(); + message.pointer_type = object.pointer_type ?? 0; + return message; + }, +}; + +export const QueryPointerVersionResponse: MessageFns = { + $type: "seiprotocol.seichain.evm.QueryPointerVersionResponse" as const, + + encode(message: QueryPointerVersionResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.version !== 0) { + writer.uint32(8).uint32(message.version); + } + if (message.cw_code_id !== 0) { + writer.uint32(16).uint64(message.cw_code_id); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryPointerVersionResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryPointerVersionResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.version = reader.uint32(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.cw_code_id = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryPointerVersionResponse { + return { + version: isSet(object.version) ? globalThis.Number(object.version) : 0, + cw_code_id: isSet(object.cw_code_id) ? globalThis.Number(object.cw_code_id) : 0, + }; + }, + + toJSON(message: QueryPointerVersionResponse): unknown { + const obj: any = {}; + if (message.version !== 0) { + obj.version = Math.round(message.version); + } + if (message.cw_code_id !== 0) { + obj.cw_code_id = Math.round(message.cw_code_id); + } + return obj; + }, + + create, I>>(base?: I): QueryPointerVersionResponse { + return QueryPointerVersionResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryPointerVersionResponse { + const message = createBaseQueryPointerVersionResponse(); + message.version = object.version ?? 0; + message.cw_code_id = object.cw_code_id ?? 0; + return message; + }, +}; + +export const QueryPointeeRequest: MessageFns = { + $type: "seiprotocol.seichain.evm.QueryPointeeRequest" as const, + + encode(message: QueryPointeeRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.pointer_type !== 0) { + writer.uint32(8).int32(message.pointer_type); + } + if (message.pointer !== "") { + writer.uint32(18).string(message.pointer); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryPointeeRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryPointeeRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.pointer_type = reader.int32() as any; + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pointer = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryPointeeRequest { + return { + pointer_type: isSet(object.pointer_type) ? pointerTypeFromJSON(object.pointer_type) : 0, + pointer: isSet(object.pointer) ? globalThis.String(object.pointer) : "", + }; + }, + + toJSON(message: QueryPointeeRequest): unknown { + const obj: any = {}; + if (message.pointer_type !== 0) { + obj.pointer_type = pointerTypeToJSON(message.pointer_type); + } + if (message.pointer !== "") { + obj.pointer = message.pointer; + } + return obj; + }, + + create, I>>(base?: I): QueryPointeeRequest { + return QueryPointeeRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryPointeeRequest { + const message = createBaseQueryPointeeRequest(); + message.pointer_type = object.pointer_type ?? 0; + message.pointer = object.pointer ?? ""; + return message; + }, +}; + +export const QueryPointeeResponse: MessageFns = { + $type: "seiprotocol.seichain.evm.QueryPointeeResponse" as const, + + encode(message: QueryPointeeResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.pointee !== "") { + writer.uint32(10).string(message.pointee); + } + if (message.version !== 0) { + writer.uint32(16).uint32(message.version); + } + if (message.exists !== false) { + writer.uint32(24).bool(message.exists); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryPointeeResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryPointeeResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.pointee = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.version = reader.uint32(); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.exists = reader.bool(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryPointeeResponse { + return { + pointee: isSet(object.pointee) ? globalThis.String(object.pointee) : "", + version: isSet(object.version) ? globalThis.Number(object.version) : 0, + exists: isSet(object.exists) ? globalThis.Boolean(object.exists) : false, + }; + }, + + toJSON(message: QueryPointeeResponse): unknown { + const obj: any = {}; + if (message.pointee !== "") { + obj.pointee = message.pointee; + } + if (message.version !== 0) { + obj.version = Math.round(message.version); + } + if (message.exists !== false) { + obj.exists = message.exists; + } + return obj; + }, + + create, I>>(base?: I): QueryPointeeResponse { + return QueryPointeeResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryPointeeResponse { + const message = createBaseQueryPointeeResponse(); + message.pointee = object.pointee ?? ""; + message.version = object.version ?? 0; + message.exists = object.exists ?? false; + return message; + }, +}; + +function createBaseQuerySeiAddressByEVMAddressRequest(): QuerySeiAddressByEVMAddressRequest { + return { evm_address: "" }; +} + +function createBaseQuerySeiAddressByEVMAddressResponse(): QuerySeiAddressByEVMAddressResponse { + return { sei_address: "", associated: false }; +} + +function createBaseQueryEVMAddressBySeiAddressRequest(): QueryEVMAddressBySeiAddressRequest { + return { sei_address: "" }; +} + +function createBaseQueryEVMAddressBySeiAddressResponse(): QueryEVMAddressBySeiAddressResponse { + return { evm_address: "", associated: false }; +} + +function createBaseQueryStaticCallRequest(): QueryStaticCallRequest { + return { data: new Uint8Array(0), to: "" }; +} + +function createBaseQueryStaticCallResponse(): QueryStaticCallResponse { + return { data: new Uint8Array(0) }; +} + +function createBaseQueryPointerRequest(): QueryPointerRequest { + return { pointer_type: 0, pointee: "" }; +} + +function createBaseQueryPointerResponse(): QueryPointerResponse { + return { pointer: "", version: 0, exists: false }; +} + +function createBaseQueryPointerVersionRequest(): QueryPointerVersionRequest { + return { pointer_type: 0 }; +} + +function createBaseQueryPointerVersionResponse(): QueryPointerVersionResponse { + return { version: 0, cw_code_id: 0 }; +} + +function createBaseQueryPointeeRequest(): QueryPointeeRequest { + return { pointer_type: 0, pointer: "" }; +} + +function createBaseQueryPointeeResponse(): QueryPointeeResponse { + return { pointee: "", version: 0, exists: false }; +} + +function bytesFromBase64(b64: string): Uint8Array { + if ((globalThis as any).Buffer) { + return Uint8Array.from(globalThis.Buffer.from(b64, "base64")); + } else { + const bin = globalThis.atob(b64); + const arr = new Uint8Array(bin.length); + for (let i = 0; i < bin.length; ++i) { + arr[i] = bin.charCodeAt(i); + } + return arr; + } +} + +function base64FromBytes(arr: Uint8Array): string { + if ((globalThis as any).Buffer) { + return globalThis.Buffer.from(arr).toString("base64"); + } else { + const bin: string[] = []; + arr.forEach((byte) => { + bin.push(globalThis.String.fromCharCode(byte)); + }); + return globalThis.btoa(bin.join("")); + } +} + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} +export const registry: Array<[string, GeneratedType]> = [ + ["/seiprotocol.seichain.evm.QueryPointerRequest", QueryPointerRequest as never], + ["/seiprotocol.seichain.evm.QueryPointerResponse", QueryPointerResponse as never], + ["/seiprotocol.seichain.evm.QueryPointeeRequest", QueryPointeeRequest as never], + ["/seiprotocol.seichain.evm.QueryPointeeResponse", QueryPointeeResponse as never], +]; +export const aminoConverters = { + "/seiprotocol.seichain.evm.QueryPointerRequest": { + aminoType: "evm/QueryPointerRequest", + toAmino: (message: QueryPointerRequest) => ({ ...message }), + fromAmino: (object: QueryPointerRequest) => ({ ...object }), + }, + + "/seiprotocol.seichain.evm.QueryPointerResponse": { + aminoType: "evm/QueryPointerResponse", + toAmino: (message: QueryPointerResponse) => ({ ...message }), + fromAmino: (object: QueryPointerResponse) => ({ ...object }), + }, + + "/seiprotocol.seichain.evm.QueryPointeeRequest": { + aminoType: "evm/QueryPointeeRequest", + toAmino: (message: QueryPointeeRequest) => ({ ...message }), + fromAmino: (object: QueryPointeeRequest) => ({ ...object }), + }, + + "/seiprotocol.seichain.evm.QueryPointeeResponse": { + aminoType: "evm/QueryPointeeResponse", + toAmino: (message: QueryPointeeResponse) => ({ ...message }), + fromAmino: (object: QueryPointeeResponse) => ({ ...object }), + }, +}; diff --git a/packages/cosmos/generated/encoding/evm/receipt.ts b/packages/cosmos/generated/encoding/evm/receipt.ts new file mode 100644 index 000000000..79dfae626 --- /dev/null +++ b/packages/cosmos/generated/encoding/evm/receipt.ts @@ -0,0 +1,459 @@ +import type { GeneratedType } from "@cosmjs/proto-signing"; + +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +import type { Log as Log_type, Receipt as Receipt_type } from "../../types/evm"; + +import type { DeepPartial, Exact, MessageFns } from "../common"; + +export interface Log extends Log_type {} +export interface Receipt extends Receipt_type {} + +export const Log: MessageFns = { + $type: "seiprotocol.seichain.evm.Log" as const, + + encode(message: Log, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.address !== "") { + writer.uint32(10).string(message.address); + } + for (const v of message.topics) { + writer.uint32(18).string(v!); + } + if (message.data.length !== 0) { + writer.uint32(26).bytes(message.data); + } + if (message.index !== 0) { + writer.uint32(32).uint32(message.index); + } + if (message.synthetic !== false) { + writer.uint32(40).bool(message.synthetic); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Log { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseLog(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.address = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.topics.push(reader.string()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.data = reader.bytes(); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.index = reader.uint32(); + continue; + case 5: + if (tag !== 40) { + break; + } + + message.synthetic = reader.bool(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Log { + return { + address: isSet(object.address) ? globalThis.String(object.address) : "", + topics: globalThis.Array.isArray(object?.topics) ? object.topics.map((e: any) => globalThis.String(e)) : [], + data: isSet(object.data) ? bytesFromBase64(object.data) : new Uint8Array(0), + index: isSet(object.index) ? globalThis.Number(object.index) : 0, + synthetic: isSet(object.synthetic) ? globalThis.Boolean(object.synthetic) : false, + }; + }, + + toJSON(message: Log): unknown { + const obj: any = {}; + if (message.address !== "") { + obj.address = message.address; + } + if (message.topics?.length) { + obj.topics = message.topics; + } + if (message.data.length !== 0) { + obj.data = base64FromBytes(message.data); + } + if (message.index !== 0) { + obj.index = Math.round(message.index); + } + if (message.synthetic !== false) { + obj.synthetic = message.synthetic; + } + return obj; + }, + + create, I>>(base?: I): Log { + return Log.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Log { + const message = createBaseLog(); + message.address = object.address ?? ""; + message.topics = object.topics?.map((e) => e) || []; + message.data = object.data ?? new Uint8Array(0); + message.index = object.index ?? 0; + message.synthetic = object.synthetic ?? false; + return message; + }, +}; + +export const Receipt: MessageFns = { + $type: "seiprotocol.seichain.evm.Receipt" as const, + + encode(message: Receipt, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.tx_type !== 0) { + writer.uint32(8).uint32(message.tx_type); + } + if (message.cumulative_gas_used !== 0) { + writer.uint32(16).uint64(message.cumulative_gas_used); + } + if (message.contract_address !== "") { + writer.uint32(26).string(message.contract_address); + } + if (message.tx_hash_hex !== "") { + writer.uint32(34).string(message.tx_hash_hex); + } + if (message.gas_used !== 0) { + writer.uint32(40).uint64(message.gas_used); + } + if (message.effective_gas_price !== 0) { + writer.uint32(48).uint64(message.effective_gas_price); + } + if (message.block_number !== 0) { + writer.uint32(56).uint64(message.block_number); + } + if (message.transaction_index !== 0) { + writer.uint32(64).uint32(message.transaction_index); + } + if (message.status !== 0) { + writer.uint32(72).uint32(message.status); + } + if (message.from !== "") { + writer.uint32(82).string(message.from); + } + if (message.to !== "") { + writer.uint32(90).string(message.to); + } + if (message.vm_error !== "") { + writer.uint32(98).string(message.vm_error); + } + for (const v of message.logs) { + Log.encode(v!, writer.uint32(106).fork()).join(); + } + if (message.logsBloom.length !== 0) { + writer.uint32(114).bytes(message.logsBloom); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Receipt { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseReceipt(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.tx_type = reader.uint32(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.cumulative_gas_used = longToNumber(reader.uint64()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.contract_address = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.tx_hash_hex = reader.string(); + continue; + case 5: + if (tag !== 40) { + break; + } + + message.gas_used = longToNumber(reader.uint64()); + continue; + case 6: + if (tag !== 48) { + break; + } + + message.effective_gas_price = longToNumber(reader.uint64()); + continue; + case 7: + if (tag !== 56) { + break; + } + + message.block_number = longToNumber(reader.uint64()); + continue; + case 8: + if (tag !== 64) { + break; + } + + message.transaction_index = reader.uint32(); + continue; + case 9: + if (tag !== 72) { + break; + } + + message.status = reader.uint32(); + continue; + case 10: + if (tag !== 82) { + break; + } + + message.from = reader.string(); + continue; + case 11: + if (tag !== 90) { + break; + } + + message.to = reader.string(); + continue; + case 12: + if (tag !== 98) { + break; + } + + message.vm_error = reader.string(); + continue; + case 13: + if (tag !== 106) { + break; + } + + message.logs.push(Log.decode(reader, reader.uint32())); + continue; + case 14: + if (tag !== 114) { + break; + } + + message.logsBloom = reader.bytes(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Receipt { + return { + tx_type: isSet(object.tx_type) ? globalThis.Number(object.tx_type) : 0, + cumulative_gas_used: isSet(object.cumulative_gas_used) ? globalThis.Number(object.cumulative_gas_used) : 0, + contract_address: isSet(object.contract_address) ? globalThis.String(object.contract_address) : "", + tx_hash_hex: isSet(object.tx_hash_hex) ? globalThis.String(object.tx_hash_hex) : "", + gas_used: isSet(object.gas_used) ? globalThis.Number(object.gas_used) : 0, + effective_gas_price: isSet(object.effective_gas_price) ? globalThis.Number(object.effective_gas_price) : 0, + block_number: isSet(object.block_number) ? globalThis.Number(object.block_number) : 0, + transaction_index: isSet(object.transaction_index) ? globalThis.Number(object.transaction_index) : 0, + status: isSet(object.status) ? globalThis.Number(object.status) : 0, + from: isSet(object.from) ? globalThis.String(object.from) : "", + to: isSet(object.to) ? globalThis.String(object.to) : "", + vm_error: isSet(object.vm_error) ? globalThis.String(object.vm_error) : "", + logs: globalThis.Array.isArray(object?.logs) ? object.logs.map((e: any) => Log.fromJSON(e)) : [], + logsBloom: isSet(object.logsBloom) ? bytesFromBase64(object.logsBloom) : new Uint8Array(0), + }; + }, + + toJSON(message: Receipt): unknown { + const obj: any = {}; + if (message.tx_type !== 0) { + obj.tx_type = Math.round(message.tx_type); + } + if (message.cumulative_gas_used !== 0) { + obj.cumulative_gas_used = Math.round(message.cumulative_gas_used); + } + if (message.contract_address !== "") { + obj.contract_address = message.contract_address; + } + if (message.tx_hash_hex !== "") { + obj.tx_hash_hex = message.tx_hash_hex; + } + if (message.gas_used !== 0) { + obj.gas_used = Math.round(message.gas_used); + } + if (message.effective_gas_price !== 0) { + obj.effective_gas_price = Math.round(message.effective_gas_price); + } + if (message.block_number !== 0) { + obj.block_number = Math.round(message.block_number); + } + if (message.transaction_index !== 0) { + obj.transaction_index = Math.round(message.transaction_index); + } + if (message.status !== 0) { + obj.status = Math.round(message.status); + } + if (message.from !== "") { + obj.from = message.from; + } + if (message.to !== "") { + obj.to = message.to; + } + if (message.vm_error !== "") { + obj.vm_error = message.vm_error; + } + if (message.logs?.length) { + obj.logs = message.logs.map((e) => Log.toJSON(e)); + } + if (message.logsBloom.length !== 0) { + obj.logsBloom = base64FromBytes(message.logsBloom); + } + return obj; + }, + + create, I>>(base?: I): Receipt { + return Receipt.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Receipt { + const message = createBaseReceipt(); + message.tx_type = object.tx_type ?? 0; + message.cumulative_gas_used = object.cumulative_gas_used ?? 0; + message.contract_address = object.contract_address ?? ""; + message.tx_hash_hex = object.tx_hash_hex ?? ""; + message.gas_used = object.gas_used ?? 0; + message.effective_gas_price = object.effective_gas_price ?? 0; + message.block_number = object.block_number ?? 0; + message.transaction_index = object.transaction_index ?? 0; + message.status = object.status ?? 0; + message.from = object.from ?? ""; + message.to = object.to ?? ""; + message.vm_error = object.vm_error ?? ""; + message.logs = object.logs?.map((e) => Log.fromPartial(e)) || []; + message.logsBloom = object.logsBloom ?? new Uint8Array(0); + return message; + }, +}; + +function createBaseLog(): Log { + return { address: "", topics: [], data: new Uint8Array(0), index: 0, synthetic: false }; +} + +function createBaseReceipt(): Receipt { + return { + tx_type: 0, + cumulative_gas_used: 0, + contract_address: "", + tx_hash_hex: "", + gas_used: 0, + effective_gas_price: 0, + block_number: 0, + transaction_index: 0, + status: 0, + from: "", + to: "", + vm_error: "", + logs: [], + logsBloom: new Uint8Array(0), + }; +} + +function bytesFromBase64(b64: string): Uint8Array { + if ((globalThis as any).Buffer) { + return Uint8Array.from(globalThis.Buffer.from(b64, "base64")); + } else { + const bin = globalThis.atob(b64); + const arr = new Uint8Array(bin.length); + for (let i = 0; i < bin.length; ++i) { + arr[i] = bin.charCodeAt(i); + } + return arr; + } +} + +function base64FromBytes(arr: Uint8Array): string { + if ((globalThis as any).Buffer) { + return globalThis.Buffer.from(arr).toString("base64"); + } else { + const bin: string[] = []; + arr.forEach((byte) => { + bin.push(globalThis.String.fromCharCode(byte)); + }); + return globalThis.btoa(bin.join("")); + } +} + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} +export const registry: Array<[string, GeneratedType]> = [ + ["/seiprotocol.seichain.evm.Log", Log as never], + ["/seiprotocol.seichain.evm.Receipt", Receipt as never], +]; +export const aminoConverters = { + "/seiprotocol.seichain.evm.Log": { + aminoType: "evm/Log", + toAmino: (message: Log) => ({ ...message }), + fromAmino: (object: Log) => ({ ...object }), + }, + + "/seiprotocol.seichain.evm.Receipt": { + aminoType: "evm/Receipt", + toAmino: (message: Receipt) => ({ ...message }), + fromAmino: (object: Receipt) => ({ ...object }), + }, +}; diff --git a/packages/cosmos/generated/encoding/evm/tx.ts b/packages/cosmos/generated/encoding/evm/tx.ts new file mode 100644 index 000000000..6e5b4b8f4 --- /dev/null +++ b/packages/cosmos/generated/encoding/evm/tx.ts @@ -0,0 +1,1183 @@ +import type { GeneratedType } from "@cosmjs/proto-signing"; + +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +import { Coin } from "../cosmos/base/v1beta1/coin"; + +import { Any } from "../google/protobuf/any"; + +import { pointerTypeFromJSON, pointerTypeToJSON } from "./enums"; + +import { Log } from "./receipt"; + +import type { + MsgAssociateContractAddressResponse as MsgAssociateContractAddressResponse_type, + MsgAssociateContractAddress as MsgAssociateContractAddress_type, + MsgAssociateResponse as MsgAssociateResponse_type, + MsgAssociate as MsgAssociate_type, + MsgEVMTransactionResponse as MsgEVMTransactionResponse_type, + MsgEVMTransaction as MsgEVMTransaction_type, + MsgInternalEVMCallResponse as MsgInternalEVMCallResponse_type, + MsgInternalEVMCall as MsgInternalEVMCall_type, + MsgInternalEVMDelegateCallResponse as MsgInternalEVMDelegateCallResponse_type, + MsgInternalEVMDelegateCall as MsgInternalEVMDelegateCall_type, + MsgRegisterPointerResponse as MsgRegisterPointerResponse_type, + MsgRegisterPointer as MsgRegisterPointer_type, + MsgSendResponse as MsgSendResponse_type, + MsgSend as MsgSend_type, +} from "../../types/evm"; + +import type { DeepPartial, Exact, MessageFns } from "../common"; + +export interface MsgEVMTransaction extends MsgEVMTransaction_type {} +export interface MsgEVMTransactionResponse extends MsgEVMTransactionResponse_type {} +export interface MsgInternalEVMCall extends MsgInternalEVMCall_type {} +export interface MsgInternalEVMCallResponse extends MsgInternalEVMCallResponse_type {} +export interface MsgInternalEVMDelegateCall extends MsgInternalEVMDelegateCall_type {} +export interface MsgInternalEVMDelegateCallResponse extends MsgInternalEVMDelegateCallResponse_type {} +export interface MsgSend extends MsgSend_type {} +export interface MsgSendResponse extends MsgSendResponse_type {} +export interface MsgRegisterPointer extends MsgRegisterPointer_type {} +export interface MsgRegisterPointerResponse extends MsgRegisterPointerResponse_type {} +export interface MsgAssociateContractAddress extends MsgAssociateContractAddress_type {} +export interface MsgAssociateContractAddressResponse extends MsgAssociateContractAddressResponse_type {} +export interface MsgAssociate extends MsgAssociate_type {} +export interface MsgAssociateResponse extends MsgAssociateResponse_type {} + +export const MsgEVMTransaction: MessageFns = { + $type: "seiprotocol.seichain.evm.MsgEVMTransaction" as const, + + encode(message: MsgEVMTransaction, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.data !== undefined) { + Any.encode(message.data, writer.uint32(10).fork()).join(); + } + if (message.derived.length !== 0) { + writer.uint32(18).bytes(message.derived); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgEVMTransaction { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgEVMTransaction(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.data = Any.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.derived = reader.bytes(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgEVMTransaction { + return { + data: isSet(object.data) ? Any.fromJSON(object.data) : undefined, + derived: isSet(object.derived) ? bytesFromBase64(object.derived) : new Uint8Array(0), + }; + }, + + toJSON(message: MsgEVMTransaction): unknown { + const obj: any = {}; + if (message.data !== undefined) { + obj.data = Any.toJSON(message.data); + } + if (message.derived.length !== 0) { + obj.derived = base64FromBytes(message.derived); + } + return obj; + }, + + create, I>>(base?: I): MsgEVMTransaction { + return MsgEVMTransaction.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgEVMTransaction { + const message = createBaseMsgEVMTransaction(); + message.data = object.data !== undefined && object.data !== null ? Any.fromPartial(object.data) : undefined; + message.derived = object.derived ?? new Uint8Array(0); + return message; + }, +}; + +export const MsgEVMTransactionResponse: MessageFns = { + $type: "seiprotocol.seichain.evm.MsgEVMTransactionResponse" as const, + + encode(message: MsgEVMTransactionResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.gas_used !== 0) { + writer.uint32(8).uint64(message.gas_used); + } + if (message.vm_error !== "") { + writer.uint32(18).string(message.vm_error); + } + if (message.return_data.length !== 0) { + writer.uint32(26).bytes(message.return_data); + } + if (message.hash !== "") { + writer.uint32(34).string(message.hash); + } + for (const v of message.logs) { + Log.encode(v!, writer.uint32(42).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgEVMTransactionResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgEVMTransactionResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.gas_used = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.vm_error = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.return_data = reader.bytes(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.hash = reader.string(); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.logs.push(Log.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgEVMTransactionResponse { + return { + gas_used: isSet(object.gas_used) ? globalThis.Number(object.gas_used) : 0, + vm_error: isSet(object.vm_error) ? globalThis.String(object.vm_error) : "", + return_data: isSet(object.return_data) ? bytesFromBase64(object.return_data) : new Uint8Array(0), + hash: isSet(object.hash) ? globalThis.String(object.hash) : "", + logs: globalThis.Array.isArray(object?.logs) ? object.logs.map((e: any) => Log.fromJSON(e)) : [], + }; + }, + + toJSON(message: MsgEVMTransactionResponse): unknown { + const obj: any = {}; + if (message.gas_used !== 0) { + obj.gas_used = Math.round(message.gas_used); + } + if (message.vm_error !== "") { + obj.vm_error = message.vm_error; + } + if (message.return_data.length !== 0) { + obj.return_data = base64FromBytes(message.return_data); + } + if (message.hash !== "") { + obj.hash = message.hash; + } + if (message.logs?.length) { + obj.logs = message.logs.map((e) => Log.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): MsgEVMTransactionResponse { + return MsgEVMTransactionResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgEVMTransactionResponse { + const message = createBaseMsgEVMTransactionResponse(); + message.gas_used = object.gas_used ?? 0; + message.vm_error = object.vm_error ?? ""; + message.return_data = object.return_data ?? new Uint8Array(0); + message.hash = object.hash ?? ""; + message.logs = object.logs?.map((e) => Log.fromPartial(e)) || []; + return message; + }, +}; + +export const MsgInternalEVMCall: MessageFns = { + $type: "seiprotocol.seichain.evm.MsgInternalEVMCall" as const, + + encode(message: MsgInternalEVMCall, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.sender !== "") { + writer.uint32(10).string(message.sender); + } + if (message.value !== "") { + writer.uint32(18).string(message.value); + } + if (message.to !== "") { + writer.uint32(26).string(message.to); + } + if (message.data.length !== 0) { + writer.uint32(34).bytes(message.data); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgInternalEVMCall { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgInternalEVMCall(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.sender = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.value = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.to = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.data = reader.bytes(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgInternalEVMCall { + return { + sender: isSet(object.sender) ? globalThis.String(object.sender) : "", + value: isSet(object.value) ? globalThis.String(object.value) : "", + to: isSet(object.to) ? globalThis.String(object.to) : "", + data: isSet(object.data) ? bytesFromBase64(object.data) : new Uint8Array(0), + }; + }, + + toJSON(message: MsgInternalEVMCall): unknown { + const obj: any = {}; + if (message.sender !== "") { + obj.sender = message.sender; + } + if (message.value !== "") { + obj.value = message.value; + } + if (message.to !== "") { + obj.to = message.to; + } + if (message.data.length !== 0) { + obj.data = base64FromBytes(message.data); + } + return obj; + }, + + create, I>>(base?: I): MsgInternalEVMCall { + return MsgInternalEVMCall.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgInternalEVMCall { + const message = createBaseMsgInternalEVMCall(); + message.sender = object.sender ?? ""; + message.value = object.value ?? ""; + message.to = object.to ?? ""; + message.data = object.data ?? new Uint8Array(0); + return message; + }, +}; + +export const MsgInternalEVMCallResponse: MessageFns = { + $type: "seiprotocol.seichain.evm.MsgInternalEVMCallResponse" as const, + + encode(_: MsgInternalEVMCallResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgInternalEVMCallResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgInternalEVMCallResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgInternalEVMCallResponse { + return {}; + }, + + toJSON(_: MsgInternalEVMCallResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgInternalEVMCallResponse { + return MsgInternalEVMCallResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgInternalEVMCallResponse { + const message = createBaseMsgInternalEVMCallResponse(); + return message; + }, +}; + +export const MsgInternalEVMDelegateCall: MessageFns = { + $type: "seiprotocol.seichain.evm.MsgInternalEVMDelegateCall" as const, + + encode(message: MsgInternalEVMDelegateCall, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.sender !== "") { + writer.uint32(10).string(message.sender); + } + if (message.codeHash.length !== 0) { + writer.uint32(18).bytes(message.codeHash); + } + if (message.to !== "") { + writer.uint32(26).string(message.to); + } + if (message.data.length !== 0) { + writer.uint32(34).bytes(message.data); + } + if (message.fromContract !== "") { + writer.uint32(42).string(message.fromContract); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgInternalEVMDelegateCall { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgInternalEVMDelegateCall(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.sender = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.codeHash = reader.bytes(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.to = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.data = reader.bytes(); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.fromContract = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgInternalEVMDelegateCall { + return { + sender: isSet(object.sender) ? globalThis.String(object.sender) : "", + codeHash: isSet(object.codeHash) ? bytesFromBase64(object.codeHash) : new Uint8Array(0), + to: isSet(object.to) ? globalThis.String(object.to) : "", + data: isSet(object.data) ? bytesFromBase64(object.data) : new Uint8Array(0), + fromContract: isSet(object.fromContract) ? globalThis.String(object.fromContract) : "", + }; + }, + + toJSON(message: MsgInternalEVMDelegateCall): unknown { + const obj: any = {}; + if (message.sender !== "") { + obj.sender = message.sender; + } + if (message.codeHash.length !== 0) { + obj.codeHash = base64FromBytes(message.codeHash); + } + if (message.to !== "") { + obj.to = message.to; + } + if (message.data.length !== 0) { + obj.data = base64FromBytes(message.data); + } + if (message.fromContract !== "") { + obj.fromContract = message.fromContract; + } + return obj; + }, + + create, I>>(base?: I): MsgInternalEVMDelegateCall { + return MsgInternalEVMDelegateCall.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgInternalEVMDelegateCall { + const message = createBaseMsgInternalEVMDelegateCall(); + message.sender = object.sender ?? ""; + message.codeHash = object.codeHash ?? new Uint8Array(0); + message.to = object.to ?? ""; + message.data = object.data ?? new Uint8Array(0); + message.fromContract = object.fromContract ?? ""; + return message; + }, +}; + +export const MsgInternalEVMDelegateCallResponse: MessageFns = + { + $type: "seiprotocol.seichain.evm.MsgInternalEVMDelegateCallResponse" as const, + + encode(_: MsgInternalEVMDelegateCallResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgInternalEVMDelegateCallResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgInternalEVMDelegateCallResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgInternalEVMDelegateCallResponse { + return {}; + }, + + toJSON(_: MsgInternalEVMDelegateCallResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgInternalEVMDelegateCallResponse { + return MsgInternalEVMDelegateCallResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgInternalEVMDelegateCallResponse { + const message = createBaseMsgInternalEVMDelegateCallResponse(); + return message; + }, + }; + +export const MsgSend: MessageFns = { + $type: "seiprotocol.seichain.evm.MsgSend" as const, + + encode(message: MsgSend, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.from_address !== "") { + writer.uint32(10).string(message.from_address); + } + if (message.to_address !== "") { + writer.uint32(18).string(message.to_address); + } + for (const v of message.amount) { + Coin.encode(v!, writer.uint32(26).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgSend { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSend(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.from_address = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.to_address = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.amount.push(Coin.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgSend { + return { + from_address: isSet(object.from_address) ? globalThis.String(object.from_address) : "", + to_address: isSet(object.to_address) ? globalThis.String(object.to_address) : "", + amount: globalThis.Array.isArray(object?.amount) ? object.amount.map((e: any) => Coin.fromJSON(e)) : [], + }; + }, + + toJSON(message: MsgSend): unknown { + const obj: any = {}; + if (message.from_address !== "") { + obj.from_address = message.from_address; + } + if (message.to_address !== "") { + obj.to_address = message.to_address; + } + if (message.amount?.length) { + obj.amount = message.amount.map((e) => Coin.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): MsgSend { + return MsgSend.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgSend { + const message = createBaseMsgSend(); + message.from_address = object.from_address ?? ""; + message.to_address = object.to_address ?? ""; + message.amount = object.amount?.map((e) => Coin.fromPartial(e)) || []; + return message; + }, +}; + +export const MsgSendResponse: MessageFns = { + $type: "seiprotocol.seichain.evm.MsgSendResponse" as const, + + encode(_: MsgSendResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgSendResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSendResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgSendResponse { + return {}; + }, + + toJSON(_: MsgSendResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgSendResponse { + return MsgSendResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgSendResponse { + const message = createBaseMsgSendResponse(); + return message; + }, +}; + +export const MsgRegisterPointer: MessageFns = { + $type: "seiprotocol.seichain.evm.MsgRegisterPointer" as const, + + encode(message: MsgRegisterPointer, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.sender !== "") { + writer.uint32(10).string(message.sender); + } + if (message.pointer_type !== 0) { + writer.uint32(16).int32(message.pointer_type); + } + if (message.erc_address !== "") { + writer.uint32(26).string(message.erc_address); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgRegisterPointer { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgRegisterPointer(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.sender = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.pointer_type = reader.int32() as any; + continue; + case 3: + if (tag !== 26) { + break; + } + + message.erc_address = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgRegisterPointer { + return { + sender: isSet(object.sender) ? globalThis.String(object.sender) : "", + pointer_type: isSet(object.pointer_type) ? pointerTypeFromJSON(object.pointer_type) : 0, + erc_address: isSet(object.erc_address) ? globalThis.String(object.erc_address) : "", + }; + }, + + toJSON(message: MsgRegisterPointer): unknown { + const obj: any = {}; + if (message.sender !== "") { + obj.sender = message.sender; + } + if (message.pointer_type !== 0) { + obj.pointer_type = pointerTypeToJSON(message.pointer_type); + } + if (message.erc_address !== "") { + obj.erc_address = message.erc_address; + } + return obj; + }, + + create, I>>(base?: I): MsgRegisterPointer { + return MsgRegisterPointer.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgRegisterPointer { + const message = createBaseMsgRegisterPointer(); + message.sender = object.sender ?? ""; + message.pointer_type = object.pointer_type ?? 0; + message.erc_address = object.erc_address ?? ""; + return message; + }, +}; + +export const MsgRegisterPointerResponse: MessageFns = { + $type: "seiprotocol.seichain.evm.MsgRegisterPointerResponse" as const, + + encode(message: MsgRegisterPointerResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.pointer_address !== "") { + writer.uint32(10).string(message.pointer_address); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgRegisterPointerResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgRegisterPointerResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.pointer_address = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgRegisterPointerResponse { + return { pointer_address: isSet(object.pointer_address) ? globalThis.String(object.pointer_address) : "" }; + }, + + toJSON(message: MsgRegisterPointerResponse): unknown { + const obj: any = {}; + if (message.pointer_address !== "") { + obj.pointer_address = message.pointer_address; + } + return obj; + }, + + create, I>>(base?: I): MsgRegisterPointerResponse { + return MsgRegisterPointerResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgRegisterPointerResponse { + const message = createBaseMsgRegisterPointerResponse(); + message.pointer_address = object.pointer_address ?? ""; + return message; + }, +}; + +export const MsgAssociateContractAddress: MessageFns = { + $type: "seiprotocol.seichain.evm.MsgAssociateContractAddress" as const, + + encode(message: MsgAssociateContractAddress, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.sender !== "") { + writer.uint32(10).string(message.sender); + } + if (message.address !== "") { + writer.uint32(18).string(message.address); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgAssociateContractAddress { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgAssociateContractAddress(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.sender = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.address = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgAssociateContractAddress { + return { + sender: isSet(object.sender) ? globalThis.String(object.sender) : "", + address: isSet(object.address) ? globalThis.String(object.address) : "", + }; + }, + + toJSON(message: MsgAssociateContractAddress): unknown { + const obj: any = {}; + if (message.sender !== "") { + obj.sender = message.sender; + } + if (message.address !== "") { + obj.address = message.address; + } + return obj; + }, + + create, I>>(base?: I): MsgAssociateContractAddress { + return MsgAssociateContractAddress.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgAssociateContractAddress { + const message = createBaseMsgAssociateContractAddress(); + message.sender = object.sender ?? ""; + message.address = object.address ?? ""; + return message; + }, +}; + +export const MsgAssociateContractAddressResponse: MessageFns< + MsgAssociateContractAddressResponse, + "seiprotocol.seichain.evm.MsgAssociateContractAddressResponse" +> = { + $type: "seiprotocol.seichain.evm.MsgAssociateContractAddressResponse" as const, + + encode(_: MsgAssociateContractAddressResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgAssociateContractAddressResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgAssociateContractAddressResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgAssociateContractAddressResponse { + return {}; + }, + + toJSON(_: MsgAssociateContractAddressResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgAssociateContractAddressResponse { + return MsgAssociateContractAddressResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgAssociateContractAddressResponse { + const message = createBaseMsgAssociateContractAddressResponse(); + return message; + }, +}; + +export const MsgAssociate: MessageFns = { + $type: "seiprotocol.seichain.evm.MsgAssociate" as const, + + encode(message: MsgAssociate, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.sender !== "") { + writer.uint32(10).string(message.sender); + } + if (message.custom_message !== "") { + writer.uint32(18).string(message.custom_message); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgAssociate { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgAssociate(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.sender = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.custom_message = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgAssociate { + return { + sender: isSet(object.sender) ? globalThis.String(object.sender) : "", + custom_message: isSet(object.custom_message) ? globalThis.String(object.custom_message) : "", + }; + }, + + toJSON(message: MsgAssociate): unknown { + const obj: any = {}; + if (message.sender !== "") { + obj.sender = message.sender; + } + if (message.custom_message !== "") { + obj.custom_message = message.custom_message; + } + return obj; + }, + + create, I>>(base?: I): MsgAssociate { + return MsgAssociate.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgAssociate { + const message = createBaseMsgAssociate(); + message.sender = object.sender ?? ""; + message.custom_message = object.custom_message ?? ""; + return message; + }, +}; + +export const MsgAssociateResponse: MessageFns = { + $type: "seiprotocol.seichain.evm.MsgAssociateResponse" as const, + + encode(_: MsgAssociateResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgAssociateResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgAssociateResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgAssociateResponse { + return {}; + }, + + toJSON(_: MsgAssociateResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgAssociateResponse { + return MsgAssociateResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgAssociateResponse { + const message = createBaseMsgAssociateResponse(); + return message; + }, +}; + +function createBaseMsgEVMTransaction(): MsgEVMTransaction { + return { data: undefined, derived: new Uint8Array(0) }; +} + +function createBaseMsgEVMTransactionResponse(): MsgEVMTransactionResponse { + return { gas_used: 0, vm_error: "", return_data: new Uint8Array(0), hash: "", logs: [] }; +} + +function createBaseMsgInternalEVMCall(): MsgInternalEVMCall { + return { sender: "", value: "", to: "", data: new Uint8Array(0) }; +} + +function createBaseMsgInternalEVMCallResponse(): MsgInternalEVMCallResponse { + return {}; +} + +function createBaseMsgInternalEVMDelegateCall(): MsgInternalEVMDelegateCall { + return { sender: "", codeHash: new Uint8Array(0), to: "", data: new Uint8Array(0), fromContract: "" }; +} + +function createBaseMsgInternalEVMDelegateCallResponse(): MsgInternalEVMDelegateCallResponse { + return {}; +} + +function createBaseMsgSend(): MsgSend { + return { from_address: "", to_address: "", amount: [] }; +} + +function createBaseMsgSendResponse(): MsgSendResponse { + return {}; +} + +function createBaseMsgRegisterPointer(): MsgRegisterPointer { + return { sender: "", pointer_type: 0, erc_address: "" }; +} + +function createBaseMsgRegisterPointerResponse(): MsgRegisterPointerResponse { + return { pointer_address: "" }; +} + +function createBaseMsgAssociateContractAddress(): MsgAssociateContractAddress { + return { sender: "", address: "" }; +} + +function createBaseMsgAssociateContractAddressResponse(): MsgAssociateContractAddressResponse { + return {}; +} + +function createBaseMsgAssociate(): MsgAssociate { + return { sender: "", custom_message: "" }; +} + +function createBaseMsgAssociateResponse(): MsgAssociateResponse { + return {}; +} + +function bytesFromBase64(b64: string): Uint8Array { + if ((globalThis as any).Buffer) { + return Uint8Array.from(globalThis.Buffer.from(b64, "base64")); + } else { + const bin = globalThis.atob(b64); + const arr = new Uint8Array(bin.length); + for (let i = 0; i < bin.length; ++i) { + arr[i] = bin.charCodeAt(i); + } + return arr; + } +} + +function base64FromBytes(arr: Uint8Array): string { + if ((globalThis as any).Buffer) { + return globalThis.Buffer.from(arr).toString("base64"); + } else { + const bin: string[] = []; + arr.forEach((byte) => { + bin.push(globalThis.String.fromCharCode(byte)); + }); + return globalThis.btoa(bin.join("")); + } +} + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} +export const registry: Array<[string, GeneratedType]> = [ + ["/seiprotocol.seichain.evm.MsgEVMTransaction", MsgEVMTransaction as never], + ["/seiprotocol.seichain.evm.MsgInternalEVMCall", MsgInternalEVMCall as never], + ["/seiprotocol.seichain.evm.MsgSend", MsgSend as never], + ["/seiprotocol.seichain.evm.MsgSendResponse", MsgSendResponse as never], + ["/seiprotocol.seichain.evm.MsgRegisterPointer", MsgRegisterPointer as never], + ["/seiprotocol.seichain.evm.MsgAssociate", MsgAssociate as never], + ["/seiprotocol.seichain.evm.MsgAssociateResponse", MsgAssociateResponse as never], +]; +export const aminoConverters = { + "/seiprotocol.seichain.evm.MsgEVMTransaction": { + aminoType: "evm/MsgEVMTransaction", + toAmino: (message: MsgEVMTransaction) => ({ ...message }), + fromAmino: (object: MsgEVMTransaction) => ({ ...object }), + }, + + "/seiprotocol.seichain.evm.MsgInternalEVMCall": { + aminoType: "evm/MsgInternalEVMCall", + toAmino: (message: MsgInternalEVMCall) => ({ ...message }), + fromAmino: (object: MsgInternalEVMCall) => ({ ...object }), + }, + + "/seiprotocol.seichain.evm.MsgSend": { + aminoType: "evm/MsgSend", + toAmino: (message: MsgSend) => ({ ...message }), + fromAmino: (object: MsgSend) => ({ ...object }), + }, + + "/seiprotocol.seichain.evm.MsgSendResponse": { + aminoType: "evm/MsgSendResponse", + toAmino: (message: MsgSendResponse) => ({ ...message }), + fromAmino: (object: MsgSendResponse) => ({ ...object }), + }, + + "/seiprotocol.seichain.evm.MsgRegisterPointer": { + aminoType: "evm/MsgRegisterPointer", + toAmino: (message: MsgRegisterPointer) => ({ ...message }), + fromAmino: (object: MsgRegisterPointer) => ({ ...object }), + }, + + "/seiprotocol.seichain.evm.MsgAssociate": { + aminoType: "evm/MsgAssociate", + toAmino: (message: MsgAssociate) => ({ ...message }), + fromAmino: (object: MsgAssociate) => ({ ...object }), + }, + + "/seiprotocol.seichain.evm.MsgAssociateResponse": { + aminoType: "evm/MsgAssociateResponse", + toAmino: (message: MsgAssociateResponse) => ({ ...message }), + fromAmino: (object: MsgAssociateResponse) => ({ ...object }), + }, +}; diff --git a/packages/cosmos/generated/encoding/evm/types.ts b/packages/cosmos/generated/encoding/evm/types.ts new file mode 100644 index 000000000..9a778d00d --- /dev/null +++ b/packages/cosmos/generated/encoding/evm/types.ts @@ -0,0 +1,238 @@ +import type { GeneratedType } from "@cosmjs/proto-signing"; + +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +import type { DeferredInfo as DeferredInfo_type, Whitelist as Whitelist_type } from "../../types/evm"; + +import type { DeepPartial, Exact, MessageFns } from "../common"; + +export interface Whitelist extends Whitelist_type {} +export interface DeferredInfo extends DeferredInfo_type {} + +export const Whitelist: MessageFns = { + $type: "seiprotocol.seichain.evm.Whitelist" as const, + + encode(message: Whitelist, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.hashes) { + writer.uint32(10).string(v!); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Whitelist { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseWhitelist(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.hashes.push(reader.string()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Whitelist { + return { + hashes: globalThis.Array.isArray(object?.hashes) ? object.hashes.map((e: any) => globalThis.String(e)) : [], + }; + }, + + toJSON(message: Whitelist): unknown { + const obj: any = {}; + if (message.hashes?.length) { + obj.hashes = message.hashes; + } + return obj; + }, + + create, I>>(base?: I): Whitelist { + return Whitelist.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Whitelist { + const message = createBaseWhitelist(); + message.hashes = object.hashes?.map((e) => e) || []; + return message; + }, +}; + +export const DeferredInfo: MessageFns = { + $type: "seiprotocol.seichain.evm.DeferredInfo" as const, + + encode(message: DeferredInfo, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.tx_index !== 0) { + writer.uint32(8).uint32(message.tx_index); + } + if (message.tx_hash.length !== 0) { + writer.uint32(18).bytes(message.tx_hash); + } + if (message.tx_bloom.length !== 0) { + writer.uint32(26).bytes(message.tx_bloom); + } + if (message.surplus !== "") { + writer.uint32(34).string(message.surplus); + } + if (message.error !== "") { + writer.uint32(42).string(message.error); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): DeferredInfo { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDeferredInfo(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.tx_index = reader.uint32(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.tx_hash = reader.bytes(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.tx_bloom = reader.bytes(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.surplus = reader.string(); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.error = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): DeferredInfo { + return { + tx_index: isSet(object.tx_index) ? globalThis.Number(object.tx_index) : 0, + tx_hash: isSet(object.tx_hash) ? bytesFromBase64(object.tx_hash) : new Uint8Array(0), + tx_bloom: isSet(object.tx_bloom) ? bytesFromBase64(object.tx_bloom) : new Uint8Array(0), + surplus: isSet(object.surplus) ? globalThis.String(object.surplus) : "", + error: isSet(object.error) ? globalThis.String(object.error) : "", + }; + }, + + toJSON(message: DeferredInfo): unknown { + const obj: any = {}; + if (message.tx_index !== 0) { + obj.tx_index = Math.round(message.tx_index); + } + if (message.tx_hash.length !== 0) { + obj.tx_hash = base64FromBytes(message.tx_hash); + } + if (message.tx_bloom.length !== 0) { + obj.tx_bloom = base64FromBytes(message.tx_bloom); + } + if (message.surplus !== "") { + obj.surplus = message.surplus; + } + if (message.error !== "") { + obj.error = message.error; + } + return obj; + }, + + create, I>>(base?: I): DeferredInfo { + return DeferredInfo.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): DeferredInfo { + const message = createBaseDeferredInfo(); + message.tx_index = object.tx_index ?? 0; + message.tx_hash = object.tx_hash ?? new Uint8Array(0); + message.tx_bloom = object.tx_bloom ?? new Uint8Array(0); + message.surplus = object.surplus ?? ""; + message.error = object.error ?? ""; + return message; + }, +}; + +function createBaseWhitelist(): Whitelist { + return { hashes: [] }; +} + +function createBaseDeferredInfo(): DeferredInfo { + return { tx_index: 0, tx_hash: new Uint8Array(0), tx_bloom: new Uint8Array(0), surplus: "", error: "" }; +} + +function bytesFromBase64(b64: string): Uint8Array { + if ((globalThis as any).Buffer) { + return Uint8Array.from(globalThis.Buffer.from(b64, "base64")); + } else { + const bin = globalThis.atob(b64); + const arr = new Uint8Array(bin.length); + for (let i = 0; i < bin.length; ++i) { + arr[i] = bin.charCodeAt(i); + } + return arr; + } +} + +function base64FromBytes(arr: Uint8Array): string { + if ((globalThis as any).Buffer) { + return globalThis.Buffer.from(arr).toString("base64"); + } else { + const bin: string[] = []; + arr.forEach((byte) => { + bin.push(globalThis.String.fromCharCode(byte)); + }); + return globalThis.btoa(bin.join("")); + } +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} +export const registry: Array<[string, GeneratedType]> = [ + ["/seiprotocol.seichain.evm.Whitelist", Whitelist as never], + ["/seiprotocol.seichain.evm.DeferredInfo", DeferredInfo as never], +]; +export const aminoConverters = { + "/seiprotocol.seichain.evm.Whitelist": { + aminoType: "evm/Whitelist", + toAmino: (message: Whitelist) => ({ ...message }), + fromAmino: (object: Whitelist) => ({ ...object }), + }, + + "/seiprotocol.seichain.evm.DeferredInfo": { + aminoType: "evm/DeferredInfo", + toAmino: (message: DeferredInfo) => ({ ...message }), + fromAmino: (object: DeferredInfo) => ({ ...object }), + }, +}; diff --git a/packages/cosmos/generated/encoding/google/api/http.ts b/packages/cosmos/generated/encoding/google/api/http.ts new file mode 100644 index 000000000..108a6dcb3 --- /dev/null +++ b/packages/cosmos/generated/encoding/google/api/http.ts @@ -0,0 +1,398 @@ +import type { GeneratedType } from "@cosmjs/proto-signing"; + +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +import type { CustomHttpPattern as CustomHttpPattern_type, HttpRule as HttpRule_type, Http as Http_type } from "../../../types/google/api"; + +import type { DeepPartial, Exact, MessageFns } from "../../common"; + +export interface Http extends Http_type {} +export interface HttpRule extends HttpRule_type {} +export interface CustomHttpPattern extends CustomHttpPattern_type {} + +export const Http: MessageFns = { + $type: "google.api.Http" as const, + + encode(message: Http, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.rules) { + HttpRule.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.fully_decode_reserved_expansion !== false) { + writer.uint32(16).bool(message.fully_decode_reserved_expansion); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Http { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseHttp(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.rules.push(HttpRule.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.fully_decode_reserved_expansion = reader.bool(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Http { + return { + rules: globalThis.Array.isArray(object?.rules) ? object.rules.map((e: any) => HttpRule.fromJSON(e)) : [], + fully_decode_reserved_expansion: isSet(object.fully_decode_reserved_expansion) ? globalThis.Boolean(object.fully_decode_reserved_expansion) : false, + }; + }, + + toJSON(message: Http): unknown { + const obj: any = {}; + if (message.rules?.length) { + obj.rules = message.rules.map((e) => HttpRule.toJSON(e)); + } + if (message.fully_decode_reserved_expansion !== false) { + obj.fully_decode_reserved_expansion = message.fully_decode_reserved_expansion; + } + return obj; + }, + + create, I>>(base?: I): Http { + return Http.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Http { + const message = createBaseHttp(); + message.rules = object.rules?.map((e) => HttpRule.fromPartial(e)) || []; + message.fully_decode_reserved_expansion = object.fully_decode_reserved_expansion ?? false; + return message; + }, +}; + +export const HttpRule: MessageFns = { + $type: "google.api.HttpRule" as const, + + encode(message: HttpRule, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + 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()).join(); + } + if (message.body !== "") { + writer.uint32(58).string(message.body); + } + if (message.response_body !== "") { + writer.uint32(98).string(message.response_body); + } + for (const v of message.additional_bindings) { + HttpRule.encode(v!, writer.uint32(90).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): HttpRule { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseHttpRule(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.selector = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.get = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.put = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.post = reader.string(); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.delete = reader.string(); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.patch = reader.string(); + continue; + case 8: + if (tag !== 66) { + break; + } + + message.custom = CustomHttpPattern.decode(reader, reader.uint32()); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.body = reader.string(); + continue; + case 12: + if (tag !== 98) { + break; + } + + message.response_body = reader.string(); + continue; + case 11: + if (tag !== 90) { + break; + } + + message.additional_bindings.push(HttpRule.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): HttpRule { + return { + selector: isSet(object.selector) ? globalThis.String(object.selector) : "", + get: isSet(object.get) ? globalThis.String(object.get) : undefined, + put: isSet(object.put) ? globalThis.String(object.put) : undefined, + post: isSet(object.post) ? globalThis.String(object.post) : undefined, + delete: isSet(object.delete) ? globalThis.String(object.delete) : undefined, + patch: isSet(object.patch) ? globalThis.String(object.patch) : undefined, + custom: isSet(object.custom) ? CustomHttpPattern.fromJSON(object.custom) : undefined, + body: isSet(object.body) ? globalThis.String(object.body) : "", + response_body: isSet(object.response_body) ? globalThis.String(object.response_body) : "", + additional_bindings: globalThis.Array.isArray(object?.additional_bindings) ? object.additional_bindings.map((e: any) => HttpRule.fromJSON(e)) : [], + }; + }, + + toJSON(message: HttpRule): unknown { + const obj: any = {}; + if (message.selector !== "") { + obj.selector = message.selector; + } + if (message.get !== undefined) { + obj.get = message.get; + } + if (message.put !== undefined) { + obj.put = message.put; + } + if (message.post !== undefined) { + obj.post = message.post; + } + if (message.delete !== undefined) { + obj.delete = message.delete; + } + if (message.patch !== undefined) { + obj.patch = message.patch; + } + if (message.custom !== undefined) { + obj.custom = CustomHttpPattern.toJSON(message.custom); + } + if (message.body !== "") { + obj.body = message.body; + } + if (message.response_body !== "") { + obj.response_body = message.response_body; + } + if (message.additional_bindings?.length) { + obj.additional_bindings = message.additional_bindings.map((e) => HttpRule.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): HttpRule { + return HttpRule.fromPartial(base ?? ({} as any)); + }, + 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.response_body = object.response_body ?? ""; + message.additional_bindings = object.additional_bindings?.map((e) => HttpRule.fromPartial(e)) || []; + return message; + }, +}; + +export const CustomHttpPattern: MessageFns = { + $type: "google.api.CustomHttpPattern" as const, + + encode(message: CustomHttpPattern, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.kind !== "") { + writer.uint32(10).string(message.kind); + } + if (message.path !== "") { + writer.uint32(18).string(message.path); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): CustomHttpPattern { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseCustomHttpPattern(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.kind = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.path = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): CustomHttpPattern { + return { + kind: isSet(object.kind) ? globalThis.String(object.kind) : "", + path: isSet(object.path) ? globalThis.String(object.path) : "", + }; + }, + + toJSON(message: CustomHttpPattern): unknown { + const obj: any = {}; + if (message.kind !== "") { + obj.kind = message.kind; + } + if (message.path !== "") { + obj.path = message.path; + } + return obj; + }, + + create, I>>(base?: I): CustomHttpPattern { + return CustomHttpPattern.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): CustomHttpPattern { + const message = createBaseCustomHttpPattern(); + message.kind = object.kind ?? ""; + message.path = object.path ?? ""; + return message; + }, +}; + +function createBaseHttp(): Http { + return { rules: [], fully_decode_reserved_expansion: false }; +} + +function createBaseHttpRule(): HttpRule { + return { + selector: "", + get: undefined, + put: undefined, + post: undefined, + delete: undefined, + patch: undefined, + custom: undefined, + body: "", + response_body: "", + additional_bindings: [], + }; +} + +function createBaseCustomHttpPattern(): CustomHttpPattern { + return { kind: "", path: "" }; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} +export const registry: Array<[string, GeneratedType]> = [ + ["/google.api.Http", Http as never], + ["/google.api.HttpRule", HttpRule as never], + ["/google.api.CustomHttpPattern", CustomHttpPattern as never], +]; +export const aminoConverters = { + "/google.api.Http": { + aminoType: "google.api.Http", + toAmino: (message: Http) => ({ ...message }), + fromAmino: (object: Http) => ({ ...object }), + }, + + "/google.api.HttpRule": { + aminoType: "google.api.HttpRule", + toAmino: (message: HttpRule) => ({ ...message }), + fromAmino: (object: HttpRule) => ({ ...object }), + }, + + "/google.api.CustomHttpPattern": { + aminoType: "google.api.CustomHttpPattern", + toAmino: (message: CustomHttpPattern) => ({ ...message }), + fromAmino: (object: CustomHttpPattern) => ({ ...object }), + }, +}; diff --git a/packages/cosmos/generated/encoding/google/api/httpbody.ts b/packages/cosmos/generated/encoding/google/api/httpbody.ts new file mode 100644 index 000000000..d7b83acad --- /dev/null +++ b/packages/cosmos/generated/encoding/google/api/httpbody.ts @@ -0,0 +1,139 @@ +import type { GeneratedType } from "@cosmjs/proto-signing"; + +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +import { Any } from "../protobuf/any"; + +import type { HttpBody as HttpBody_type } from "../../../types/google/api"; + +import type { DeepPartial, Exact, MessageFns } from "../../common"; + +export interface HttpBody extends HttpBody_type {} + +export const HttpBody: MessageFns = { + $type: "google.api.HttpBody" as const, + + encode(message: HttpBody, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.content_type !== "") { + writer.uint32(10).string(message.content_type); + } + if (message.data.length !== 0) { + writer.uint32(18).bytes(message.data); + } + for (const v of message.extensions) { + Any.encode(v!, writer.uint32(26).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): HttpBody { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseHttpBody(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.content_type = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.data = reader.bytes(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.extensions.push(Any.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): HttpBody { + return { + content_type: isSet(object.content_type) ? globalThis.String(object.content_type) : "", + data: isSet(object.data) ? bytesFromBase64(object.data) : new Uint8Array(0), + extensions: globalThis.Array.isArray(object?.extensions) ? object.extensions.map((e: any) => Any.fromJSON(e)) : [], + }; + }, + + toJSON(message: HttpBody): unknown { + const obj: any = {}; + if (message.content_type !== "") { + obj.content_type = message.content_type; + } + if (message.data.length !== 0) { + obj.data = base64FromBytes(message.data); + } + if (message.extensions?.length) { + obj.extensions = message.extensions.map((e) => Any.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): HttpBody { + return HttpBody.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): HttpBody { + const message = createBaseHttpBody(); + message.content_type = object.content_type ?? ""; + message.data = object.data ?? new Uint8Array(0); + message.extensions = object.extensions?.map((e) => Any.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseHttpBody(): HttpBody { + return { content_type: "", data: new Uint8Array(0), extensions: [] }; +} + +function bytesFromBase64(b64: string): Uint8Array { + if ((globalThis as any).Buffer) { + return Uint8Array.from(globalThis.Buffer.from(b64, "base64")); + } else { + const bin = globalThis.atob(b64); + const arr = new Uint8Array(bin.length); + for (let i = 0; i < bin.length; ++i) { + arr[i] = bin.charCodeAt(i); + } + return arr; + } +} + +function base64FromBytes(arr: Uint8Array): string { + if ((globalThis as any).Buffer) { + return globalThis.Buffer.from(arr).toString("base64"); + } else { + const bin: string[] = []; + arr.forEach((byte) => { + bin.push(globalThis.String.fromCharCode(byte)); + }); + return globalThis.btoa(bin.join("")); + } +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} +export const registry: Array<[string, GeneratedType]> = [["/google.api.HttpBody", HttpBody as never]]; +export const aminoConverters = { + "/google.api.HttpBody": { + aminoType: "google.api.HttpBody", + toAmino: (message: HttpBody) => ({ ...message }), + fromAmino: (object: HttpBody) => ({ ...object }), + }, +}; diff --git a/packages/cosmos/generated/encoding/google/api/index.ts b/packages/cosmos/generated/encoding/google/api/index.ts new file mode 100644 index 000000000..96ed9c615 --- /dev/null +++ b/packages/cosmos/generated/encoding/google/api/index.ts @@ -0,0 +1,4 @@ +// @ts-nocheck + +export * from './http'; +export * from './httpbody'; \ No newline at end of file diff --git a/packages/cosmos/generated/encoding/google/protobuf/any.ts b/packages/cosmos/generated/encoding/google/protobuf/any.ts new file mode 100644 index 000000000..7dd89c9fa --- /dev/null +++ b/packages/cosmos/generated/encoding/google/protobuf/any.ts @@ -0,0 +1,122 @@ +import type { GeneratedType } from "@cosmjs/proto-signing"; + +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +import type { Any as Any_type } from "../../../types/google/protobuf"; + +import type { DeepPartial, Exact, MessageFns } from "../../common"; + +export interface Any extends Any_type {} + +export const Any: MessageFns = { + $type: "google.protobuf.Any" as const, + + encode(message: Any, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.type_url !== "") { + writer.uint32(10).string(message.type_url); + } + if (message.value.length !== 0) { + writer.uint32(18).bytes(message.value); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Any { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseAny(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.type_url = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.value = reader.bytes(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Any { + return { + type_url: isSet(object.type_url) ? globalThis.String(object.type_url) : "", + value: isSet(object.value) ? bytesFromBase64(object.value) : new Uint8Array(0), + }; + }, + + toJSON(message: Any): unknown { + const obj: any = {}; + if (message.type_url !== "") { + obj.type_url = message.type_url; + } + if (message.value.length !== 0) { + obj.value = base64FromBytes(message.value); + } + return obj; + }, + + create, I>>(base?: I): Any { + return Any.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Any { + const message = createBaseAny(); + message.type_url = object.type_url ?? ""; + message.value = object.value ?? new Uint8Array(0); + return message; + }, +}; + +function createBaseAny(): Any { + return { type_url: "", value: new Uint8Array(0) }; +} + +function bytesFromBase64(b64: string): Uint8Array { + if ((globalThis as any).Buffer) { + return Uint8Array.from(globalThis.Buffer.from(b64, "base64")); + } else { + const bin = globalThis.atob(b64); + const arr = new Uint8Array(bin.length); + for (let i = 0; i < bin.length; ++i) { + arr[i] = bin.charCodeAt(i); + } + return arr; + } +} + +function base64FromBytes(arr: Uint8Array): string { + if ((globalThis as any).Buffer) { + return globalThis.Buffer.from(arr).toString("base64"); + } else { + const bin: string[] = []; + arr.forEach((byte) => { + bin.push(globalThis.String.fromCharCode(byte)); + }); + return globalThis.btoa(bin.join("")); + } +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} +export const registry: Array<[string, GeneratedType]> = [["/google.protobuf.Any", Any as never]]; +export const aminoConverters = { + "/google.protobuf.Any": { + aminoType: "google.protobuf.Any", + toAmino: (message: Any) => ({ ...message }), + fromAmino: (object: Any) => ({ ...object }), + }, +}; diff --git a/packages/cosmos/generated/encoding/google/protobuf/descriptor.ts b/packages/cosmos/generated/encoding/google/protobuf/descriptor.ts new file mode 100644 index 000000000..1befa25f6 --- /dev/null +++ b/packages/cosmos/generated/encoding/google/protobuf/descriptor.ts @@ -0,0 +1,5291 @@ +import type { GeneratedType } from "@cosmjs/proto-signing"; + +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +import type { + DescriptorProtoExtensionRange as DescriptorProtoExtensionRange_type, + DescriptorProtoReservedRange as DescriptorProtoReservedRange_type, + DescriptorProto as DescriptorProto_type, + EnumDescriptorProtoEnumReservedRange as EnumDescriptorProtoEnumReservedRange_type, + EnumDescriptorProto as EnumDescriptorProto_type, + EnumOptions as EnumOptions_type, + EnumValueDescriptorProto as EnumValueDescriptorProto_type, + EnumValueOptions as EnumValueOptions_type, + ExtensionRangeOptionsDeclaration as ExtensionRangeOptionsDeclaration_type, + ExtensionRangeOptions as ExtensionRangeOptions_type, + FeatureSetDefaultsFeatureSetEditionDefault as FeatureSetDefaultsFeatureSetEditionDefault_type, + FeatureSetDefaults as FeatureSetDefaults_type, + FeatureSet as FeatureSet_type, + FieldDescriptorProto as FieldDescriptorProto_type, + FieldOptionsEditionDefault as FieldOptionsEditionDefault_type, + FieldOptionsFeatureSupport as FieldOptionsFeatureSupport_type, + FieldOptions as FieldOptions_type, + FileDescriptorProto as FileDescriptorProto_type, + FileDescriptorSet as FileDescriptorSet_type, + FileOptions as FileOptions_type, + GeneratedCodeInfoAnnotation as GeneratedCodeInfoAnnotation_type, + GeneratedCodeInfo as GeneratedCodeInfo_type, + MessageOptions as MessageOptions_type, + MethodDescriptorProto as MethodDescriptorProto_type, + MethodOptions as MethodOptions_type, + OneofDescriptorProto as OneofDescriptorProto_type, + OneofOptions as OneofOptions_type, + ServiceDescriptorProto as ServiceDescriptorProto_type, + ServiceOptions as ServiceOptions_type, + SourceCodeInfoLocation as SourceCodeInfoLocation_type, + SourceCodeInfo as SourceCodeInfo_type, + UninterpretedOptionNamePart as UninterpretedOptionNamePart_type, + UninterpretedOption as UninterpretedOption_type, +} from "../../../types/google/protobuf"; + +import { + Edition, + ExtensionRangeOptionsVerificationState, + FeatureSetEnumType, + FeatureSetFieldPresence, + FeatureSetJsonFormat, + FeatureSetMessageEncoding, + FeatureSetRepeatedFieldEncoding, + FeatureSetUtf8Validation, + FieldDescriptorProtoLabel, + FieldDescriptorProtoType, + FieldOptionsCType, + FieldOptionsJSType, + FieldOptionsOptionRetention, + FieldOptionsOptionTargetType, + FileOptionsOptimizeMode, + GeneratedCodeInfoAnnotationSemantic, + MethodOptionsIdempotencyLevel, +} from "../../../types/google/protobuf"; + +import type { DeepPartial, Exact, MessageFns } from "../../common"; + +export interface FileDescriptorSet extends FileDescriptorSet_type {} +export interface FileDescriptorProto extends FileDescriptorProto_type {} +export interface DescriptorProto extends DescriptorProto_type {} +export interface DescriptorProtoExtensionRange extends DescriptorProtoExtensionRange_type {} +export interface DescriptorProtoReservedRange extends DescriptorProtoReservedRange_type {} +export interface ExtensionRangeOptions extends ExtensionRangeOptions_type {} +export interface ExtensionRangeOptionsDeclaration extends ExtensionRangeOptionsDeclaration_type {} +export interface FieldDescriptorProto extends FieldDescriptorProto_type {} +export interface OneofDescriptorProto extends OneofDescriptorProto_type {} +export interface EnumDescriptorProto extends EnumDescriptorProto_type {} +export interface EnumDescriptorProtoEnumReservedRange extends EnumDescriptorProtoEnumReservedRange_type {} +export interface EnumValueDescriptorProto extends EnumValueDescriptorProto_type {} +export interface ServiceDescriptorProto extends ServiceDescriptorProto_type {} +export interface MethodDescriptorProto extends MethodDescriptorProto_type {} +export interface FileOptions extends FileOptions_type {} +export interface MessageOptions extends MessageOptions_type {} +export interface FieldOptions extends FieldOptions_type {} +export interface FieldOptionsEditionDefault extends FieldOptionsEditionDefault_type {} +export interface FieldOptionsFeatureSupport extends FieldOptionsFeatureSupport_type {} +export interface OneofOptions extends OneofOptions_type {} +export interface EnumOptions extends EnumOptions_type {} +export interface EnumValueOptions extends EnumValueOptions_type {} +export interface ServiceOptions extends ServiceOptions_type {} +export interface MethodOptions extends MethodOptions_type {} +export interface UninterpretedOption extends UninterpretedOption_type {} +export interface UninterpretedOptionNamePart extends UninterpretedOptionNamePart_type {} +export interface FeatureSet extends FeatureSet_type {} +export interface FeatureSetDefaults extends FeatureSetDefaults_type {} +export interface FeatureSetDefaultsFeatureSetEditionDefault extends FeatureSetDefaultsFeatureSetEditionDefault_type {} +export interface SourceCodeInfo extends SourceCodeInfo_type {} +export interface SourceCodeInfoLocation extends SourceCodeInfoLocation_type {} +export interface GeneratedCodeInfo extends GeneratedCodeInfo_type {} +export interface GeneratedCodeInfoAnnotation extends GeneratedCodeInfoAnnotation_type {} + +export const FileDescriptorSet: MessageFns = { + $type: "google.protobuf.FileDescriptorSet" as const, + + encode(message: FileDescriptorSet, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.file) { + FileDescriptorProto.encode(v!, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): FileDescriptorSet { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseFileDescriptorSet(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.file.push(FileDescriptorProto.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): FileDescriptorSet { + return { + file: globalThis.Array.isArray(object?.file) ? object.file.map((e: any) => FileDescriptorProto.fromJSON(e)) : [], + }; + }, + + toJSON(message: FileDescriptorSet): unknown { + const obj: any = {}; + if (message.file?.length) { + obj.file = message.file.map((e) => FileDescriptorProto.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): FileDescriptorSet { + return FileDescriptorSet.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): FileDescriptorSet { + const message = createBaseFileDescriptorSet(); + message.file = object.file?.map((e) => FileDescriptorProto.fromPartial(e)) || []; + return message; + }, +}; + +export const FileDescriptorProto: MessageFns = { + $type: "google.protobuf.FileDescriptorProto" as const, + + encode(message: FileDescriptorProto, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== undefined && message.name !== "") { + writer.uint32(10).string(message.name); + } + if (message.package !== undefined && message.package !== "") { + writer.uint32(18).string(message.package); + } + for (const v of message.dependency) { + writer.uint32(26).string(v!); + } + writer.uint32(82).fork(); + for (const v of message.public_dependency) { + writer.int32(v); + } + writer.join(); + writer.uint32(90).fork(); + for (const v of message.weak_dependency) { + writer.int32(v); + } + writer.join(); + for (const v of message.message_type) { + DescriptorProto.encode(v!, writer.uint32(34).fork()).join(); + } + for (const v of message.enum_type) { + EnumDescriptorProto.encode(v!, writer.uint32(42).fork()).join(); + } + for (const v of message.service) { + ServiceDescriptorProto.encode(v!, writer.uint32(50).fork()).join(); + } + for (const v of message.extension) { + FieldDescriptorProto.encode(v!, writer.uint32(58).fork()).join(); + } + if (message.options !== undefined) { + FileOptions.encode(message.options, writer.uint32(66).fork()).join(); + } + if (message.source_code_info !== undefined) { + SourceCodeInfo.encode(message.source_code_info, writer.uint32(74).fork()).join(); + } + if (message.syntax !== undefined && message.syntax !== "") { + writer.uint32(98).string(message.syntax); + } + if (message.edition !== undefined && message.edition !== 0) { + writer.uint32(112).int32(message.edition); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): FileDescriptorProto { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseFileDescriptorProto(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.name = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.package = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.dependency.push(reader.string()); + continue; + case 10: + if (tag === 80) { + message.public_dependency.push(reader.int32()); + + continue; + } + + if (tag === 82) { + const end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) { + message.public_dependency.push(reader.int32()); + } + + continue; + } + + break; + case 11: + if (tag === 88) { + message.weak_dependency.push(reader.int32()); + + continue; + } + + if (tag === 90) { + const end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) { + message.weak_dependency.push(reader.int32()); + } + + continue; + } + + break; + case 4: + if (tag !== 34) { + break; + } + + message.message_type.push(DescriptorProto.decode(reader, reader.uint32())); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.enum_type.push(EnumDescriptorProto.decode(reader, reader.uint32())); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.service.push(ServiceDescriptorProto.decode(reader, reader.uint32())); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.extension.push(FieldDescriptorProto.decode(reader, reader.uint32())); + continue; + case 8: + if (tag !== 66) { + break; + } + + message.options = FileOptions.decode(reader, reader.uint32()); + continue; + case 9: + if (tag !== 74) { + break; + } + + message.source_code_info = SourceCodeInfo.decode(reader, reader.uint32()); + continue; + case 12: + if (tag !== 98) { + break; + } + + message.syntax = reader.string(); + continue; + case 14: + if (tag !== 112) { + break; + } + + message.edition = reader.int32() as any; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): FileDescriptorProto { + return { + name: isSet(object.name) ? globalThis.String(object.name) : "", + package: isSet(object.package) ? globalThis.String(object.package) : "", + dependency: globalThis.Array.isArray(object?.dependency) ? object.dependency.map((e: any) => globalThis.String(e)) : [], + public_dependency: globalThis.Array.isArray(object?.public_dependency) ? object.public_dependency.map((e: any) => globalThis.Number(e)) : [], + weak_dependency: globalThis.Array.isArray(object?.weak_dependency) ? object.weak_dependency.map((e: any) => globalThis.Number(e)) : [], + message_type: globalThis.Array.isArray(object?.message_type) ? object.message_type.map((e: any) => DescriptorProto.fromJSON(e)) : [], + enum_type: globalThis.Array.isArray(object?.enum_type) ? object.enum_type.map((e: any) => EnumDescriptorProto.fromJSON(e)) : [], + service: globalThis.Array.isArray(object?.service) ? object.service.map((e: any) => ServiceDescriptorProto.fromJSON(e)) : [], + extension: globalThis.Array.isArray(object?.extension) ? object.extension.map((e: any) => FieldDescriptorProto.fromJSON(e)) : [], + options: isSet(object.options) ? FileOptions.fromJSON(object.options) : undefined, + source_code_info: isSet(object.source_code_info) ? SourceCodeInfo.fromJSON(object.source_code_info) : undefined, + syntax: isSet(object.syntax) ? globalThis.String(object.syntax) : "", + edition: isSet(object.edition) ? editionFromJSON(object.edition) : 0, + }; + }, + + toJSON(message: FileDescriptorProto): unknown { + const obj: any = {}; + if (message.name !== undefined && message.name !== "") { + obj.name = message.name; + } + if (message.package !== undefined && message.package !== "") { + obj.package = message.package; + } + if (message.dependency?.length) { + obj.dependency = message.dependency; + } + if (message.public_dependency?.length) { + obj.public_dependency = message.public_dependency.map((e) => Math.round(e)); + } + if (message.weak_dependency?.length) { + obj.weak_dependency = message.weak_dependency.map((e) => Math.round(e)); + } + if (message.message_type?.length) { + obj.message_type = message.message_type.map((e) => DescriptorProto.toJSON(e)); + } + if (message.enum_type?.length) { + obj.enum_type = message.enum_type.map((e) => EnumDescriptorProto.toJSON(e)); + } + if (message.service?.length) { + obj.service = message.service.map((e) => ServiceDescriptorProto.toJSON(e)); + } + if (message.extension?.length) { + obj.extension = message.extension.map((e) => FieldDescriptorProto.toJSON(e)); + } + if (message.options !== undefined) { + obj.options = FileOptions.toJSON(message.options); + } + if (message.source_code_info !== undefined) { + obj.source_code_info = SourceCodeInfo.toJSON(message.source_code_info); + } + if (message.syntax !== undefined && message.syntax !== "") { + obj.syntax = message.syntax; + } + if (message.edition !== undefined && message.edition !== 0) { + obj.edition = editionToJSON(message.edition); + } + return obj; + }, + + create, I>>(base?: I): FileDescriptorProto { + return FileDescriptorProto.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): FileDescriptorProto { + const message = createBaseFileDescriptorProto(); + message.name = object.name ?? ""; + message.package = object.package ?? ""; + message.dependency = object.dependency?.map((e) => e) || []; + message.public_dependency = object.public_dependency?.map((e) => e) || []; + message.weak_dependency = object.weak_dependency?.map((e) => e) || []; + message.message_type = object.message_type?.map((e) => DescriptorProto.fromPartial(e)) || []; + message.enum_type = object.enum_type?.map((e) => EnumDescriptorProto.fromPartial(e)) || []; + message.service = object.service?.map((e) => ServiceDescriptorProto.fromPartial(e)) || []; + message.extension = object.extension?.map((e) => FieldDescriptorProto.fromPartial(e)) || []; + message.options = object.options !== undefined && object.options !== null ? FileOptions.fromPartial(object.options) : undefined; + message.source_code_info = + object.source_code_info !== undefined && object.source_code_info !== null ? SourceCodeInfo.fromPartial(object.source_code_info) : undefined; + message.syntax = object.syntax ?? ""; + message.edition = object.edition ?? 0; + return message; + }, +}; + +export const DescriptorProto: MessageFns = { + $type: "google.protobuf.DescriptorProto" as const, + + encode(message: DescriptorProto, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== undefined && message.name !== "") { + writer.uint32(10).string(message.name); + } + for (const v of message.field) { + FieldDescriptorProto.encode(v!, writer.uint32(18).fork()).join(); + } + for (const v of message.extension) { + FieldDescriptorProto.encode(v!, writer.uint32(50).fork()).join(); + } + for (const v of message.nested_type) { + DescriptorProto.encode(v!, writer.uint32(26).fork()).join(); + } + for (const v of message.enum_type) { + EnumDescriptorProto.encode(v!, writer.uint32(34).fork()).join(); + } + for (const v of message.extension_range) { + DescriptorProtoExtensionRange.encode(v!, writer.uint32(42).fork()).join(); + } + for (const v of message.oneof_decl) { + OneofDescriptorProto.encode(v!, writer.uint32(66).fork()).join(); + } + if (message.options !== undefined) { + MessageOptions.encode(message.options, writer.uint32(58).fork()).join(); + } + for (const v of message.reserved_range) { + DescriptorProtoReservedRange.encode(v!, writer.uint32(74).fork()).join(); + } + for (const v of message.reserved_name) { + writer.uint32(82).string(v!); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): DescriptorProto { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDescriptorProto(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.name = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.field.push(FieldDescriptorProto.decode(reader, reader.uint32())); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.extension.push(FieldDescriptorProto.decode(reader, reader.uint32())); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.nested_type.push(DescriptorProto.decode(reader, reader.uint32())); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.enum_type.push(EnumDescriptorProto.decode(reader, reader.uint32())); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.extension_range.push(DescriptorProtoExtensionRange.decode(reader, reader.uint32())); + continue; + case 8: + if (tag !== 66) { + break; + } + + message.oneof_decl.push(OneofDescriptorProto.decode(reader, reader.uint32())); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.options = MessageOptions.decode(reader, reader.uint32()); + continue; + case 9: + if (tag !== 74) { + break; + } + + message.reserved_range.push(DescriptorProtoReservedRange.decode(reader, reader.uint32())); + continue; + case 10: + if (tag !== 82) { + break; + } + + message.reserved_name.push(reader.string()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): DescriptorProto { + return { + name: isSet(object.name) ? globalThis.String(object.name) : "", + field: globalThis.Array.isArray(object?.field) ? object.field.map((e: any) => FieldDescriptorProto.fromJSON(e)) : [], + extension: globalThis.Array.isArray(object?.extension) ? object.extension.map((e: any) => FieldDescriptorProto.fromJSON(e)) : [], + nested_type: globalThis.Array.isArray(object?.nested_type) ? object.nested_type.map((e: any) => DescriptorProto.fromJSON(e)) : [], + enum_type: globalThis.Array.isArray(object?.enum_type) ? object.enum_type.map((e: any) => EnumDescriptorProto.fromJSON(e)) : [], + extension_range: globalThis.Array.isArray(object?.extension_range) + ? object.extension_range.map((e: any) => DescriptorProtoExtensionRange.fromJSON(e)) + : [], + oneof_decl: globalThis.Array.isArray(object?.oneof_decl) ? object.oneof_decl.map((e: any) => OneofDescriptorProto.fromJSON(e)) : [], + options: isSet(object.options) ? MessageOptions.fromJSON(object.options) : undefined, + reserved_range: globalThis.Array.isArray(object?.reserved_range) ? object.reserved_range.map((e: any) => DescriptorProtoReservedRange.fromJSON(e)) : [], + reserved_name: globalThis.Array.isArray(object?.reserved_name) ? object.reserved_name.map((e: any) => globalThis.String(e)) : [], + }; + }, + + toJSON(message: DescriptorProto): unknown { + const obj: any = {}; + if (message.name !== undefined && message.name !== "") { + obj.name = message.name; + } + if (message.field?.length) { + obj.field = message.field.map((e) => FieldDescriptorProto.toJSON(e)); + } + if (message.extension?.length) { + obj.extension = message.extension.map((e) => FieldDescriptorProto.toJSON(e)); + } + if (message.nested_type?.length) { + obj.nested_type = message.nested_type.map((e) => DescriptorProto.toJSON(e)); + } + if (message.enum_type?.length) { + obj.enum_type = message.enum_type.map((e) => EnumDescriptorProto.toJSON(e)); + } + if (message.extension_range?.length) { + obj.extension_range = message.extension_range.map((e) => DescriptorProtoExtensionRange.toJSON(e)); + } + if (message.oneof_decl?.length) { + obj.oneof_decl = message.oneof_decl.map((e) => OneofDescriptorProto.toJSON(e)); + } + if (message.options !== undefined) { + obj.options = MessageOptions.toJSON(message.options); + } + if (message.reserved_range?.length) { + obj.reserved_range = message.reserved_range.map((e) => DescriptorProtoReservedRange.toJSON(e)); + } + if (message.reserved_name?.length) { + obj.reserved_name = message.reserved_name; + } + return obj; + }, + + create, I>>(base?: I): DescriptorProto { + return DescriptorProto.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): DescriptorProto { + const message = createBaseDescriptorProto(); + message.name = object.name ?? ""; + message.field = object.field?.map((e) => FieldDescriptorProto.fromPartial(e)) || []; + message.extension = object.extension?.map((e) => FieldDescriptorProto.fromPartial(e)) || []; + message.nested_type = object.nested_type?.map((e) => DescriptorProto.fromPartial(e)) || []; + message.enum_type = object.enum_type?.map((e) => EnumDescriptorProto.fromPartial(e)) || []; + message.extension_range = object.extension_range?.map((e) => DescriptorProtoExtensionRange.fromPartial(e)) || []; + message.oneof_decl = object.oneof_decl?.map((e) => OneofDescriptorProto.fromPartial(e)) || []; + message.options = object.options !== undefined && object.options !== null ? MessageOptions.fromPartial(object.options) : undefined; + message.reserved_range = object.reserved_range?.map((e) => DescriptorProtoReservedRange.fromPartial(e)) || []; + message.reserved_name = object.reserved_name?.map((e) => e) || []; + return message; + }, +}; + +export const DescriptorProtoExtensionRange: MessageFns = { + $type: "google.protobuf.DescriptorProto.ExtensionRange" as const, + + encode(message: DescriptorProtoExtensionRange, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.start !== undefined && message.start !== 0) { + writer.uint32(8).int32(message.start); + } + if (message.end !== undefined && message.end !== 0) { + writer.uint32(16).int32(message.end); + } + if (message.options !== undefined) { + ExtensionRangeOptions.encode(message.options, writer.uint32(26).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): DescriptorProtoExtensionRange { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDescriptorProtoExtensionRange(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.start = reader.int32(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.end = reader.int32(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.options = ExtensionRangeOptions.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): DescriptorProtoExtensionRange { + return { + start: isSet(object.start) ? globalThis.Number(object.start) : 0, + end: isSet(object.end) ? globalThis.Number(object.end) : 0, + options: isSet(object.options) ? ExtensionRangeOptions.fromJSON(object.options) : undefined, + }; + }, + + toJSON(message: DescriptorProtoExtensionRange): unknown { + const obj: any = {}; + if (message.start !== undefined && message.start !== 0) { + obj.start = Math.round(message.start); + } + if (message.end !== undefined && message.end !== 0) { + obj.end = Math.round(message.end); + } + if (message.options !== undefined) { + obj.options = ExtensionRangeOptions.toJSON(message.options); + } + return obj; + }, + + create, I>>(base?: I): DescriptorProtoExtensionRange { + return DescriptorProtoExtensionRange.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): DescriptorProtoExtensionRange { + const message = createBaseDescriptorProtoExtensionRange(); + message.start = object.start ?? 0; + message.end = object.end ?? 0; + message.options = object.options !== undefined && object.options !== null ? ExtensionRangeOptions.fromPartial(object.options) : undefined; + return message; + }, +}; + +export const DescriptorProtoReservedRange: MessageFns = { + $type: "google.protobuf.DescriptorProto.ReservedRange" as const, + + encode(message: DescriptorProtoReservedRange, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.start !== undefined && message.start !== 0) { + writer.uint32(8).int32(message.start); + } + if (message.end !== undefined && message.end !== 0) { + writer.uint32(16).int32(message.end); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): DescriptorProtoReservedRange { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDescriptorProtoReservedRange(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.start = reader.int32(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.end = reader.int32(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): DescriptorProtoReservedRange { + return { + start: isSet(object.start) ? globalThis.Number(object.start) : 0, + end: isSet(object.end) ? globalThis.Number(object.end) : 0, + }; + }, + + toJSON(message: DescriptorProtoReservedRange): unknown { + const obj: any = {}; + if (message.start !== undefined && message.start !== 0) { + obj.start = Math.round(message.start); + } + if (message.end !== undefined && message.end !== 0) { + obj.end = Math.round(message.end); + } + return obj; + }, + + create, I>>(base?: I): DescriptorProtoReservedRange { + return DescriptorProtoReservedRange.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): DescriptorProtoReservedRange { + const message = createBaseDescriptorProtoReservedRange(); + message.start = object.start ?? 0; + message.end = object.end ?? 0; + return message; + }, +}; + +export const ExtensionRangeOptions: MessageFns = { + $type: "google.protobuf.ExtensionRangeOptions" as const, + + encode(message: ExtensionRangeOptions, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.uninterpreted_option) { + UninterpretedOption.encode(v!, writer.uint32(7994).fork()).join(); + } + for (const v of message.declaration) { + ExtensionRangeOptionsDeclaration.encode(v!, writer.uint32(18).fork()).join(); + } + if (message.features !== undefined) { + FeatureSet.encode(message.features, writer.uint32(402).fork()).join(); + } + if (message.verification !== undefined && message.verification !== 1) { + writer.uint32(24).int32(message.verification); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ExtensionRangeOptions { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseExtensionRangeOptions(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 999: + if (tag !== 7994) { + break; + } + + message.uninterpreted_option.push(UninterpretedOption.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.declaration.push(ExtensionRangeOptionsDeclaration.decode(reader, reader.uint32())); + continue; + case 50: + if (tag !== 402) { + break; + } + + message.features = FeatureSet.decode(reader, reader.uint32()); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.verification = reader.int32() as any; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ExtensionRangeOptions { + return { + uninterpreted_option: globalThis.Array.isArray(object?.uninterpreted_option) + ? object.uninterpreted_option.map((e: any) => UninterpretedOption.fromJSON(e)) + : [], + declaration: globalThis.Array.isArray(object?.declaration) ? object.declaration.map((e: any) => ExtensionRangeOptionsDeclaration.fromJSON(e)) : [], + features: isSet(object.features) ? FeatureSet.fromJSON(object.features) : undefined, + verification: isSet(object.verification) ? extensionRangeOptionsVerificationStateFromJSON(object.verification) : 1, + }; + }, + + toJSON(message: ExtensionRangeOptions): unknown { + const obj: any = {}; + if (message.uninterpreted_option?.length) { + obj.uninterpreted_option = message.uninterpreted_option.map((e) => UninterpretedOption.toJSON(e)); + } + if (message.declaration?.length) { + obj.declaration = message.declaration.map((e) => ExtensionRangeOptionsDeclaration.toJSON(e)); + } + if (message.features !== undefined) { + obj.features = FeatureSet.toJSON(message.features); + } + if (message.verification !== undefined && message.verification !== 1) { + obj.verification = extensionRangeOptionsVerificationStateToJSON(message.verification); + } + return obj; + }, + + create, I>>(base?: I): ExtensionRangeOptions { + return ExtensionRangeOptions.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ExtensionRangeOptions { + const message = createBaseExtensionRangeOptions(); + message.uninterpreted_option = object.uninterpreted_option?.map((e) => UninterpretedOption.fromPartial(e)) || []; + message.declaration = object.declaration?.map((e) => ExtensionRangeOptionsDeclaration.fromPartial(e)) || []; + message.features = object.features !== undefined && object.features !== null ? FeatureSet.fromPartial(object.features) : undefined; + message.verification = object.verification ?? 1; + return message; + }, +}; + +export const ExtensionRangeOptionsDeclaration: MessageFns = { + $type: "google.protobuf.ExtensionRangeOptions.Declaration" as const, + + encode(message: ExtensionRangeOptionsDeclaration, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.number !== undefined && message.number !== 0) { + writer.uint32(8).int32(message.number); + } + if (message.full_name !== undefined && message.full_name !== "") { + writer.uint32(18).string(message.full_name); + } + if (message.type !== undefined && message.type !== "") { + writer.uint32(26).string(message.type); + } + if (message.reserved !== undefined && message.reserved !== false) { + writer.uint32(40).bool(message.reserved); + } + if (message.repeated !== undefined && message.repeated !== false) { + writer.uint32(48).bool(message.repeated); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ExtensionRangeOptionsDeclaration { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseExtensionRangeOptionsDeclaration(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.number = reader.int32(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.full_name = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.type = reader.string(); + continue; + case 5: + if (tag !== 40) { + break; + } + + message.reserved = reader.bool(); + continue; + case 6: + if (tag !== 48) { + break; + } + + message.repeated = reader.bool(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ExtensionRangeOptionsDeclaration { + return { + number: isSet(object.number) ? globalThis.Number(object.number) : 0, + full_name: isSet(object.full_name) ? globalThis.String(object.full_name) : "", + type: isSet(object.type) ? globalThis.String(object.type) : "", + reserved: isSet(object.reserved) ? globalThis.Boolean(object.reserved) : false, + repeated: isSet(object.repeated) ? globalThis.Boolean(object.repeated) : false, + }; + }, + + toJSON(message: ExtensionRangeOptionsDeclaration): unknown { + const obj: any = {}; + if (message.number !== undefined && message.number !== 0) { + obj.number = Math.round(message.number); + } + if (message.full_name !== undefined && message.full_name !== "") { + obj.full_name = message.full_name; + } + if (message.type !== undefined && message.type !== "") { + obj.type = message.type; + } + if (message.reserved !== undefined && message.reserved !== false) { + obj.reserved = message.reserved; + } + if (message.repeated !== undefined && message.repeated !== false) { + obj.repeated = message.repeated; + } + return obj; + }, + + create, I>>(base?: I): ExtensionRangeOptionsDeclaration { + return ExtensionRangeOptionsDeclaration.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ExtensionRangeOptionsDeclaration { + const message = createBaseExtensionRangeOptionsDeclaration(); + message.number = object.number ?? 0; + message.full_name = object.full_name ?? ""; + message.type = object.type ?? ""; + message.reserved = object.reserved ?? false; + message.repeated = object.repeated ?? false; + return message; + }, +}; + +export const FieldDescriptorProto: MessageFns = { + $type: "google.protobuf.FieldDescriptorProto" as const, + + encode(message: FieldDescriptorProto, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== undefined && message.name !== "") { + writer.uint32(10).string(message.name); + } + if (message.number !== undefined && message.number !== 0) { + writer.uint32(24).int32(message.number); + } + if (message.label !== undefined && message.label !== 1) { + writer.uint32(32).int32(message.label); + } + if (message.type !== undefined && message.type !== 1) { + writer.uint32(40).int32(message.type); + } + if (message.type_name !== undefined && message.type_name !== "") { + writer.uint32(50).string(message.type_name); + } + if (message.extendee !== undefined && message.extendee !== "") { + writer.uint32(18).string(message.extendee); + } + if (message.default_value !== undefined && message.default_value !== "") { + writer.uint32(58).string(message.default_value); + } + if (message.oneof_index !== undefined && message.oneof_index !== 0) { + writer.uint32(72).int32(message.oneof_index); + } + if (message.json_name !== undefined && message.json_name !== "") { + writer.uint32(82).string(message.json_name); + } + if (message.options !== undefined) { + FieldOptions.encode(message.options, writer.uint32(66).fork()).join(); + } + if (message.proto3_optional !== undefined && message.proto3_optional !== false) { + writer.uint32(136).bool(message.proto3_optional); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): FieldDescriptorProto { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseFieldDescriptorProto(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.name = reader.string(); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.number = reader.int32(); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.label = reader.int32() as any; + continue; + case 5: + if (tag !== 40) { + break; + } + + message.type = reader.int32() as any; + continue; + case 6: + if (tag !== 50) { + break; + } + + message.type_name = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.extendee = reader.string(); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.default_value = reader.string(); + continue; + case 9: + if (tag !== 72) { + break; + } + + message.oneof_index = reader.int32(); + continue; + case 10: + if (tag !== 82) { + break; + } + + message.json_name = reader.string(); + continue; + case 8: + if (tag !== 66) { + break; + } + + message.options = FieldOptions.decode(reader, reader.uint32()); + continue; + case 17: + if (tag !== 136) { + break; + } + + message.proto3_optional = reader.bool(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): FieldDescriptorProto { + return { + name: isSet(object.name) ? globalThis.String(object.name) : "", + number: isSet(object.number) ? globalThis.Number(object.number) : 0, + label: isSet(object.label) ? fieldDescriptorProtoLabelFromJSON(object.label) : 1, + type: isSet(object.type) ? fieldDescriptorProtoTypeFromJSON(object.type) : 1, + type_name: isSet(object.type_name) ? globalThis.String(object.type_name) : "", + extendee: isSet(object.extendee) ? globalThis.String(object.extendee) : "", + default_value: isSet(object.default_value) ? globalThis.String(object.default_value) : "", + oneof_index: isSet(object.oneof_index) ? globalThis.Number(object.oneof_index) : 0, + json_name: isSet(object.json_name) ? globalThis.String(object.json_name) : "", + options: isSet(object.options) ? FieldOptions.fromJSON(object.options) : undefined, + proto3_optional: isSet(object.proto3_optional) ? globalThis.Boolean(object.proto3_optional) : false, + }; + }, + + toJSON(message: FieldDescriptorProto): unknown { + const obj: any = {}; + if (message.name !== undefined && message.name !== "") { + obj.name = message.name; + } + if (message.number !== undefined && message.number !== 0) { + obj.number = Math.round(message.number); + } + if (message.label !== undefined && message.label !== 1) { + obj.label = fieldDescriptorProtoLabelToJSON(message.label); + } + if (message.type !== undefined && message.type !== 1) { + obj.type = fieldDescriptorProtoTypeToJSON(message.type); + } + if (message.type_name !== undefined && message.type_name !== "") { + obj.type_name = message.type_name; + } + if (message.extendee !== undefined && message.extendee !== "") { + obj.extendee = message.extendee; + } + if (message.default_value !== undefined && message.default_value !== "") { + obj.default_value = message.default_value; + } + if (message.oneof_index !== undefined && message.oneof_index !== 0) { + obj.oneof_index = Math.round(message.oneof_index); + } + if (message.json_name !== undefined && message.json_name !== "") { + obj.json_name = message.json_name; + } + if (message.options !== undefined) { + obj.options = FieldOptions.toJSON(message.options); + } + if (message.proto3_optional !== undefined && message.proto3_optional !== false) { + obj.proto3_optional = message.proto3_optional; + } + return obj; + }, + + create, I>>(base?: I): FieldDescriptorProto { + return FieldDescriptorProto.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): FieldDescriptorProto { + const message = createBaseFieldDescriptorProto(); + message.name = object.name ?? ""; + message.number = object.number ?? 0; + message.label = object.label ?? 1; + message.type = object.type ?? 1; + message.type_name = object.type_name ?? ""; + message.extendee = object.extendee ?? ""; + message.default_value = object.default_value ?? ""; + message.oneof_index = object.oneof_index ?? 0; + message.json_name = object.json_name ?? ""; + message.options = object.options !== undefined && object.options !== null ? FieldOptions.fromPartial(object.options) : undefined; + message.proto3_optional = object.proto3_optional ?? false; + return message; + }, +}; + +export const OneofDescriptorProto: MessageFns = { + $type: "google.protobuf.OneofDescriptorProto" as const, + + encode(message: OneofDescriptorProto, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== undefined && message.name !== "") { + writer.uint32(10).string(message.name); + } + if (message.options !== undefined) { + OneofOptions.encode(message.options, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): OneofDescriptorProto { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseOneofDescriptorProto(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.name = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.options = OneofOptions.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): OneofDescriptorProto { + return { + name: isSet(object.name) ? globalThis.String(object.name) : "", + options: isSet(object.options) ? OneofOptions.fromJSON(object.options) : undefined, + }; + }, + + toJSON(message: OneofDescriptorProto): unknown { + const obj: any = {}; + if (message.name !== undefined && message.name !== "") { + obj.name = message.name; + } + if (message.options !== undefined) { + obj.options = OneofOptions.toJSON(message.options); + } + return obj; + }, + + create, I>>(base?: I): OneofDescriptorProto { + return OneofDescriptorProto.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): OneofDescriptorProto { + const message = createBaseOneofDescriptorProto(); + message.name = object.name ?? ""; + message.options = object.options !== undefined && object.options !== null ? OneofOptions.fromPartial(object.options) : undefined; + return message; + }, +}; + +export const EnumDescriptorProto: MessageFns = { + $type: "google.protobuf.EnumDescriptorProto" as const, + + encode(message: EnumDescriptorProto, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== undefined && message.name !== "") { + writer.uint32(10).string(message.name); + } + for (const v of message.value) { + EnumValueDescriptorProto.encode(v!, writer.uint32(18).fork()).join(); + } + if (message.options !== undefined) { + EnumOptions.encode(message.options, writer.uint32(26).fork()).join(); + } + for (const v of message.reserved_range) { + EnumDescriptorProtoEnumReservedRange.encode(v!, writer.uint32(34).fork()).join(); + } + for (const v of message.reserved_name) { + writer.uint32(42).string(v!); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): EnumDescriptorProto { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEnumDescriptorProto(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.name = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.value.push(EnumValueDescriptorProto.decode(reader, reader.uint32())); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.options = EnumOptions.decode(reader, reader.uint32()); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.reserved_range.push(EnumDescriptorProtoEnumReservedRange.decode(reader, reader.uint32())); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.reserved_name.push(reader.string()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): EnumDescriptorProto { + return { + name: isSet(object.name) ? globalThis.String(object.name) : "", + value: globalThis.Array.isArray(object?.value) ? object.value.map((e: any) => EnumValueDescriptorProto.fromJSON(e)) : [], + options: isSet(object.options) ? EnumOptions.fromJSON(object.options) : undefined, + reserved_range: globalThis.Array.isArray(object?.reserved_range) + ? object.reserved_range.map((e: any) => EnumDescriptorProtoEnumReservedRange.fromJSON(e)) + : [], + reserved_name: globalThis.Array.isArray(object?.reserved_name) ? object.reserved_name.map((e: any) => globalThis.String(e)) : [], + }; + }, + + toJSON(message: EnumDescriptorProto): unknown { + const obj: any = {}; + if (message.name !== undefined && message.name !== "") { + obj.name = message.name; + } + if (message.value?.length) { + obj.value = message.value.map((e) => EnumValueDescriptorProto.toJSON(e)); + } + if (message.options !== undefined) { + obj.options = EnumOptions.toJSON(message.options); + } + if (message.reserved_range?.length) { + obj.reserved_range = message.reserved_range.map((e) => EnumDescriptorProtoEnumReservedRange.toJSON(e)); + } + if (message.reserved_name?.length) { + obj.reserved_name = message.reserved_name; + } + return obj; + }, + + create, I>>(base?: I): EnumDescriptorProto { + return EnumDescriptorProto.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): EnumDescriptorProto { + const message = createBaseEnumDescriptorProto(); + message.name = object.name ?? ""; + message.value = object.value?.map((e) => EnumValueDescriptorProto.fromPartial(e)) || []; + message.options = object.options !== undefined && object.options !== null ? EnumOptions.fromPartial(object.options) : undefined; + message.reserved_range = object.reserved_range?.map((e) => EnumDescriptorProtoEnumReservedRange.fromPartial(e)) || []; + message.reserved_name = object.reserved_name?.map((e) => e) || []; + return message; + }, +}; + +export const EnumDescriptorProtoEnumReservedRange: MessageFns = { + $type: "google.protobuf.EnumDescriptorProto.EnumReservedRange" as const, + + encode(message: EnumDescriptorProtoEnumReservedRange, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.start !== undefined && message.start !== 0) { + writer.uint32(8).int32(message.start); + } + if (message.end !== undefined && message.end !== 0) { + writer.uint32(16).int32(message.end); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): EnumDescriptorProtoEnumReservedRange { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEnumDescriptorProtoEnumReservedRange(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.start = reader.int32(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.end = reader.int32(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): EnumDescriptorProtoEnumReservedRange { + return { + start: isSet(object.start) ? globalThis.Number(object.start) : 0, + end: isSet(object.end) ? globalThis.Number(object.end) : 0, + }; + }, + + toJSON(message: EnumDescriptorProtoEnumReservedRange): unknown { + const obj: any = {}; + if (message.start !== undefined && message.start !== 0) { + obj.start = Math.round(message.start); + } + if (message.end !== undefined && message.end !== 0) { + obj.end = Math.round(message.end); + } + return obj; + }, + + create, I>>(base?: I): EnumDescriptorProtoEnumReservedRange { + return EnumDescriptorProtoEnumReservedRange.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): EnumDescriptorProtoEnumReservedRange { + const message = createBaseEnumDescriptorProtoEnumReservedRange(); + message.start = object.start ?? 0; + message.end = object.end ?? 0; + return message; + }, +}; + +export const EnumValueDescriptorProto: MessageFns = { + $type: "google.protobuf.EnumValueDescriptorProto" as const, + + encode(message: EnumValueDescriptorProto, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== undefined && message.name !== "") { + writer.uint32(10).string(message.name); + } + if (message.number !== undefined && message.number !== 0) { + writer.uint32(16).int32(message.number); + } + if (message.options !== undefined) { + EnumValueOptions.encode(message.options, writer.uint32(26).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): EnumValueDescriptorProto { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEnumValueDescriptorProto(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.name = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.number = reader.int32(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.options = EnumValueOptions.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): EnumValueDescriptorProto { + return { + name: isSet(object.name) ? globalThis.String(object.name) : "", + number: isSet(object.number) ? globalThis.Number(object.number) : 0, + options: isSet(object.options) ? EnumValueOptions.fromJSON(object.options) : undefined, + }; + }, + + toJSON(message: EnumValueDescriptorProto): unknown { + const obj: any = {}; + if (message.name !== undefined && message.name !== "") { + obj.name = message.name; + } + if (message.number !== undefined && message.number !== 0) { + obj.number = Math.round(message.number); + } + if (message.options !== undefined) { + obj.options = EnumValueOptions.toJSON(message.options); + } + return obj; + }, + + create, I>>(base?: I): EnumValueDescriptorProto { + return EnumValueDescriptorProto.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): EnumValueDescriptorProto { + const message = createBaseEnumValueDescriptorProto(); + message.name = object.name ?? ""; + message.number = object.number ?? 0; + message.options = object.options !== undefined && object.options !== null ? EnumValueOptions.fromPartial(object.options) : undefined; + return message; + }, +}; + +export const ServiceDescriptorProto: MessageFns = { + $type: "google.protobuf.ServiceDescriptorProto" as const, + + encode(message: ServiceDescriptorProto, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== undefined && message.name !== "") { + writer.uint32(10).string(message.name); + } + for (const v of message.method) { + MethodDescriptorProto.encode(v!, writer.uint32(18).fork()).join(); + } + if (message.options !== undefined) { + ServiceOptions.encode(message.options, writer.uint32(26).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ServiceDescriptorProto { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseServiceDescriptorProto(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.name = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.method.push(MethodDescriptorProto.decode(reader, reader.uint32())); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.options = ServiceOptions.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ServiceDescriptorProto { + return { + name: isSet(object.name) ? globalThis.String(object.name) : "", + method: globalThis.Array.isArray(object?.method) ? object.method.map((e: any) => MethodDescriptorProto.fromJSON(e)) : [], + options: isSet(object.options) ? ServiceOptions.fromJSON(object.options) : undefined, + }; + }, + + toJSON(message: ServiceDescriptorProto): unknown { + const obj: any = {}; + if (message.name !== undefined && message.name !== "") { + obj.name = message.name; + } + if (message.method?.length) { + obj.method = message.method.map((e) => MethodDescriptorProto.toJSON(e)); + } + if (message.options !== undefined) { + obj.options = ServiceOptions.toJSON(message.options); + } + return obj; + }, + + create, I>>(base?: I): ServiceDescriptorProto { + return ServiceDescriptorProto.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ServiceDescriptorProto { + const message = createBaseServiceDescriptorProto(); + message.name = object.name ?? ""; + message.method = object.method?.map((e) => MethodDescriptorProto.fromPartial(e)) || []; + message.options = object.options !== undefined && object.options !== null ? ServiceOptions.fromPartial(object.options) : undefined; + return message; + }, +}; + +export const MethodDescriptorProto: MessageFns = { + $type: "google.protobuf.MethodDescriptorProto" as const, + + encode(message: MethodDescriptorProto, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== undefined && message.name !== "") { + writer.uint32(10).string(message.name); + } + if (message.input_type !== undefined && message.input_type !== "") { + writer.uint32(18).string(message.input_type); + } + if (message.output_type !== undefined && message.output_type !== "") { + writer.uint32(26).string(message.output_type); + } + if (message.options !== undefined) { + MethodOptions.encode(message.options, writer.uint32(34).fork()).join(); + } + if (message.client_streaming !== undefined && message.client_streaming !== false) { + writer.uint32(40).bool(message.client_streaming); + } + if (message.server_streaming !== undefined && message.server_streaming !== false) { + writer.uint32(48).bool(message.server_streaming); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MethodDescriptorProto { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMethodDescriptorProto(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.name = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.input_type = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.output_type = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.options = MethodOptions.decode(reader, reader.uint32()); + continue; + case 5: + if (tag !== 40) { + break; + } + + message.client_streaming = reader.bool(); + continue; + case 6: + if (tag !== 48) { + break; + } + + message.server_streaming = reader.bool(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MethodDescriptorProto { + return { + name: isSet(object.name) ? globalThis.String(object.name) : "", + input_type: isSet(object.input_type) ? globalThis.String(object.input_type) : "", + output_type: isSet(object.output_type) ? globalThis.String(object.output_type) : "", + options: isSet(object.options) ? MethodOptions.fromJSON(object.options) : undefined, + client_streaming: isSet(object.client_streaming) ? globalThis.Boolean(object.client_streaming) : false, + server_streaming: isSet(object.server_streaming) ? globalThis.Boolean(object.server_streaming) : false, + }; + }, + + toJSON(message: MethodDescriptorProto): unknown { + const obj: any = {}; + if (message.name !== undefined && message.name !== "") { + obj.name = message.name; + } + if (message.input_type !== undefined && message.input_type !== "") { + obj.input_type = message.input_type; + } + if (message.output_type !== undefined && message.output_type !== "") { + obj.output_type = message.output_type; + } + if (message.options !== undefined) { + obj.options = MethodOptions.toJSON(message.options); + } + if (message.client_streaming !== undefined && message.client_streaming !== false) { + obj.client_streaming = message.client_streaming; + } + if (message.server_streaming !== undefined && message.server_streaming !== false) { + obj.server_streaming = message.server_streaming; + } + return obj; + }, + + create, I>>(base?: I): MethodDescriptorProto { + return MethodDescriptorProto.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MethodDescriptorProto { + const message = createBaseMethodDescriptorProto(); + message.name = object.name ?? ""; + message.input_type = object.input_type ?? ""; + message.output_type = object.output_type ?? ""; + message.options = object.options !== undefined && object.options !== null ? MethodOptions.fromPartial(object.options) : undefined; + message.client_streaming = object.client_streaming ?? false; + message.server_streaming = object.server_streaming ?? false; + return message; + }, +}; + +export const FileOptions: MessageFns = { + $type: "google.protobuf.FileOptions" as const, + + encode(message: FileOptions, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.java_package !== undefined && message.java_package !== "") { + writer.uint32(10).string(message.java_package); + } + if (message.java_outer_classname !== undefined && message.java_outer_classname !== "") { + writer.uint32(66).string(message.java_outer_classname); + } + if (message.java_multiple_files !== undefined && message.java_multiple_files !== false) { + writer.uint32(80).bool(message.java_multiple_files); + } + if (message.java_generate_equals_and_hash !== undefined && message.java_generate_equals_and_hash !== false) { + writer.uint32(160).bool(message.java_generate_equals_and_hash); + } + if (message.java_string_check_utf8 !== undefined && message.java_string_check_utf8 !== false) { + writer.uint32(216).bool(message.java_string_check_utf8); + } + if (message.optimize_for !== undefined && message.optimize_for !== 1) { + writer.uint32(72).int32(message.optimize_for); + } + if (message.go_package !== undefined && message.go_package !== "") { + writer.uint32(90).string(message.go_package); + } + if (message.cc_generic_services !== undefined && message.cc_generic_services !== false) { + writer.uint32(128).bool(message.cc_generic_services); + } + if (message.java_generic_services !== undefined && message.java_generic_services !== false) { + writer.uint32(136).bool(message.java_generic_services); + } + if (message.py_generic_services !== undefined && message.py_generic_services !== false) { + writer.uint32(144).bool(message.py_generic_services); + } + if (message.deprecated !== undefined && message.deprecated !== false) { + writer.uint32(184).bool(message.deprecated); + } + if (message.cc_enable_arenas !== undefined && message.cc_enable_arenas !== true) { + writer.uint32(248).bool(message.cc_enable_arenas); + } + if (message.objc_class_prefix !== undefined && message.objc_class_prefix !== "") { + writer.uint32(290).string(message.objc_class_prefix); + } + if (message.csharp_namespace !== undefined && message.csharp_namespace !== "") { + writer.uint32(298).string(message.csharp_namespace); + } + if (message.swift_prefix !== undefined && message.swift_prefix !== "") { + writer.uint32(314).string(message.swift_prefix); + } + if (message.php_class_prefix !== undefined && message.php_class_prefix !== "") { + writer.uint32(322).string(message.php_class_prefix); + } + if (message.php_namespace !== undefined && message.php_namespace !== "") { + writer.uint32(330).string(message.php_namespace); + } + if (message.php_metadata_namespace !== undefined && message.php_metadata_namespace !== "") { + writer.uint32(354).string(message.php_metadata_namespace); + } + if (message.ruby_package !== undefined && message.ruby_package !== "") { + writer.uint32(362).string(message.ruby_package); + } + if (message.features !== undefined) { + FeatureSet.encode(message.features, writer.uint32(402).fork()).join(); + } + for (const v of message.uninterpreted_option) { + UninterpretedOption.encode(v!, writer.uint32(7994).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): FileOptions { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseFileOptions(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.java_package = reader.string(); + continue; + case 8: + if (tag !== 66) { + break; + } + + message.java_outer_classname = reader.string(); + continue; + case 10: + if (tag !== 80) { + break; + } + + message.java_multiple_files = reader.bool(); + continue; + case 20: + if (tag !== 160) { + break; + } + + message.java_generate_equals_and_hash = reader.bool(); + continue; + case 27: + if (tag !== 216) { + break; + } + + message.java_string_check_utf8 = reader.bool(); + continue; + case 9: + if (tag !== 72) { + break; + } + + message.optimize_for = reader.int32() as any; + continue; + case 11: + if (tag !== 90) { + break; + } + + message.go_package = reader.string(); + continue; + case 16: + if (tag !== 128) { + break; + } + + message.cc_generic_services = reader.bool(); + continue; + case 17: + if (tag !== 136) { + break; + } + + message.java_generic_services = reader.bool(); + continue; + case 18: + if (tag !== 144) { + break; + } + + message.py_generic_services = reader.bool(); + continue; + case 23: + if (tag !== 184) { + break; + } + + message.deprecated = reader.bool(); + continue; + case 31: + if (tag !== 248) { + break; + } + + message.cc_enable_arenas = reader.bool(); + continue; + case 36: + if (tag !== 290) { + break; + } + + message.objc_class_prefix = reader.string(); + continue; + case 37: + if (tag !== 298) { + break; + } + + message.csharp_namespace = reader.string(); + continue; + case 39: + if (tag !== 314) { + break; + } + + message.swift_prefix = reader.string(); + continue; + case 40: + if (tag !== 322) { + break; + } + + message.php_class_prefix = reader.string(); + continue; + case 41: + if (tag !== 330) { + break; + } + + message.php_namespace = reader.string(); + continue; + case 44: + if (tag !== 354) { + break; + } + + message.php_metadata_namespace = reader.string(); + continue; + case 45: + if (tag !== 362) { + break; + } + + message.ruby_package = reader.string(); + continue; + case 50: + if (tag !== 402) { + break; + } + + message.features = FeatureSet.decode(reader, reader.uint32()); + continue; + case 999: + if (tag !== 7994) { + break; + } + + message.uninterpreted_option.push(UninterpretedOption.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): FileOptions { + return { + java_package: isSet(object.java_package) ? globalThis.String(object.java_package) : "", + java_outer_classname: isSet(object.java_outer_classname) ? globalThis.String(object.java_outer_classname) : "", + java_multiple_files: isSet(object.java_multiple_files) ? globalThis.Boolean(object.java_multiple_files) : false, + java_generate_equals_and_hash: isSet(object.java_generate_equals_and_hash) ? globalThis.Boolean(object.java_generate_equals_and_hash) : false, + java_string_check_utf8: isSet(object.java_string_check_utf8) ? globalThis.Boolean(object.java_string_check_utf8) : false, + optimize_for: isSet(object.optimize_for) ? fileOptionsOptimizeModeFromJSON(object.optimize_for) : 1, + go_package: isSet(object.go_package) ? globalThis.String(object.go_package) : "", + cc_generic_services: isSet(object.cc_generic_services) ? globalThis.Boolean(object.cc_generic_services) : false, + java_generic_services: isSet(object.java_generic_services) ? globalThis.Boolean(object.java_generic_services) : false, + py_generic_services: isSet(object.py_generic_services) ? globalThis.Boolean(object.py_generic_services) : false, + deprecated: isSet(object.deprecated) ? globalThis.Boolean(object.deprecated) : false, + cc_enable_arenas: isSet(object.cc_enable_arenas) ? globalThis.Boolean(object.cc_enable_arenas) : true, + objc_class_prefix: isSet(object.objc_class_prefix) ? globalThis.String(object.objc_class_prefix) : "", + csharp_namespace: isSet(object.csharp_namespace) ? globalThis.String(object.csharp_namespace) : "", + swift_prefix: isSet(object.swift_prefix) ? globalThis.String(object.swift_prefix) : "", + php_class_prefix: isSet(object.php_class_prefix) ? globalThis.String(object.php_class_prefix) : "", + php_namespace: isSet(object.php_namespace) ? globalThis.String(object.php_namespace) : "", + php_metadata_namespace: isSet(object.php_metadata_namespace) ? globalThis.String(object.php_metadata_namespace) : "", + ruby_package: isSet(object.ruby_package) ? globalThis.String(object.ruby_package) : "", + features: isSet(object.features) ? FeatureSet.fromJSON(object.features) : undefined, + uninterpreted_option: globalThis.Array.isArray(object?.uninterpreted_option) + ? object.uninterpreted_option.map((e: any) => UninterpretedOption.fromJSON(e)) + : [], + }; + }, + + toJSON(message: FileOptions): unknown { + const obj: any = {}; + if (message.java_package !== undefined && message.java_package !== "") { + obj.java_package = message.java_package; + } + if (message.java_outer_classname !== undefined && message.java_outer_classname !== "") { + obj.java_outer_classname = message.java_outer_classname; + } + if (message.java_multiple_files !== undefined && message.java_multiple_files !== false) { + obj.java_multiple_files = message.java_multiple_files; + } + if (message.java_generate_equals_and_hash !== undefined && message.java_generate_equals_and_hash !== false) { + obj.java_generate_equals_and_hash = message.java_generate_equals_and_hash; + } + if (message.java_string_check_utf8 !== undefined && message.java_string_check_utf8 !== false) { + obj.java_string_check_utf8 = message.java_string_check_utf8; + } + if (message.optimize_for !== undefined && message.optimize_for !== 1) { + obj.optimize_for = fileOptionsOptimizeModeToJSON(message.optimize_for); + } + if (message.go_package !== undefined && message.go_package !== "") { + obj.go_package = message.go_package; + } + if (message.cc_generic_services !== undefined && message.cc_generic_services !== false) { + obj.cc_generic_services = message.cc_generic_services; + } + if (message.java_generic_services !== undefined && message.java_generic_services !== false) { + obj.java_generic_services = message.java_generic_services; + } + if (message.py_generic_services !== undefined && message.py_generic_services !== false) { + obj.py_generic_services = message.py_generic_services; + } + if (message.deprecated !== undefined && message.deprecated !== false) { + obj.deprecated = message.deprecated; + } + if (message.cc_enable_arenas !== undefined && message.cc_enable_arenas !== true) { + obj.cc_enable_arenas = message.cc_enable_arenas; + } + if (message.objc_class_prefix !== undefined && message.objc_class_prefix !== "") { + obj.objc_class_prefix = message.objc_class_prefix; + } + if (message.csharp_namespace !== undefined && message.csharp_namespace !== "") { + obj.csharp_namespace = message.csharp_namespace; + } + if (message.swift_prefix !== undefined && message.swift_prefix !== "") { + obj.swift_prefix = message.swift_prefix; + } + if (message.php_class_prefix !== undefined && message.php_class_prefix !== "") { + obj.php_class_prefix = message.php_class_prefix; + } + if (message.php_namespace !== undefined && message.php_namespace !== "") { + obj.php_namespace = message.php_namespace; + } + if (message.php_metadata_namespace !== undefined && message.php_metadata_namespace !== "") { + obj.php_metadata_namespace = message.php_metadata_namespace; + } + if (message.ruby_package !== undefined && message.ruby_package !== "") { + obj.ruby_package = message.ruby_package; + } + if (message.features !== undefined) { + obj.features = FeatureSet.toJSON(message.features); + } + if (message.uninterpreted_option?.length) { + obj.uninterpreted_option = message.uninterpreted_option.map((e) => UninterpretedOption.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): FileOptions { + return FileOptions.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): FileOptions { + const message = createBaseFileOptions(); + message.java_package = object.java_package ?? ""; + message.java_outer_classname = object.java_outer_classname ?? ""; + message.java_multiple_files = object.java_multiple_files ?? false; + message.java_generate_equals_and_hash = object.java_generate_equals_and_hash ?? false; + message.java_string_check_utf8 = object.java_string_check_utf8 ?? false; + message.optimize_for = object.optimize_for ?? 1; + message.go_package = object.go_package ?? ""; + message.cc_generic_services = object.cc_generic_services ?? false; + message.java_generic_services = object.java_generic_services ?? false; + message.py_generic_services = object.py_generic_services ?? false; + message.deprecated = object.deprecated ?? false; + message.cc_enable_arenas = object.cc_enable_arenas ?? true; + message.objc_class_prefix = object.objc_class_prefix ?? ""; + message.csharp_namespace = object.csharp_namespace ?? ""; + message.swift_prefix = object.swift_prefix ?? ""; + message.php_class_prefix = object.php_class_prefix ?? ""; + message.php_namespace = object.php_namespace ?? ""; + message.php_metadata_namespace = object.php_metadata_namespace ?? ""; + message.ruby_package = object.ruby_package ?? ""; + message.features = object.features !== undefined && object.features !== null ? FeatureSet.fromPartial(object.features) : undefined; + message.uninterpreted_option = object.uninterpreted_option?.map((e) => UninterpretedOption.fromPartial(e)) || []; + return message; + }, +}; + +export const MessageOptions: MessageFns = { + $type: "google.protobuf.MessageOptions" as const, + + encode(message: MessageOptions, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.message_set_wire_format !== undefined && message.message_set_wire_format !== false) { + writer.uint32(8).bool(message.message_set_wire_format); + } + if (message.no_standard_descriptor_accessor !== undefined && message.no_standard_descriptor_accessor !== false) { + writer.uint32(16).bool(message.no_standard_descriptor_accessor); + } + if (message.deprecated !== undefined && message.deprecated !== false) { + writer.uint32(24).bool(message.deprecated); + } + if (message.map_entry !== undefined && message.map_entry !== false) { + writer.uint32(56).bool(message.map_entry); + } + if (message.deprecated_legacy_json_field_conflicts !== undefined && message.deprecated_legacy_json_field_conflicts !== false) { + writer.uint32(88).bool(message.deprecated_legacy_json_field_conflicts); + } + if (message.features !== undefined) { + FeatureSet.encode(message.features, writer.uint32(98).fork()).join(); + } + for (const v of message.uninterpreted_option) { + UninterpretedOption.encode(v!, writer.uint32(7994).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MessageOptions { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMessageOptions(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.message_set_wire_format = reader.bool(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.no_standard_descriptor_accessor = reader.bool(); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.deprecated = reader.bool(); + continue; + case 7: + if (tag !== 56) { + break; + } + + message.map_entry = reader.bool(); + continue; + case 11: + if (tag !== 88) { + break; + } + + message.deprecated_legacy_json_field_conflicts = reader.bool(); + continue; + case 12: + if (tag !== 98) { + break; + } + + message.features = FeatureSet.decode(reader, reader.uint32()); + continue; + case 999: + if (tag !== 7994) { + break; + } + + message.uninterpreted_option.push(UninterpretedOption.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MessageOptions { + return { + message_set_wire_format: isSet(object.message_set_wire_format) ? globalThis.Boolean(object.message_set_wire_format) : false, + no_standard_descriptor_accessor: isSet(object.no_standard_descriptor_accessor) ? globalThis.Boolean(object.no_standard_descriptor_accessor) : false, + deprecated: isSet(object.deprecated) ? globalThis.Boolean(object.deprecated) : false, + map_entry: isSet(object.map_entry) ? globalThis.Boolean(object.map_entry) : false, + deprecated_legacy_json_field_conflicts: isSet(object.deprecated_legacy_json_field_conflicts) + ? globalThis.Boolean(object.deprecated_legacy_json_field_conflicts) + : false, + features: isSet(object.features) ? FeatureSet.fromJSON(object.features) : undefined, + uninterpreted_option: globalThis.Array.isArray(object?.uninterpreted_option) + ? object.uninterpreted_option.map((e: any) => UninterpretedOption.fromJSON(e)) + : [], + }; + }, + + toJSON(message: MessageOptions): unknown { + const obj: any = {}; + if (message.message_set_wire_format !== undefined && message.message_set_wire_format !== false) { + obj.message_set_wire_format = message.message_set_wire_format; + } + if (message.no_standard_descriptor_accessor !== undefined && message.no_standard_descriptor_accessor !== false) { + obj.no_standard_descriptor_accessor = message.no_standard_descriptor_accessor; + } + if (message.deprecated !== undefined && message.deprecated !== false) { + obj.deprecated = message.deprecated; + } + if (message.map_entry !== undefined && message.map_entry !== false) { + obj.map_entry = message.map_entry; + } + if (message.deprecated_legacy_json_field_conflicts !== undefined && message.deprecated_legacy_json_field_conflicts !== false) { + obj.deprecated_legacy_json_field_conflicts = message.deprecated_legacy_json_field_conflicts; + } + if (message.features !== undefined) { + obj.features = FeatureSet.toJSON(message.features); + } + if (message.uninterpreted_option?.length) { + obj.uninterpreted_option = message.uninterpreted_option.map((e) => UninterpretedOption.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): MessageOptions { + return MessageOptions.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MessageOptions { + const message = createBaseMessageOptions(); + message.message_set_wire_format = object.message_set_wire_format ?? false; + message.no_standard_descriptor_accessor = object.no_standard_descriptor_accessor ?? false; + message.deprecated = object.deprecated ?? false; + message.map_entry = object.map_entry ?? false; + message.deprecated_legacy_json_field_conflicts = object.deprecated_legacy_json_field_conflicts ?? false; + message.features = object.features !== undefined && object.features !== null ? FeatureSet.fromPartial(object.features) : undefined; + message.uninterpreted_option = object.uninterpreted_option?.map((e) => UninterpretedOption.fromPartial(e)) || []; + return message; + }, +}; + +export const FieldOptions: MessageFns = { + $type: "google.protobuf.FieldOptions" as const, + + encode(message: FieldOptions, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.ctype !== undefined && message.ctype !== 0) { + writer.uint32(8).int32(message.ctype); + } + if (message.packed !== undefined && message.packed !== false) { + writer.uint32(16).bool(message.packed); + } + if (message.jstype !== undefined && message.jstype !== 0) { + writer.uint32(48).int32(message.jstype); + } + if (message.lazy !== undefined && message.lazy !== false) { + writer.uint32(40).bool(message.lazy); + } + if (message.unverified_lazy !== undefined && message.unverified_lazy !== false) { + writer.uint32(120).bool(message.unverified_lazy); + } + if (message.deprecated !== undefined && message.deprecated !== false) { + writer.uint32(24).bool(message.deprecated); + } + if (message.weak !== undefined && message.weak !== false) { + writer.uint32(80).bool(message.weak); + } + if (message.debug_redact !== undefined && message.debug_redact !== false) { + writer.uint32(128).bool(message.debug_redact); + } + if (message.retention !== undefined && message.retention !== 0) { + writer.uint32(136).int32(message.retention); + } + writer.uint32(154).fork(); + for (const v of message.targets) { + writer.int32(v); + } + writer.join(); + for (const v of message.edition_defaults) { + FieldOptionsEditionDefault.encode(v!, writer.uint32(162).fork()).join(); + } + if (message.features !== undefined) { + FeatureSet.encode(message.features, writer.uint32(170).fork()).join(); + } + if (message.feature_support !== undefined) { + FieldOptionsFeatureSupport.encode(message.feature_support, writer.uint32(178).fork()).join(); + } + for (const v of message.uninterpreted_option) { + UninterpretedOption.encode(v!, writer.uint32(7994).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): FieldOptions { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseFieldOptions(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.ctype = reader.int32() as any; + continue; + case 2: + if (tag !== 16) { + break; + } + + message.packed = reader.bool(); + continue; + case 6: + if (tag !== 48) { + break; + } + + message.jstype = reader.int32() as any; + continue; + case 5: + if (tag !== 40) { + break; + } + + message.lazy = reader.bool(); + continue; + case 15: + if (tag !== 120) { + break; + } + + message.unverified_lazy = reader.bool(); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.deprecated = reader.bool(); + continue; + case 10: + if (tag !== 80) { + break; + } + + message.weak = reader.bool(); + continue; + case 16: + if (tag !== 128) { + break; + } + + message.debug_redact = reader.bool(); + continue; + case 17: + if (tag !== 136) { + break; + } + + message.retention = reader.int32() as any; + continue; + case 19: + if (tag === 152) { + message.targets.push(reader.int32() as any); + + continue; + } + + if (tag === 154) { + const end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) { + message.targets.push(reader.int32() as any); + } + + continue; + } + + break; + case 20: + if (tag !== 162) { + break; + } + + message.edition_defaults.push(FieldOptionsEditionDefault.decode(reader, reader.uint32())); + continue; + case 21: + if (tag !== 170) { + break; + } + + message.features = FeatureSet.decode(reader, reader.uint32()); + continue; + case 22: + if (tag !== 178) { + break; + } + + message.feature_support = FieldOptionsFeatureSupport.decode(reader, reader.uint32()); + continue; + case 999: + if (tag !== 7994) { + break; + } + + message.uninterpreted_option.push(UninterpretedOption.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): FieldOptions { + return { + ctype: isSet(object.ctype) ? fieldOptionsCTypeFromJSON(object.ctype) : 0, + packed: isSet(object.packed) ? globalThis.Boolean(object.packed) : false, + jstype: isSet(object.jstype) ? fieldOptionsJSTypeFromJSON(object.jstype) : 0, + lazy: isSet(object.lazy) ? globalThis.Boolean(object.lazy) : false, + unverified_lazy: isSet(object.unverified_lazy) ? globalThis.Boolean(object.unverified_lazy) : false, + deprecated: isSet(object.deprecated) ? globalThis.Boolean(object.deprecated) : false, + weak: isSet(object.weak) ? globalThis.Boolean(object.weak) : false, + debug_redact: isSet(object.debug_redact) ? globalThis.Boolean(object.debug_redact) : false, + retention: isSet(object.retention) ? fieldOptionsOptionRetentionFromJSON(object.retention) : 0, + targets: globalThis.Array.isArray(object?.targets) ? object.targets.map((e: any) => fieldOptionsOptionTargetTypeFromJSON(e)) : [], + edition_defaults: globalThis.Array.isArray(object?.edition_defaults) + ? object.edition_defaults.map((e: any) => FieldOptionsEditionDefault.fromJSON(e)) + : [], + features: isSet(object.features) ? FeatureSet.fromJSON(object.features) : undefined, + feature_support: isSet(object.feature_support) ? FieldOptionsFeatureSupport.fromJSON(object.feature_support) : undefined, + uninterpreted_option: globalThis.Array.isArray(object?.uninterpreted_option) + ? object.uninterpreted_option.map((e: any) => UninterpretedOption.fromJSON(e)) + : [], + }; + }, + + toJSON(message: FieldOptions): unknown { + const obj: any = {}; + if (message.ctype !== undefined && message.ctype !== 0) { + obj.ctype = fieldOptionsCTypeToJSON(message.ctype); + } + if (message.packed !== undefined && message.packed !== false) { + obj.packed = message.packed; + } + if (message.jstype !== undefined && message.jstype !== 0) { + obj.jstype = fieldOptionsJSTypeToJSON(message.jstype); + } + if (message.lazy !== undefined && message.lazy !== false) { + obj.lazy = message.lazy; + } + if (message.unverified_lazy !== undefined && message.unverified_lazy !== false) { + obj.unverified_lazy = message.unverified_lazy; + } + if (message.deprecated !== undefined && message.deprecated !== false) { + obj.deprecated = message.deprecated; + } + if (message.weak !== undefined && message.weak !== false) { + obj.weak = message.weak; + } + if (message.debug_redact !== undefined && message.debug_redact !== false) { + obj.debug_redact = message.debug_redact; + } + if (message.retention !== undefined && message.retention !== 0) { + obj.retention = fieldOptionsOptionRetentionToJSON(message.retention); + } + if (message.targets?.length) { + obj.targets = message.targets.map((e) => fieldOptionsOptionTargetTypeToJSON(e)); + } + if (message.edition_defaults?.length) { + obj.edition_defaults = message.edition_defaults.map((e) => FieldOptionsEditionDefault.toJSON(e)); + } + if (message.features !== undefined) { + obj.features = FeatureSet.toJSON(message.features); + } + if (message.feature_support !== undefined) { + obj.feature_support = FieldOptionsFeatureSupport.toJSON(message.feature_support); + } + if (message.uninterpreted_option?.length) { + obj.uninterpreted_option = message.uninterpreted_option.map((e) => UninterpretedOption.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): FieldOptions { + return FieldOptions.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): FieldOptions { + const message = createBaseFieldOptions(); + message.ctype = object.ctype ?? 0; + message.packed = object.packed ?? false; + message.jstype = object.jstype ?? 0; + message.lazy = object.lazy ?? false; + message.unverified_lazy = object.unverified_lazy ?? false; + message.deprecated = object.deprecated ?? false; + message.weak = object.weak ?? false; + message.debug_redact = object.debug_redact ?? false; + message.retention = object.retention ?? 0; + message.targets = object.targets?.map((e) => e) || []; + message.edition_defaults = object.edition_defaults?.map((e) => FieldOptionsEditionDefault.fromPartial(e)) || []; + message.features = object.features !== undefined && object.features !== null ? FeatureSet.fromPartial(object.features) : undefined; + message.feature_support = + object.feature_support !== undefined && object.feature_support !== null ? FieldOptionsFeatureSupport.fromPartial(object.feature_support) : undefined; + message.uninterpreted_option = object.uninterpreted_option?.map((e) => UninterpretedOption.fromPartial(e)) || []; + return message; + }, +}; + +export const FieldOptionsEditionDefault: MessageFns = { + $type: "google.protobuf.FieldOptions.EditionDefault" as const, + + encode(message: FieldOptionsEditionDefault, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.edition !== undefined && message.edition !== 0) { + writer.uint32(24).int32(message.edition); + } + if (message.value !== undefined && message.value !== "") { + writer.uint32(18).string(message.value); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): FieldOptionsEditionDefault { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseFieldOptionsEditionDefault(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 3: + if (tag !== 24) { + break; + } + + message.edition = reader.int32() as any; + continue; + case 2: + if (tag !== 18) { + break; + } + + message.value = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): FieldOptionsEditionDefault { + return { + edition: isSet(object.edition) ? editionFromJSON(object.edition) : 0, + value: isSet(object.value) ? globalThis.String(object.value) : "", + }; + }, + + toJSON(message: FieldOptionsEditionDefault): unknown { + const obj: any = {}; + if (message.edition !== undefined && message.edition !== 0) { + obj.edition = editionToJSON(message.edition); + } + if (message.value !== undefined && message.value !== "") { + obj.value = message.value; + } + return obj; + }, + + create, I>>(base?: I): FieldOptionsEditionDefault { + return FieldOptionsEditionDefault.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): FieldOptionsEditionDefault { + const message = createBaseFieldOptionsEditionDefault(); + message.edition = object.edition ?? 0; + message.value = object.value ?? ""; + return message; + }, +}; + +export const FieldOptionsFeatureSupport: MessageFns = { + $type: "google.protobuf.FieldOptions.FeatureSupport" as const, + + encode(message: FieldOptionsFeatureSupport, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.edition_introduced !== undefined && message.edition_introduced !== 0) { + writer.uint32(8).int32(message.edition_introduced); + } + if (message.edition_deprecated !== undefined && message.edition_deprecated !== 0) { + writer.uint32(16).int32(message.edition_deprecated); + } + if (message.deprecation_warning !== undefined && message.deprecation_warning !== "") { + writer.uint32(26).string(message.deprecation_warning); + } + if (message.edition_removed !== undefined && message.edition_removed !== 0) { + writer.uint32(32).int32(message.edition_removed); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): FieldOptionsFeatureSupport { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseFieldOptionsFeatureSupport(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.edition_introduced = reader.int32() as any; + continue; + case 2: + if (tag !== 16) { + break; + } + + message.edition_deprecated = reader.int32() as any; + continue; + case 3: + if (tag !== 26) { + break; + } + + message.deprecation_warning = reader.string(); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.edition_removed = reader.int32() as any; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): FieldOptionsFeatureSupport { + return { + edition_introduced: isSet(object.edition_introduced) ? editionFromJSON(object.edition_introduced) : 0, + edition_deprecated: isSet(object.edition_deprecated) ? editionFromJSON(object.edition_deprecated) : 0, + deprecation_warning: isSet(object.deprecation_warning) ? globalThis.String(object.deprecation_warning) : "", + edition_removed: isSet(object.edition_removed) ? editionFromJSON(object.edition_removed) : 0, + }; + }, + + toJSON(message: FieldOptionsFeatureSupport): unknown { + const obj: any = {}; + if (message.edition_introduced !== undefined && message.edition_introduced !== 0) { + obj.edition_introduced = editionToJSON(message.edition_introduced); + } + if (message.edition_deprecated !== undefined && message.edition_deprecated !== 0) { + obj.edition_deprecated = editionToJSON(message.edition_deprecated); + } + if (message.deprecation_warning !== undefined && message.deprecation_warning !== "") { + obj.deprecation_warning = message.deprecation_warning; + } + if (message.edition_removed !== undefined && message.edition_removed !== 0) { + obj.edition_removed = editionToJSON(message.edition_removed); + } + return obj; + }, + + create, I>>(base?: I): FieldOptionsFeatureSupport { + return FieldOptionsFeatureSupport.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): FieldOptionsFeatureSupport { + const message = createBaseFieldOptionsFeatureSupport(); + message.edition_introduced = object.edition_introduced ?? 0; + message.edition_deprecated = object.edition_deprecated ?? 0; + message.deprecation_warning = object.deprecation_warning ?? ""; + message.edition_removed = object.edition_removed ?? 0; + return message; + }, +}; + +export const OneofOptions: MessageFns = { + $type: "google.protobuf.OneofOptions" as const, + + encode(message: OneofOptions, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.features !== undefined) { + FeatureSet.encode(message.features, writer.uint32(10).fork()).join(); + } + for (const v of message.uninterpreted_option) { + UninterpretedOption.encode(v!, writer.uint32(7994).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): OneofOptions { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseOneofOptions(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.features = FeatureSet.decode(reader, reader.uint32()); + continue; + case 999: + if (tag !== 7994) { + break; + } + + message.uninterpreted_option.push(UninterpretedOption.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): OneofOptions { + return { + features: isSet(object.features) ? FeatureSet.fromJSON(object.features) : undefined, + uninterpreted_option: globalThis.Array.isArray(object?.uninterpreted_option) + ? object.uninterpreted_option.map((e: any) => UninterpretedOption.fromJSON(e)) + : [], + }; + }, + + toJSON(message: OneofOptions): unknown { + const obj: any = {}; + if (message.features !== undefined) { + obj.features = FeatureSet.toJSON(message.features); + } + if (message.uninterpreted_option?.length) { + obj.uninterpreted_option = message.uninterpreted_option.map((e) => UninterpretedOption.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): OneofOptions { + return OneofOptions.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): OneofOptions { + const message = createBaseOneofOptions(); + message.features = object.features !== undefined && object.features !== null ? FeatureSet.fromPartial(object.features) : undefined; + message.uninterpreted_option = object.uninterpreted_option?.map((e) => UninterpretedOption.fromPartial(e)) || []; + return message; + }, +}; + +export const EnumOptions: MessageFns = { + $type: "google.protobuf.EnumOptions" as const, + + encode(message: EnumOptions, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.allow_alias !== undefined && message.allow_alias !== false) { + writer.uint32(16).bool(message.allow_alias); + } + if (message.deprecated !== undefined && message.deprecated !== false) { + writer.uint32(24).bool(message.deprecated); + } + if (message.deprecated_legacy_json_field_conflicts !== undefined && message.deprecated_legacy_json_field_conflicts !== false) { + writer.uint32(48).bool(message.deprecated_legacy_json_field_conflicts); + } + if (message.features !== undefined) { + FeatureSet.encode(message.features, writer.uint32(58).fork()).join(); + } + for (const v of message.uninterpreted_option) { + UninterpretedOption.encode(v!, writer.uint32(7994).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): EnumOptions { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEnumOptions(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 2: + if (tag !== 16) { + break; + } + + message.allow_alias = reader.bool(); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.deprecated = reader.bool(); + continue; + case 6: + if (tag !== 48) { + break; + } + + message.deprecated_legacy_json_field_conflicts = reader.bool(); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.features = FeatureSet.decode(reader, reader.uint32()); + continue; + case 999: + if (tag !== 7994) { + break; + } + + message.uninterpreted_option.push(UninterpretedOption.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): EnumOptions { + return { + allow_alias: isSet(object.allow_alias) ? globalThis.Boolean(object.allow_alias) : false, + deprecated: isSet(object.deprecated) ? globalThis.Boolean(object.deprecated) : false, + deprecated_legacy_json_field_conflicts: isSet(object.deprecated_legacy_json_field_conflicts) + ? globalThis.Boolean(object.deprecated_legacy_json_field_conflicts) + : false, + features: isSet(object.features) ? FeatureSet.fromJSON(object.features) : undefined, + uninterpreted_option: globalThis.Array.isArray(object?.uninterpreted_option) + ? object.uninterpreted_option.map((e: any) => UninterpretedOption.fromJSON(e)) + : [], + }; + }, + + toJSON(message: EnumOptions): unknown { + const obj: any = {}; + if (message.allow_alias !== undefined && message.allow_alias !== false) { + obj.allow_alias = message.allow_alias; + } + if (message.deprecated !== undefined && message.deprecated !== false) { + obj.deprecated = message.deprecated; + } + if (message.deprecated_legacy_json_field_conflicts !== undefined && message.deprecated_legacy_json_field_conflicts !== false) { + obj.deprecated_legacy_json_field_conflicts = message.deprecated_legacy_json_field_conflicts; + } + if (message.features !== undefined) { + obj.features = FeatureSet.toJSON(message.features); + } + if (message.uninterpreted_option?.length) { + obj.uninterpreted_option = message.uninterpreted_option.map((e) => UninterpretedOption.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): EnumOptions { + return EnumOptions.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): EnumOptions { + const message = createBaseEnumOptions(); + message.allow_alias = object.allow_alias ?? false; + message.deprecated = object.deprecated ?? false; + message.deprecated_legacy_json_field_conflicts = object.deprecated_legacy_json_field_conflicts ?? false; + message.features = object.features !== undefined && object.features !== null ? FeatureSet.fromPartial(object.features) : undefined; + message.uninterpreted_option = object.uninterpreted_option?.map((e) => UninterpretedOption.fromPartial(e)) || []; + return message; + }, +}; + +export const EnumValueOptions: MessageFns = { + $type: "google.protobuf.EnumValueOptions" as const, + + encode(message: EnumValueOptions, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.deprecated !== undefined && message.deprecated !== false) { + writer.uint32(8).bool(message.deprecated); + } + if (message.features !== undefined) { + FeatureSet.encode(message.features, writer.uint32(18).fork()).join(); + } + if (message.debug_redact !== undefined && message.debug_redact !== false) { + writer.uint32(24).bool(message.debug_redact); + } + if (message.feature_support !== undefined) { + FieldOptionsFeatureSupport.encode(message.feature_support, writer.uint32(34).fork()).join(); + } + for (const v of message.uninterpreted_option) { + UninterpretedOption.encode(v!, writer.uint32(7994).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): EnumValueOptions { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEnumValueOptions(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.deprecated = reader.bool(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.features = FeatureSet.decode(reader, reader.uint32()); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.debug_redact = reader.bool(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.feature_support = FieldOptionsFeatureSupport.decode(reader, reader.uint32()); + continue; + case 999: + if (tag !== 7994) { + break; + } + + message.uninterpreted_option.push(UninterpretedOption.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): EnumValueOptions { + return { + deprecated: isSet(object.deprecated) ? globalThis.Boolean(object.deprecated) : false, + features: isSet(object.features) ? FeatureSet.fromJSON(object.features) : undefined, + debug_redact: isSet(object.debug_redact) ? globalThis.Boolean(object.debug_redact) : false, + feature_support: isSet(object.feature_support) ? FieldOptionsFeatureSupport.fromJSON(object.feature_support) : undefined, + uninterpreted_option: globalThis.Array.isArray(object?.uninterpreted_option) + ? object.uninterpreted_option.map((e: any) => UninterpretedOption.fromJSON(e)) + : [], + }; + }, + + toJSON(message: EnumValueOptions): unknown { + const obj: any = {}; + if (message.deprecated !== undefined && message.deprecated !== false) { + obj.deprecated = message.deprecated; + } + if (message.features !== undefined) { + obj.features = FeatureSet.toJSON(message.features); + } + if (message.debug_redact !== undefined && message.debug_redact !== false) { + obj.debug_redact = message.debug_redact; + } + if (message.feature_support !== undefined) { + obj.feature_support = FieldOptionsFeatureSupport.toJSON(message.feature_support); + } + if (message.uninterpreted_option?.length) { + obj.uninterpreted_option = message.uninterpreted_option.map((e) => UninterpretedOption.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): EnumValueOptions { + return EnumValueOptions.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): EnumValueOptions { + const message = createBaseEnumValueOptions(); + message.deprecated = object.deprecated ?? false; + message.features = object.features !== undefined && object.features !== null ? FeatureSet.fromPartial(object.features) : undefined; + message.debug_redact = object.debug_redact ?? false; + message.feature_support = + object.feature_support !== undefined && object.feature_support !== null ? FieldOptionsFeatureSupport.fromPartial(object.feature_support) : undefined; + message.uninterpreted_option = object.uninterpreted_option?.map((e) => UninterpretedOption.fromPartial(e)) || []; + return message; + }, +}; + +export const ServiceOptions: MessageFns = { + $type: "google.protobuf.ServiceOptions" as const, + + encode(message: ServiceOptions, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.features !== undefined) { + FeatureSet.encode(message.features, writer.uint32(274).fork()).join(); + } + if (message.deprecated !== undefined && message.deprecated !== false) { + writer.uint32(264).bool(message.deprecated); + } + for (const v of message.uninterpreted_option) { + UninterpretedOption.encode(v!, writer.uint32(7994).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ServiceOptions { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseServiceOptions(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 34: + if (tag !== 274) { + break; + } + + message.features = FeatureSet.decode(reader, reader.uint32()); + continue; + case 33: + if (tag !== 264) { + break; + } + + message.deprecated = reader.bool(); + continue; + case 999: + if (tag !== 7994) { + break; + } + + message.uninterpreted_option.push(UninterpretedOption.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ServiceOptions { + return { + features: isSet(object.features) ? FeatureSet.fromJSON(object.features) : undefined, + deprecated: isSet(object.deprecated) ? globalThis.Boolean(object.deprecated) : false, + uninterpreted_option: globalThis.Array.isArray(object?.uninterpreted_option) + ? object.uninterpreted_option.map((e: any) => UninterpretedOption.fromJSON(e)) + : [], + }; + }, + + toJSON(message: ServiceOptions): unknown { + const obj: any = {}; + if (message.features !== undefined) { + obj.features = FeatureSet.toJSON(message.features); + } + if (message.deprecated !== undefined && message.deprecated !== false) { + obj.deprecated = message.deprecated; + } + if (message.uninterpreted_option?.length) { + obj.uninterpreted_option = message.uninterpreted_option.map((e) => UninterpretedOption.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): ServiceOptions { + return ServiceOptions.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ServiceOptions { + const message = createBaseServiceOptions(); + message.features = object.features !== undefined && object.features !== null ? FeatureSet.fromPartial(object.features) : undefined; + message.deprecated = object.deprecated ?? false; + message.uninterpreted_option = object.uninterpreted_option?.map((e) => UninterpretedOption.fromPartial(e)) || []; + return message; + }, +}; + +export const MethodOptions: MessageFns = { + $type: "google.protobuf.MethodOptions" as const, + + encode(message: MethodOptions, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.deprecated !== undefined && message.deprecated !== false) { + writer.uint32(264).bool(message.deprecated); + } + if (message.idempotency_level !== undefined && message.idempotency_level !== 0) { + writer.uint32(272).int32(message.idempotency_level); + } + if (message.features !== undefined) { + FeatureSet.encode(message.features, writer.uint32(282).fork()).join(); + } + for (const v of message.uninterpreted_option) { + UninterpretedOption.encode(v!, writer.uint32(7994).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MethodOptions { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMethodOptions(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 33: + if (tag !== 264) { + break; + } + + message.deprecated = reader.bool(); + continue; + case 34: + if (tag !== 272) { + break; + } + + message.idempotency_level = reader.int32() as any; + continue; + case 35: + if (tag !== 282) { + break; + } + + message.features = FeatureSet.decode(reader, reader.uint32()); + continue; + case 999: + if (tag !== 7994) { + break; + } + + message.uninterpreted_option.push(UninterpretedOption.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MethodOptions { + return { + deprecated: isSet(object.deprecated) ? globalThis.Boolean(object.deprecated) : false, + idempotency_level: isSet(object.idempotency_level) ? methodOptionsIdempotencyLevelFromJSON(object.idempotency_level) : 0, + features: isSet(object.features) ? FeatureSet.fromJSON(object.features) : undefined, + uninterpreted_option: globalThis.Array.isArray(object?.uninterpreted_option) + ? object.uninterpreted_option.map((e: any) => UninterpretedOption.fromJSON(e)) + : [], + }; + }, + + toJSON(message: MethodOptions): unknown { + const obj: any = {}; + if (message.deprecated !== undefined && message.deprecated !== false) { + obj.deprecated = message.deprecated; + } + if (message.idempotency_level !== undefined && message.idempotency_level !== 0) { + obj.idempotency_level = methodOptionsIdempotencyLevelToJSON(message.idempotency_level); + } + if (message.features !== undefined) { + obj.features = FeatureSet.toJSON(message.features); + } + if (message.uninterpreted_option?.length) { + obj.uninterpreted_option = message.uninterpreted_option.map((e) => UninterpretedOption.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): MethodOptions { + return MethodOptions.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MethodOptions { + const message = createBaseMethodOptions(); + message.deprecated = object.deprecated ?? false; + message.idempotency_level = object.idempotency_level ?? 0; + message.features = object.features !== undefined && object.features !== null ? FeatureSet.fromPartial(object.features) : undefined; + message.uninterpreted_option = object.uninterpreted_option?.map((e) => UninterpretedOption.fromPartial(e)) || []; + return message; + }, +}; + +export const UninterpretedOption: MessageFns = { + $type: "google.protobuf.UninterpretedOption" as const, + + encode(message: UninterpretedOption, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.name) { + UninterpretedOptionNamePart.encode(v!, writer.uint32(18).fork()).join(); + } + if (message.identifier_value !== undefined && message.identifier_value !== "") { + writer.uint32(26).string(message.identifier_value); + } + if (message.positive_int_value !== undefined && message.positive_int_value !== 0) { + writer.uint32(32).uint64(message.positive_int_value); + } + if (message.negative_int_value !== undefined && message.negative_int_value !== 0) { + writer.uint32(40).int64(message.negative_int_value); + } + if (message.double_value !== undefined && message.double_value !== 0) { + writer.uint32(49).double(message.double_value); + } + if (message.string_value !== undefined && message.string_value.length !== 0) { + writer.uint32(58).bytes(message.string_value); + } + if (message.aggregate_value !== undefined && message.aggregate_value !== "") { + writer.uint32(66).string(message.aggregate_value); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): UninterpretedOption { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseUninterpretedOption(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 2: + if (tag !== 18) { + break; + } + + message.name.push(UninterpretedOptionNamePart.decode(reader, reader.uint32())); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.identifier_value = reader.string(); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.positive_int_value = longToNumber(reader.uint64()); + continue; + case 5: + if (tag !== 40) { + break; + } + + message.negative_int_value = longToNumber(reader.int64()); + continue; + case 6: + if (tag !== 49) { + break; + } + + message.double_value = reader.double(); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.string_value = reader.bytes(); + continue; + case 8: + if (tag !== 66) { + break; + } + + message.aggregate_value = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): UninterpretedOption { + return { + name: globalThis.Array.isArray(object?.name) ? object.name.map((e: any) => UninterpretedOptionNamePart.fromJSON(e)) : [], + identifier_value: isSet(object.identifier_value) ? globalThis.String(object.identifier_value) : "", + positive_int_value: isSet(object.positive_int_value) ? globalThis.Number(object.positive_int_value) : 0, + negative_int_value: isSet(object.negative_int_value) ? globalThis.Number(object.negative_int_value) : 0, + double_value: isSet(object.double_value) ? globalThis.Number(object.double_value) : 0, + string_value: isSet(object.string_value) ? bytesFromBase64(object.string_value) : new Uint8Array(0), + aggregate_value: isSet(object.aggregate_value) ? globalThis.String(object.aggregate_value) : "", + }; + }, + + toJSON(message: UninterpretedOption): unknown { + const obj: any = {}; + if (message.name?.length) { + obj.name = message.name.map((e) => UninterpretedOptionNamePart.toJSON(e)); + } + if (message.identifier_value !== undefined && message.identifier_value !== "") { + obj.identifier_value = message.identifier_value; + } + if (message.positive_int_value !== undefined && message.positive_int_value !== 0) { + obj.positive_int_value = Math.round(message.positive_int_value); + } + if (message.negative_int_value !== undefined && message.negative_int_value !== 0) { + obj.negative_int_value = Math.round(message.negative_int_value); + } + if (message.double_value !== undefined && message.double_value !== 0) { + obj.double_value = message.double_value; + } + if (message.string_value !== undefined && message.string_value.length !== 0) { + obj.string_value = base64FromBytes(message.string_value); + } + if (message.aggregate_value !== undefined && message.aggregate_value !== "") { + obj.aggregate_value = message.aggregate_value; + } + return obj; + }, + + create, I>>(base?: I): UninterpretedOption { + return UninterpretedOption.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): UninterpretedOption { + const message = createBaseUninterpretedOption(); + message.name = object.name?.map((e) => UninterpretedOptionNamePart.fromPartial(e)) || []; + message.identifier_value = object.identifier_value ?? ""; + message.positive_int_value = object.positive_int_value ?? 0; + message.negative_int_value = object.negative_int_value ?? 0; + message.double_value = object.double_value ?? 0; + message.string_value = object.string_value ?? new Uint8Array(0); + message.aggregate_value = object.aggregate_value ?? ""; + return message; + }, +}; + +export const UninterpretedOptionNamePart: MessageFns = { + $type: "google.protobuf.UninterpretedOption.NamePart" as const, + + encode(message: UninterpretedOptionNamePart, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name_part !== "") { + writer.uint32(10).string(message.name_part); + } + if (message.is_extension !== false) { + writer.uint32(16).bool(message.is_extension); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): UninterpretedOptionNamePart { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseUninterpretedOptionNamePart(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.name_part = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.is_extension = reader.bool(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): UninterpretedOptionNamePart { + return { + name_part: isSet(object.name_part) ? globalThis.String(object.name_part) : "", + is_extension: isSet(object.is_extension) ? globalThis.Boolean(object.is_extension) : false, + }; + }, + + toJSON(message: UninterpretedOptionNamePart): unknown { + const obj: any = {}; + if (message.name_part !== "") { + obj.name_part = message.name_part; + } + if (message.is_extension !== false) { + obj.is_extension = message.is_extension; + } + return obj; + }, + + create, I>>(base?: I): UninterpretedOptionNamePart { + return UninterpretedOptionNamePart.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): UninterpretedOptionNamePart { + const message = createBaseUninterpretedOptionNamePart(); + message.name_part = object.name_part ?? ""; + message.is_extension = object.is_extension ?? false; + return message; + }, +}; + +export const FeatureSet: MessageFns = { + $type: "google.protobuf.FeatureSet" as const, + + encode(message: FeatureSet, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.field_presence !== undefined && message.field_presence !== 0) { + writer.uint32(8).int32(message.field_presence); + } + if (message.enum_type !== undefined && message.enum_type !== 0) { + writer.uint32(16).int32(message.enum_type); + } + if (message.repeated_field_encoding !== undefined && message.repeated_field_encoding !== 0) { + writer.uint32(24).int32(message.repeated_field_encoding); + } + if (message.utf8_validation !== undefined && message.utf8_validation !== 0) { + writer.uint32(32).int32(message.utf8_validation); + } + if (message.message_encoding !== undefined && message.message_encoding !== 0) { + writer.uint32(40).int32(message.message_encoding); + } + if (message.json_format !== undefined && message.json_format !== 0) { + writer.uint32(48).int32(message.json_format); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): FeatureSet { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseFeatureSet(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.field_presence = reader.int32() as any; + continue; + case 2: + if (tag !== 16) { + break; + } + + message.enum_type = reader.int32() as any; + continue; + case 3: + if (tag !== 24) { + break; + } + + message.repeated_field_encoding = reader.int32() as any; + continue; + case 4: + if (tag !== 32) { + break; + } + + message.utf8_validation = reader.int32() as any; + continue; + case 5: + if (tag !== 40) { + break; + } + + message.message_encoding = reader.int32() as any; + continue; + case 6: + if (tag !== 48) { + break; + } + + message.json_format = reader.int32() as any; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): FeatureSet { + return { + field_presence: isSet(object.field_presence) ? featureSetFieldPresenceFromJSON(object.field_presence) : 0, + enum_type: isSet(object.enum_type) ? featureSetEnumTypeFromJSON(object.enum_type) : 0, + repeated_field_encoding: isSet(object.repeated_field_encoding) ? featureSetRepeatedFieldEncodingFromJSON(object.repeated_field_encoding) : 0, + utf8_validation: isSet(object.utf8_validation) ? featureSetUtf8ValidationFromJSON(object.utf8_validation) : 0, + message_encoding: isSet(object.message_encoding) ? featureSetMessageEncodingFromJSON(object.message_encoding) : 0, + json_format: isSet(object.json_format) ? featureSetJsonFormatFromJSON(object.json_format) : 0, + }; + }, + + toJSON(message: FeatureSet): unknown { + const obj: any = {}; + if (message.field_presence !== undefined && message.field_presence !== 0) { + obj.field_presence = featureSetFieldPresenceToJSON(message.field_presence); + } + if (message.enum_type !== undefined && message.enum_type !== 0) { + obj.enum_type = featureSetEnumTypeToJSON(message.enum_type); + } + if (message.repeated_field_encoding !== undefined && message.repeated_field_encoding !== 0) { + obj.repeated_field_encoding = featureSetRepeatedFieldEncodingToJSON(message.repeated_field_encoding); + } + if (message.utf8_validation !== undefined && message.utf8_validation !== 0) { + obj.utf8_validation = featureSetUtf8ValidationToJSON(message.utf8_validation); + } + if (message.message_encoding !== undefined && message.message_encoding !== 0) { + obj.message_encoding = featureSetMessageEncodingToJSON(message.message_encoding); + } + if (message.json_format !== undefined && message.json_format !== 0) { + obj.json_format = featureSetJsonFormatToJSON(message.json_format); + } + return obj; + }, + + create, I>>(base?: I): FeatureSet { + return FeatureSet.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): FeatureSet { + const message = createBaseFeatureSet(); + message.field_presence = object.field_presence ?? 0; + message.enum_type = object.enum_type ?? 0; + message.repeated_field_encoding = object.repeated_field_encoding ?? 0; + message.utf8_validation = object.utf8_validation ?? 0; + message.message_encoding = object.message_encoding ?? 0; + message.json_format = object.json_format ?? 0; + return message; + }, +}; + +export const FeatureSetDefaults: MessageFns = { + $type: "google.protobuf.FeatureSetDefaults" as const, + + encode(message: FeatureSetDefaults, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.defaults) { + FeatureSetDefaultsFeatureSetEditionDefault.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.minimum_edition !== undefined && message.minimum_edition !== 0) { + writer.uint32(32).int32(message.minimum_edition); + } + if (message.maximum_edition !== undefined && message.maximum_edition !== 0) { + writer.uint32(40).int32(message.maximum_edition); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): FeatureSetDefaults { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseFeatureSetDefaults(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.defaults.push(FeatureSetDefaultsFeatureSetEditionDefault.decode(reader, reader.uint32())); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.minimum_edition = reader.int32() as any; + continue; + case 5: + if (tag !== 40) { + break; + } + + message.maximum_edition = reader.int32() as any; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): FeatureSetDefaults { + return { + defaults: globalThis.Array.isArray(object?.defaults) ? object.defaults.map((e: any) => FeatureSetDefaultsFeatureSetEditionDefault.fromJSON(e)) : [], + minimum_edition: isSet(object.minimum_edition) ? editionFromJSON(object.minimum_edition) : 0, + maximum_edition: isSet(object.maximum_edition) ? editionFromJSON(object.maximum_edition) : 0, + }; + }, + + toJSON(message: FeatureSetDefaults): unknown { + const obj: any = {}; + if (message.defaults?.length) { + obj.defaults = message.defaults.map((e) => FeatureSetDefaultsFeatureSetEditionDefault.toJSON(e)); + } + if (message.minimum_edition !== undefined && message.minimum_edition !== 0) { + obj.minimum_edition = editionToJSON(message.minimum_edition); + } + if (message.maximum_edition !== undefined && message.maximum_edition !== 0) { + obj.maximum_edition = editionToJSON(message.maximum_edition); + } + return obj; + }, + + create, I>>(base?: I): FeatureSetDefaults { + return FeatureSetDefaults.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): FeatureSetDefaults { + const message = createBaseFeatureSetDefaults(); + message.defaults = object.defaults?.map((e) => FeatureSetDefaultsFeatureSetEditionDefault.fromPartial(e)) || []; + message.minimum_edition = object.minimum_edition ?? 0; + message.maximum_edition = object.maximum_edition ?? 0; + return message; + }, +}; + +export const FeatureSetDefaultsFeatureSetEditionDefault: MessageFns< + FeatureSetDefaultsFeatureSetEditionDefault, + "google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault" +> = { + $type: "google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault" as const, + + encode(message: FeatureSetDefaultsFeatureSetEditionDefault, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.edition !== undefined && message.edition !== 0) { + writer.uint32(24).int32(message.edition); + } + if (message.overridable_features !== undefined) { + FeatureSet.encode(message.overridable_features, writer.uint32(34).fork()).join(); + } + if (message.fixed_features !== undefined) { + FeatureSet.encode(message.fixed_features, writer.uint32(42).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): FeatureSetDefaultsFeatureSetEditionDefault { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseFeatureSetDefaultsFeatureSetEditionDefault(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 3: + if (tag !== 24) { + break; + } + + message.edition = reader.int32() as any; + continue; + case 4: + if (tag !== 34) { + break; + } + + message.overridable_features = FeatureSet.decode(reader, reader.uint32()); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.fixed_features = FeatureSet.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): FeatureSetDefaultsFeatureSetEditionDefault { + return { + edition: isSet(object.edition) ? editionFromJSON(object.edition) : 0, + overridable_features: isSet(object.overridable_features) ? FeatureSet.fromJSON(object.overridable_features) : undefined, + fixed_features: isSet(object.fixed_features) ? FeatureSet.fromJSON(object.fixed_features) : undefined, + }; + }, + + toJSON(message: FeatureSetDefaultsFeatureSetEditionDefault): unknown { + const obj: any = {}; + if (message.edition !== undefined && message.edition !== 0) { + obj.edition = editionToJSON(message.edition); + } + if (message.overridable_features !== undefined) { + obj.overridable_features = FeatureSet.toJSON(message.overridable_features); + } + if (message.fixed_features !== undefined) { + obj.fixed_features = FeatureSet.toJSON(message.fixed_features); + } + return obj; + }, + + create, I>>(base?: I): FeatureSetDefaultsFeatureSetEditionDefault { + return FeatureSetDefaultsFeatureSetEditionDefault.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): FeatureSetDefaultsFeatureSetEditionDefault { + const message = createBaseFeatureSetDefaultsFeatureSetEditionDefault(); + message.edition = object.edition ?? 0; + message.overridable_features = + object.overridable_features !== undefined && object.overridable_features !== null ? FeatureSet.fromPartial(object.overridable_features) : undefined; + message.fixed_features = object.fixed_features !== undefined && object.fixed_features !== null ? FeatureSet.fromPartial(object.fixed_features) : undefined; + return message; + }, +}; + +export const SourceCodeInfo: MessageFns = { + $type: "google.protobuf.SourceCodeInfo" as const, + + encode(message: SourceCodeInfo, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.location) { + SourceCodeInfoLocation.encode(v!, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): SourceCodeInfo { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseSourceCodeInfo(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.location.push(SourceCodeInfoLocation.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): SourceCodeInfo { + return { + location: globalThis.Array.isArray(object?.location) ? object.location.map((e: any) => SourceCodeInfoLocation.fromJSON(e)) : [], + }; + }, + + toJSON(message: SourceCodeInfo): unknown { + const obj: any = {}; + if (message.location?.length) { + obj.location = message.location.map((e) => SourceCodeInfoLocation.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): SourceCodeInfo { + return SourceCodeInfo.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): SourceCodeInfo { + const message = createBaseSourceCodeInfo(); + message.location = object.location?.map((e) => SourceCodeInfoLocation.fromPartial(e)) || []; + return message; + }, +}; + +export const SourceCodeInfoLocation: MessageFns = { + $type: "google.protobuf.SourceCodeInfo.Location" as const, + + encode(message: SourceCodeInfoLocation, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + writer.uint32(10).fork(); + for (const v of message.path) { + writer.int32(v); + } + writer.join(); + writer.uint32(18).fork(); + for (const v of message.span) { + writer.int32(v); + } + writer.join(); + if (message.leading_comments !== undefined && message.leading_comments !== "") { + writer.uint32(26).string(message.leading_comments); + } + if (message.trailing_comments !== undefined && message.trailing_comments !== "") { + writer.uint32(34).string(message.trailing_comments); + } + for (const v of message.leading_detached_comments) { + writer.uint32(50).string(v!); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): SourceCodeInfoLocation { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseSourceCodeInfoLocation(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag === 8) { + message.path.push(reader.int32()); + + continue; + } + + if (tag === 10) { + const end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) { + message.path.push(reader.int32()); + } + + continue; + } + + break; + case 2: + if (tag === 16) { + message.span.push(reader.int32()); + + continue; + } + + if (tag === 18) { + const end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) { + message.span.push(reader.int32()); + } + + continue; + } + + break; + case 3: + if (tag !== 26) { + break; + } + + message.leading_comments = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.trailing_comments = reader.string(); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.leading_detached_comments.push(reader.string()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): SourceCodeInfoLocation { + return { + path: globalThis.Array.isArray(object?.path) ? object.path.map((e: any) => globalThis.Number(e)) : [], + span: globalThis.Array.isArray(object?.span) ? object.span.map((e: any) => globalThis.Number(e)) : [], + leading_comments: isSet(object.leading_comments) ? globalThis.String(object.leading_comments) : "", + trailing_comments: isSet(object.trailing_comments) ? globalThis.String(object.trailing_comments) : "", + leading_detached_comments: globalThis.Array.isArray(object?.leading_detached_comments) + ? object.leading_detached_comments.map((e: any) => globalThis.String(e)) + : [], + }; + }, + + toJSON(message: SourceCodeInfoLocation): unknown { + const obj: any = {}; + if (message.path?.length) { + obj.path = message.path.map((e) => Math.round(e)); + } + if (message.span?.length) { + obj.span = message.span.map((e) => Math.round(e)); + } + if (message.leading_comments !== undefined && message.leading_comments !== "") { + obj.leading_comments = message.leading_comments; + } + if (message.trailing_comments !== undefined && message.trailing_comments !== "") { + obj.trailing_comments = message.trailing_comments; + } + if (message.leading_detached_comments?.length) { + obj.leading_detached_comments = message.leading_detached_comments; + } + return obj; + }, + + create, I>>(base?: I): SourceCodeInfoLocation { + return SourceCodeInfoLocation.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): SourceCodeInfoLocation { + const message = createBaseSourceCodeInfoLocation(); + message.path = object.path?.map((e) => e) || []; + message.span = object.span?.map((e) => e) || []; + message.leading_comments = object.leading_comments ?? ""; + message.trailing_comments = object.trailing_comments ?? ""; + message.leading_detached_comments = object.leading_detached_comments?.map((e) => e) || []; + return message; + }, +}; + +export const GeneratedCodeInfo: MessageFns = { + $type: "google.protobuf.GeneratedCodeInfo" as const, + + encode(message: GeneratedCodeInfo, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.annotation) { + GeneratedCodeInfoAnnotation.encode(v!, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GeneratedCodeInfo { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGeneratedCodeInfo(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.annotation.push(GeneratedCodeInfoAnnotation.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GeneratedCodeInfo { + return { + annotation: globalThis.Array.isArray(object?.annotation) ? object.annotation.map((e: any) => GeneratedCodeInfoAnnotation.fromJSON(e)) : [], + }; + }, + + toJSON(message: GeneratedCodeInfo): unknown { + const obj: any = {}; + if (message.annotation?.length) { + obj.annotation = message.annotation.map((e) => GeneratedCodeInfoAnnotation.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): GeneratedCodeInfo { + return GeneratedCodeInfo.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): GeneratedCodeInfo { + const message = createBaseGeneratedCodeInfo(); + message.annotation = object.annotation?.map((e) => GeneratedCodeInfoAnnotation.fromPartial(e)) || []; + return message; + }, +}; + +export const GeneratedCodeInfoAnnotation: MessageFns = { + $type: "google.protobuf.GeneratedCodeInfo.Annotation" as const, + + encode(message: GeneratedCodeInfoAnnotation, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + writer.uint32(10).fork(); + for (const v of message.path) { + writer.int32(v); + } + writer.join(); + if (message.source_file !== undefined && message.source_file !== "") { + writer.uint32(18).string(message.source_file); + } + if (message.begin !== undefined && message.begin !== 0) { + writer.uint32(24).int32(message.begin); + } + if (message.end !== undefined && message.end !== 0) { + writer.uint32(32).int32(message.end); + } + if (message.semantic !== undefined && message.semantic !== 0) { + writer.uint32(40).int32(message.semantic); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GeneratedCodeInfoAnnotation { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGeneratedCodeInfoAnnotation(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag === 8) { + message.path.push(reader.int32()); + + continue; + } + + if (tag === 10) { + const end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) { + message.path.push(reader.int32()); + } + + continue; + } + + break; + case 2: + if (tag !== 18) { + break; + } + + message.source_file = reader.string(); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.begin = reader.int32(); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.end = reader.int32(); + continue; + case 5: + if (tag !== 40) { + break; + } + + message.semantic = reader.int32() as any; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GeneratedCodeInfoAnnotation { + return { + path: globalThis.Array.isArray(object?.path) ? object.path.map((e: any) => globalThis.Number(e)) : [], + source_file: isSet(object.source_file) ? globalThis.String(object.source_file) : "", + begin: isSet(object.begin) ? globalThis.Number(object.begin) : 0, + end: isSet(object.end) ? globalThis.Number(object.end) : 0, + semantic: isSet(object.semantic) ? generatedCodeInfoAnnotationSemanticFromJSON(object.semantic) : 0, + }; + }, + + toJSON(message: GeneratedCodeInfoAnnotation): unknown { + const obj: any = {}; + if (message.path?.length) { + obj.path = message.path.map((e) => Math.round(e)); + } + if (message.source_file !== undefined && message.source_file !== "") { + obj.source_file = message.source_file; + } + if (message.begin !== undefined && message.begin !== 0) { + obj.begin = Math.round(message.begin); + } + if (message.end !== undefined && message.end !== 0) { + obj.end = Math.round(message.end); + } + if (message.semantic !== undefined && message.semantic !== 0) { + obj.semantic = generatedCodeInfoAnnotationSemanticToJSON(message.semantic); + } + return obj; + }, + + create, I>>(base?: I): GeneratedCodeInfoAnnotation { + return GeneratedCodeInfoAnnotation.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): GeneratedCodeInfoAnnotation { + const message = createBaseGeneratedCodeInfoAnnotation(); + message.path = object.path?.map((e) => e) || []; + message.source_file = object.source_file ?? ""; + message.begin = object.begin ?? 0; + message.end = object.end ?? 0; + message.semantic = object.semantic ?? 0; + return message; + }, +}; + +export function editionFromJSON(object: any): Edition { + switch (object) { + case 0: + case "EDITION_UNKNOWN": + return Edition.EDITION_UNKNOWN; + case 900: + case "EDITION_LEGACY": + return Edition.EDITION_LEGACY; + case 998: + case "EDITION_PROTO2": + return Edition.EDITION_PROTO2; + case 999: + case "EDITION_PROTO3": + return Edition.EDITION_PROTO3; + case 1000: + case "EDITION_2023": + return Edition.EDITION_2023; + case 1001: + case "EDITION_2024": + return Edition.EDITION_2024; + case 1: + case "EDITION_1_TEST_ONLY": + return Edition.EDITION_1_TEST_ONLY; + case 2: + case "EDITION_2_TEST_ONLY": + return Edition.EDITION_2_TEST_ONLY; + case 99997: + case "EDITION_99997_TEST_ONLY": + return Edition.EDITION_99997_TEST_ONLY; + case 99998: + case "EDITION_99998_TEST_ONLY": + return Edition.EDITION_99998_TEST_ONLY; + case 99999: + case "EDITION_99999_TEST_ONLY": + return Edition.EDITION_99999_TEST_ONLY; + case 2147483647: + case "EDITION_MAX": + return Edition.EDITION_MAX; + case -1: + case "UNRECOGNIZED": + default: + return Edition.UNRECOGNIZED; + } +} + +export function editionToJSON(object: Edition): string { + switch (object) { + case Edition.EDITION_UNKNOWN: + return "EDITION_UNKNOWN"; + case Edition.EDITION_LEGACY: + return "EDITION_LEGACY"; + case Edition.EDITION_PROTO2: + return "EDITION_PROTO2"; + case Edition.EDITION_PROTO3: + return "EDITION_PROTO3"; + case Edition.EDITION_2023: + return "EDITION_2023"; + case Edition.EDITION_2024: + return "EDITION_2024"; + case Edition.EDITION_1_TEST_ONLY: + return "EDITION_1_TEST_ONLY"; + case Edition.EDITION_2_TEST_ONLY: + return "EDITION_2_TEST_ONLY"; + case Edition.EDITION_99997_TEST_ONLY: + return "EDITION_99997_TEST_ONLY"; + case Edition.EDITION_99998_TEST_ONLY: + return "EDITION_99998_TEST_ONLY"; + case Edition.EDITION_99999_TEST_ONLY: + return "EDITION_99999_TEST_ONLY"; + case Edition.EDITION_MAX: + return "EDITION_MAX"; + case Edition.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +export function extensionRangeOptionsVerificationStateFromJSON(object: any): ExtensionRangeOptionsVerificationState { + switch (object) { + case 0: + case "DECLARATION": + return ExtensionRangeOptionsVerificationState.DECLARATION; + case 1: + case "UNVERIFIED": + return ExtensionRangeOptionsVerificationState.UNVERIFIED; + case -1: + case "UNRECOGNIZED": + default: + return ExtensionRangeOptionsVerificationState.UNRECOGNIZED; + } +} + +export function extensionRangeOptionsVerificationStateToJSON(object: ExtensionRangeOptionsVerificationState): string { + switch (object) { + case ExtensionRangeOptionsVerificationState.DECLARATION: + return "DECLARATION"; + case ExtensionRangeOptionsVerificationState.UNVERIFIED: + return "UNVERIFIED"; + case ExtensionRangeOptionsVerificationState.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +export function fieldDescriptorProtoTypeFromJSON(object: any): FieldDescriptorProtoType { + switch (object) { + case 1: + case "TYPE_DOUBLE": + return FieldDescriptorProtoType.TYPE_DOUBLE; + case 2: + case "TYPE_FLOAT": + return FieldDescriptorProtoType.TYPE_FLOAT; + case 3: + case "TYPE_INT64": + return FieldDescriptorProtoType.TYPE_INT64; + case 4: + case "TYPE_UINT64": + return FieldDescriptorProtoType.TYPE_UINT64; + case 5: + case "TYPE_INT32": + return FieldDescriptorProtoType.TYPE_INT32; + case 6: + case "TYPE_FIXED64": + return FieldDescriptorProtoType.TYPE_FIXED64; + case 7: + case "TYPE_FIXED32": + return FieldDescriptorProtoType.TYPE_FIXED32; + case 8: + case "TYPE_BOOL": + return FieldDescriptorProtoType.TYPE_BOOL; + case 9: + case "TYPE_STRING": + return FieldDescriptorProtoType.TYPE_STRING; + case 10: + case "TYPE_GROUP": + return FieldDescriptorProtoType.TYPE_GROUP; + case 11: + case "TYPE_MESSAGE": + return FieldDescriptorProtoType.TYPE_MESSAGE; + case 12: + case "TYPE_BYTES": + return FieldDescriptorProtoType.TYPE_BYTES; + case 13: + case "TYPE_UINT32": + return FieldDescriptorProtoType.TYPE_UINT32; + case 14: + case "TYPE_ENUM": + return FieldDescriptorProtoType.TYPE_ENUM; + case 15: + case "TYPE_SFIXED32": + return FieldDescriptorProtoType.TYPE_SFIXED32; + case 16: + case "TYPE_SFIXED64": + return FieldDescriptorProtoType.TYPE_SFIXED64; + case 17: + case "TYPE_SINT32": + return FieldDescriptorProtoType.TYPE_SINT32; + case 18: + case "TYPE_SINT64": + return FieldDescriptorProtoType.TYPE_SINT64; + case -1: + case "UNRECOGNIZED": + default: + return FieldDescriptorProtoType.UNRECOGNIZED; + } +} + +export function fieldDescriptorProtoTypeToJSON(object: FieldDescriptorProtoType): string { + switch (object) { + case FieldDescriptorProtoType.TYPE_DOUBLE: + return "TYPE_DOUBLE"; + case FieldDescriptorProtoType.TYPE_FLOAT: + return "TYPE_FLOAT"; + case FieldDescriptorProtoType.TYPE_INT64: + return "TYPE_INT64"; + case FieldDescriptorProtoType.TYPE_UINT64: + return "TYPE_UINT64"; + case FieldDescriptorProtoType.TYPE_INT32: + return "TYPE_INT32"; + case FieldDescriptorProtoType.TYPE_FIXED64: + return "TYPE_FIXED64"; + case FieldDescriptorProtoType.TYPE_FIXED32: + return "TYPE_FIXED32"; + case FieldDescriptorProtoType.TYPE_BOOL: + return "TYPE_BOOL"; + case FieldDescriptorProtoType.TYPE_STRING: + return "TYPE_STRING"; + case FieldDescriptorProtoType.TYPE_GROUP: + return "TYPE_GROUP"; + case FieldDescriptorProtoType.TYPE_MESSAGE: + return "TYPE_MESSAGE"; + case FieldDescriptorProtoType.TYPE_BYTES: + return "TYPE_BYTES"; + case FieldDescriptorProtoType.TYPE_UINT32: + return "TYPE_UINT32"; + case FieldDescriptorProtoType.TYPE_ENUM: + return "TYPE_ENUM"; + case FieldDescriptorProtoType.TYPE_SFIXED32: + return "TYPE_SFIXED32"; + case FieldDescriptorProtoType.TYPE_SFIXED64: + return "TYPE_SFIXED64"; + case FieldDescriptorProtoType.TYPE_SINT32: + return "TYPE_SINT32"; + case FieldDescriptorProtoType.TYPE_SINT64: + return "TYPE_SINT64"; + case FieldDescriptorProtoType.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +export function fieldDescriptorProtoLabelFromJSON(object: any): FieldDescriptorProtoLabel { + switch (object) { + case 1: + case "LABEL_OPTIONAL": + return FieldDescriptorProtoLabel.LABEL_OPTIONAL; + case 3: + case "LABEL_REPEATED": + return FieldDescriptorProtoLabel.LABEL_REPEATED; + case 2: + case "LABEL_REQUIRED": + return FieldDescriptorProtoLabel.LABEL_REQUIRED; + case -1: + case "UNRECOGNIZED": + default: + return FieldDescriptorProtoLabel.UNRECOGNIZED; + } +} + +export function fieldDescriptorProtoLabelToJSON(object: FieldDescriptorProtoLabel): string { + switch (object) { + case FieldDescriptorProtoLabel.LABEL_OPTIONAL: + return "LABEL_OPTIONAL"; + case FieldDescriptorProtoLabel.LABEL_REPEATED: + return "LABEL_REPEATED"; + case FieldDescriptorProtoLabel.LABEL_REQUIRED: + return "LABEL_REQUIRED"; + case FieldDescriptorProtoLabel.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +export function fileOptionsOptimizeModeFromJSON(object: any): FileOptionsOptimizeMode { + switch (object) { + case 1: + case "SPEED": + return FileOptionsOptimizeMode.SPEED; + case 2: + case "CODE_SIZE": + return FileOptionsOptimizeMode.CODE_SIZE; + case 3: + case "LITE_RUNTIME": + return FileOptionsOptimizeMode.LITE_RUNTIME; + case -1: + case "UNRECOGNIZED": + default: + return FileOptionsOptimizeMode.UNRECOGNIZED; + } +} + +export function fileOptionsOptimizeModeToJSON(object: FileOptionsOptimizeMode): string { + switch (object) { + case FileOptionsOptimizeMode.SPEED: + return "SPEED"; + case FileOptionsOptimizeMode.CODE_SIZE: + return "CODE_SIZE"; + case FileOptionsOptimizeMode.LITE_RUNTIME: + return "LITE_RUNTIME"; + case FileOptionsOptimizeMode.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +export function fieldOptionsCTypeFromJSON(object: any): FieldOptionsCType { + switch (object) { + case 0: + case "STRING": + return FieldOptionsCType.STRING; + case 1: + case "CORD": + return FieldOptionsCType.CORD; + case 2: + case "STRING_PIECE": + return FieldOptionsCType.STRING_PIECE; + case -1: + case "UNRECOGNIZED": + default: + return FieldOptionsCType.UNRECOGNIZED; + } +} + +export function fieldOptionsCTypeToJSON(object: FieldOptionsCType): string { + switch (object) { + case FieldOptionsCType.STRING: + return "STRING"; + case FieldOptionsCType.CORD: + return "CORD"; + case FieldOptionsCType.STRING_PIECE: + return "STRING_PIECE"; + case FieldOptionsCType.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +export function fieldOptionsJSTypeFromJSON(object: any): FieldOptionsJSType { + switch (object) { + case 0: + case "JS_NORMAL": + return FieldOptionsJSType.JS_NORMAL; + case 1: + case "JS_STRING": + return FieldOptionsJSType.JS_STRING; + case 2: + case "JS_NUMBER": + return FieldOptionsJSType.JS_NUMBER; + case -1: + case "UNRECOGNIZED": + default: + return FieldOptionsJSType.UNRECOGNIZED; + } +} + +export function fieldOptionsJSTypeToJSON(object: FieldOptionsJSType): string { + switch (object) { + case FieldOptionsJSType.JS_NORMAL: + return "JS_NORMAL"; + case FieldOptionsJSType.JS_STRING: + return "JS_STRING"; + case FieldOptionsJSType.JS_NUMBER: + return "JS_NUMBER"; + case FieldOptionsJSType.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +export function fieldOptionsOptionRetentionFromJSON(object: any): FieldOptionsOptionRetention { + switch (object) { + case 0: + case "RETENTION_UNKNOWN": + return FieldOptionsOptionRetention.RETENTION_UNKNOWN; + case 1: + case "RETENTION_RUNTIME": + return FieldOptionsOptionRetention.RETENTION_RUNTIME; + case 2: + case "RETENTION_SOURCE": + return FieldOptionsOptionRetention.RETENTION_SOURCE; + case -1: + case "UNRECOGNIZED": + default: + return FieldOptionsOptionRetention.UNRECOGNIZED; + } +} + +export function fieldOptionsOptionRetentionToJSON(object: FieldOptionsOptionRetention): string { + switch (object) { + case FieldOptionsOptionRetention.RETENTION_UNKNOWN: + return "RETENTION_UNKNOWN"; + case FieldOptionsOptionRetention.RETENTION_RUNTIME: + return "RETENTION_RUNTIME"; + case FieldOptionsOptionRetention.RETENTION_SOURCE: + return "RETENTION_SOURCE"; + case FieldOptionsOptionRetention.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +export function fieldOptionsOptionTargetTypeFromJSON(object: any): FieldOptionsOptionTargetType { + switch (object) { + case 0: + case "TARGET_TYPE_UNKNOWN": + return FieldOptionsOptionTargetType.TARGET_TYPE_UNKNOWN; + case 1: + case "TARGET_TYPE_FILE": + return FieldOptionsOptionTargetType.TARGET_TYPE_FILE; + case 2: + case "TARGET_TYPE_EXTENSION_RANGE": + return FieldOptionsOptionTargetType.TARGET_TYPE_EXTENSION_RANGE; + case 3: + case "TARGET_TYPE_MESSAGE": + return FieldOptionsOptionTargetType.TARGET_TYPE_MESSAGE; + case 4: + case "TARGET_TYPE_FIELD": + return FieldOptionsOptionTargetType.TARGET_TYPE_FIELD; + case 5: + case "TARGET_TYPE_ONEOF": + return FieldOptionsOptionTargetType.TARGET_TYPE_ONEOF; + case 6: + case "TARGET_TYPE_ENUM": + return FieldOptionsOptionTargetType.TARGET_TYPE_ENUM; + case 7: + case "TARGET_TYPE_ENUM_ENTRY": + return FieldOptionsOptionTargetType.TARGET_TYPE_ENUM_ENTRY; + case 8: + case "TARGET_TYPE_SERVICE": + return FieldOptionsOptionTargetType.TARGET_TYPE_SERVICE; + case 9: + case "TARGET_TYPE_METHOD": + return FieldOptionsOptionTargetType.TARGET_TYPE_METHOD; + case -1: + case "UNRECOGNIZED": + default: + return FieldOptionsOptionTargetType.UNRECOGNIZED; + } +} + +export function fieldOptionsOptionTargetTypeToJSON(object: FieldOptionsOptionTargetType): string { + switch (object) { + case FieldOptionsOptionTargetType.TARGET_TYPE_UNKNOWN: + return "TARGET_TYPE_UNKNOWN"; + case FieldOptionsOptionTargetType.TARGET_TYPE_FILE: + return "TARGET_TYPE_FILE"; + case FieldOptionsOptionTargetType.TARGET_TYPE_EXTENSION_RANGE: + return "TARGET_TYPE_EXTENSION_RANGE"; + case FieldOptionsOptionTargetType.TARGET_TYPE_MESSAGE: + return "TARGET_TYPE_MESSAGE"; + case FieldOptionsOptionTargetType.TARGET_TYPE_FIELD: + return "TARGET_TYPE_FIELD"; + case FieldOptionsOptionTargetType.TARGET_TYPE_ONEOF: + return "TARGET_TYPE_ONEOF"; + case FieldOptionsOptionTargetType.TARGET_TYPE_ENUM: + return "TARGET_TYPE_ENUM"; + case FieldOptionsOptionTargetType.TARGET_TYPE_ENUM_ENTRY: + return "TARGET_TYPE_ENUM_ENTRY"; + case FieldOptionsOptionTargetType.TARGET_TYPE_SERVICE: + return "TARGET_TYPE_SERVICE"; + case FieldOptionsOptionTargetType.TARGET_TYPE_METHOD: + return "TARGET_TYPE_METHOD"; + case FieldOptionsOptionTargetType.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +export function methodOptionsIdempotencyLevelFromJSON(object: any): MethodOptionsIdempotencyLevel { + switch (object) { + case 0: + case "IDEMPOTENCY_UNKNOWN": + return MethodOptionsIdempotencyLevel.IDEMPOTENCY_UNKNOWN; + case 1: + case "NO_SIDE_EFFECTS": + return MethodOptionsIdempotencyLevel.NO_SIDE_EFFECTS; + case 2: + case "IDEMPOTENT": + return MethodOptionsIdempotencyLevel.IDEMPOTENT; + case -1: + case "UNRECOGNIZED": + default: + return MethodOptionsIdempotencyLevel.UNRECOGNIZED; + } +} + +export function methodOptionsIdempotencyLevelToJSON(object: MethodOptionsIdempotencyLevel): string { + switch (object) { + case MethodOptionsIdempotencyLevel.IDEMPOTENCY_UNKNOWN: + return "IDEMPOTENCY_UNKNOWN"; + case MethodOptionsIdempotencyLevel.NO_SIDE_EFFECTS: + return "NO_SIDE_EFFECTS"; + case MethodOptionsIdempotencyLevel.IDEMPOTENT: + return "IDEMPOTENT"; + case MethodOptionsIdempotencyLevel.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +export function featureSetFieldPresenceFromJSON(object: any): FeatureSetFieldPresence { + switch (object) { + case 0: + case "FIELD_PRESENCE_UNKNOWN": + return FeatureSetFieldPresence.FIELD_PRESENCE_UNKNOWN; + case 1: + case "EXPLICIT": + return FeatureSetFieldPresence.EXPLICIT; + case 2: + case "IMPLICIT": + return FeatureSetFieldPresence.IMPLICIT; + case 3: + case "LEGACY_REQUIRED": + return FeatureSetFieldPresence.LEGACY_REQUIRED; + case -1: + case "UNRECOGNIZED": + default: + return FeatureSetFieldPresence.UNRECOGNIZED; + } +} + +export function featureSetFieldPresenceToJSON(object: FeatureSetFieldPresence): string { + switch (object) { + case FeatureSetFieldPresence.FIELD_PRESENCE_UNKNOWN: + return "FIELD_PRESENCE_UNKNOWN"; + case FeatureSetFieldPresence.EXPLICIT: + return "EXPLICIT"; + case FeatureSetFieldPresence.IMPLICIT: + return "IMPLICIT"; + case FeatureSetFieldPresence.LEGACY_REQUIRED: + return "LEGACY_REQUIRED"; + case FeatureSetFieldPresence.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +export function featureSetEnumTypeFromJSON(object: any): FeatureSetEnumType { + switch (object) { + case 0: + case "ENUM_TYPE_UNKNOWN": + return FeatureSetEnumType.ENUM_TYPE_UNKNOWN; + case 1: + case "OPEN": + return FeatureSetEnumType.OPEN; + case 2: + case "CLOSED": + return FeatureSetEnumType.CLOSED; + case -1: + case "UNRECOGNIZED": + default: + return FeatureSetEnumType.UNRECOGNIZED; + } +} + +export function featureSetEnumTypeToJSON(object: FeatureSetEnumType): string { + switch (object) { + case FeatureSetEnumType.ENUM_TYPE_UNKNOWN: + return "ENUM_TYPE_UNKNOWN"; + case FeatureSetEnumType.OPEN: + return "OPEN"; + case FeatureSetEnumType.CLOSED: + return "CLOSED"; + case FeatureSetEnumType.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +export function featureSetRepeatedFieldEncodingFromJSON(object: any): FeatureSetRepeatedFieldEncoding { + switch (object) { + case 0: + case "REPEATED_FIELD_ENCODING_UNKNOWN": + return FeatureSetRepeatedFieldEncoding.REPEATED_FIELD_ENCODING_UNKNOWN; + case 1: + case "PACKED": + return FeatureSetRepeatedFieldEncoding.PACKED; + case 2: + case "EXPANDED": + return FeatureSetRepeatedFieldEncoding.EXPANDED; + case -1: + case "UNRECOGNIZED": + default: + return FeatureSetRepeatedFieldEncoding.UNRECOGNIZED; + } +} + +export function featureSetRepeatedFieldEncodingToJSON(object: FeatureSetRepeatedFieldEncoding): string { + switch (object) { + case FeatureSetRepeatedFieldEncoding.REPEATED_FIELD_ENCODING_UNKNOWN: + return "REPEATED_FIELD_ENCODING_UNKNOWN"; + case FeatureSetRepeatedFieldEncoding.PACKED: + return "PACKED"; + case FeatureSetRepeatedFieldEncoding.EXPANDED: + return "EXPANDED"; + case FeatureSetRepeatedFieldEncoding.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +export function featureSetUtf8ValidationFromJSON(object: any): FeatureSetUtf8Validation { + switch (object) { + case 0: + case "UTF8_VALIDATION_UNKNOWN": + return FeatureSetUtf8Validation.UTF8_VALIDATION_UNKNOWN; + case 2: + case "VERIFY": + return FeatureSetUtf8Validation.VERIFY; + case 3: + case "NONE": + return FeatureSetUtf8Validation.NONE; + case -1: + case "UNRECOGNIZED": + default: + return FeatureSetUtf8Validation.UNRECOGNIZED; + } +} + +export function featureSetUtf8ValidationToJSON(object: FeatureSetUtf8Validation): string { + switch (object) { + case FeatureSetUtf8Validation.UTF8_VALIDATION_UNKNOWN: + return "UTF8_VALIDATION_UNKNOWN"; + case FeatureSetUtf8Validation.VERIFY: + return "VERIFY"; + case FeatureSetUtf8Validation.NONE: + return "NONE"; + case FeatureSetUtf8Validation.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +export function featureSetMessageEncodingFromJSON(object: any): FeatureSetMessageEncoding { + switch (object) { + case 0: + case "MESSAGE_ENCODING_UNKNOWN": + return FeatureSetMessageEncoding.MESSAGE_ENCODING_UNKNOWN; + case 1: + case "LENGTH_PREFIXED": + return FeatureSetMessageEncoding.LENGTH_PREFIXED; + case 2: + case "DELIMITED": + return FeatureSetMessageEncoding.DELIMITED; + case -1: + case "UNRECOGNIZED": + default: + return FeatureSetMessageEncoding.UNRECOGNIZED; + } +} + +export function featureSetMessageEncodingToJSON(object: FeatureSetMessageEncoding): string { + switch (object) { + case FeatureSetMessageEncoding.MESSAGE_ENCODING_UNKNOWN: + return "MESSAGE_ENCODING_UNKNOWN"; + case FeatureSetMessageEncoding.LENGTH_PREFIXED: + return "LENGTH_PREFIXED"; + case FeatureSetMessageEncoding.DELIMITED: + return "DELIMITED"; + case FeatureSetMessageEncoding.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +export function featureSetJsonFormatFromJSON(object: any): FeatureSetJsonFormat { + switch (object) { + case 0: + case "JSON_FORMAT_UNKNOWN": + return FeatureSetJsonFormat.JSON_FORMAT_UNKNOWN; + case 1: + case "ALLOW": + return FeatureSetJsonFormat.ALLOW; + case 2: + case "LEGACY_BEST_EFFORT": + return FeatureSetJsonFormat.LEGACY_BEST_EFFORT; + case -1: + case "UNRECOGNIZED": + default: + return FeatureSetJsonFormat.UNRECOGNIZED; + } +} + +export function featureSetJsonFormatToJSON(object: FeatureSetJsonFormat): string { + switch (object) { + case FeatureSetJsonFormat.JSON_FORMAT_UNKNOWN: + return "JSON_FORMAT_UNKNOWN"; + case FeatureSetJsonFormat.ALLOW: + return "ALLOW"; + case FeatureSetJsonFormat.LEGACY_BEST_EFFORT: + return "LEGACY_BEST_EFFORT"; + case FeatureSetJsonFormat.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +export function generatedCodeInfoAnnotationSemanticFromJSON(object: any): GeneratedCodeInfoAnnotationSemantic { + switch (object) { + case 0: + case "NONE": + return GeneratedCodeInfoAnnotationSemantic.NONE; + case 1: + case "SET": + return GeneratedCodeInfoAnnotationSemantic.SET; + case 2: + case "ALIAS": + return GeneratedCodeInfoAnnotationSemantic.ALIAS; + case -1: + case "UNRECOGNIZED": + default: + return GeneratedCodeInfoAnnotationSemantic.UNRECOGNIZED; + } +} + +export function generatedCodeInfoAnnotationSemanticToJSON(object: GeneratedCodeInfoAnnotationSemantic): string { + switch (object) { + case GeneratedCodeInfoAnnotationSemantic.NONE: + return "NONE"; + case GeneratedCodeInfoAnnotationSemantic.SET: + return "SET"; + case GeneratedCodeInfoAnnotationSemantic.ALIAS: + return "ALIAS"; + case GeneratedCodeInfoAnnotationSemantic.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +function createBaseFileDescriptorSet(): FileDescriptorSet { + return { file: [] }; +} + +function createBaseFileDescriptorProto(): FileDescriptorProto { + return { + name: "", + package: "", + dependency: [], + public_dependency: [], + weak_dependency: [], + message_type: [], + enum_type: [], + service: [], + extension: [], + options: undefined, + source_code_info: undefined, + syntax: "", + edition: 0, + }; +} + +function createBaseDescriptorProto(): DescriptorProto { + return { + name: "", + field: [], + extension: [], + nested_type: [], + enum_type: [], + extension_range: [], + oneof_decl: [], + options: undefined, + reserved_range: [], + reserved_name: [], + }; +} + +function createBaseDescriptorProtoExtensionRange(): DescriptorProtoExtensionRange { + return { start: 0, end: 0, options: undefined }; +} + +function createBaseDescriptorProtoReservedRange(): DescriptorProtoReservedRange { + return { start: 0, end: 0 }; +} + +function createBaseExtensionRangeOptions(): ExtensionRangeOptions { + return { uninterpreted_option: [], declaration: [], features: undefined, verification: 1 }; +} + +function createBaseExtensionRangeOptionsDeclaration(): ExtensionRangeOptionsDeclaration { + return { number: 0, full_name: "", type: "", reserved: false, repeated: false }; +} + +function createBaseFieldDescriptorProto(): FieldDescriptorProto { + return { + name: "", + number: 0, + label: 1, + type: 1, + type_name: "", + extendee: "", + default_value: "", + oneof_index: 0, + json_name: "", + options: undefined, + proto3_optional: false, + }; +} + +function createBaseOneofDescriptorProto(): OneofDescriptorProto { + return { name: "", options: undefined }; +} + +function createBaseEnumDescriptorProto(): EnumDescriptorProto { + return { name: "", value: [], options: undefined, reserved_range: [], reserved_name: [] }; +} + +function createBaseEnumDescriptorProtoEnumReservedRange(): EnumDescriptorProtoEnumReservedRange { + return { start: 0, end: 0 }; +} + +function createBaseEnumValueDescriptorProto(): EnumValueDescriptorProto { + return { name: "", number: 0, options: undefined }; +} + +function createBaseServiceDescriptorProto(): ServiceDescriptorProto { + return { name: "", method: [], options: undefined }; +} + +function createBaseMethodDescriptorProto(): MethodDescriptorProto { + return { + name: "", + input_type: "", + output_type: "", + options: undefined, + client_streaming: false, + server_streaming: false, + }; +} + +function createBaseFileOptions(): FileOptions { + return { + java_package: "", + java_outer_classname: "", + java_multiple_files: false, + java_generate_equals_and_hash: false, + java_string_check_utf8: false, + optimize_for: 1, + go_package: "", + cc_generic_services: false, + java_generic_services: false, + py_generic_services: false, + deprecated: false, + cc_enable_arenas: true, + objc_class_prefix: "", + csharp_namespace: "", + swift_prefix: "", + php_class_prefix: "", + php_namespace: "", + php_metadata_namespace: "", + ruby_package: "", + features: undefined, + uninterpreted_option: [], + }; +} + +function createBaseMessageOptions(): MessageOptions { + return { + message_set_wire_format: false, + no_standard_descriptor_accessor: false, + deprecated: false, + map_entry: false, + deprecated_legacy_json_field_conflicts: false, + features: undefined, + uninterpreted_option: [], + }; +} + +function createBaseFieldOptions(): FieldOptions { + return { + ctype: 0, + packed: false, + jstype: 0, + lazy: false, + unverified_lazy: false, + deprecated: false, + weak: false, + debug_redact: false, + retention: 0, + targets: [], + edition_defaults: [], + features: undefined, + feature_support: undefined, + uninterpreted_option: [], + }; +} + +function createBaseFieldOptionsEditionDefault(): FieldOptionsEditionDefault { + return { edition: 0, value: "" }; +} + +function createBaseFieldOptionsFeatureSupport(): FieldOptionsFeatureSupport { + return { edition_introduced: 0, edition_deprecated: 0, deprecation_warning: "", edition_removed: 0 }; +} + +function createBaseOneofOptions(): OneofOptions { + return { features: undefined, uninterpreted_option: [] }; +} + +function createBaseEnumOptions(): EnumOptions { + return { + allow_alias: false, + deprecated: false, + deprecated_legacy_json_field_conflicts: false, + features: undefined, + uninterpreted_option: [], + }; +} + +function createBaseEnumValueOptions(): EnumValueOptions { + return { + deprecated: false, + features: undefined, + debug_redact: false, + feature_support: undefined, + uninterpreted_option: [], + }; +} + +function createBaseServiceOptions(): ServiceOptions { + return { features: undefined, deprecated: false, uninterpreted_option: [] }; +} + +function createBaseMethodOptions(): MethodOptions { + return { deprecated: false, idempotency_level: 0, features: undefined, uninterpreted_option: [] }; +} + +function createBaseUninterpretedOption(): UninterpretedOption { + return { + name: [], + identifier_value: "", + positive_int_value: 0, + negative_int_value: 0, + double_value: 0, + string_value: new Uint8Array(0), + aggregate_value: "", + }; +} + +function createBaseUninterpretedOptionNamePart(): UninterpretedOptionNamePart { + return { name_part: "", is_extension: false }; +} + +function createBaseFeatureSet(): FeatureSet { + return { + field_presence: 0, + enum_type: 0, + repeated_field_encoding: 0, + utf8_validation: 0, + message_encoding: 0, + json_format: 0, + }; +} + +function createBaseFeatureSetDefaults(): FeatureSetDefaults { + return { defaults: [], minimum_edition: 0, maximum_edition: 0 }; +} + +function createBaseFeatureSetDefaultsFeatureSetEditionDefault(): FeatureSetDefaultsFeatureSetEditionDefault { + return { edition: 0, overridable_features: undefined, fixed_features: undefined }; +} + +function createBaseSourceCodeInfo(): SourceCodeInfo { + return { location: [] }; +} + +function createBaseSourceCodeInfoLocation(): SourceCodeInfoLocation { + return { path: [], span: [], leading_comments: "", trailing_comments: "", leading_detached_comments: [] }; +} + +function createBaseGeneratedCodeInfo(): GeneratedCodeInfo { + return { annotation: [] }; +} + +function createBaseGeneratedCodeInfoAnnotation(): GeneratedCodeInfoAnnotation { + return { path: [], source_file: "", begin: 0, end: 0, semantic: 0 }; +} + +function bytesFromBase64(b64: string): Uint8Array { + if ((globalThis as any).Buffer) { + return Uint8Array.from(globalThis.Buffer.from(b64, "base64")); + } else { + const bin = globalThis.atob(b64); + const arr = new Uint8Array(bin.length); + for (let i = 0; i < bin.length; ++i) { + arr[i] = bin.charCodeAt(i); + } + return arr; + } +} + +function base64FromBytes(arr: Uint8Array): string { + if ((globalThis as any).Buffer) { + return globalThis.Buffer.from(arr).toString("base64"); + } else { + const bin: string[] = []; + arr.forEach((byte) => { + bin.push(globalThis.String.fromCharCode(byte)); + }); + return globalThis.btoa(bin.join("")); + } +} + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} +export const registry: Array<[string, GeneratedType]> = [ + ["/google.protobuf.FileDescriptorSet", FileDescriptorSet as never], + ["/google.protobuf.FileDescriptorProto", FileDescriptorProto as never], + ["/google.protobuf.DescriptorProto", DescriptorProto as never], + ["/google.protobuf.ExtensionRangeOptions", ExtensionRangeOptions as never], + ["/google.protobuf.FieldDescriptorProto", FieldDescriptorProto as never], + ["/google.protobuf.OneofDescriptorProto", OneofDescriptorProto as never], + ["/google.protobuf.EnumDescriptorProto", EnumDescriptorProto as never], + ["/google.protobuf.ServiceDescriptorProto", ServiceDescriptorProto as never], + ["/google.protobuf.MethodDescriptorProto", MethodDescriptorProto as never], + ["/google.protobuf.FileOptions", FileOptions as never], + ["/google.protobuf.MessageOptions", MessageOptions as never], + ["/google.protobuf.FieldOptions", FieldOptions as never], + ["/google.protobuf.OneofOptions", OneofOptions as never], + ["/google.protobuf.EnumOptions", EnumOptions as never], + ["/google.protobuf.EnumValueOptions", EnumValueOptions as never], + ["/google.protobuf.ServiceOptions", ServiceOptions as never], + ["/google.protobuf.MethodOptions", MethodOptions as never], + ["/google.protobuf.UninterpretedOption", UninterpretedOption as never], + ["/google.protobuf.FeatureSet", FeatureSet as never], + ["/google.protobuf.FeatureSetDefaults", FeatureSetDefaults as never], + ["/google.protobuf.SourceCodeInfo", SourceCodeInfo as never], + ["/google.protobuf.SourceCodeInfo.Location", SourceCodeInfoLocation as never], + ["/google.protobuf.GeneratedCodeInfo", GeneratedCodeInfo as never], +]; +export const aminoConverters = { + "/google.protobuf.FileDescriptorSet": { + aminoType: "google.protobuf.FileDescriptorSet", + toAmino: (message: FileDescriptorSet) => ({ ...message }), + fromAmino: (object: FileDescriptorSet) => ({ ...object }), + }, + + "/google.protobuf.FileDescriptorProto": { + aminoType: "google.protobuf.FileDescriptorProto", + toAmino: (message: FileDescriptorProto) => ({ ...message }), + fromAmino: (object: FileDescriptorProto) => ({ ...object }), + }, + + "/google.protobuf.DescriptorProto": { + aminoType: "google.protobuf.DescriptorProto", + toAmino: (message: DescriptorProto) => ({ ...message }), + fromAmino: (object: DescriptorProto) => ({ ...object }), + }, + + "/google.protobuf.ExtensionRangeOptions": { + aminoType: "google.protobuf.ExtensionRangeOptions", + toAmino: (message: ExtensionRangeOptions) => ({ ...message }), + fromAmino: (object: ExtensionRangeOptions) => ({ ...object }), + }, + + "/google.protobuf.FieldDescriptorProto": { + aminoType: "google.protobuf.FieldDescriptorProto", + toAmino: (message: FieldDescriptorProto) => ({ ...message }), + fromAmino: (object: FieldDescriptorProto) => ({ ...object }), + }, + + "/google.protobuf.OneofDescriptorProto": { + aminoType: "google.protobuf.OneofDescriptorProto", + toAmino: (message: OneofDescriptorProto) => ({ ...message }), + fromAmino: (object: OneofDescriptorProto) => ({ ...object }), + }, + + "/google.protobuf.EnumDescriptorProto": { + aminoType: "google.protobuf.EnumDescriptorProto", + toAmino: (message: EnumDescriptorProto) => ({ ...message }), + fromAmino: (object: EnumDescriptorProto) => ({ ...object }), + }, + + "/google.protobuf.ServiceDescriptorProto": { + aminoType: "google.protobuf.ServiceDescriptorProto", + toAmino: (message: ServiceDescriptorProto) => ({ ...message }), + fromAmino: (object: ServiceDescriptorProto) => ({ ...object }), + }, + + "/google.protobuf.MethodDescriptorProto": { + aminoType: "google.protobuf.MethodDescriptorProto", + toAmino: (message: MethodDescriptorProto) => ({ ...message }), + fromAmino: (object: MethodDescriptorProto) => ({ ...object }), + }, + + "/google.protobuf.FileOptions": { + aminoType: "google.protobuf.FileOptions", + toAmino: (message: FileOptions) => ({ ...message }), + fromAmino: (object: FileOptions) => ({ ...object }), + }, + + "/google.protobuf.MessageOptions": { + aminoType: "google.protobuf.MessageOptions", + toAmino: (message: MessageOptions) => ({ ...message }), + fromAmino: (object: MessageOptions) => ({ ...object }), + }, + + "/google.protobuf.FieldOptions": { + aminoType: "google.protobuf.FieldOptions", + toAmino: (message: FieldOptions) => ({ ...message }), + fromAmino: (object: FieldOptions) => ({ ...object }), + }, + + "/google.protobuf.OneofOptions": { + aminoType: "google.protobuf.OneofOptions", + toAmino: (message: OneofOptions) => ({ ...message }), + fromAmino: (object: OneofOptions) => ({ ...object }), + }, + + "/google.protobuf.EnumOptions": { + aminoType: "google.protobuf.EnumOptions", + toAmino: (message: EnumOptions) => ({ ...message }), + fromAmino: (object: EnumOptions) => ({ ...object }), + }, + + "/google.protobuf.EnumValueOptions": { + aminoType: "google.protobuf.EnumValueOptions", + toAmino: (message: EnumValueOptions) => ({ ...message }), + fromAmino: (object: EnumValueOptions) => ({ ...object }), + }, + + "/google.protobuf.ServiceOptions": { + aminoType: "google.protobuf.ServiceOptions", + toAmino: (message: ServiceOptions) => ({ ...message }), + fromAmino: (object: ServiceOptions) => ({ ...object }), + }, + + "/google.protobuf.MethodOptions": { + aminoType: "google.protobuf.MethodOptions", + toAmino: (message: MethodOptions) => ({ ...message }), + fromAmino: (object: MethodOptions) => ({ ...object }), + }, + + "/google.protobuf.UninterpretedOption": { + aminoType: "google.protobuf.UninterpretedOption", + toAmino: (message: UninterpretedOption) => ({ ...message }), + fromAmino: (object: UninterpretedOption) => ({ ...object }), + }, + + "/google.protobuf.FeatureSet": { + aminoType: "google.protobuf.FeatureSet", + toAmino: (message: FeatureSet) => ({ ...message }), + fromAmino: (object: FeatureSet) => ({ ...object }), + }, + + "/google.protobuf.FeatureSetDefaults": { + aminoType: "google.protobuf.FeatureSetDefaults", + toAmino: (message: FeatureSetDefaults) => ({ ...message }), + fromAmino: (object: FeatureSetDefaults) => ({ ...object }), + }, + + "/google.protobuf.SourceCodeInfo": { + aminoType: "google.protobuf.SourceCodeInfo", + toAmino: (message: SourceCodeInfo) => ({ ...message }), + fromAmino: (object: SourceCodeInfo) => ({ ...object }), + }, + + "/google.protobuf.SourceCodeInfo.Location": { + aminoType: "google.protobuf.SourceCodeInfo.Location", + toAmino: (message: SourceCodeInfoLocation) => ({ ...message }), + fromAmino: (object: SourceCodeInfoLocation) => ({ ...object }), + }, + + "/google.protobuf.GeneratedCodeInfo": { + aminoType: "google.protobuf.GeneratedCodeInfo", + toAmino: (message: GeneratedCodeInfo) => ({ ...message }), + fromAmino: (object: GeneratedCodeInfo) => ({ ...object }), + }, +}; diff --git a/packages/cosmos/generated/encoding/google/protobuf/duration.ts b/packages/cosmos/generated/encoding/google/protobuf/duration.ts new file mode 100644 index 000000000..4915d3e08 --- /dev/null +++ b/packages/cosmos/generated/encoding/google/protobuf/duration.ts @@ -0,0 +1,108 @@ +import type { GeneratedType } from "@cosmjs/proto-signing"; + +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +import type { Duration as Duration_type } from "../../../types/google/protobuf"; + +import type { DeepPartial, Exact, MessageFns } from "../../common"; + +export interface Duration extends Duration_type {} + +export const Duration: MessageFns = { + $type: "google.protobuf.Duration" as const, + + encode(message: Duration, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.seconds !== 0) { + writer.uint32(8).int64(message.seconds); + } + if (message.nanos !== 0) { + writer.uint32(16).int32(message.nanos); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Duration { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDuration(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.seconds = longToNumber(reader.int64()); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.nanos = reader.int32(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Duration { + return { + seconds: isSet(object.seconds) ? globalThis.Number(object.seconds) : 0, + nanos: isSet(object.nanos) ? globalThis.Number(object.nanos) : 0, + }; + }, + + toJSON(message: Duration): unknown { + const obj: any = {}; + if (message.seconds !== 0) { + obj.seconds = Math.round(message.seconds); + } + if (message.nanos !== 0) { + obj.nanos = Math.round(message.nanos); + } + return obj; + }, + + create, I>>(base?: I): Duration { + return Duration.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Duration { + const message = createBaseDuration(); + message.seconds = object.seconds ?? 0; + message.nanos = object.nanos ?? 0; + return message; + }, +}; + +function createBaseDuration(): Duration { + return { seconds: 0, nanos: 0 }; +} + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} +export const registry: Array<[string, GeneratedType]> = [["/google.protobuf.Duration", Duration as never]]; +export const aminoConverters = { + "/google.protobuf.Duration": { + aminoType: "google.protobuf.Duration", + toAmino: (message: Duration) => ({ ...message }), + fromAmino: (object: Duration) => ({ ...object }), + }, +}; diff --git a/packages/cosmos/generated/encoding/google/protobuf/index.ts b/packages/cosmos/generated/encoding/google/protobuf/index.ts new file mode 100644 index 000000000..30a5203d9 --- /dev/null +++ b/packages/cosmos/generated/encoding/google/protobuf/index.ts @@ -0,0 +1,6 @@ +// @ts-nocheck + +export * from './any'; +export * from './descriptor'; +export * from './duration'; +export * from './timestamp'; \ No newline at end of file diff --git a/packages/cosmos/generated/encoding/google/protobuf/timestamp.ts b/packages/cosmos/generated/encoding/google/protobuf/timestamp.ts new file mode 100644 index 000000000..4f4b8aca1 --- /dev/null +++ b/packages/cosmos/generated/encoding/google/protobuf/timestamp.ts @@ -0,0 +1,108 @@ +import type { GeneratedType } from "@cosmjs/proto-signing"; + +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +import type { Timestamp as Timestamp_type } from "../../../types/google/protobuf"; + +import type { DeepPartial, Exact, MessageFns } from "../../common"; + +export interface Timestamp extends Timestamp_type {} + +export const Timestamp: MessageFns = { + $type: "google.protobuf.Timestamp" as const, + + encode(message: Timestamp, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.seconds !== 0) { + writer.uint32(8).int64(message.seconds); + } + if (message.nanos !== 0) { + writer.uint32(16).int32(message.nanos); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Timestamp { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseTimestamp(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.seconds = longToNumber(reader.int64()); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.nanos = reader.int32(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Timestamp { + return { + seconds: isSet(object.seconds) ? globalThis.Number(object.seconds) : 0, + nanos: isSet(object.nanos) ? globalThis.Number(object.nanos) : 0, + }; + }, + + toJSON(message: Timestamp): unknown { + const obj: any = {}; + if (message.seconds !== 0) { + obj.seconds = Math.round(message.seconds); + } + if (message.nanos !== 0) { + obj.nanos = Math.round(message.nanos); + } + return obj; + }, + + create, I>>(base?: I): Timestamp { + return Timestamp.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Timestamp { + const message = createBaseTimestamp(); + message.seconds = object.seconds ?? 0; + message.nanos = object.nanos ?? 0; + return message; + }, +}; + +function createBaseTimestamp(): Timestamp { + return { seconds: 0, nanos: 0 }; +} + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} +export const registry: Array<[string, GeneratedType]> = [["/google.protobuf.Timestamp", Timestamp as never]]; +export const aminoConverters = { + "/google.protobuf.Timestamp": { + aminoType: "google.protobuf.Timestamp", + toAmino: (message: Timestamp) => ({ ...message }), + fromAmino: (object: Timestamp) => ({ ...object }), + }, +}; diff --git a/packages/cosmos/generated/encoding/index.ts b/packages/cosmos/generated/encoding/index.ts new file mode 100644 index 000000000..d321cbd52 --- /dev/null +++ b/packages/cosmos/generated/encoding/index.ts @@ -0,0 +1,107 @@ +import * as confio from "./confio/index"; +import * as cosmos_accesscontrol from "./cosmos/accesscontrol/index"; +import * as cosmos_accesscontrol_x from "./cosmos/accesscontrol_x/index"; +import * as cosmos_auth_v1beta1 from "./cosmos/auth/v1beta1/index"; +import * as cosmos_authz_v1beta1 from "./cosmos/authz/v1beta1/index"; +import * as cosmos_bank_v1beta1 from "./cosmos/bank/v1beta1/index"; +import * as cosmos_base_abci_v1beta1 from "./cosmos/base/abci/v1beta1/index"; +import * as cosmos_base_kv_v1beta1 from "./cosmos/base/kv/v1beta1/index"; +import * as cosmos_base_query_v1beta1 from "./cosmos/base/query/v1beta1/index"; +import * as cosmos_base_reflection_v1beta1 from "./cosmos/base/reflection/v1beta1/index"; +import * as cosmos_base_reflection_v2alpha1 from "./cosmos/base/reflection/v2alpha1/index"; +import * as cosmos_base_snapshots_v1beta1 from "./cosmos/base/snapshots/v1beta1/index"; +import * as cosmos_base_store_v1beta1 from "./cosmos/base/store/v1beta1/index"; +import * as cosmos_base_tendermint_v1beta1 from "./cosmos/base/tendermint/v1beta1/index"; +import * as cosmos_base_v1beta1 from "./cosmos/base/v1beta1/index"; +import * as cosmos_capability_v1beta1 from "./cosmos/capability/v1beta1/index"; +import * as cosmos_crisis_v1beta1 from "./cosmos/crisis/v1beta1/index"; +import * as cosmos_crypto_ed25519 from "./cosmos/crypto/ed25519/index"; +import * as cosmos_crypto_multisig from "./cosmos/crypto/multisig/index"; +import * as cosmos_crypto_secp256k1 from "./cosmos/crypto/secp256k1/index"; +import * as cosmos_crypto_secp256r1 from "./cosmos/crypto/secp256r1/index"; +import * as cosmos_crypto_sr25519 from "./cosmos/crypto/sr25519/index"; +import * as cosmos_distribution_v1beta1 from "./cosmos/distribution/v1beta1/index"; +import * as cosmos_evidence_v1beta1 from "./cosmos/evidence/v1beta1/index"; +import * as cosmos_feegrant_v1beta1 from "./cosmos/feegrant/v1beta1/index"; +import * as cosmos_genutil_v1beta1 from "./cosmos/genutil/v1beta1/index"; +import * as cosmos_gov_v1beta1 from "./cosmos/gov/v1beta1/index"; +import * as cosmos_mint_v1beta1 from "./cosmos/mint/v1beta1/index"; +import * as cosmos_params_types from "./cosmos/params/types/index"; +import * as cosmos_params_v1beta1 from "./cosmos/params/v1beta1/index"; +import * as cosmos_slashing_v1beta1 from "./cosmos/slashing/v1beta1/index"; +import * as cosmos_staking_v1beta1 from "./cosmos/staking/v1beta1/index"; +import * as cosmos_tx_signing_v1beta1 from "./cosmos/tx/signing/v1beta1/index"; +import * as cosmos_tx_v1beta1 from "./cosmos/tx/v1beta1/index"; +import * as cosmos_upgrade_v1beta1 from "./cosmos/upgrade/v1beta1/index"; +import * as cosmos_vesting_v1beta1 from "./cosmos/vesting/v1beta1/index"; +import * as epoch from "./epoch/index"; +import * as eth from "./eth/index"; +import * as evm from "./evm/index"; +import * as google_api from "./google/api/index"; +import * as google_protobuf from "./google/protobuf/index"; +import * as mint_v1beta1 from "./mint/v1beta1/index"; +import * as oracle from "./oracle/index"; +import * as tendermint_abci from "./tendermint/abci/index"; +import * as tendermint_crypto from "./tendermint/crypto/index"; +import * as tendermint_libs_bits from "./tendermint/libs/bits/index"; +import * as tendermint_p2p from "./tendermint/p2p/index"; +import * as tendermint_types from "./tendermint/types/index"; +import * as tendermint_version from "./tendermint/version/index"; +import * as tokenfactory from "./tokenfactory/index"; + +export const Encoder = { + confio: confio, + cosmos: { + accesscontrol: cosmos_accesscontrol, + accesscontrol_x: cosmos_accesscontrol_x, + auth: { v1beta1: cosmos_auth_v1beta1 }, + authz: { v1beta1: cosmos_authz_v1beta1 }, + bank: { v1beta1: cosmos_bank_v1beta1 }, + base: { + abci: { v1beta1: cosmos_base_abci_v1beta1 }, + kv: { v1beta1: cosmos_base_kv_v1beta1 }, + query: { v1beta1: cosmos_base_query_v1beta1 }, + reflection: { v1beta1: cosmos_base_reflection_v1beta1, v2alpha1: cosmos_base_reflection_v2alpha1 }, + snapshots: { v1beta1: cosmos_base_snapshots_v1beta1 }, + store: { v1beta1: cosmos_base_store_v1beta1 }, + tendermint: { v1beta1: cosmos_base_tendermint_v1beta1 }, + v1beta1: cosmos_base_v1beta1, + }, + capability: { v1beta1: cosmos_capability_v1beta1 }, + crisis: { v1beta1: cosmos_crisis_v1beta1 }, + crypto: { + ed25519: cosmos_crypto_ed25519, + multisig: cosmos_crypto_multisig, + secp256k1: cosmos_crypto_secp256k1, + secp256r1: cosmos_crypto_secp256r1, + sr25519: cosmos_crypto_sr25519, + }, + distribution: { v1beta1: cosmos_distribution_v1beta1 }, + evidence: { v1beta1: cosmos_evidence_v1beta1 }, + feegrant: { v1beta1: cosmos_feegrant_v1beta1 }, + genutil: { v1beta1: cosmos_genutil_v1beta1 }, + gov: { v1beta1: cosmos_gov_v1beta1 }, + mint: { v1beta1: cosmos_mint_v1beta1 }, + params: { types: cosmos_params_types, v1beta1: cosmos_params_v1beta1 }, + slashing: { v1beta1: cosmos_slashing_v1beta1 }, + staking: { v1beta1: cosmos_staking_v1beta1 }, + tx: { signing: { v1beta1: cosmos_tx_signing_v1beta1 }, v1beta1: cosmos_tx_v1beta1 }, + upgrade: { v1beta1: cosmos_upgrade_v1beta1 }, + vesting: { v1beta1: cosmos_vesting_v1beta1 }, + }, + epoch: epoch, + eth: eth, + evm: evm, + google: { api: google_api, protobuf: google_protobuf }, + mint: { v1beta1: mint_v1beta1 }, + oracle: oracle, + tendermint: { + abci: tendermint_abci, + crypto: tendermint_crypto, + libs: { bits: tendermint_libs_bits }, + p2p: tendermint_p2p, + types: tendermint_types, + version: tendermint_version, + }, + tokenfactory: tokenfactory, +}; diff --git a/packages/cosmos/generated/encoding/mint/v1beta1/genesis.ts b/packages/cosmos/generated/encoding/mint/v1beta1/genesis.ts new file mode 100644 index 000000000..629afbfab --- /dev/null +++ b/packages/cosmos/generated/encoding/mint/v1beta1/genesis.ts @@ -0,0 +1,99 @@ +import type { GeneratedType } from "@cosmjs/proto-signing"; + +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +import { Minter, Params } from "./mint"; + +import type { GenesisState as GenesisState_type } from "../../../types/mint/v1beta1"; + +import type { DeepPartial, Exact, MessageFns } from "../../common"; + +export interface GenesisState extends GenesisState_type {} + +export const GenesisState: MessageFns = { + $type: "seiprotocol.seichain.mint.GenesisState" as const, + + encode(message: GenesisState, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.minter !== undefined) { + Minter.encode(message.minter, writer.uint32(10).fork()).join(); + } + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GenesisState { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGenesisState(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.minter = Minter.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.params = Params.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GenesisState { + return { + minter: isSet(object.minter) ? Minter.fromJSON(object.minter) : undefined, + params: isSet(object.params) ? Params.fromJSON(object.params) : undefined, + }; + }, + + toJSON(message: GenesisState): unknown { + const obj: any = {}; + if (message.minter !== undefined) { + obj.minter = Minter.toJSON(message.minter); + } + if (message.params !== undefined) { + obj.params = Params.toJSON(message.params); + } + return obj; + }, + + create, I>>(base?: I): GenesisState { + return GenesisState.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): GenesisState { + const message = createBaseGenesisState(); + message.minter = object.minter !== undefined && object.minter !== null ? Minter.fromPartial(object.minter) : undefined; + message.params = object.params !== undefined && object.params !== null ? Params.fromPartial(object.params) : undefined; + return message; + }, +}; + +function createBaseGenesisState(): GenesisState { + return { minter: undefined, params: undefined }; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} +export const registry: Array<[string, GeneratedType]> = [["/seiprotocol.seichain.mint.GenesisState", GenesisState as never]]; +export const aminoConverters = { + "/seiprotocol.seichain.mint.GenesisState": { + aminoType: "mint/GenesisState", + toAmino: (message: GenesisState) => ({ ...message }), + fromAmino: (object: GenesisState) => ({ ...object }), + }, +}; diff --git a/packages/cosmos/generated/encoding/mint/v1beta1/gov.ts b/packages/cosmos/generated/encoding/mint/v1beta1/gov.ts new file mode 100644 index 000000000..1d79fd957 --- /dev/null +++ b/packages/cosmos/generated/encoding/mint/v1beta1/gov.ts @@ -0,0 +1,114 @@ +import type { GeneratedType } from "@cosmjs/proto-signing"; + +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +import { Minter } from "./mint"; + +import type { UpdateMinterProposal as UpdateMinterProposal_type } from "../../../types/mint/v1beta1"; + +import type { DeepPartial, Exact, MessageFns } from "../../common"; + +export interface UpdateMinterProposal extends UpdateMinterProposal_type {} + +export const UpdateMinterProposal: MessageFns = { + $type: "seiprotocol.seichain.mint.UpdateMinterProposal" as const, + + encode(message: UpdateMinterProposal, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.title !== "") { + writer.uint32(10).string(message.title); + } + if (message.description !== "") { + writer.uint32(18).string(message.description); + } + if (message.minter !== undefined) { + Minter.encode(message.minter, writer.uint32(26).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): UpdateMinterProposal { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseUpdateMinterProposal(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.title = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.description = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.minter = Minter.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): UpdateMinterProposal { + return { + title: isSet(object.title) ? globalThis.String(object.title) : "", + description: isSet(object.description) ? globalThis.String(object.description) : "", + minter: isSet(object.minter) ? Minter.fromJSON(object.minter) : undefined, + }; + }, + + toJSON(message: UpdateMinterProposal): unknown { + const obj: any = {}; + if (message.title !== "") { + obj.title = message.title; + } + if (message.description !== "") { + obj.description = message.description; + } + if (message.minter !== undefined) { + obj.minter = Minter.toJSON(message.minter); + } + return obj; + }, + + create, I>>(base?: I): UpdateMinterProposal { + return UpdateMinterProposal.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): UpdateMinterProposal { + const message = createBaseUpdateMinterProposal(); + message.title = object.title ?? ""; + message.description = object.description ?? ""; + message.minter = object.minter !== undefined && object.minter !== null ? Minter.fromPartial(object.minter) : undefined; + return message; + }, +}; + +function createBaseUpdateMinterProposal(): UpdateMinterProposal { + return { title: "", description: "", minter: undefined }; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} +export const registry: Array<[string, GeneratedType]> = [["/seiprotocol.seichain.mint.UpdateMinterProposal", UpdateMinterProposal as never]]; +export const aminoConverters = { + "/seiprotocol.seichain.mint.UpdateMinterProposal": { + aminoType: "mint/UpdateMinterProposal", + toAmino: (message: UpdateMinterProposal) => ({ ...message }), + fromAmino: (object: UpdateMinterProposal) => ({ ...object }), + }, +}; diff --git a/packages/cosmos/generated/encoding/mint/v1beta1/index.ts b/packages/cosmos/generated/encoding/mint/v1beta1/index.ts new file mode 100644 index 000000000..81aaf2edc --- /dev/null +++ b/packages/cosmos/generated/encoding/mint/v1beta1/index.ts @@ -0,0 +1,6 @@ +// @ts-nocheck + +export * from './genesis'; +export * from './gov'; +export * from './mint'; +export * from './query'; \ No newline at end of file diff --git a/packages/cosmos/generated/encoding/mint/v1beta1/mint.ts b/packages/cosmos/generated/encoding/mint/v1beta1/mint.ts new file mode 100644 index 000000000..0c42f8316 --- /dev/null +++ b/packages/cosmos/generated/encoding/mint/v1beta1/mint.ts @@ -0,0 +1,671 @@ +import type { GeneratedType } from "@cosmjs/proto-signing"; + +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +import type { + Minter as Minter_type, + Params as Params_type, + ScheduledTokenRelease as ScheduledTokenRelease_type, + Version2Minter as Version2Minter_type, + Version2Params as Version2Params_type, + Version2ScheduledTokenRelease as Version2ScheduledTokenRelease_type, +} from "../../../types/mint/v1beta1"; + +import type { DeepPartial, Exact, MessageFns } from "../../common"; + +export interface Minter extends Minter_type {} +export interface ScheduledTokenRelease extends ScheduledTokenRelease_type {} +export interface Params extends Params_type {} +export interface Version2Minter extends Version2Minter_type {} +export interface Version2ScheduledTokenRelease extends Version2ScheduledTokenRelease_type {} +export interface Version2Params extends Version2Params_type {} + +export const Minter: MessageFns = { + $type: "seiprotocol.seichain.mint.Minter" as const, + + encode(message: Minter, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.start_date !== "") { + writer.uint32(10).string(message.start_date); + } + if (message.end_date !== "") { + writer.uint32(18).string(message.end_date); + } + if (message.denom !== "") { + writer.uint32(26).string(message.denom); + } + if (message.total_mint_amount !== 0) { + writer.uint32(32).uint64(message.total_mint_amount); + } + if (message.remaining_mint_amount !== 0) { + writer.uint32(40).uint64(message.remaining_mint_amount); + } + if (message.last_mint_amount !== 0) { + writer.uint32(48).uint64(message.last_mint_amount); + } + if (message.last_mint_date !== "") { + writer.uint32(58).string(message.last_mint_date); + } + if (message.last_mint_height !== 0) { + writer.uint32(64).uint64(message.last_mint_height); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Minter { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMinter(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.start_date = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.end_date = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.denom = reader.string(); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.total_mint_amount = longToNumber(reader.uint64()); + continue; + case 5: + if (tag !== 40) { + break; + } + + message.remaining_mint_amount = longToNumber(reader.uint64()); + continue; + case 6: + if (tag !== 48) { + break; + } + + message.last_mint_amount = longToNumber(reader.uint64()); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.last_mint_date = reader.string(); + continue; + case 8: + if (tag !== 64) { + break; + } + + message.last_mint_height = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Minter { + return { + start_date: isSet(object.start_date) ? globalThis.String(object.start_date) : "", + end_date: isSet(object.end_date) ? globalThis.String(object.end_date) : "", + denom: isSet(object.denom) ? globalThis.String(object.denom) : "", + total_mint_amount: isSet(object.total_mint_amount) ? globalThis.Number(object.total_mint_amount) : 0, + remaining_mint_amount: isSet(object.remaining_mint_amount) ? globalThis.Number(object.remaining_mint_amount) : 0, + last_mint_amount: isSet(object.last_mint_amount) ? globalThis.Number(object.last_mint_amount) : 0, + last_mint_date: isSet(object.last_mint_date) ? globalThis.String(object.last_mint_date) : "", + last_mint_height: isSet(object.last_mint_height) ? globalThis.Number(object.last_mint_height) : 0, + }; + }, + + toJSON(message: Minter): unknown { + const obj: any = {}; + if (message.start_date !== "") { + obj.start_date = message.start_date; + } + if (message.end_date !== "") { + obj.end_date = message.end_date; + } + if (message.denom !== "") { + obj.denom = message.denom; + } + if (message.total_mint_amount !== 0) { + obj.total_mint_amount = Math.round(message.total_mint_amount); + } + if (message.remaining_mint_amount !== 0) { + obj.remaining_mint_amount = Math.round(message.remaining_mint_amount); + } + if (message.last_mint_amount !== 0) { + obj.last_mint_amount = Math.round(message.last_mint_amount); + } + if (message.last_mint_date !== "") { + obj.last_mint_date = message.last_mint_date; + } + if (message.last_mint_height !== 0) { + obj.last_mint_height = Math.round(message.last_mint_height); + } + return obj; + }, + + create, I>>(base?: I): Minter { + return Minter.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Minter { + const message = createBaseMinter(); + message.start_date = object.start_date ?? ""; + message.end_date = object.end_date ?? ""; + message.denom = object.denom ?? ""; + message.total_mint_amount = object.total_mint_amount ?? 0; + message.remaining_mint_amount = object.remaining_mint_amount ?? 0; + message.last_mint_amount = object.last_mint_amount ?? 0; + message.last_mint_date = object.last_mint_date ?? ""; + message.last_mint_height = object.last_mint_height ?? 0; + return message; + }, +}; + +export const ScheduledTokenRelease: MessageFns = { + $type: "seiprotocol.seichain.mint.ScheduledTokenRelease" as const, + + encode(message: ScheduledTokenRelease, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.start_date !== "") { + writer.uint32(10).string(message.start_date); + } + if (message.end_date !== "") { + writer.uint32(18).string(message.end_date); + } + if (message.token_release_amount !== 0) { + writer.uint32(24).uint64(message.token_release_amount); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ScheduledTokenRelease { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseScheduledTokenRelease(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.start_date = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.end_date = reader.string(); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.token_release_amount = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ScheduledTokenRelease { + return { + start_date: isSet(object.start_date) ? globalThis.String(object.start_date) : "", + end_date: isSet(object.end_date) ? globalThis.String(object.end_date) : "", + token_release_amount: isSet(object.token_release_amount) ? globalThis.Number(object.token_release_amount) : 0, + }; + }, + + toJSON(message: ScheduledTokenRelease): unknown { + const obj: any = {}; + if (message.start_date !== "") { + obj.start_date = message.start_date; + } + if (message.end_date !== "") { + obj.end_date = message.end_date; + } + if (message.token_release_amount !== 0) { + obj.token_release_amount = Math.round(message.token_release_amount); + } + return obj; + }, + + create, I>>(base?: I): ScheduledTokenRelease { + return ScheduledTokenRelease.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ScheduledTokenRelease { + const message = createBaseScheduledTokenRelease(); + message.start_date = object.start_date ?? ""; + message.end_date = object.end_date ?? ""; + message.token_release_amount = object.token_release_amount ?? 0; + return message; + }, +}; + +export const Params: MessageFns = { + $type: "seiprotocol.seichain.mint.Params" as const, + + encode(message: Params, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.mint_denom !== "") { + writer.uint32(10).string(message.mint_denom); + } + for (const v of message.token_release_schedule) { + ScheduledTokenRelease.encode(v!, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Params { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.mint_denom = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.token_release_schedule.push(ScheduledTokenRelease.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Params { + return { + mint_denom: isSet(object.mint_denom) ? globalThis.String(object.mint_denom) : "", + token_release_schedule: globalThis.Array.isArray(object?.token_release_schedule) + ? object.token_release_schedule.map((e: any) => ScheduledTokenRelease.fromJSON(e)) + : [], + }; + }, + + toJSON(message: Params): unknown { + const obj: any = {}; + if (message.mint_denom !== "") { + obj.mint_denom = message.mint_denom; + } + if (message.token_release_schedule?.length) { + obj.token_release_schedule = message.token_release_schedule.map((e) => ScheduledTokenRelease.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): Params { + return Params.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Params { + const message = createBaseParams(); + message.mint_denom = object.mint_denom ?? ""; + message.token_release_schedule = object.token_release_schedule?.map((e) => ScheduledTokenRelease.fromPartial(e)) || []; + return message; + }, +}; + +export const Version2Minter: MessageFns = { + $type: "seiprotocol.seichain.mint.Version2Minter" as const, + + encode(message: Version2Minter, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.last_mint_amount !== "") { + writer.uint32(10).string(message.last_mint_amount); + } + if (message.last_mint_date !== "") { + writer.uint32(18).string(message.last_mint_date); + } + if (message.last_mint_height !== 0) { + writer.uint32(24).int64(message.last_mint_height); + } + if (message.denom !== "") { + writer.uint32(34).string(message.denom); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Version2Minter { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseVersion2Minter(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.last_mint_amount = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.last_mint_date = reader.string(); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.last_mint_height = longToNumber(reader.int64()); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.denom = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Version2Minter { + return { + last_mint_amount: isSet(object.last_mint_amount) ? globalThis.String(object.last_mint_amount) : "", + last_mint_date: isSet(object.last_mint_date) ? globalThis.String(object.last_mint_date) : "", + last_mint_height: isSet(object.last_mint_height) ? globalThis.Number(object.last_mint_height) : 0, + denom: isSet(object.denom) ? globalThis.String(object.denom) : "", + }; + }, + + toJSON(message: Version2Minter): unknown { + const obj: any = {}; + if (message.last_mint_amount !== "") { + obj.last_mint_amount = message.last_mint_amount; + } + if (message.last_mint_date !== "") { + obj.last_mint_date = message.last_mint_date; + } + if (message.last_mint_height !== 0) { + obj.last_mint_height = Math.round(message.last_mint_height); + } + if (message.denom !== "") { + obj.denom = message.denom; + } + return obj; + }, + + create, I>>(base?: I): Version2Minter { + return Version2Minter.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Version2Minter { + const message = createBaseVersion2Minter(); + message.last_mint_amount = object.last_mint_amount ?? ""; + message.last_mint_date = object.last_mint_date ?? ""; + message.last_mint_height = object.last_mint_height ?? 0; + message.denom = object.denom ?? ""; + return message; + }, +}; + +export const Version2ScheduledTokenRelease: MessageFns = { + $type: "seiprotocol.seichain.mint.Version2ScheduledTokenRelease" as const, + + encode(message: Version2ScheduledTokenRelease, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.date !== "") { + writer.uint32(10).string(message.date); + } + if (message.token_release_amount !== 0) { + writer.uint32(16).int64(message.token_release_amount); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Version2ScheduledTokenRelease { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseVersion2ScheduledTokenRelease(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.date = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.token_release_amount = longToNumber(reader.int64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Version2ScheduledTokenRelease { + return { + date: isSet(object.date) ? globalThis.String(object.date) : "", + token_release_amount: isSet(object.token_release_amount) ? globalThis.Number(object.token_release_amount) : 0, + }; + }, + + toJSON(message: Version2ScheduledTokenRelease): unknown { + const obj: any = {}; + if (message.date !== "") { + obj.date = message.date; + } + if (message.token_release_amount !== 0) { + obj.token_release_amount = Math.round(message.token_release_amount); + } + return obj; + }, + + create, I>>(base?: I): Version2ScheduledTokenRelease { + return Version2ScheduledTokenRelease.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Version2ScheduledTokenRelease { + const message = createBaseVersion2ScheduledTokenRelease(); + message.date = object.date ?? ""; + message.token_release_amount = object.token_release_amount ?? 0; + return message; + }, +}; + +export const Version2Params: MessageFns = { + $type: "seiprotocol.seichain.mint.Version2Params" as const, + + encode(message: Version2Params, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.mint_denom !== "") { + writer.uint32(10).string(message.mint_denom); + } + for (const v of message.token_release_schedule) { + Version2ScheduledTokenRelease.encode(v!, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Version2Params { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseVersion2Params(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.mint_denom = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.token_release_schedule.push(Version2ScheduledTokenRelease.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Version2Params { + return { + mint_denom: isSet(object.mint_denom) ? globalThis.String(object.mint_denom) : "", + token_release_schedule: globalThis.Array.isArray(object?.token_release_schedule) + ? object.token_release_schedule.map((e: any) => Version2ScheduledTokenRelease.fromJSON(e)) + : [], + }; + }, + + toJSON(message: Version2Params): unknown { + const obj: any = {}; + if (message.mint_denom !== "") { + obj.mint_denom = message.mint_denom; + } + if (message.token_release_schedule?.length) { + obj.token_release_schedule = message.token_release_schedule.map((e) => Version2ScheduledTokenRelease.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): Version2Params { + return Version2Params.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Version2Params { + const message = createBaseVersion2Params(); + message.mint_denom = object.mint_denom ?? ""; + message.token_release_schedule = object.token_release_schedule?.map((e) => Version2ScheduledTokenRelease.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseMinter(): Minter { + return { + start_date: "", + end_date: "", + denom: "", + total_mint_amount: 0, + remaining_mint_amount: 0, + last_mint_amount: 0, + last_mint_date: "", + last_mint_height: 0, + }; +} + +function createBaseScheduledTokenRelease(): ScheduledTokenRelease { + return { start_date: "", end_date: "", token_release_amount: 0 }; +} + +function createBaseParams(): Params { + return { mint_denom: "", token_release_schedule: [] }; +} + +function createBaseVersion2Minter(): Version2Minter { + return { last_mint_amount: "", last_mint_date: "", last_mint_height: 0, denom: "" }; +} + +function createBaseVersion2ScheduledTokenRelease(): Version2ScheduledTokenRelease { + return { date: "", token_release_amount: 0 }; +} + +function createBaseVersion2Params(): Version2Params { + return { mint_denom: "", token_release_schedule: [] }; +} + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} +export const registry: Array<[string, GeneratedType]> = [ + ["/seiprotocol.seichain.mint.Minter", Minter as never], + ["/seiprotocol.seichain.mint.Params", Params as never], + ["/seiprotocol.seichain.mint.Version2Minter", Version2Minter as never], + ["/seiprotocol.seichain.mint.Version2Params", Version2Params as never], +]; +export const aminoConverters = { + "/seiprotocol.seichain.mint.Minter": { + aminoType: "mint/Minter", + toAmino: (message: Minter) => ({ ...message }), + fromAmino: (object: Minter) => ({ ...object }), + }, + + "/seiprotocol.seichain.mint.Params": { + aminoType: "mint/Params", + toAmino: (message: Params) => ({ ...message }), + fromAmino: (object: Params) => ({ ...object }), + }, + + "/seiprotocol.seichain.mint.Version2Minter": { + aminoType: "mint/Version2Minter", + toAmino: (message: Version2Minter) => ({ ...message }), + fromAmino: (object: Version2Minter) => ({ ...object }), + }, + + "/seiprotocol.seichain.mint.Version2Params": { + aminoType: "mint/Version2Params", + toAmino: (message: Version2Params) => ({ ...message }), + fromAmino: (object: Version2Params) => ({ ...object }), + }, +}; diff --git a/packages/cosmos/generated/encoding/mint/v1beta1/query.ts b/packages/cosmos/generated/encoding/mint/v1beta1/query.ts new file mode 100644 index 000000000..907e44675 --- /dev/null +++ b/packages/cosmos/generated/encoding/mint/v1beta1/query.ts @@ -0,0 +1,389 @@ +import type { GeneratedType } from "@cosmjs/proto-signing"; + +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +import { Params } from "./mint"; + +import type { + QueryMinterRequest as QueryMinterRequest_type, + QueryMinterResponse as QueryMinterResponse_type, + QueryParamsRequest as QueryParamsRequest_type, + QueryParamsResponse as QueryParamsResponse_type, +} from "../../../types/mint/v1beta1"; + +import type { DeepPartial, Exact, MessageFns } from "../../common"; + +export interface QueryParamsRequest extends QueryParamsRequest_type {} +export interface QueryParamsResponse extends QueryParamsResponse_type {} +export interface QueryMinterRequest extends QueryMinterRequest_type {} +export interface QueryMinterResponse extends QueryMinterResponse_type {} + +export const QueryParamsRequest: MessageFns = { + $type: "seiprotocol.seichain.mint.QueryParamsRequest" as const, + + encode(_: QueryParamsRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryParamsRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryParamsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): QueryParamsRequest { + return {}; + }, + + toJSON(_: QueryParamsRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): QueryParamsRequest { + return QueryParamsRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): QueryParamsRequest { + const message = createBaseQueryParamsRequest(); + return message; + }, +}; + +export const QueryParamsResponse: MessageFns = { + $type: "seiprotocol.seichain.mint.QueryParamsResponse" as const, + + encode(message: QueryParamsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryParamsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryParamsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.params = Params.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryParamsResponse { + return { params: isSet(object.params) ? Params.fromJSON(object.params) : undefined }; + }, + + toJSON(message: QueryParamsResponse): unknown { + const obj: any = {}; + if (message.params !== undefined) { + obj.params = Params.toJSON(message.params); + } + return obj; + }, + + create, I>>(base?: I): QueryParamsResponse { + return QueryParamsResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryParamsResponse { + const message = createBaseQueryParamsResponse(); + message.params = object.params !== undefined && object.params !== null ? Params.fromPartial(object.params) : undefined; + return message; + }, +}; + +export const QueryMinterRequest: MessageFns = { + $type: "seiprotocol.seichain.mint.QueryMinterRequest" as const, + + encode(_: QueryMinterRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryMinterRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryMinterRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): QueryMinterRequest { + return {}; + }, + + toJSON(_: QueryMinterRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): QueryMinterRequest { + return QueryMinterRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): QueryMinterRequest { + const message = createBaseQueryMinterRequest(); + return message; + }, +}; + +export const QueryMinterResponse: MessageFns = { + $type: "seiprotocol.seichain.mint.QueryMinterResponse" as const, + + encode(message: QueryMinterResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.start_date !== "") { + writer.uint32(10).string(message.start_date); + } + if (message.end_date !== "") { + writer.uint32(18).string(message.end_date); + } + if (message.denom !== "") { + writer.uint32(26).string(message.denom); + } + if (message.total_mint_amount !== 0) { + writer.uint32(32).uint64(message.total_mint_amount); + } + if (message.remaining_mint_amount !== 0) { + writer.uint32(40).uint64(message.remaining_mint_amount); + } + if (message.last_mint_amount !== 0) { + writer.uint32(48).uint64(message.last_mint_amount); + } + if (message.last_mint_date !== "") { + writer.uint32(58).string(message.last_mint_date); + } + if (message.last_mint_height !== 0) { + writer.uint32(64).uint64(message.last_mint_height); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryMinterResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryMinterResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.start_date = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.end_date = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.denom = reader.string(); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.total_mint_amount = longToNumber(reader.uint64()); + continue; + case 5: + if (tag !== 40) { + break; + } + + message.remaining_mint_amount = longToNumber(reader.uint64()); + continue; + case 6: + if (tag !== 48) { + break; + } + + message.last_mint_amount = longToNumber(reader.uint64()); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.last_mint_date = reader.string(); + continue; + case 8: + if (tag !== 64) { + break; + } + + message.last_mint_height = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryMinterResponse { + return { + start_date: isSet(object.start_date) ? globalThis.String(object.start_date) : "", + end_date: isSet(object.end_date) ? globalThis.String(object.end_date) : "", + denom: isSet(object.denom) ? globalThis.String(object.denom) : "", + total_mint_amount: isSet(object.total_mint_amount) ? globalThis.Number(object.total_mint_amount) : 0, + remaining_mint_amount: isSet(object.remaining_mint_amount) ? globalThis.Number(object.remaining_mint_amount) : 0, + last_mint_amount: isSet(object.last_mint_amount) ? globalThis.Number(object.last_mint_amount) : 0, + last_mint_date: isSet(object.last_mint_date) ? globalThis.String(object.last_mint_date) : "", + last_mint_height: isSet(object.last_mint_height) ? globalThis.Number(object.last_mint_height) : 0, + }; + }, + + toJSON(message: QueryMinterResponse): unknown { + const obj: any = {}; + if (message.start_date !== "") { + obj.start_date = message.start_date; + } + if (message.end_date !== "") { + obj.end_date = message.end_date; + } + if (message.denom !== "") { + obj.denom = message.denom; + } + if (message.total_mint_amount !== 0) { + obj.total_mint_amount = Math.round(message.total_mint_amount); + } + if (message.remaining_mint_amount !== 0) { + obj.remaining_mint_amount = Math.round(message.remaining_mint_amount); + } + if (message.last_mint_amount !== 0) { + obj.last_mint_amount = Math.round(message.last_mint_amount); + } + if (message.last_mint_date !== "") { + obj.last_mint_date = message.last_mint_date; + } + if (message.last_mint_height !== 0) { + obj.last_mint_height = Math.round(message.last_mint_height); + } + return obj; + }, + + create, I>>(base?: I): QueryMinterResponse { + return QueryMinterResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryMinterResponse { + const message = createBaseQueryMinterResponse(); + message.start_date = object.start_date ?? ""; + message.end_date = object.end_date ?? ""; + message.denom = object.denom ?? ""; + message.total_mint_amount = object.total_mint_amount ?? 0; + message.remaining_mint_amount = object.remaining_mint_amount ?? 0; + message.last_mint_amount = object.last_mint_amount ?? 0; + message.last_mint_date = object.last_mint_date ?? ""; + message.last_mint_height = object.last_mint_height ?? 0; + return message; + }, +}; + +function createBaseQueryParamsRequest(): QueryParamsRequest { + return {}; +} + +function createBaseQueryParamsResponse(): QueryParamsResponse { + return { params: undefined }; +} + +function createBaseQueryMinterRequest(): QueryMinterRequest { + return {}; +} + +function createBaseQueryMinterResponse(): QueryMinterResponse { + return { + start_date: "", + end_date: "", + denom: "", + total_mint_amount: 0, + remaining_mint_amount: 0, + last_mint_amount: 0, + last_mint_date: "", + last_mint_height: 0, + }; +} + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} +export const registry: Array<[string, GeneratedType]> = [ + ["/seiprotocol.seichain.mint.QueryParamsRequest", QueryParamsRequest as never], + ["/seiprotocol.seichain.mint.QueryParamsResponse", QueryParamsResponse as never], + ["/seiprotocol.seichain.mint.QueryMinterRequest", QueryMinterRequest as never], + ["/seiprotocol.seichain.mint.QueryMinterResponse", QueryMinterResponse as never], +]; +export const aminoConverters = { + "/seiprotocol.seichain.mint.QueryParamsRequest": { + aminoType: "mint/QueryParamsRequest", + toAmino: (message: QueryParamsRequest) => ({ ...message }), + fromAmino: (object: QueryParamsRequest) => ({ ...object }), + }, + + "/seiprotocol.seichain.mint.QueryParamsResponse": { + aminoType: "mint/QueryParamsResponse", + toAmino: (message: QueryParamsResponse) => ({ ...message }), + fromAmino: (object: QueryParamsResponse) => ({ ...object }), + }, + + "/seiprotocol.seichain.mint.QueryMinterRequest": { + aminoType: "mint/QueryMinterRequest", + toAmino: (message: QueryMinterRequest) => ({ ...message }), + fromAmino: (object: QueryMinterRequest) => ({ ...object }), + }, + + "/seiprotocol.seichain.mint.QueryMinterResponse": { + aminoType: "mint/QueryMinterResponse", + toAmino: (message: QueryMinterResponse) => ({ ...message }), + fromAmino: (object: QueryMinterResponse) => ({ ...object }), + }, +}; diff --git a/packages/cosmos/generated/encoding/oracle/genesis.ts b/packages/cosmos/generated/encoding/oracle/genesis.ts new file mode 100644 index 000000000..d34d4f78b --- /dev/null +++ b/packages/cosmos/generated/encoding/oracle/genesis.ts @@ -0,0 +1,341 @@ +import type { GeneratedType } from "@cosmjs/proto-signing"; + +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +import { AggregateExchangeRateVote, ExchangeRateTuple, Params, PriceSnapshot, VotePenaltyCounter } from "./oracle"; + +import type { FeederDelegation as FeederDelegation_type, GenesisState as GenesisState_type, PenaltyCounter as PenaltyCounter_type } from "../../types/oracle"; + +import type { DeepPartial, Exact, MessageFns } from "../common"; + +export interface GenesisState extends GenesisState_type {} +export interface FeederDelegation extends FeederDelegation_type {} +export interface PenaltyCounter extends PenaltyCounter_type {} + +export const GenesisState: MessageFns = { + $type: "seiprotocol.seichain.oracle.GenesisState" as const, + + encode(message: GenesisState, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(10).fork()).join(); + } + for (const v of message.feeder_delegations) { + FeederDelegation.encode(v!, writer.uint32(18).fork()).join(); + } + for (const v of message.exchange_rates) { + ExchangeRateTuple.encode(v!, writer.uint32(26).fork()).join(); + } + for (const v of message.penalty_counters) { + PenaltyCounter.encode(v!, writer.uint32(34).fork()).join(); + } + for (const v of message.aggregate_exchange_rate_votes) { + AggregateExchangeRateVote.encode(v!, writer.uint32(50).fork()).join(); + } + for (const v of message.price_snapshots) { + PriceSnapshot.encode(v!, writer.uint32(58).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GenesisState { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGenesisState(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.params = Params.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.feeder_delegations.push(FeederDelegation.decode(reader, reader.uint32())); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.exchange_rates.push(ExchangeRateTuple.decode(reader, reader.uint32())); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.penalty_counters.push(PenaltyCounter.decode(reader, reader.uint32())); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.aggregate_exchange_rate_votes.push(AggregateExchangeRateVote.decode(reader, reader.uint32())); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.price_snapshots.push(PriceSnapshot.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GenesisState { + return { + params: isSet(object.params) ? Params.fromJSON(object.params) : undefined, + feeder_delegations: globalThis.Array.isArray(object?.feeder_delegations) ? object.feeder_delegations.map((e: any) => FeederDelegation.fromJSON(e)) : [], + exchange_rates: globalThis.Array.isArray(object?.exchange_rates) ? object.exchange_rates.map((e: any) => ExchangeRateTuple.fromJSON(e)) : [], + penalty_counters: globalThis.Array.isArray(object?.penalty_counters) ? object.penalty_counters.map((e: any) => PenaltyCounter.fromJSON(e)) : [], + aggregate_exchange_rate_votes: globalThis.Array.isArray(object?.aggregate_exchange_rate_votes) + ? object.aggregate_exchange_rate_votes.map((e: any) => AggregateExchangeRateVote.fromJSON(e)) + : [], + price_snapshots: globalThis.Array.isArray(object?.price_snapshots) ? object.price_snapshots.map((e: any) => PriceSnapshot.fromJSON(e)) : [], + }; + }, + + toJSON(message: GenesisState): unknown { + const obj: any = {}; + if (message.params !== undefined) { + obj.params = Params.toJSON(message.params); + } + if (message.feeder_delegations?.length) { + obj.feeder_delegations = message.feeder_delegations.map((e) => FeederDelegation.toJSON(e)); + } + if (message.exchange_rates?.length) { + obj.exchange_rates = message.exchange_rates.map((e) => ExchangeRateTuple.toJSON(e)); + } + if (message.penalty_counters?.length) { + obj.penalty_counters = message.penalty_counters.map((e) => PenaltyCounter.toJSON(e)); + } + if (message.aggregate_exchange_rate_votes?.length) { + obj.aggregate_exchange_rate_votes = message.aggregate_exchange_rate_votes.map((e) => AggregateExchangeRateVote.toJSON(e)); + } + if (message.price_snapshots?.length) { + obj.price_snapshots = message.price_snapshots.map((e) => PriceSnapshot.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): GenesisState { + return GenesisState.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): GenesisState { + const message = createBaseGenesisState(); + message.params = object.params !== undefined && object.params !== null ? Params.fromPartial(object.params) : undefined; + message.feeder_delegations = object.feeder_delegations?.map((e) => FeederDelegation.fromPartial(e)) || []; + message.exchange_rates = object.exchange_rates?.map((e) => ExchangeRateTuple.fromPartial(e)) || []; + message.penalty_counters = object.penalty_counters?.map((e) => PenaltyCounter.fromPartial(e)) || []; + message.aggregate_exchange_rate_votes = object.aggregate_exchange_rate_votes?.map((e) => AggregateExchangeRateVote.fromPartial(e)) || []; + message.price_snapshots = object.price_snapshots?.map((e) => PriceSnapshot.fromPartial(e)) || []; + return message; + }, +}; + +export const FeederDelegation: MessageFns = { + $type: "seiprotocol.seichain.oracle.FeederDelegation" as const, + + encode(message: FeederDelegation, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.feeder_address !== "") { + writer.uint32(10).string(message.feeder_address); + } + if (message.validator_address !== "") { + writer.uint32(18).string(message.validator_address); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): FeederDelegation { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseFeederDelegation(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.feeder_address = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.validator_address = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): FeederDelegation { + return { + feeder_address: isSet(object.feeder_address) ? globalThis.String(object.feeder_address) : "", + validator_address: isSet(object.validator_address) ? globalThis.String(object.validator_address) : "", + }; + }, + + toJSON(message: FeederDelegation): unknown { + const obj: any = {}; + if (message.feeder_address !== "") { + obj.feeder_address = message.feeder_address; + } + if (message.validator_address !== "") { + obj.validator_address = message.validator_address; + } + return obj; + }, + + create, I>>(base?: I): FeederDelegation { + return FeederDelegation.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): FeederDelegation { + const message = createBaseFeederDelegation(); + message.feeder_address = object.feeder_address ?? ""; + message.validator_address = object.validator_address ?? ""; + return message; + }, +}; + +export const PenaltyCounter: MessageFns = { + $type: "seiprotocol.seichain.oracle.PenaltyCounter" as const, + + encode(message: PenaltyCounter, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.validator_address !== "") { + writer.uint32(10).string(message.validator_address); + } + if (message.vote_penalty_counter !== undefined) { + VotePenaltyCounter.encode(message.vote_penalty_counter, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): PenaltyCounter { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePenaltyCounter(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.validator_address = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.vote_penalty_counter = VotePenaltyCounter.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): PenaltyCounter { + return { + validator_address: isSet(object.validator_address) ? globalThis.String(object.validator_address) : "", + vote_penalty_counter: isSet(object.vote_penalty_counter) ? VotePenaltyCounter.fromJSON(object.vote_penalty_counter) : undefined, + }; + }, + + toJSON(message: PenaltyCounter): unknown { + const obj: any = {}; + if (message.validator_address !== "") { + obj.validator_address = message.validator_address; + } + if (message.vote_penalty_counter !== undefined) { + obj.vote_penalty_counter = VotePenaltyCounter.toJSON(message.vote_penalty_counter); + } + return obj; + }, + + create, I>>(base?: I): PenaltyCounter { + return PenaltyCounter.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): PenaltyCounter { + const message = createBasePenaltyCounter(); + message.validator_address = object.validator_address ?? ""; + message.vote_penalty_counter = + object.vote_penalty_counter !== undefined && object.vote_penalty_counter !== null + ? VotePenaltyCounter.fromPartial(object.vote_penalty_counter) + : undefined; + return message; + }, +}; + +function createBaseGenesisState(): GenesisState { + return { + params: undefined, + feeder_delegations: [], + exchange_rates: [], + penalty_counters: [], + aggregate_exchange_rate_votes: [], + price_snapshots: [], + }; +} + +function createBaseFeederDelegation(): FeederDelegation { + return { feeder_address: "", validator_address: "" }; +} + +function createBasePenaltyCounter(): PenaltyCounter { + return { validator_address: "", vote_penalty_counter: undefined }; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} +export const registry: Array<[string, GeneratedType]> = [ + ["/seiprotocol.seichain.oracle.GenesisState", GenesisState as never], + ["/seiprotocol.seichain.oracle.FeederDelegation", FeederDelegation as never], + ["/seiprotocol.seichain.oracle.PenaltyCounter", PenaltyCounter as never], +]; +export const aminoConverters = { + "/seiprotocol.seichain.oracle.GenesisState": { + aminoType: "oracle/GenesisState", + toAmino: (message: GenesisState) => ({ ...message }), + fromAmino: (object: GenesisState) => ({ ...object }), + }, + + "/seiprotocol.seichain.oracle.FeederDelegation": { + aminoType: "oracle/FeederDelegation", + toAmino: (message: FeederDelegation) => ({ ...message }), + fromAmino: (object: FeederDelegation) => ({ ...object }), + }, + + "/seiprotocol.seichain.oracle.PenaltyCounter": { + aminoType: "oracle/PenaltyCounter", + toAmino: (message: PenaltyCounter) => ({ ...message }), + fromAmino: (object: PenaltyCounter) => ({ ...object }), + }, +}; diff --git a/packages/cosmos/generated/encoding/oracle/index.ts b/packages/cosmos/generated/encoding/oracle/index.ts new file mode 100644 index 000000000..bd05e78b7 --- /dev/null +++ b/packages/cosmos/generated/encoding/oracle/index.ts @@ -0,0 +1,6 @@ +// @ts-nocheck + +export * from './genesis'; +export * from './oracle'; +export * from './query'; +export * from './tx'; \ No newline at end of file diff --git a/packages/cosmos/generated/encoding/oracle/oracle.ts b/packages/cosmos/generated/encoding/oracle/oracle.ts new file mode 100644 index 000000000..f8ffaf09a --- /dev/null +++ b/packages/cosmos/generated/encoding/oracle/oracle.ts @@ -0,0 +1,919 @@ +import type { GeneratedType } from "@cosmjs/proto-signing"; + +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +import type { + AggregateExchangeRateVote as AggregateExchangeRateVote_type, + Denom as Denom_type, + ExchangeRateTuple as ExchangeRateTuple_type, + OracleExchangeRate as OracleExchangeRate_type, + OracleTwap as OracleTwap_type, + Params as Params_type, + PriceSnapshotItem as PriceSnapshotItem_type, + PriceSnapshot as PriceSnapshot_type, + VotePenaltyCounter as VotePenaltyCounter_type, +} from "../../types/oracle"; + +import type { DeepPartial, Exact, MessageFns } from "../common"; + +export interface Params extends Params_type {} +export interface Denom extends Denom_type {} +export interface AggregateExchangeRateVote extends AggregateExchangeRateVote_type {} +export interface ExchangeRateTuple extends ExchangeRateTuple_type {} +export interface OracleExchangeRate extends OracleExchangeRate_type {} +export interface PriceSnapshotItem extends PriceSnapshotItem_type {} +export interface PriceSnapshot extends PriceSnapshot_type {} +export interface OracleTwap extends OracleTwap_type {} +export interface VotePenaltyCounter extends VotePenaltyCounter_type {} + +export const Params: MessageFns = { + $type: "seiprotocol.seichain.oracle.Params" as const, + + encode(message: Params, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.vote_period !== 0) { + writer.uint32(8).uint64(message.vote_period); + } + if (message.vote_threshold !== "") { + writer.uint32(18).string(message.vote_threshold); + } + if (message.reward_band !== "") { + writer.uint32(26).string(message.reward_band); + } + for (const v of message.whitelist) { + Denom.encode(v!, writer.uint32(34).fork()).join(); + } + if (message.slash_fraction !== "") { + writer.uint32(42).string(message.slash_fraction); + } + if (message.slash_window !== 0) { + writer.uint32(48).uint64(message.slash_window); + } + if (message.min_valid_per_window !== "") { + writer.uint32(58).string(message.min_valid_per_window); + } + if (message.lookback_duration !== 0) { + writer.uint32(72).uint64(message.lookback_duration); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Params { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.vote_period = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.vote_threshold = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.reward_band = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.whitelist.push(Denom.decode(reader, reader.uint32())); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.slash_fraction = reader.string(); + continue; + case 6: + if (tag !== 48) { + break; + } + + message.slash_window = longToNumber(reader.uint64()); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.min_valid_per_window = reader.string(); + continue; + case 9: + if (tag !== 72) { + break; + } + + message.lookback_duration = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Params { + return { + vote_period: isSet(object.vote_period) ? globalThis.Number(object.vote_period) : 0, + vote_threshold: isSet(object.vote_threshold) ? globalThis.String(object.vote_threshold) : "", + reward_band: isSet(object.reward_band) ? globalThis.String(object.reward_band) : "", + whitelist: globalThis.Array.isArray(object?.whitelist) ? object.whitelist.map((e: any) => Denom.fromJSON(e)) : [], + slash_fraction: isSet(object.slash_fraction) ? globalThis.String(object.slash_fraction) : "", + slash_window: isSet(object.slash_window) ? globalThis.Number(object.slash_window) : 0, + min_valid_per_window: isSet(object.min_valid_per_window) ? globalThis.String(object.min_valid_per_window) : "", + lookback_duration: isSet(object.lookback_duration) ? globalThis.Number(object.lookback_duration) : 0, + }; + }, + + toJSON(message: Params): unknown { + const obj: any = {}; + if (message.vote_period !== 0) { + obj.vote_period = Math.round(message.vote_period); + } + if (message.vote_threshold !== "") { + obj.vote_threshold = message.vote_threshold; + } + if (message.reward_band !== "") { + obj.reward_band = message.reward_band; + } + if (message.whitelist?.length) { + obj.whitelist = message.whitelist.map((e) => Denom.toJSON(e)); + } + if (message.slash_fraction !== "") { + obj.slash_fraction = message.slash_fraction; + } + if (message.slash_window !== 0) { + obj.slash_window = Math.round(message.slash_window); + } + if (message.min_valid_per_window !== "") { + obj.min_valid_per_window = message.min_valid_per_window; + } + if (message.lookback_duration !== 0) { + obj.lookback_duration = Math.round(message.lookback_duration); + } + return obj; + }, + + create, I>>(base?: I): Params { + return Params.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Params { + const message = createBaseParams(); + message.vote_period = object.vote_period ?? 0; + message.vote_threshold = object.vote_threshold ?? ""; + message.reward_band = object.reward_band ?? ""; + message.whitelist = object.whitelist?.map((e) => Denom.fromPartial(e)) || []; + message.slash_fraction = object.slash_fraction ?? ""; + message.slash_window = object.slash_window ?? 0; + message.min_valid_per_window = object.min_valid_per_window ?? ""; + message.lookback_duration = object.lookback_duration ?? 0; + return message; + }, +}; + +export const Denom: MessageFns = { + $type: "seiprotocol.seichain.oracle.Denom" as const, + + encode(message: Denom, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.name !== "") { + writer.uint32(10).string(message.name); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Denom { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDenom(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.name = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Denom { + return { name: isSet(object.name) ? globalThis.String(object.name) : "" }; + }, + + toJSON(message: Denom): unknown { + const obj: any = {}; + if (message.name !== "") { + obj.name = message.name; + } + return obj; + }, + + create, I>>(base?: I): Denom { + return Denom.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Denom { + const message = createBaseDenom(); + message.name = object.name ?? ""; + return message; + }, +}; + +export const AggregateExchangeRateVote: MessageFns = { + $type: "seiprotocol.seichain.oracle.AggregateExchangeRateVote" as const, + + encode(message: AggregateExchangeRateVote, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.exchange_rate_tuples) { + ExchangeRateTuple.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.voter !== "") { + writer.uint32(18).string(message.voter); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): AggregateExchangeRateVote { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseAggregateExchangeRateVote(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.exchange_rate_tuples.push(ExchangeRateTuple.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.voter = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): AggregateExchangeRateVote { + return { + exchange_rate_tuples: globalThis.Array.isArray(object?.exchange_rate_tuples) + ? object.exchange_rate_tuples.map((e: any) => ExchangeRateTuple.fromJSON(e)) + : [], + voter: isSet(object.voter) ? globalThis.String(object.voter) : "", + }; + }, + + toJSON(message: AggregateExchangeRateVote): unknown { + const obj: any = {}; + if (message.exchange_rate_tuples?.length) { + obj.exchange_rate_tuples = message.exchange_rate_tuples.map((e) => ExchangeRateTuple.toJSON(e)); + } + if (message.voter !== "") { + obj.voter = message.voter; + } + return obj; + }, + + create, I>>(base?: I): AggregateExchangeRateVote { + return AggregateExchangeRateVote.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): AggregateExchangeRateVote { + const message = createBaseAggregateExchangeRateVote(); + message.exchange_rate_tuples = object.exchange_rate_tuples?.map((e) => ExchangeRateTuple.fromPartial(e)) || []; + message.voter = object.voter ?? ""; + return message; + }, +}; + +export const ExchangeRateTuple: MessageFns = { + $type: "seiprotocol.seichain.oracle.ExchangeRateTuple" as const, + + encode(message: ExchangeRateTuple, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.denom !== "") { + writer.uint32(10).string(message.denom); + } + if (message.exchange_rate !== "") { + writer.uint32(18).string(message.exchange_rate); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ExchangeRateTuple { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseExchangeRateTuple(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.denom = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.exchange_rate = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ExchangeRateTuple { + return { + denom: isSet(object.denom) ? globalThis.String(object.denom) : "", + exchange_rate: isSet(object.exchange_rate) ? globalThis.String(object.exchange_rate) : "", + }; + }, + + toJSON(message: ExchangeRateTuple): unknown { + const obj: any = {}; + if (message.denom !== "") { + obj.denom = message.denom; + } + if (message.exchange_rate !== "") { + obj.exchange_rate = message.exchange_rate; + } + return obj; + }, + + create, I>>(base?: I): ExchangeRateTuple { + return ExchangeRateTuple.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ExchangeRateTuple { + const message = createBaseExchangeRateTuple(); + message.denom = object.denom ?? ""; + message.exchange_rate = object.exchange_rate ?? ""; + return message; + }, +}; + +export const OracleExchangeRate: MessageFns = { + $type: "seiprotocol.seichain.oracle.OracleExchangeRate" as const, + + encode(message: OracleExchangeRate, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.exchange_rate !== "") { + writer.uint32(10).string(message.exchange_rate); + } + if (message.last_update !== "") { + writer.uint32(18).string(message.last_update); + } + if (message.last_update_timestamp !== 0) { + writer.uint32(24).int64(message.last_update_timestamp); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): OracleExchangeRate { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseOracleExchangeRate(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.exchange_rate = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.last_update = reader.string(); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.last_update_timestamp = longToNumber(reader.int64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): OracleExchangeRate { + return { + exchange_rate: isSet(object.exchange_rate) ? globalThis.String(object.exchange_rate) : "", + last_update: isSet(object.last_update) ? globalThis.String(object.last_update) : "", + last_update_timestamp: isSet(object.last_update_timestamp) ? globalThis.Number(object.last_update_timestamp) : 0, + }; + }, + + toJSON(message: OracleExchangeRate): unknown { + const obj: any = {}; + if (message.exchange_rate !== "") { + obj.exchange_rate = message.exchange_rate; + } + if (message.last_update !== "") { + obj.last_update = message.last_update; + } + if (message.last_update_timestamp !== 0) { + obj.last_update_timestamp = Math.round(message.last_update_timestamp); + } + return obj; + }, + + create, I>>(base?: I): OracleExchangeRate { + return OracleExchangeRate.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): OracleExchangeRate { + const message = createBaseOracleExchangeRate(); + message.exchange_rate = object.exchange_rate ?? ""; + message.last_update = object.last_update ?? ""; + message.last_update_timestamp = object.last_update_timestamp ?? 0; + return message; + }, +}; + +export const PriceSnapshotItem: MessageFns = { + $type: "seiprotocol.seichain.oracle.PriceSnapshotItem" as const, + + encode(message: PriceSnapshotItem, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.denom !== "") { + writer.uint32(10).string(message.denom); + } + if (message.oracle_exchange_rate !== undefined) { + OracleExchangeRate.encode(message.oracle_exchange_rate, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): PriceSnapshotItem { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePriceSnapshotItem(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.denom = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.oracle_exchange_rate = OracleExchangeRate.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): PriceSnapshotItem { + return { + denom: isSet(object.denom) ? globalThis.String(object.denom) : "", + oracle_exchange_rate: isSet(object.oracle_exchange_rate) ? OracleExchangeRate.fromJSON(object.oracle_exchange_rate) : undefined, + }; + }, + + toJSON(message: PriceSnapshotItem): unknown { + const obj: any = {}; + if (message.denom !== "") { + obj.denom = message.denom; + } + if (message.oracle_exchange_rate !== undefined) { + obj.oracle_exchange_rate = OracleExchangeRate.toJSON(message.oracle_exchange_rate); + } + return obj; + }, + + create, I>>(base?: I): PriceSnapshotItem { + return PriceSnapshotItem.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): PriceSnapshotItem { + const message = createBasePriceSnapshotItem(); + message.denom = object.denom ?? ""; + message.oracle_exchange_rate = + object.oracle_exchange_rate !== undefined && object.oracle_exchange_rate !== null + ? OracleExchangeRate.fromPartial(object.oracle_exchange_rate) + : undefined; + return message; + }, +}; + +export const PriceSnapshot: MessageFns = { + $type: "seiprotocol.seichain.oracle.PriceSnapshot" as const, + + encode(message: PriceSnapshot, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.snapshot_timestamp !== 0) { + writer.uint32(8).int64(message.snapshot_timestamp); + } + for (const v of message.price_snapshot_items) { + PriceSnapshotItem.encode(v!, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): PriceSnapshot { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePriceSnapshot(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.snapshot_timestamp = longToNumber(reader.int64()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.price_snapshot_items.push(PriceSnapshotItem.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): PriceSnapshot { + return { + snapshot_timestamp: isSet(object.snapshot_timestamp) ? globalThis.Number(object.snapshot_timestamp) : 0, + price_snapshot_items: globalThis.Array.isArray(object?.price_snapshot_items) + ? object.price_snapshot_items.map((e: any) => PriceSnapshotItem.fromJSON(e)) + : [], + }; + }, + + toJSON(message: PriceSnapshot): unknown { + const obj: any = {}; + if (message.snapshot_timestamp !== 0) { + obj.snapshot_timestamp = Math.round(message.snapshot_timestamp); + } + if (message.price_snapshot_items?.length) { + obj.price_snapshot_items = message.price_snapshot_items.map((e) => PriceSnapshotItem.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): PriceSnapshot { + return PriceSnapshot.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): PriceSnapshot { + const message = createBasePriceSnapshot(); + message.snapshot_timestamp = object.snapshot_timestamp ?? 0; + message.price_snapshot_items = object.price_snapshot_items?.map((e) => PriceSnapshotItem.fromPartial(e)) || []; + return message; + }, +}; + +export const OracleTwap: MessageFns = { + $type: "seiprotocol.seichain.oracle.OracleTwap" as const, + + encode(message: OracleTwap, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.denom !== "") { + writer.uint32(10).string(message.denom); + } + if (message.twap !== "") { + writer.uint32(18).string(message.twap); + } + if (message.lookback_seconds !== 0) { + writer.uint32(24).int64(message.lookback_seconds); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): OracleTwap { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseOracleTwap(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.denom = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.twap = reader.string(); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.lookback_seconds = longToNumber(reader.int64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): OracleTwap { + return { + denom: isSet(object.denom) ? globalThis.String(object.denom) : "", + twap: isSet(object.twap) ? globalThis.String(object.twap) : "", + lookback_seconds: isSet(object.lookback_seconds) ? globalThis.Number(object.lookback_seconds) : 0, + }; + }, + + toJSON(message: OracleTwap): unknown { + const obj: any = {}; + if (message.denom !== "") { + obj.denom = message.denom; + } + if (message.twap !== "") { + obj.twap = message.twap; + } + if (message.lookback_seconds !== 0) { + obj.lookback_seconds = Math.round(message.lookback_seconds); + } + return obj; + }, + + create, I>>(base?: I): OracleTwap { + return OracleTwap.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): OracleTwap { + const message = createBaseOracleTwap(); + message.denom = object.denom ?? ""; + message.twap = object.twap ?? ""; + message.lookback_seconds = object.lookback_seconds ?? 0; + return message; + }, +}; + +export const VotePenaltyCounter: MessageFns = { + $type: "seiprotocol.seichain.oracle.VotePenaltyCounter" as const, + + encode(message: VotePenaltyCounter, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.miss_count !== 0) { + writer.uint32(8).uint64(message.miss_count); + } + if (message.abstain_count !== 0) { + writer.uint32(16).uint64(message.abstain_count); + } + if (message.success_count !== 0) { + writer.uint32(24).uint64(message.success_count); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): VotePenaltyCounter { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseVotePenaltyCounter(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.miss_count = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.abstain_count = longToNumber(reader.uint64()); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.success_count = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): VotePenaltyCounter { + return { + miss_count: isSet(object.miss_count) ? globalThis.Number(object.miss_count) : 0, + abstain_count: isSet(object.abstain_count) ? globalThis.Number(object.abstain_count) : 0, + success_count: isSet(object.success_count) ? globalThis.Number(object.success_count) : 0, + }; + }, + + toJSON(message: VotePenaltyCounter): unknown { + const obj: any = {}; + if (message.miss_count !== 0) { + obj.miss_count = Math.round(message.miss_count); + } + if (message.abstain_count !== 0) { + obj.abstain_count = Math.round(message.abstain_count); + } + if (message.success_count !== 0) { + obj.success_count = Math.round(message.success_count); + } + return obj; + }, + + create, I>>(base?: I): VotePenaltyCounter { + return VotePenaltyCounter.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): VotePenaltyCounter { + const message = createBaseVotePenaltyCounter(); + message.miss_count = object.miss_count ?? 0; + message.abstain_count = object.abstain_count ?? 0; + message.success_count = object.success_count ?? 0; + return message; + }, +}; + +function createBaseParams(): Params { + return { + vote_period: 0, + vote_threshold: "", + reward_band: "", + whitelist: [], + slash_fraction: "", + slash_window: 0, + min_valid_per_window: "", + lookback_duration: 0, + }; +} + +function createBaseDenom(): Denom { + return { name: "" }; +} + +function createBaseAggregateExchangeRateVote(): AggregateExchangeRateVote { + return { exchange_rate_tuples: [], voter: "" }; +} + +function createBaseExchangeRateTuple(): ExchangeRateTuple { + return { denom: "", exchange_rate: "" }; +} + +function createBaseOracleExchangeRate(): OracleExchangeRate { + return { exchange_rate: "", last_update: "", last_update_timestamp: 0 }; +} + +function createBasePriceSnapshotItem(): PriceSnapshotItem { + return { denom: "", oracle_exchange_rate: undefined }; +} + +function createBasePriceSnapshot(): PriceSnapshot { + return { snapshot_timestamp: 0, price_snapshot_items: [] }; +} + +function createBaseOracleTwap(): OracleTwap { + return { denom: "", twap: "", lookback_seconds: 0 }; +} + +function createBaseVotePenaltyCounter(): VotePenaltyCounter { + return { miss_count: 0, abstain_count: 0, success_count: 0 }; +} + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} +export const registry: Array<[string, GeneratedType]> = [ + ["/seiprotocol.seichain.oracle.Params", Params as never], + ["/seiprotocol.seichain.oracle.Denom", Denom as never], + ["/seiprotocol.seichain.oracle.ExchangeRateTuple", ExchangeRateTuple as never], + ["/seiprotocol.seichain.oracle.OracleExchangeRate", OracleExchangeRate as never], + ["/seiprotocol.seichain.oracle.PriceSnapshotItem", PriceSnapshotItem as never], + ["/seiprotocol.seichain.oracle.PriceSnapshot", PriceSnapshot as never], + ["/seiprotocol.seichain.oracle.OracleTwap", OracleTwap as never], + ["/seiprotocol.seichain.oracle.VotePenaltyCounter", VotePenaltyCounter as never], +]; +export const aminoConverters = { + "/seiprotocol.seichain.oracle.Params": { + aminoType: "oracle/Params", + toAmino: (message: Params) => ({ ...message }), + fromAmino: (object: Params) => ({ ...object }), + }, + + "/seiprotocol.seichain.oracle.Denom": { + aminoType: "oracle/Denom", + toAmino: (message: Denom) => ({ ...message }), + fromAmino: (object: Denom) => ({ ...object }), + }, + + "/seiprotocol.seichain.oracle.ExchangeRateTuple": { + aminoType: "oracle/ExchangeRateTuple", + toAmino: (message: ExchangeRateTuple) => ({ ...message }), + fromAmino: (object: ExchangeRateTuple) => ({ ...object }), + }, + + "/seiprotocol.seichain.oracle.OracleExchangeRate": { + aminoType: "oracle/OracleExchangeRate", + toAmino: (message: OracleExchangeRate) => ({ ...message }), + fromAmino: (object: OracleExchangeRate) => ({ ...object }), + }, + + "/seiprotocol.seichain.oracle.PriceSnapshotItem": { + aminoType: "oracle/PriceSnapshotItem", + toAmino: (message: PriceSnapshotItem) => ({ ...message }), + fromAmino: (object: PriceSnapshotItem) => ({ ...object }), + }, + + "/seiprotocol.seichain.oracle.PriceSnapshot": { + aminoType: "oracle/PriceSnapshot", + toAmino: (message: PriceSnapshot) => ({ ...message }), + fromAmino: (object: PriceSnapshot) => ({ ...object }), + }, + + "/seiprotocol.seichain.oracle.OracleTwap": { + aminoType: "oracle/OracleTwap", + toAmino: (message: OracleTwap) => ({ ...message }), + fromAmino: (object: OracleTwap) => ({ ...object }), + }, + + "/seiprotocol.seichain.oracle.VotePenaltyCounter": { + aminoType: "oracle/VotePenaltyCounter", + toAmino: (message: VotePenaltyCounter) => ({ ...message }), + fromAmino: (object: VotePenaltyCounter) => ({ ...object }), + }, +}; diff --git a/packages/cosmos/generated/encoding/oracle/query.ts b/packages/cosmos/generated/encoding/oracle/query.ts new file mode 100644 index 000000000..a54993b85 --- /dev/null +++ b/packages/cosmos/generated/encoding/oracle/query.ts @@ -0,0 +1,1304 @@ +import type { GeneratedType } from "@cosmjs/proto-signing"; + +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +import { OracleExchangeRate, OracleTwap, Params, PriceSnapshot, VotePenaltyCounter } from "./oracle"; + +import type { + DenomOracleExchangeRatePair as DenomOracleExchangeRatePair_type, + QueryActivesRequest as QueryActivesRequest_type, + QueryActivesResponse as QueryActivesResponse_type, + QueryExchangeRateRequest as QueryExchangeRateRequest_type, + QueryExchangeRateResponse as QueryExchangeRateResponse_type, + QueryExchangeRatesRequest as QueryExchangeRatesRequest_type, + QueryExchangeRatesResponse as QueryExchangeRatesResponse_type, + QueryFeederDelegationRequest as QueryFeederDelegationRequest_type, + QueryFeederDelegationResponse as QueryFeederDelegationResponse_type, + QueryParamsRequest as QueryParamsRequest_type, + QueryParamsResponse as QueryParamsResponse_type, + QueryPriceSnapshotHistoryRequest as QueryPriceSnapshotHistoryRequest_type, + QueryPriceSnapshotHistoryResponse as QueryPriceSnapshotHistoryResponse_type, + QuerySlashWindowRequest as QuerySlashWindowRequest_type, + QuerySlashWindowResponse as QuerySlashWindowResponse_type, + QueryTwapsRequest as QueryTwapsRequest_type, + QueryTwapsResponse as QueryTwapsResponse_type, + QueryVotePenaltyCounterRequest as QueryVotePenaltyCounterRequest_type, + QueryVotePenaltyCounterResponse as QueryVotePenaltyCounterResponse_type, + QueryVoteTargetsRequest as QueryVoteTargetsRequest_type, + QueryVoteTargetsResponse as QueryVoteTargetsResponse_type, +} from "../../types/oracle"; + +import type { DeepPartial, Exact, MessageFns } from "../common"; + +export interface QueryExchangeRateRequest extends QueryExchangeRateRequest_type {} +export interface QueryExchangeRateResponse extends QueryExchangeRateResponse_type {} +export interface QueryExchangeRatesRequest extends QueryExchangeRatesRequest_type {} +export interface DenomOracleExchangeRatePair extends DenomOracleExchangeRatePair_type {} +export interface QueryExchangeRatesResponse extends QueryExchangeRatesResponse_type {} +export interface QueryActivesRequest extends QueryActivesRequest_type {} +export interface QueryActivesResponse extends QueryActivesResponse_type {} +export interface QueryVoteTargetsRequest extends QueryVoteTargetsRequest_type {} +export interface QueryVoteTargetsResponse extends QueryVoteTargetsResponse_type {} +export interface QueryPriceSnapshotHistoryRequest extends QueryPriceSnapshotHistoryRequest_type {} +export interface QueryPriceSnapshotHistoryResponse extends QueryPriceSnapshotHistoryResponse_type {} +export interface QueryTwapsRequest extends QueryTwapsRequest_type {} +export interface QueryTwapsResponse extends QueryTwapsResponse_type {} +export interface QueryFeederDelegationRequest extends QueryFeederDelegationRequest_type {} +export interface QueryFeederDelegationResponse extends QueryFeederDelegationResponse_type {} +export interface QueryVotePenaltyCounterRequest extends QueryVotePenaltyCounterRequest_type {} +export interface QueryVotePenaltyCounterResponse extends QueryVotePenaltyCounterResponse_type {} +export interface QuerySlashWindowRequest extends QuerySlashWindowRequest_type {} +export interface QuerySlashWindowResponse extends QuerySlashWindowResponse_type {} +export interface QueryParamsRequest extends QueryParamsRequest_type {} +export interface QueryParamsResponse extends QueryParamsResponse_type {} + +export const QueryExchangeRateRequest: MessageFns = { + $type: "seiprotocol.seichain.oracle.QueryExchangeRateRequest" as const, + + encode(message: QueryExchangeRateRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.denom !== "") { + writer.uint32(10).string(message.denom); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryExchangeRateRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryExchangeRateRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.denom = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryExchangeRateRequest { + return { denom: isSet(object.denom) ? globalThis.String(object.denom) : "" }; + }, + + toJSON(message: QueryExchangeRateRequest): unknown { + const obj: any = {}; + if (message.denom !== "") { + obj.denom = message.denom; + } + return obj; + }, + + create, I>>(base?: I): QueryExchangeRateRequest { + return QueryExchangeRateRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryExchangeRateRequest { + const message = createBaseQueryExchangeRateRequest(); + message.denom = object.denom ?? ""; + return message; + }, +}; + +export const QueryExchangeRateResponse: MessageFns = { + $type: "seiprotocol.seichain.oracle.QueryExchangeRateResponse" as const, + + encode(message: QueryExchangeRateResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.oracle_exchange_rate !== undefined) { + OracleExchangeRate.encode(message.oracle_exchange_rate, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryExchangeRateResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryExchangeRateResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.oracle_exchange_rate = OracleExchangeRate.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryExchangeRateResponse { + return { + oracle_exchange_rate: isSet(object.oracle_exchange_rate) ? OracleExchangeRate.fromJSON(object.oracle_exchange_rate) : undefined, + }; + }, + + toJSON(message: QueryExchangeRateResponse): unknown { + const obj: any = {}; + if (message.oracle_exchange_rate !== undefined) { + obj.oracle_exchange_rate = OracleExchangeRate.toJSON(message.oracle_exchange_rate); + } + return obj; + }, + + create, I>>(base?: I): QueryExchangeRateResponse { + return QueryExchangeRateResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryExchangeRateResponse { + const message = createBaseQueryExchangeRateResponse(); + message.oracle_exchange_rate = + object.oracle_exchange_rate !== undefined && object.oracle_exchange_rate !== null + ? OracleExchangeRate.fromPartial(object.oracle_exchange_rate) + : undefined; + return message; + }, +}; + +export const QueryExchangeRatesRequest: MessageFns = { + $type: "seiprotocol.seichain.oracle.QueryExchangeRatesRequest" as const, + + encode(_: QueryExchangeRatesRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryExchangeRatesRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryExchangeRatesRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): QueryExchangeRatesRequest { + return {}; + }, + + toJSON(_: QueryExchangeRatesRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): QueryExchangeRatesRequest { + return QueryExchangeRatesRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): QueryExchangeRatesRequest { + const message = createBaseQueryExchangeRatesRequest(); + return message; + }, +}; + +export const DenomOracleExchangeRatePair: MessageFns = { + $type: "seiprotocol.seichain.oracle.DenomOracleExchangeRatePair" as const, + + encode(message: DenomOracleExchangeRatePair, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.denom !== "") { + writer.uint32(10).string(message.denom); + } + if (message.oracle_exchange_rate !== undefined) { + OracleExchangeRate.encode(message.oracle_exchange_rate, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): DenomOracleExchangeRatePair { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDenomOracleExchangeRatePair(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.denom = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.oracle_exchange_rate = OracleExchangeRate.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): DenomOracleExchangeRatePair { + return { + denom: isSet(object.denom) ? globalThis.String(object.denom) : "", + oracle_exchange_rate: isSet(object.oracle_exchange_rate) ? OracleExchangeRate.fromJSON(object.oracle_exchange_rate) : undefined, + }; + }, + + toJSON(message: DenomOracleExchangeRatePair): unknown { + const obj: any = {}; + if (message.denom !== "") { + obj.denom = message.denom; + } + if (message.oracle_exchange_rate !== undefined) { + obj.oracle_exchange_rate = OracleExchangeRate.toJSON(message.oracle_exchange_rate); + } + return obj; + }, + + create, I>>(base?: I): DenomOracleExchangeRatePair { + return DenomOracleExchangeRatePair.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): DenomOracleExchangeRatePair { + const message = createBaseDenomOracleExchangeRatePair(); + message.denom = object.denom ?? ""; + message.oracle_exchange_rate = + object.oracle_exchange_rate !== undefined && object.oracle_exchange_rate !== null + ? OracleExchangeRate.fromPartial(object.oracle_exchange_rate) + : undefined; + return message; + }, +}; + +export const QueryExchangeRatesResponse: MessageFns = { + $type: "seiprotocol.seichain.oracle.QueryExchangeRatesResponse" as const, + + encode(message: QueryExchangeRatesResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.denom_oracle_exchange_rate_pairs) { + DenomOracleExchangeRatePair.encode(v!, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryExchangeRatesResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryExchangeRatesResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.denom_oracle_exchange_rate_pairs.push(DenomOracleExchangeRatePair.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryExchangeRatesResponse { + return { + denom_oracle_exchange_rate_pairs: globalThis.Array.isArray(object?.denom_oracle_exchange_rate_pairs) + ? object.denom_oracle_exchange_rate_pairs.map((e: any) => DenomOracleExchangeRatePair.fromJSON(e)) + : [], + }; + }, + + toJSON(message: QueryExchangeRatesResponse): unknown { + const obj: any = {}; + if (message.denom_oracle_exchange_rate_pairs?.length) { + obj.denom_oracle_exchange_rate_pairs = message.denom_oracle_exchange_rate_pairs.map((e) => DenomOracleExchangeRatePair.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): QueryExchangeRatesResponse { + return QueryExchangeRatesResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryExchangeRatesResponse { + const message = createBaseQueryExchangeRatesResponse(); + message.denom_oracle_exchange_rate_pairs = object.denom_oracle_exchange_rate_pairs?.map((e) => DenomOracleExchangeRatePair.fromPartial(e)) || []; + return message; + }, +}; + +export const QueryActivesRequest: MessageFns = { + $type: "seiprotocol.seichain.oracle.QueryActivesRequest" as const, + + encode(_: QueryActivesRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryActivesRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryActivesRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): QueryActivesRequest { + return {}; + }, + + toJSON(_: QueryActivesRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): QueryActivesRequest { + return QueryActivesRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): QueryActivesRequest { + const message = createBaseQueryActivesRequest(); + return message; + }, +}; + +export const QueryActivesResponse: MessageFns = { + $type: "seiprotocol.seichain.oracle.QueryActivesResponse" as const, + + encode(message: QueryActivesResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.actives) { + writer.uint32(10).string(v!); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryActivesResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryActivesResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.actives.push(reader.string()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryActivesResponse { + return { + actives: globalThis.Array.isArray(object?.actives) ? object.actives.map((e: any) => globalThis.String(e)) : [], + }; + }, + + toJSON(message: QueryActivesResponse): unknown { + const obj: any = {}; + if (message.actives?.length) { + obj.actives = message.actives; + } + return obj; + }, + + create, I>>(base?: I): QueryActivesResponse { + return QueryActivesResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryActivesResponse { + const message = createBaseQueryActivesResponse(); + message.actives = object.actives?.map((e) => e) || []; + return message; + }, +}; + +export const QueryVoteTargetsRequest: MessageFns = { + $type: "seiprotocol.seichain.oracle.QueryVoteTargetsRequest" as const, + + encode(_: QueryVoteTargetsRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryVoteTargetsRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryVoteTargetsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): QueryVoteTargetsRequest { + return {}; + }, + + toJSON(_: QueryVoteTargetsRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): QueryVoteTargetsRequest { + return QueryVoteTargetsRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): QueryVoteTargetsRequest { + const message = createBaseQueryVoteTargetsRequest(); + return message; + }, +}; + +export const QueryVoteTargetsResponse: MessageFns = { + $type: "seiprotocol.seichain.oracle.QueryVoteTargetsResponse" as const, + + encode(message: QueryVoteTargetsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.vote_targets) { + writer.uint32(10).string(v!); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryVoteTargetsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryVoteTargetsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.vote_targets.push(reader.string()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryVoteTargetsResponse { + return { + vote_targets: globalThis.Array.isArray(object?.vote_targets) ? object.vote_targets.map((e: any) => globalThis.String(e)) : [], + }; + }, + + toJSON(message: QueryVoteTargetsResponse): unknown { + const obj: any = {}; + if (message.vote_targets?.length) { + obj.vote_targets = message.vote_targets; + } + return obj; + }, + + create, I>>(base?: I): QueryVoteTargetsResponse { + return QueryVoteTargetsResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryVoteTargetsResponse { + const message = createBaseQueryVoteTargetsResponse(); + message.vote_targets = object.vote_targets?.map((e) => e) || []; + return message; + }, +}; + +export const QueryPriceSnapshotHistoryRequest: MessageFns = { + $type: "seiprotocol.seichain.oracle.QueryPriceSnapshotHistoryRequest" as const, + + encode(_: QueryPriceSnapshotHistoryRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryPriceSnapshotHistoryRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryPriceSnapshotHistoryRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): QueryPriceSnapshotHistoryRequest { + return {}; + }, + + toJSON(_: QueryPriceSnapshotHistoryRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): QueryPriceSnapshotHistoryRequest { + return QueryPriceSnapshotHistoryRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): QueryPriceSnapshotHistoryRequest { + const message = createBaseQueryPriceSnapshotHistoryRequest(); + return message; + }, +}; + +export const QueryPriceSnapshotHistoryResponse: MessageFns = + { + $type: "seiprotocol.seichain.oracle.QueryPriceSnapshotHistoryResponse" as const, + + encode(message: QueryPriceSnapshotHistoryResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.price_snapshots) { + PriceSnapshot.encode(v!, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryPriceSnapshotHistoryResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryPriceSnapshotHistoryResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.price_snapshots.push(PriceSnapshot.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryPriceSnapshotHistoryResponse { + return { + price_snapshots: globalThis.Array.isArray(object?.price_snapshots) ? object.price_snapshots.map((e: any) => PriceSnapshot.fromJSON(e)) : [], + }; + }, + + toJSON(message: QueryPriceSnapshotHistoryResponse): unknown { + const obj: any = {}; + if (message.price_snapshots?.length) { + obj.price_snapshots = message.price_snapshots.map((e) => PriceSnapshot.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): QueryPriceSnapshotHistoryResponse { + return QueryPriceSnapshotHistoryResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryPriceSnapshotHistoryResponse { + const message = createBaseQueryPriceSnapshotHistoryResponse(); + message.price_snapshots = object.price_snapshots?.map((e) => PriceSnapshot.fromPartial(e)) || []; + return message; + }, + }; + +export const QueryTwapsRequest: MessageFns = { + $type: "seiprotocol.seichain.oracle.QueryTwapsRequest" as const, + + encode(message: QueryTwapsRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.lookback_seconds !== 0) { + writer.uint32(8).uint64(message.lookback_seconds); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryTwapsRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryTwapsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.lookback_seconds = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryTwapsRequest { + return { lookback_seconds: isSet(object.lookback_seconds) ? globalThis.Number(object.lookback_seconds) : 0 }; + }, + + toJSON(message: QueryTwapsRequest): unknown { + const obj: any = {}; + if (message.lookback_seconds !== 0) { + obj.lookback_seconds = Math.round(message.lookback_seconds); + } + return obj; + }, + + create, I>>(base?: I): QueryTwapsRequest { + return QueryTwapsRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryTwapsRequest { + const message = createBaseQueryTwapsRequest(); + message.lookback_seconds = object.lookback_seconds ?? 0; + return message; + }, +}; + +export const QueryTwapsResponse: MessageFns = { + $type: "seiprotocol.seichain.oracle.QueryTwapsResponse" as const, + + encode(message: QueryTwapsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.oracle_twaps) { + OracleTwap.encode(v!, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryTwapsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryTwapsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.oracle_twaps.push(OracleTwap.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryTwapsResponse { + return { + oracle_twaps: globalThis.Array.isArray(object?.oracle_twaps) ? object.oracle_twaps.map((e: any) => OracleTwap.fromJSON(e)) : [], + }; + }, + + toJSON(message: QueryTwapsResponse): unknown { + const obj: any = {}; + if (message.oracle_twaps?.length) { + obj.oracle_twaps = message.oracle_twaps.map((e) => OracleTwap.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): QueryTwapsResponse { + return QueryTwapsResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryTwapsResponse { + const message = createBaseQueryTwapsResponse(); + message.oracle_twaps = object.oracle_twaps?.map((e) => OracleTwap.fromPartial(e)) || []; + return message; + }, +}; + +export const QueryFeederDelegationRequest: MessageFns = { + $type: "seiprotocol.seichain.oracle.QueryFeederDelegationRequest" as const, + + encode(message: QueryFeederDelegationRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.validator_addr !== "") { + writer.uint32(10).string(message.validator_addr); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryFeederDelegationRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryFeederDelegationRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.validator_addr = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryFeederDelegationRequest { + return { validator_addr: isSet(object.validator_addr) ? globalThis.String(object.validator_addr) : "" }; + }, + + toJSON(message: QueryFeederDelegationRequest): unknown { + const obj: any = {}; + if (message.validator_addr !== "") { + obj.validator_addr = message.validator_addr; + } + return obj; + }, + + create, I>>(base?: I): QueryFeederDelegationRequest { + return QueryFeederDelegationRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryFeederDelegationRequest { + const message = createBaseQueryFeederDelegationRequest(); + message.validator_addr = object.validator_addr ?? ""; + return message; + }, +}; + +export const QueryFeederDelegationResponse: MessageFns = { + $type: "seiprotocol.seichain.oracle.QueryFeederDelegationResponse" as const, + + encode(message: QueryFeederDelegationResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.feeder_addr !== "") { + writer.uint32(10).string(message.feeder_addr); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryFeederDelegationResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryFeederDelegationResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.feeder_addr = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryFeederDelegationResponse { + return { feeder_addr: isSet(object.feeder_addr) ? globalThis.String(object.feeder_addr) : "" }; + }, + + toJSON(message: QueryFeederDelegationResponse): unknown { + const obj: any = {}; + if (message.feeder_addr !== "") { + obj.feeder_addr = message.feeder_addr; + } + return obj; + }, + + create, I>>(base?: I): QueryFeederDelegationResponse { + return QueryFeederDelegationResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryFeederDelegationResponse { + const message = createBaseQueryFeederDelegationResponse(); + message.feeder_addr = object.feeder_addr ?? ""; + return message; + }, +}; + +export const QueryVotePenaltyCounterRequest: MessageFns = { + $type: "seiprotocol.seichain.oracle.QueryVotePenaltyCounterRequest" as const, + + encode(message: QueryVotePenaltyCounterRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.validator_addr !== "") { + writer.uint32(10).string(message.validator_addr); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryVotePenaltyCounterRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryVotePenaltyCounterRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.validator_addr = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryVotePenaltyCounterRequest { + return { validator_addr: isSet(object.validator_addr) ? globalThis.String(object.validator_addr) : "" }; + }, + + toJSON(message: QueryVotePenaltyCounterRequest): unknown { + const obj: any = {}; + if (message.validator_addr !== "") { + obj.validator_addr = message.validator_addr; + } + return obj; + }, + + create, I>>(base?: I): QueryVotePenaltyCounterRequest { + return QueryVotePenaltyCounterRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryVotePenaltyCounterRequest { + const message = createBaseQueryVotePenaltyCounterRequest(); + message.validator_addr = object.validator_addr ?? ""; + return message; + }, +}; + +export const QueryVotePenaltyCounterResponse: MessageFns = { + $type: "seiprotocol.seichain.oracle.QueryVotePenaltyCounterResponse" as const, + + encode(message: QueryVotePenaltyCounterResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.vote_penalty_counter !== undefined) { + VotePenaltyCounter.encode(message.vote_penalty_counter, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryVotePenaltyCounterResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryVotePenaltyCounterResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.vote_penalty_counter = VotePenaltyCounter.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryVotePenaltyCounterResponse { + return { + vote_penalty_counter: isSet(object.vote_penalty_counter) ? VotePenaltyCounter.fromJSON(object.vote_penalty_counter) : undefined, + }; + }, + + toJSON(message: QueryVotePenaltyCounterResponse): unknown { + const obj: any = {}; + if (message.vote_penalty_counter !== undefined) { + obj.vote_penalty_counter = VotePenaltyCounter.toJSON(message.vote_penalty_counter); + } + return obj; + }, + + create, I>>(base?: I): QueryVotePenaltyCounterResponse { + return QueryVotePenaltyCounterResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryVotePenaltyCounterResponse { + const message = createBaseQueryVotePenaltyCounterResponse(); + message.vote_penalty_counter = + object.vote_penalty_counter !== undefined && object.vote_penalty_counter !== null + ? VotePenaltyCounter.fromPartial(object.vote_penalty_counter) + : undefined; + return message; + }, +}; + +export const QuerySlashWindowRequest: MessageFns = { + $type: "seiprotocol.seichain.oracle.QuerySlashWindowRequest" as const, + + encode(_: QuerySlashWindowRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QuerySlashWindowRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQuerySlashWindowRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): QuerySlashWindowRequest { + return {}; + }, + + toJSON(_: QuerySlashWindowRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): QuerySlashWindowRequest { + return QuerySlashWindowRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): QuerySlashWindowRequest { + const message = createBaseQuerySlashWindowRequest(); + return message; + }, +}; + +export const QuerySlashWindowResponse: MessageFns = { + $type: "seiprotocol.seichain.oracle.QuerySlashWindowResponse" as const, + + encode(message: QuerySlashWindowResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.window_progress !== 0) { + writer.uint32(8).uint64(message.window_progress); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QuerySlashWindowResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQuerySlashWindowResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.window_progress = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QuerySlashWindowResponse { + return { window_progress: isSet(object.window_progress) ? globalThis.Number(object.window_progress) : 0 }; + }, + + toJSON(message: QuerySlashWindowResponse): unknown { + const obj: any = {}; + if (message.window_progress !== 0) { + obj.window_progress = Math.round(message.window_progress); + } + return obj; + }, + + create, I>>(base?: I): QuerySlashWindowResponse { + return QuerySlashWindowResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QuerySlashWindowResponse { + const message = createBaseQuerySlashWindowResponse(); + message.window_progress = object.window_progress ?? 0; + return message; + }, +}; + +export const QueryParamsRequest: MessageFns = { + $type: "seiprotocol.seichain.oracle.QueryParamsRequest" as const, + + encode(_: QueryParamsRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryParamsRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryParamsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): QueryParamsRequest { + return {}; + }, + + toJSON(_: QueryParamsRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): QueryParamsRequest { + return QueryParamsRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): QueryParamsRequest { + const message = createBaseQueryParamsRequest(); + return message; + }, +}; + +export const QueryParamsResponse: MessageFns = { + $type: "seiprotocol.seichain.oracle.QueryParamsResponse" as const, + + encode(message: QueryParamsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryParamsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryParamsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.params = Params.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryParamsResponse { + return { params: isSet(object.params) ? Params.fromJSON(object.params) : undefined }; + }, + + toJSON(message: QueryParamsResponse): unknown { + const obj: any = {}; + if (message.params !== undefined) { + obj.params = Params.toJSON(message.params); + } + return obj; + }, + + create, I>>(base?: I): QueryParamsResponse { + return QueryParamsResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryParamsResponse { + const message = createBaseQueryParamsResponse(); + message.params = object.params !== undefined && object.params !== null ? Params.fromPartial(object.params) : undefined; + return message; + }, +}; + +function createBaseQueryExchangeRateRequest(): QueryExchangeRateRequest { + return { denom: "" }; +} + +function createBaseQueryExchangeRateResponse(): QueryExchangeRateResponse { + return { oracle_exchange_rate: undefined }; +} + +function createBaseQueryExchangeRatesRequest(): QueryExchangeRatesRequest { + return {}; +} + +function createBaseDenomOracleExchangeRatePair(): DenomOracleExchangeRatePair { + return { denom: "", oracle_exchange_rate: undefined }; +} + +function createBaseQueryExchangeRatesResponse(): QueryExchangeRatesResponse { + return { denom_oracle_exchange_rate_pairs: [] }; +} + +function createBaseQueryActivesRequest(): QueryActivesRequest { + return {}; +} + +function createBaseQueryActivesResponse(): QueryActivesResponse { + return { actives: [] }; +} + +function createBaseQueryVoteTargetsRequest(): QueryVoteTargetsRequest { + return {}; +} + +function createBaseQueryVoteTargetsResponse(): QueryVoteTargetsResponse { + return { vote_targets: [] }; +} + +function createBaseQueryPriceSnapshotHistoryRequest(): QueryPriceSnapshotHistoryRequest { + return {}; +} + +function createBaseQueryPriceSnapshotHistoryResponse(): QueryPriceSnapshotHistoryResponse { + return { price_snapshots: [] }; +} + +function createBaseQueryTwapsRequest(): QueryTwapsRequest { + return { lookback_seconds: 0 }; +} + +function createBaseQueryTwapsResponse(): QueryTwapsResponse { + return { oracle_twaps: [] }; +} + +function createBaseQueryFeederDelegationRequest(): QueryFeederDelegationRequest { + return { validator_addr: "" }; +} + +function createBaseQueryFeederDelegationResponse(): QueryFeederDelegationResponse { + return { feeder_addr: "" }; +} + +function createBaseQueryVotePenaltyCounterRequest(): QueryVotePenaltyCounterRequest { + return { validator_addr: "" }; +} + +function createBaseQueryVotePenaltyCounterResponse(): QueryVotePenaltyCounterResponse { + return { vote_penalty_counter: undefined }; +} + +function createBaseQuerySlashWindowRequest(): QuerySlashWindowRequest { + return {}; +} + +function createBaseQuerySlashWindowResponse(): QuerySlashWindowResponse { + return { window_progress: 0 }; +} + +function createBaseQueryParamsRequest(): QueryParamsRequest { + return {}; +} + +function createBaseQueryParamsResponse(): QueryParamsResponse { + return { params: undefined }; +} + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} +export const registry: Array<[string, GeneratedType]> = [ + ["/seiprotocol.seichain.oracle.QueryActivesRequest", QueryActivesRequest as never], + ["/seiprotocol.seichain.oracle.QueryTwapsRequest", QueryTwapsRequest as never], + ["/seiprotocol.seichain.oracle.QueryTwapsResponse", QueryTwapsResponse as never], + ["/seiprotocol.seichain.oracle.QueryParamsRequest", QueryParamsRequest as never], + ["/seiprotocol.seichain.oracle.QueryParamsResponse", QueryParamsResponse as never], +]; +export const aminoConverters = { + "/seiprotocol.seichain.oracle.QueryActivesRequest": { + aminoType: "oracle/QueryActivesRequest", + toAmino: (message: QueryActivesRequest) => ({ ...message }), + fromAmino: (object: QueryActivesRequest) => ({ ...object }), + }, + + "/seiprotocol.seichain.oracle.QueryTwapsRequest": { + aminoType: "oracle/QueryTwapsRequest", + toAmino: (message: QueryTwapsRequest) => ({ ...message }), + fromAmino: (object: QueryTwapsRequest) => ({ ...object }), + }, + + "/seiprotocol.seichain.oracle.QueryTwapsResponse": { + aminoType: "oracle/QueryTwapsResponse", + toAmino: (message: QueryTwapsResponse) => ({ ...message }), + fromAmino: (object: QueryTwapsResponse) => ({ ...object }), + }, + + "/seiprotocol.seichain.oracle.QueryParamsRequest": { + aminoType: "oracle/QueryParamsRequest", + toAmino: (message: QueryParamsRequest) => ({ ...message }), + fromAmino: (object: QueryParamsRequest) => ({ ...object }), + }, + + "/seiprotocol.seichain.oracle.QueryParamsResponse": { + aminoType: "oracle/QueryParamsResponse", + toAmino: (message: QueryParamsResponse) => ({ ...message }), + fromAmino: (object: QueryParamsResponse) => ({ ...object }), + }, +}; diff --git a/packages/cosmos/generated/encoding/oracle/tx.ts b/packages/cosmos/generated/encoding/oracle/tx.ts new file mode 100644 index 000000000..093d06935 --- /dev/null +++ b/packages/cosmos/generated/encoding/oracle/tx.ts @@ -0,0 +1,279 @@ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +import type { + MsgAggregateExchangeRateVoteResponse as MsgAggregateExchangeRateVoteResponse_type, + MsgAggregateExchangeRateVote as MsgAggregateExchangeRateVote_type, + MsgDelegateFeedConsentResponse as MsgDelegateFeedConsentResponse_type, + MsgDelegateFeedConsent as MsgDelegateFeedConsent_type, +} from "../../types/oracle"; + +import type { DeepPartial, Exact, MessageFns } from "../common"; + +export interface MsgAggregateExchangeRateVote extends MsgAggregateExchangeRateVote_type {} +export interface MsgAggregateExchangeRateVoteResponse extends MsgAggregateExchangeRateVoteResponse_type {} +export interface MsgDelegateFeedConsent extends MsgDelegateFeedConsent_type {} +export interface MsgDelegateFeedConsentResponse extends MsgDelegateFeedConsentResponse_type {} + +export const MsgAggregateExchangeRateVote: MessageFns = { + $type: "seiprotocol.seichain.oracle.MsgAggregateExchangeRateVote" as const, + + encode(message: MsgAggregateExchangeRateVote, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.exchange_rates !== "") { + writer.uint32(18).string(message.exchange_rates); + } + if (message.feeder !== "") { + writer.uint32(26).string(message.feeder); + } + if (message.validator !== "") { + writer.uint32(34).string(message.validator); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgAggregateExchangeRateVote { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgAggregateExchangeRateVote(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 2: + if (tag !== 18) { + break; + } + + message.exchange_rates = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.feeder = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.validator = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgAggregateExchangeRateVote { + return { + exchange_rates: isSet(object.exchange_rates) ? globalThis.String(object.exchange_rates) : "", + feeder: isSet(object.feeder) ? globalThis.String(object.feeder) : "", + validator: isSet(object.validator) ? globalThis.String(object.validator) : "", + }; + }, + + toJSON(message: MsgAggregateExchangeRateVote): unknown { + const obj: any = {}; + if (message.exchange_rates !== "") { + obj.exchange_rates = message.exchange_rates; + } + if (message.feeder !== "") { + obj.feeder = message.feeder; + } + if (message.validator !== "") { + obj.validator = message.validator; + } + return obj; + }, + + create, I>>(base?: I): MsgAggregateExchangeRateVote { + return MsgAggregateExchangeRateVote.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgAggregateExchangeRateVote { + const message = createBaseMsgAggregateExchangeRateVote(); + message.exchange_rates = object.exchange_rates ?? ""; + message.feeder = object.feeder ?? ""; + message.validator = object.validator ?? ""; + return message; + }, +}; + +export const MsgAggregateExchangeRateVoteResponse: MessageFns< + MsgAggregateExchangeRateVoteResponse, + "seiprotocol.seichain.oracle.MsgAggregateExchangeRateVoteResponse" +> = { + $type: "seiprotocol.seichain.oracle.MsgAggregateExchangeRateVoteResponse" as const, + + encode(_: MsgAggregateExchangeRateVoteResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgAggregateExchangeRateVoteResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgAggregateExchangeRateVoteResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgAggregateExchangeRateVoteResponse { + return {}; + }, + + toJSON(_: MsgAggregateExchangeRateVoteResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgAggregateExchangeRateVoteResponse { + return MsgAggregateExchangeRateVoteResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgAggregateExchangeRateVoteResponse { + const message = createBaseMsgAggregateExchangeRateVoteResponse(); + return message; + }, +}; + +export const MsgDelegateFeedConsent: MessageFns = { + $type: "seiprotocol.seichain.oracle.MsgDelegateFeedConsent" as const, + + encode(message: MsgDelegateFeedConsent, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.operator !== "") { + writer.uint32(10).string(message.operator); + } + if (message.delegate !== "") { + writer.uint32(18).string(message.delegate); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgDelegateFeedConsent { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgDelegateFeedConsent(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.operator = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.delegate = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgDelegateFeedConsent { + return { + operator: isSet(object.operator) ? globalThis.String(object.operator) : "", + delegate: isSet(object.delegate) ? globalThis.String(object.delegate) : "", + }; + }, + + toJSON(message: MsgDelegateFeedConsent): unknown { + const obj: any = {}; + if (message.operator !== "") { + obj.operator = message.operator; + } + if (message.delegate !== "") { + obj.delegate = message.delegate; + } + return obj; + }, + + create, I>>(base?: I): MsgDelegateFeedConsent { + return MsgDelegateFeedConsent.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgDelegateFeedConsent { + const message = createBaseMsgDelegateFeedConsent(); + message.operator = object.operator ?? ""; + message.delegate = object.delegate ?? ""; + return message; + }, +}; + +export const MsgDelegateFeedConsentResponse: MessageFns = { + $type: "seiprotocol.seichain.oracle.MsgDelegateFeedConsentResponse" as const, + + encode(_: MsgDelegateFeedConsentResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgDelegateFeedConsentResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgDelegateFeedConsentResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgDelegateFeedConsentResponse { + return {}; + }, + + toJSON(_: MsgDelegateFeedConsentResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgDelegateFeedConsentResponse { + return MsgDelegateFeedConsentResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgDelegateFeedConsentResponse { + const message = createBaseMsgDelegateFeedConsentResponse(); + return message; + }, +}; + +function createBaseMsgAggregateExchangeRateVote(): MsgAggregateExchangeRateVote { + return { exchange_rates: "", feeder: "", validator: "" }; +} + +function createBaseMsgAggregateExchangeRateVoteResponse(): MsgAggregateExchangeRateVoteResponse { + return {}; +} + +function createBaseMsgDelegateFeedConsent(): MsgDelegateFeedConsent { + return { operator: "", delegate: "" }; +} + +function createBaseMsgDelegateFeedConsentResponse(): MsgDelegateFeedConsentResponse { + return {}; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} diff --git a/packages/cosmos/generated/encoding/proto.ts b/packages/cosmos/generated/encoding/proto.ts new file mode 100644 index 000000000..1ff2f0d3c --- /dev/null +++ b/packages/cosmos/generated/encoding/proto.ts @@ -0,0 +1,225 @@ +import { registry as confio_proofs_registry } from "./confio/proofs"; +import { registry as cosmos_accesscontrol_accesscontrol_registry } from "./cosmos/accesscontrol/accesscontrol"; +import { registry as cosmos_accesscontrol_x_genesis_registry } from "./cosmos/accesscontrol_x/genesis"; +import { registry as cosmos_accesscontrol_x_query_registry } from "./cosmos/accesscontrol_x/query"; +import { registry as cosmos_auth_v1beta1_auth_registry } from "./cosmos/auth/v1beta1/auth"; +import { registry as cosmos_auth_v1beta1_genesis_registry } from "./cosmos/auth/v1beta1/genesis"; +import { registry as cosmos_auth_v1beta1_query_registry } from "./cosmos/auth/v1beta1/query"; +import { registry as cosmos_authz_v1beta1_authz_registry } from "./cosmos/authz/v1beta1/authz"; +import { registry as cosmos_authz_v1beta1_event_registry } from "./cosmos/authz/v1beta1/event"; +import { registry as cosmos_authz_v1beta1_genesis_registry } from "./cosmos/authz/v1beta1/genesis"; +import { registry as cosmos_authz_v1beta1_query_registry } from "./cosmos/authz/v1beta1/query"; +import { registry as cosmos_authz_v1beta1_tx_registry } from "./cosmos/authz/v1beta1/tx"; +import { registry as cosmos_bank_v1beta1_authz_registry } from "./cosmos/bank/v1beta1/authz"; +import { registry as cosmos_bank_v1beta1_bank_registry } from "./cosmos/bank/v1beta1/bank"; +import { registry as cosmos_bank_v1beta1_genesis_registry } from "./cosmos/bank/v1beta1/genesis"; +import { registry as cosmos_bank_v1beta1_query_registry } from "./cosmos/bank/v1beta1/query"; +import { registry as cosmos_bank_v1beta1_tx_registry } from "./cosmos/bank/v1beta1/tx"; +import { registry as cosmos_base_abci_v1beta1_abci_registry } from "./cosmos/base/abci/v1beta1/abci"; +import { registry as cosmos_base_kv_v1beta1_kv_registry } from "./cosmos/base/kv/v1beta1/kv"; +import { registry as cosmos_base_query_v1beta1_pagination_registry } from "./cosmos/base/query/v1beta1/pagination"; +import { registry as cosmos_base_reflection_v2alpha1_reflection_registry } from "./cosmos/base/reflection/v2alpha1/reflection"; +import { registry as cosmos_base_snapshots_v1beta1_snapshot_registry } from "./cosmos/base/snapshots/v1beta1/snapshot"; +import { registry as cosmos_base_store_v1beta1_commit_info_registry } from "./cosmos/base/store/v1beta1/commit_info"; +import { registry as cosmos_base_store_v1beta1_listening_registry } from "./cosmos/base/store/v1beta1/listening"; +import { registry as cosmos_base_tendermint_v1beta1_query_registry } from "./cosmos/base/tendermint/v1beta1/query"; +import { registry as cosmos_base_v1beta1_coin_registry } from "./cosmos/base/v1beta1/coin"; +import { registry as cosmos_capability_v1beta1_capability_registry } from "./cosmos/capability/v1beta1/capability"; +import { registry as cosmos_capability_v1beta1_genesis_registry } from "./cosmos/capability/v1beta1/genesis"; +import { registry as cosmos_crisis_v1beta1_genesis_registry } from "./cosmos/crisis/v1beta1/genesis"; +import { registry as cosmos_crisis_v1beta1_tx_registry } from "./cosmos/crisis/v1beta1/tx"; +import { registry as cosmos_crypto_ed25519_keys_registry } from "./cosmos/crypto/ed25519/keys"; +import { registry as cosmos_crypto_multisig_keys_registry } from "./cosmos/crypto/multisig/keys"; +import { registry as cosmos_crypto_multisig_v1beta1_multisig_registry } from "./cosmos/crypto/multisig/v1beta1/multisig"; +import { registry as cosmos_crypto_secp256k1_keys_registry } from "./cosmos/crypto/secp256k1/keys"; +import { registry as cosmos_crypto_secp256r1_keys_registry } from "./cosmos/crypto/secp256r1/keys"; +import { registry as cosmos_crypto_sr25519_keys_registry } from "./cosmos/crypto/sr25519/keys"; +import { registry as cosmos_distribution_v1beta1_distribution_registry } from "./cosmos/distribution/v1beta1/distribution"; +import { registry as cosmos_distribution_v1beta1_genesis_registry } from "./cosmos/distribution/v1beta1/genesis"; +import { registry as cosmos_distribution_v1beta1_query_registry } from "./cosmos/distribution/v1beta1/query"; +import { registry as cosmos_evidence_v1beta1_evidence_registry } from "./cosmos/evidence/v1beta1/evidence"; +import { registry as cosmos_evidence_v1beta1_genesis_registry } from "./cosmos/evidence/v1beta1/genesis"; +import { registry as cosmos_evidence_v1beta1_query_registry } from "./cosmos/evidence/v1beta1/query"; +import { registry as cosmos_evidence_v1beta1_tx_registry } from "./cosmos/evidence/v1beta1/tx"; +import { registry as cosmos_feegrant_v1beta1_feegrant_registry } from "./cosmos/feegrant/v1beta1/feegrant"; +import { registry as cosmos_feegrant_v1beta1_genesis_registry } from "./cosmos/feegrant/v1beta1/genesis"; +import { registry as cosmos_feegrant_v1beta1_query_registry } from "./cosmos/feegrant/v1beta1/query"; +import { registry as cosmos_feegrant_v1beta1_tx_registry } from "./cosmos/feegrant/v1beta1/tx"; +import { registry as cosmos_genutil_v1beta1_genesis_registry } from "./cosmos/genutil/v1beta1/genesis"; +import { registry as cosmos_gov_v1beta1_genesis_registry } from "./cosmos/gov/v1beta1/genesis"; +import { registry as cosmos_gov_v1beta1_gov_registry } from "./cosmos/gov/v1beta1/gov"; +import { registry as cosmos_gov_v1beta1_query_registry } from "./cosmos/gov/v1beta1/query"; +import { registry as cosmos_gov_v1beta1_tx_registry } from "./cosmos/gov/v1beta1/tx"; +import { registry as cosmos_mint_v1beta1_genesis_registry } from "./cosmos/mint/v1beta1/genesis"; +import { registry as cosmos_mint_v1beta1_mint_registry } from "./cosmos/mint/v1beta1/mint"; +import { registry as cosmos_mint_v1beta1_query_registry } from "./cosmos/mint/v1beta1/query"; +import { registry as cosmos_params_types_types_registry } from "./cosmos/params/types/types"; +import { registry as cosmos_params_v1beta1_params_registry } from "./cosmos/params/v1beta1/params"; +import { registry as cosmos_params_v1beta1_query_registry } from "./cosmos/params/v1beta1/query"; +import { registry as cosmos_slashing_v1beta1_genesis_registry } from "./cosmos/slashing/v1beta1/genesis"; +import { registry as cosmos_slashing_v1beta1_query_registry } from "./cosmos/slashing/v1beta1/query"; +import { registry as cosmos_slashing_v1beta1_slashing_registry } from "./cosmos/slashing/v1beta1/slashing"; +import { registry as cosmos_slashing_v1beta1_tx_registry } from "./cosmos/slashing/v1beta1/tx"; +import { registry as cosmos_staking_v1beta1_authz_registry } from "./cosmos/staking/v1beta1/authz"; +import { registry as cosmos_staking_v1beta1_genesis_registry } from "./cosmos/staking/v1beta1/genesis"; +import { registry as cosmos_staking_v1beta1_query_registry } from "./cosmos/staking/v1beta1/query"; +import { registry as cosmos_staking_v1beta1_staking_registry } from "./cosmos/staking/v1beta1/staking"; +import { registry as cosmos_staking_v1beta1_tx_registry } from "./cosmos/staking/v1beta1/tx"; +import { registry as cosmos_tx_signing_v1beta1_signing_registry } from "./cosmos/tx/signing/v1beta1/signing"; +import { registry as cosmos_tx_v1beta1_service_registry } from "./cosmos/tx/v1beta1/service"; +import { registry as cosmos_tx_v1beta1_tx_registry } from "./cosmos/tx/v1beta1/tx"; +import { registry as cosmos_upgrade_v1beta1_upgrade_registry } from "./cosmos/upgrade/v1beta1/upgrade"; +import { registry as cosmos_vesting_v1beta1_vesting_registry } from "./cosmos/vesting/v1beta1/vesting"; +import { registry as epoch_epoch_registry } from "./epoch/epoch"; +import { registry as epoch_genesis_registry } from "./epoch/genesis"; +import { registry as epoch_params_registry } from "./epoch/params"; +import { registry as epoch_query_registry } from "./epoch/query"; +import { registry as eth_tx_registry } from "./eth/tx"; +import { registry as evm_config_registry } from "./evm/config"; +import { registry as evm_genesis_registry } from "./evm/genesis"; +import { registry as evm_params_registry } from "./evm/params"; +import { registry as evm_query_registry } from "./evm/query"; +import { registry as evm_receipt_registry } from "./evm/receipt"; +import { registry as evm_tx_registry } from "./evm/tx"; +import { registry as evm_types_registry } from "./evm/types"; +import { registry as google_api_http_registry } from "./google/api/http"; +import { registry as google_api_httpbody_registry } from "./google/api/httpbody"; +import { registry as google_protobuf_any_registry } from "./google/protobuf/any"; +import { registry as google_protobuf_descriptor_registry } from "./google/protobuf/descriptor"; +import { registry as google_protobuf_duration_registry } from "./google/protobuf/duration"; +import { registry as google_protobuf_timestamp_registry } from "./google/protobuf/timestamp"; +import { registry as mint_v1beta1_genesis_registry } from "./mint/v1beta1/genesis"; +import { registry as mint_v1beta1_gov_registry } from "./mint/v1beta1/gov"; +import { registry as mint_v1beta1_mint_registry } from "./mint/v1beta1/mint"; +import { registry as mint_v1beta1_query_registry } from "./mint/v1beta1/query"; +import { registry as oracle_genesis_registry } from "./oracle/genesis"; +import { registry as oracle_oracle_registry } from "./oracle/oracle"; +import { registry as oracle_query_registry } from "./oracle/query"; +import { registry as tendermint_abci_types_registry } from "./tendermint/abci/types"; +import { registry as tendermint_crypto_keys_registry } from "./tendermint/crypto/keys"; +import { registry as tendermint_crypto_proof_registry } from "./tendermint/crypto/proof"; +import { registry as tendermint_libs_bits_types_registry } from "./tendermint/libs/bits/types"; +import { registry as tendermint_p2p_types_registry } from "./tendermint/p2p/types"; +import { registry as tendermint_types_block_registry } from "./tendermint/types/block"; +import { registry as tendermint_types_evidence_registry } from "./tendermint/types/evidence"; +import { registry as tendermint_types_params_registry } from "./tendermint/types/params"; +import { registry as tendermint_types_types_registry } from "./tendermint/types/types"; +import { registry as tendermint_types_validator_registry } from "./tendermint/types/validator"; +import { registry as tendermint_version_types_registry } from "./tendermint/version/types"; +import { registry as tokenfactory_genesis_registry } from "./tokenfactory/genesis"; +import { registry as tokenfactory_params_registry } from "./tokenfactory/params"; +import { registry as tokenfactory_tx_registry } from "./tokenfactory/tx"; + +export const seiProtoRegistry = [ + ...epoch_epoch_registry, + ...confio_proofs_registry, + ...epoch_genesis_registry, + ...epoch_params_registry, + ...epoch_query_registry, + ...eth_tx_registry, + ...evm_config_registry, + ...evm_genesis_registry, + ...evm_params_registry, + ...evm_receipt_registry, + ...evm_query_registry, + ...evm_types_registry, + ...evm_tx_registry, + ...oracle_genesis_registry, + ...oracle_oracle_registry, + ...oracle_query_registry, + ...tokenfactory_genesis_registry, + ...tokenfactory_params_registry, + ...tokenfactory_tx_registry, + ...cosmos_accesscontrol_accesscontrol_registry, + ...cosmos_accesscontrol_x_genesis_registry, + ...cosmos_accesscontrol_x_query_registry, + ...google_api_http_registry, + ...google_api_httpbody_registry, + ...google_protobuf_any_registry, + ...google_protobuf_duration_registry, + ...google_protobuf_timestamp_registry, + ...mint_v1beta1_genesis_registry, + ...google_protobuf_descriptor_registry, + ...mint_v1beta1_gov_registry, + ...mint_v1beta1_mint_registry, + ...mint_v1beta1_query_registry, + ...tendermint_crypto_keys_registry, + ...tendermint_crypto_proof_registry, + ...tendermint_p2p_types_registry, + ...tendermint_types_block_registry, + ...tendermint_types_evidence_registry, + ...tendermint_types_params_registry, + ...tendermint_types_validator_registry, + ...tendermint_version_types_registry, + ...tendermint_types_types_registry, + ...tendermint_abci_types_registry, + ...cosmos_auth_v1beta1_auth_registry, + ...cosmos_auth_v1beta1_genesis_registry, + ...cosmos_auth_v1beta1_query_registry, + ...cosmos_authz_v1beta1_authz_registry, + ...cosmos_authz_v1beta1_event_registry, + ...cosmos_authz_v1beta1_genesis_registry, + ...cosmos_authz_v1beta1_tx_registry, + ...cosmos_authz_v1beta1_query_registry, + ...cosmos_bank_v1beta1_authz_registry, + ...cosmos_bank_v1beta1_bank_registry, + ...cosmos_bank_v1beta1_genesis_registry, + ...cosmos_bank_v1beta1_tx_registry, + ...cosmos_bank_v1beta1_query_registry, + ...cosmos_capability_v1beta1_capability_registry, + ...cosmos_capability_v1beta1_genesis_registry, + ...cosmos_base_v1beta1_coin_registry, + ...cosmos_crypto_ed25519_keys_registry, + ...cosmos_crisis_v1beta1_genesis_registry, + ...cosmos_crisis_v1beta1_tx_registry, + ...cosmos_crypto_multisig_keys_registry, + ...cosmos_crypto_secp256k1_keys_registry, + ...cosmos_crypto_sr25519_keys_registry, + ...cosmos_distribution_v1beta1_distribution_registry, + ...cosmos_distribution_v1beta1_query_registry, + ...cosmos_distribution_v1beta1_genesis_registry, + ...cosmos_crypto_secp256r1_keys_registry, + ...cosmos_evidence_v1beta1_genesis_registry, + ...cosmos_evidence_v1beta1_evidence_registry, + ...cosmos_evidence_v1beta1_query_registry, + ...cosmos_evidence_v1beta1_tx_registry, + ...cosmos_genutil_v1beta1_genesis_registry, + ...cosmos_gov_v1beta1_genesis_registry, + ...cosmos_gov_v1beta1_tx_registry, + ...cosmos_feegrant_v1beta1_feegrant_registry, + ...cosmos_gov_v1beta1_gov_registry, + ...cosmos_feegrant_v1beta1_genesis_registry, + ...cosmos_gov_v1beta1_query_registry, + ...cosmos_feegrant_v1beta1_tx_registry, + ...cosmos_feegrant_v1beta1_query_registry, + ...cosmos_mint_v1beta1_genesis_registry, + ...cosmos_params_types_types_registry, + ...cosmos_mint_v1beta1_query_registry, + ...cosmos_mint_v1beta1_mint_registry, + ...cosmos_params_v1beta1_params_registry, + ...cosmos_params_v1beta1_query_registry, + ...cosmos_slashing_v1beta1_genesis_registry, + ...cosmos_slashing_v1beta1_query_registry, + ...cosmos_slashing_v1beta1_slashing_registry, + ...cosmos_slashing_v1beta1_tx_registry, + ...cosmos_staking_v1beta1_authz_registry, + ...cosmos_staking_v1beta1_genesis_registry, + ...cosmos_staking_v1beta1_tx_registry, + ...cosmos_staking_v1beta1_query_registry, + ...cosmos_staking_v1beta1_staking_registry, + ...cosmos_tx_v1beta1_service_registry, + ...cosmos_tx_v1beta1_tx_registry, + ...cosmos_vesting_v1beta1_vesting_registry, + ...cosmos_upgrade_v1beta1_upgrade_registry, + ...tendermint_libs_bits_types_registry, + ...cosmos_base_kv_v1beta1_kv_registry, + ...cosmos_base_abci_v1beta1_abci_registry, + ...cosmos_base_query_v1beta1_pagination_registry, + ...cosmos_base_snapshots_v1beta1_snapshot_registry, + ...cosmos_base_reflection_v2alpha1_reflection_registry, + ...cosmos_base_store_v1beta1_commit_info_registry, + ...cosmos_base_store_v1beta1_listening_registry, + ...cosmos_base_tendermint_v1beta1_query_registry, + ...cosmos_crypto_multisig_v1beta1_multisig_registry, + ...cosmos_tx_signing_v1beta1_signing_registry, +]; diff --git a/packages/cosmos/generated/encoding/stargate.ts b/packages/cosmos/generated/encoding/stargate.ts new file mode 100644 index 000000000..793a49554 --- /dev/null +++ b/packages/cosmos/generated/encoding/stargate.ts @@ -0,0 +1,2 @@ +export * from "./amino"; +export * from "./proto"; diff --git a/packages/cosmos/generated/encoding/tendermint/abci/index.ts b/packages/cosmos/generated/encoding/tendermint/abci/index.ts new file mode 100644 index 000000000..316cec4f0 --- /dev/null +++ b/packages/cosmos/generated/encoding/tendermint/abci/index.ts @@ -0,0 +1,3 @@ +// @ts-nocheck + +export * from './types'; \ No newline at end of file diff --git a/packages/cosmos/generated/encoding/tendermint/abci/types.ts b/packages/cosmos/generated/encoding/tendermint/abci/types.ts new file mode 100644 index 000000000..962c4ce0a --- /dev/null +++ b/packages/cosmos/generated/encoding/tendermint/abci/types.ts @@ -0,0 +1,5942 @@ +import type { GeneratedType } from "@cosmjs/proto-signing"; + +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +import { Timestamp } from "../../google/protobuf/timestamp"; + +import { PublicKey } from "../crypto/keys"; + +import { ProofOps } from "../crypto/proof"; + +import { ConsensusParams } from "../types/params"; + +import type { + CommitInfo as CommitInfo_type, + EventAttribute as EventAttribute_type, + Event as Event_type, + ExecTxResult as ExecTxResult_type, + ExtendedCommitInfo as ExtendedCommitInfo_type, + ExtendedVoteInfo as ExtendedVoteInfo_type, + Misbehavior as Misbehavior_type, + RequestApplySnapshotChunk as RequestApplySnapshotChunk_type, + RequestCheckTx as RequestCheckTx_type, + RequestCommit as RequestCommit_type, + RequestEcho as RequestEcho_type, + RequestExtendVote as RequestExtendVote_type, + RequestFinalizeBlock as RequestFinalizeBlock_type, + RequestFlush as RequestFlush_type, + RequestInfo as RequestInfo_type, + RequestInitChain as RequestInitChain_type, + RequestListSnapshots as RequestListSnapshots_type, + RequestLoadSnapshotChunk as RequestLoadSnapshotChunk_type, + RequestOfferSnapshot as RequestOfferSnapshot_type, + RequestPrepareProposal as RequestPrepareProposal_type, + RequestProcessProposal as RequestProcessProposal_type, + RequestQuery as RequestQuery_type, + RequestVerifyVoteExtension as RequestVerifyVoteExtension_type, + Request as Request_type, + ResponseApplySnapshotChunk as ResponseApplySnapshotChunk_type, + ResponseCheckTx as ResponseCheckTx_type, + ResponseCommit as ResponseCommit_type, + ResponseDeliverTx as ResponseDeliverTx_type, + ResponseEcho as ResponseEcho_type, + ResponseException as ResponseException_type, + ResponseExtendVote as ResponseExtendVote_type, + ResponseFinalizeBlock as ResponseFinalizeBlock_type, + ResponseFlush as ResponseFlush_type, + ResponseInfo as ResponseInfo_type, + ResponseInitChain as ResponseInitChain_type, + ResponseListSnapshots as ResponseListSnapshots_type, + ResponseLoadSnapshotChunk as ResponseLoadSnapshotChunk_type, + ResponseOfferSnapshot as ResponseOfferSnapshot_type, + ResponsePrepareProposal as ResponsePrepareProposal_type, + ResponseProcessProposal as ResponseProcessProposal_type, + ResponseQuery as ResponseQuery_type, + ResponseVerifyVoteExtension as ResponseVerifyVoteExtension_type, + Response as Response_type, + Snapshot as Snapshot_type, + TxRecord as TxRecord_type, + TxResult as TxResult_type, + ValidatorUpdate as ValidatorUpdate_type, + Validator as Validator_type, + VoteInfo as VoteInfo_type, +} from "../../../types/tendermint/abci"; + +import { + CheckTxType, + MisbehaviorType, + ResponseApplySnapshotChunkResult, + ResponseOfferSnapshotResult, + ResponseProcessProposalProposalStatus, + ResponseVerifyVoteExtensionVerifyStatus, + TxRecordTxAction, +} from "../../../types/tendermint/abci"; + +import type { DeepPartial, Exact, MessageFns } from "../../common"; + +export interface Request extends Request_type {} +export interface RequestEcho extends RequestEcho_type {} +export interface RequestFlush extends RequestFlush_type {} +export interface RequestInfo extends RequestInfo_type {} +export interface RequestInitChain extends RequestInitChain_type {} +export interface RequestQuery extends RequestQuery_type {} +export interface RequestCheckTx extends RequestCheckTx_type {} +export interface RequestCommit extends RequestCommit_type {} +export interface RequestListSnapshots extends RequestListSnapshots_type {} +export interface RequestOfferSnapshot extends RequestOfferSnapshot_type {} +export interface RequestLoadSnapshotChunk extends RequestLoadSnapshotChunk_type {} +export interface RequestApplySnapshotChunk extends RequestApplySnapshotChunk_type {} +export interface RequestPrepareProposal extends RequestPrepareProposal_type {} +export interface RequestProcessProposal extends RequestProcessProposal_type {} +export interface RequestExtendVote extends RequestExtendVote_type {} +export interface RequestVerifyVoteExtension extends RequestVerifyVoteExtension_type {} +export interface RequestFinalizeBlock extends RequestFinalizeBlock_type {} +export interface Response extends Response_type {} +export interface ResponseException extends ResponseException_type {} +export interface ResponseEcho extends ResponseEcho_type {} +export interface ResponseFlush extends ResponseFlush_type {} +export interface ResponseInfo extends ResponseInfo_type {} +export interface ResponseInitChain extends ResponseInitChain_type {} +export interface ResponseQuery extends ResponseQuery_type {} +export interface ResponseCheckTx extends ResponseCheckTx_type {} +export interface ResponseDeliverTx extends ResponseDeliverTx_type {} +export interface ResponseCommit extends ResponseCommit_type {} +export interface ResponseListSnapshots extends ResponseListSnapshots_type {} +export interface ResponseOfferSnapshot extends ResponseOfferSnapshot_type {} +export interface ResponseLoadSnapshotChunk extends ResponseLoadSnapshotChunk_type {} +export interface ResponseApplySnapshotChunk extends ResponseApplySnapshotChunk_type {} +export interface ResponsePrepareProposal extends ResponsePrepareProposal_type {} +export interface ResponseProcessProposal extends ResponseProcessProposal_type {} +export interface ResponseExtendVote extends ResponseExtendVote_type {} +export interface ResponseVerifyVoteExtension extends ResponseVerifyVoteExtension_type {} +export interface ResponseFinalizeBlock extends ResponseFinalizeBlock_type {} +export interface CommitInfo extends CommitInfo_type {} +export interface ExtendedCommitInfo extends ExtendedCommitInfo_type {} +export interface Event extends Event_type {} +export interface EventAttribute extends EventAttribute_type {} +export interface ExecTxResult extends ExecTxResult_type {} +export interface TxResult extends TxResult_type {} +export interface TxRecord extends TxRecord_type {} +export interface Validator extends Validator_type {} +export interface ValidatorUpdate extends ValidatorUpdate_type {} +export interface VoteInfo extends VoteInfo_type {} +export interface ExtendedVoteInfo extends ExtendedVoteInfo_type {} +export interface Misbehavior extends Misbehavior_type {} +export interface Snapshot extends Snapshot_type {} + +export const Request: MessageFns = { + $type: "tendermint.abci.Request" as const, + + encode(message: Request, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.echo !== undefined) { + RequestEcho.encode(message.echo, writer.uint32(10).fork()).join(); + } + if (message.flush !== undefined) { + RequestFlush.encode(message.flush, writer.uint32(18).fork()).join(); + } + if (message.info !== undefined) { + RequestInfo.encode(message.info, writer.uint32(26).fork()).join(); + } + if (message.init_chain !== undefined) { + RequestInitChain.encode(message.init_chain, writer.uint32(34).fork()).join(); + } + if (message.query !== undefined) { + RequestQuery.encode(message.query, writer.uint32(42).fork()).join(); + } + if (message.check_tx !== undefined) { + RequestCheckTx.encode(message.check_tx, writer.uint32(58).fork()).join(); + } + if (message.commit !== undefined) { + RequestCommit.encode(message.commit, writer.uint32(82).fork()).join(); + } + if (message.list_snapshots !== undefined) { + RequestListSnapshots.encode(message.list_snapshots, writer.uint32(90).fork()).join(); + } + if (message.offer_snapshot !== undefined) { + RequestOfferSnapshot.encode(message.offer_snapshot, writer.uint32(98).fork()).join(); + } + if (message.load_snapshot_chunk !== undefined) { + RequestLoadSnapshotChunk.encode(message.load_snapshot_chunk, writer.uint32(106).fork()).join(); + } + if (message.apply_snapshot_chunk !== undefined) { + RequestApplySnapshotChunk.encode(message.apply_snapshot_chunk, writer.uint32(114).fork()).join(); + } + if (message.prepare_proposal !== undefined) { + RequestPrepareProposal.encode(message.prepare_proposal, writer.uint32(122).fork()).join(); + } + if (message.process_proposal !== undefined) { + RequestProcessProposal.encode(message.process_proposal, writer.uint32(130).fork()).join(); + } + if (message.extend_vote !== undefined) { + RequestExtendVote.encode(message.extend_vote, writer.uint32(138).fork()).join(); + } + if (message.verify_vote_extension !== undefined) { + RequestVerifyVoteExtension.encode(message.verify_vote_extension, writer.uint32(146).fork()).join(); + } + if (message.finalize_block !== undefined) { + RequestFinalizeBlock.encode(message.finalize_block, writer.uint32(154).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Request { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.echo = RequestEcho.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.flush = RequestFlush.decode(reader, reader.uint32()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.info = RequestInfo.decode(reader, reader.uint32()); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.init_chain = RequestInitChain.decode(reader, reader.uint32()); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.query = RequestQuery.decode(reader, reader.uint32()); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.check_tx = RequestCheckTx.decode(reader, reader.uint32()); + continue; + case 10: + if (tag !== 82) { + break; + } + + message.commit = RequestCommit.decode(reader, reader.uint32()); + continue; + case 11: + if (tag !== 90) { + break; + } + + message.list_snapshots = RequestListSnapshots.decode(reader, reader.uint32()); + continue; + case 12: + if (tag !== 98) { + break; + } + + message.offer_snapshot = RequestOfferSnapshot.decode(reader, reader.uint32()); + continue; + case 13: + if (tag !== 106) { + break; + } + + message.load_snapshot_chunk = RequestLoadSnapshotChunk.decode(reader, reader.uint32()); + continue; + case 14: + if (tag !== 114) { + break; + } + + message.apply_snapshot_chunk = RequestApplySnapshotChunk.decode(reader, reader.uint32()); + continue; + case 15: + if (tag !== 122) { + break; + } + + message.prepare_proposal = RequestPrepareProposal.decode(reader, reader.uint32()); + continue; + case 16: + if (tag !== 130) { + break; + } + + message.process_proposal = RequestProcessProposal.decode(reader, reader.uint32()); + continue; + case 17: + if (tag !== 138) { + break; + } + + message.extend_vote = RequestExtendVote.decode(reader, reader.uint32()); + continue; + case 18: + if (tag !== 146) { + break; + } + + message.verify_vote_extension = RequestVerifyVoteExtension.decode(reader, reader.uint32()); + continue; + case 19: + if (tag !== 154) { + break; + } + + message.finalize_block = RequestFinalizeBlock.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Request { + return { + echo: isSet(object.echo) ? RequestEcho.fromJSON(object.echo) : undefined, + flush: isSet(object.flush) ? RequestFlush.fromJSON(object.flush) : undefined, + info: isSet(object.info) ? RequestInfo.fromJSON(object.info) : undefined, + init_chain: isSet(object.init_chain) ? RequestInitChain.fromJSON(object.init_chain) : undefined, + query: isSet(object.query) ? RequestQuery.fromJSON(object.query) : undefined, + check_tx: isSet(object.check_tx) ? RequestCheckTx.fromJSON(object.check_tx) : undefined, + commit: isSet(object.commit) ? RequestCommit.fromJSON(object.commit) : undefined, + list_snapshots: isSet(object.list_snapshots) ? RequestListSnapshots.fromJSON(object.list_snapshots) : undefined, + offer_snapshot: isSet(object.offer_snapshot) ? RequestOfferSnapshot.fromJSON(object.offer_snapshot) : undefined, + load_snapshot_chunk: isSet(object.load_snapshot_chunk) ? RequestLoadSnapshotChunk.fromJSON(object.load_snapshot_chunk) : undefined, + apply_snapshot_chunk: isSet(object.apply_snapshot_chunk) ? RequestApplySnapshotChunk.fromJSON(object.apply_snapshot_chunk) : undefined, + prepare_proposal: isSet(object.prepare_proposal) ? RequestPrepareProposal.fromJSON(object.prepare_proposal) : undefined, + process_proposal: isSet(object.process_proposal) ? RequestProcessProposal.fromJSON(object.process_proposal) : undefined, + extend_vote: isSet(object.extend_vote) ? RequestExtendVote.fromJSON(object.extend_vote) : undefined, + verify_vote_extension: isSet(object.verify_vote_extension) ? RequestVerifyVoteExtension.fromJSON(object.verify_vote_extension) : undefined, + finalize_block: isSet(object.finalize_block) ? RequestFinalizeBlock.fromJSON(object.finalize_block) : undefined, + }; + }, + + toJSON(message: Request): unknown { + const obj: any = {}; + if (message.echo !== undefined) { + obj.echo = RequestEcho.toJSON(message.echo); + } + if (message.flush !== undefined) { + obj.flush = RequestFlush.toJSON(message.flush); + } + if (message.info !== undefined) { + obj.info = RequestInfo.toJSON(message.info); + } + if (message.init_chain !== undefined) { + obj.init_chain = RequestInitChain.toJSON(message.init_chain); + } + if (message.query !== undefined) { + obj.query = RequestQuery.toJSON(message.query); + } + if (message.check_tx !== undefined) { + obj.check_tx = RequestCheckTx.toJSON(message.check_tx); + } + if (message.commit !== undefined) { + obj.commit = RequestCommit.toJSON(message.commit); + } + if (message.list_snapshots !== undefined) { + obj.list_snapshots = RequestListSnapshots.toJSON(message.list_snapshots); + } + if (message.offer_snapshot !== undefined) { + obj.offer_snapshot = RequestOfferSnapshot.toJSON(message.offer_snapshot); + } + if (message.load_snapshot_chunk !== undefined) { + obj.load_snapshot_chunk = RequestLoadSnapshotChunk.toJSON(message.load_snapshot_chunk); + } + if (message.apply_snapshot_chunk !== undefined) { + obj.apply_snapshot_chunk = RequestApplySnapshotChunk.toJSON(message.apply_snapshot_chunk); + } + if (message.prepare_proposal !== undefined) { + obj.prepare_proposal = RequestPrepareProposal.toJSON(message.prepare_proposal); + } + if (message.process_proposal !== undefined) { + obj.process_proposal = RequestProcessProposal.toJSON(message.process_proposal); + } + if (message.extend_vote !== undefined) { + obj.extend_vote = RequestExtendVote.toJSON(message.extend_vote); + } + if (message.verify_vote_extension !== undefined) { + obj.verify_vote_extension = RequestVerifyVoteExtension.toJSON(message.verify_vote_extension); + } + if (message.finalize_block !== undefined) { + obj.finalize_block = RequestFinalizeBlock.toJSON(message.finalize_block); + } + return obj; + }, + + create, I>>(base?: I): Request { + return Request.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Request { + const message = createBaseRequest(); + message.echo = object.echo !== undefined && object.echo !== null ? RequestEcho.fromPartial(object.echo) : undefined; + message.flush = object.flush !== undefined && object.flush !== null ? RequestFlush.fromPartial(object.flush) : undefined; + message.info = object.info !== undefined && object.info !== null ? RequestInfo.fromPartial(object.info) : undefined; + message.init_chain = object.init_chain !== undefined && object.init_chain !== null ? RequestInitChain.fromPartial(object.init_chain) : undefined; + message.query = object.query !== undefined && object.query !== null ? RequestQuery.fromPartial(object.query) : undefined; + message.check_tx = object.check_tx !== undefined && object.check_tx !== null ? RequestCheckTx.fromPartial(object.check_tx) : undefined; + message.commit = object.commit !== undefined && object.commit !== null ? RequestCommit.fromPartial(object.commit) : undefined; + message.list_snapshots = + object.list_snapshots !== undefined && object.list_snapshots !== null ? RequestListSnapshots.fromPartial(object.list_snapshots) : undefined; + message.offer_snapshot = + object.offer_snapshot !== undefined && object.offer_snapshot !== null ? RequestOfferSnapshot.fromPartial(object.offer_snapshot) : undefined; + message.load_snapshot_chunk = + object.load_snapshot_chunk !== undefined && object.load_snapshot_chunk !== null + ? RequestLoadSnapshotChunk.fromPartial(object.load_snapshot_chunk) + : undefined; + message.apply_snapshot_chunk = + object.apply_snapshot_chunk !== undefined && object.apply_snapshot_chunk !== null + ? RequestApplySnapshotChunk.fromPartial(object.apply_snapshot_chunk) + : undefined; + message.prepare_proposal = + object.prepare_proposal !== undefined && object.prepare_proposal !== null ? RequestPrepareProposal.fromPartial(object.prepare_proposal) : undefined; + message.process_proposal = + object.process_proposal !== undefined && object.process_proposal !== null ? RequestProcessProposal.fromPartial(object.process_proposal) : undefined; + message.extend_vote = object.extend_vote !== undefined && object.extend_vote !== null ? RequestExtendVote.fromPartial(object.extend_vote) : undefined; + message.verify_vote_extension = + object.verify_vote_extension !== undefined && object.verify_vote_extension !== null + ? RequestVerifyVoteExtension.fromPartial(object.verify_vote_extension) + : undefined; + message.finalize_block = + object.finalize_block !== undefined && object.finalize_block !== null ? RequestFinalizeBlock.fromPartial(object.finalize_block) : undefined; + return message; + }, +}; + +export const RequestEcho: MessageFns = { + $type: "tendermint.abci.RequestEcho" as const, + + encode(message: RequestEcho, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.message !== "") { + writer.uint32(10).string(message.message); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): RequestEcho { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRequestEcho(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.message = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): RequestEcho { + return { message: isSet(object.message) ? globalThis.String(object.message) : "" }; + }, + + toJSON(message: RequestEcho): unknown { + const obj: any = {}; + if (message.message !== "") { + obj.message = message.message; + } + return obj; + }, + + create, I>>(base?: I): RequestEcho { + return RequestEcho.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): RequestEcho { + const message = createBaseRequestEcho(); + message.message = object.message ?? ""; + return message; + }, +}; + +export const RequestFlush: MessageFns = { + $type: "tendermint.abci.RequestFlush" as const, + + encode(_: RequestFlush, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): RequestFlush { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRequestFlush(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): RequestFlush { + return {}; + }, + + toJSON(_: RequestFlush): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): RequestFlush { + return RequestFlush.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): RequestFlush { + const message = createBaseRequestFlush(); + return message; + }, +}; + +export const RequestInfo: MessageFns = { + $type: "tendermint.abci.RequestInfo" as const, + + encode(message: RequestInfo, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.version !== "") { + writer.uint32(10).string(message.version); + } + if (message.block_version !== 0) { + writer.uint32(16).uint64(message.block_version); + } + if (message.p2p_version !== 0) { + writer.uint32(24).uint64(message.p2p_version); + } + if (message.abci_version !== "") { + writer.uint32(34).string(message.abci_version); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): RequestInfo { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRequestInfo(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.version = reader.string(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.block_version = longToNumber(reader.uint64()); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.p2p_version = longToNumber(reader.uint64()); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.abci_version = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): RequestInfo { + return { + version: isSet(object.version) ? globalThis.String(object.version) : "", + block_version: isSet(object.block_version) ? globalThis.Number(object.block_version) : 0, + p2p_version: isSet(object.p2p_version) ? globalThis.Number(object.p2p_version) : 0, + abci_version: isSet(object.abci_version) ? globalThis.String(object.abci_version) : "", + }; + }, + + toJSON(message: RequestInfo): unknown { + const obj: any = {}; + if (message.version !== "") { + obj.version = message.version; + } + if (message.block_version !== 0) { + obj.block_version = Math.round(message.block_version); + } + if (message.p2p_version !== 0) { + obj.p2p_version = Math.round(message.p2p_version); + } + if (message.abci_version !== "") { + obj.abci_version = message.abci_version; + } + return obj; + }, + + create, I>>(base?: I): RequestInfo { + return RequestInfo.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): RequestInfo { + const message = createBaseRequestInfo(); + message.version = object.version ?? ""; + message.block_version = object.block_version ?? 0; + message.p2p_version = object.p2p_version ?? 0; + message.abci_version = object.abci_version ?? ""; + return message; + }, +}; + +export const RequestInitChain: MessageFns = { + $type: "tendermint.abci.RequestInitChain" as const, + + encode(message: RequestInitChain, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.time !== undefined) { + Timestamp.encode(toTimestamp(message.time), writer.uint32(10).fork()).join(); + } + if (message.chain_id !== "") { + writer.uint32(18).string(message.chain_id); + } + if (message.consensus_params !== undefined) { + ConsensusParams.encode(message.consensus_params, writer.uint32(26).fork()).join(); + } + for (const v of message.validators) { + ValidatorUpdate.encode(v!, writer.uint32(34).fork()).join(); + } + if (message.app_state_bytes.length !== 0) { + writer.uint32(42).bytes(message.app_state_bytes); + } + if (message.initial_height !== 0) { + writer.uint32(48).int64(message.initial_height); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): RequestInitChain { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRequestInitChain(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.time = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.chain_id = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.consensus_params = ConsensusParams.decode(reader, reader.uint32()); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.validators.push(ValidatorUpdate.decode(reader, reader.uint32())); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.app_state_bytes = reader.bytes(); + continue; + case 6: + if (tag !== 48) { + break; + } + + message.initial_height = longToNumber(reader.int64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): RequestInitChain { + return { + time: isSet(object.time) ? fromJsonTimestamp(object.time) : undefined, + chain_id: isSet(object.chain_id) ? globalThis.String(object.chain_id) : "", + consensus_params: isSet(object.consensus_params) ? ConsensusParams.fromJSON(object.consensus_params) : undefined, + validators: globalThis.Array.isArray(object?.validators) ? object.validators.map((e: any) => ValidatorUpdate.fromJSON(e)) : [], + app_state_bytes: isSet(object.app_state_bytes) ? bytesFromBase64(object.app_state_bytes) : new Uint8Array(0), + initial_height: isSet(object.initial_height) ? globalThis.Number(object.initial_height) : 0, + }; + }, + + toJSON(message: RequestInitChain): unknown { + const obj: any = {}; + if (message.time !== undefined) { + obj.time = message.time.toISOString(); + } + if (message.chain_id !== "") { + obj.chain_id = message.chain_id; + } + if (message.consensus_params !== undefined) { + obj.consensus_params = ConsensusParams.toJSON(message.consensus_params); + } + if (message.validators?.length) { + obj.validators = message.validators.map((e) => ValidatorUpdate.toJSON(e)); + } + if (message.app_state_bytes.length !== 0) { + obj.app_state_bytes = base64FromBytes(message.app_state_bytes); + } + if (message.initial_height !== 0) { + obj.initial_height = Math.round(message.initial_height); + } + return obj; + }, + + create, I>>(base?: I): RequestInitChain { + return RequestInitChain.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): RequestInitChain { + const message = createBaseRequestInitChain(); + message.time = object.time ?? undefined; + message.chain_id = object.chain_id ?? ""; + message.consensus_params = + object.consensus_params !== undefined && object.consensus_params !== null ? ConsensusParams.fromPartial(object.consensus_params) : undefined; + message.validators = object.validators?.map((e) => ValidatorUpdate.fromPartial(e)) || []; + message.app_state_bytes = object.app_state_bytes ?? new Uint8Array(0); + message.initial_height = object.initial_height ?? 0; + return message; + }, +}; + +export const RequestQuery: MessageFns = { + $type: "tendermint.abci.RequestQuery" as const, + + encode(message: RequestQuery, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.data.length !== 0) { + writer.uint32(10).bytes(message.data); + } + if (message.path !== "") { + writer.uint32(18).string(message.path); + } + if (message.height !== 0) { + writer.uint32(24).int64(message.height); + } + if (message.prove !== false) { + writer.uint32(32).bool(message.prove); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): RequestQuery { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRequestQuery(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.data = reader.bytes(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.path = reader.string(); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.height = longToNumber(reader.int64()); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.prove = reader.bool(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): RequestQuery { + return { + data: isSet(object.data) ? bytesFromBase64(object.data) : new Uint8Array(0), + path: isSet(object.path) ? globalThis.String(object.path) : "", + height: isSet(object.height) ? globalThis.Number(object.height) : 0, + prove: isSet(object.prove) ? globalThis.Boolean(object.prove) : false, + }; + }, + + toJSON(message: RequestQuery): unknown { + const obj: any = {}; + if (message.data.length !== 0) { + obj.data = base64FromBytes(message.data); + } + if (message.path !== "") { + obj.path = message.path; + } + if (message.height !== 0) { + obj.height = Math.round(message.height); + } + if (message.prove !== false) { + obj.prove = message.prove; + } + return obj; + }, + + create, I>>(base?: I): RequestQuery { + return RequestQuery.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): RequestQuery { + const message = createBaseRequestQuery(); + message.data = object.data ?? new Uint8Array(0); + message.path = object.path ?? ""; + message.height = object.height ?? 0; + message.prove = object.prove ?? false; + return message; + }, +}; + +export const RequestCheckTx: MessageFns = { + $type: "tendermint.abci.RequestCheckTx" as const, + + encode(message: RequestCheckTx, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.tx.length !== 0) { + writer.uint32(10).bytes(message.tx); + } + if (message.type !== 0) { + writer.uint32(16).int32(message.type); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): RequestCheckTx { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRequestCheckTx(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.tx = reader.bytes(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.type = reader.int32() as any; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): RequestCheckTx { + return { + tx: isSet(object.tx) ? bytesFromBase64(object.tx) : new Uint8Array(0), + type: isSet(object.type) ? checkTxTypeFromJSON(object.type) : 0, + }; + }, + + toJSON(message: RequestCheckTx): unknown { + const obj: any = {}; + if (message.tx.length !== 0) { + obj.tx = base64FromBytes(message.tx); + } + if (message.type !== 0) { + obj.type = checkTxTypeToJSON(message.type); + } + return obj; + }, + + create, I>>(base?: I): RequestCheckTx { + return RequestCheckTx.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): RequestCheckTx { + const message = createBaseRequestCheckTx(); + message.tx = object.tx ?? new Uint8Array(0); + message.type = object.type ?? 0; + return message; + }, +}; + +export const RequestCommit: MessageFns = { + $type: "tendermint.abci.RequestCommit" as const, + + encode(_: RequestCommit, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): RequestCommit { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRequestCommit(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): RequestCommit { + return {}; + }, + + toJSON(_: RequestCommit): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): RequestCommit { + return RequestCommit.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): RequestCommit { + const message = createBaseRequestCommit(); + return message; + }, +}; + +export const RequestListSnapshots: MessageFns = { + $type: "tendermint.abci.RequestListSnapshots" as const, + + encode(_: RequestListSnapshots, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): RequestListSnapshots { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRequestListSnapshots(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): RequestListSnapshots { + return {}; + }, + + toJSON(_: RequestListSnapshots): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): RequestListSnapshots { + return RequestListSnapshots.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): RequestListSnapshots { + const message = createBaseRequestListSnapshots(); + return message; + }, +}; + +export const RequestOfferSnapshot: MessageFns = { + $type: "tendermint.abci.RequestOfferSnapshot" as const, + + encode(message: RequestOfferSnapshot, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.snapshot !== undefined) { + Snapshot.encode(message.snapshot, writer.uint32(10).fork()).join(); + } + if (message.app_hash.length !== 0) { + writer.uint32(18).bytes(message.app_hash); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): RequestOfferSnapshot { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRequestOfferSnapshot(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.snapshot = Snapshot.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.app_hash = reader.bytes(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): RequestOfferSnapshot { + return { + snapshot: isSet(object.snapshot) ? Snapshot.fromJSON(object.snapshot) : undefined, + app_hash: isSet(object.app_hash) ? bytesFromBase64(object.app_hash) : new Uint8Array(0), + }; + }, + + toJSON(message: RequestOfferSnapshot): unknown { + const obj: any = {}; + if (message.snapshot !== undefined) { + obj.snapshot = Snapshot.toJSON(message.snapshot); + } + if (message.app_hash.length !== 0) { + obj.app_hash = base64FromBytes(message.app_hash); + } + return obj; + }, + + create, I>>(base?: I): RequestOfferSnapshot { + return RequestOfferSnapshot.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): RequestOfferSnapshot { + const message = createBaseRequestOfferSnapshot(); + message.snapshot = object.snapshot !== undefined && object.snapshot !== null ? Snapshot.fromPartial(object.snapshot) : undefined; + message.app_hash = object.app_hash ?? new Uint8Array(0); + return message; + }, +}; + +export const RequestLoadSnapshotChunk: MessageFns = { + $type: "tendermint.abci.RequestLoadSnapshotChunk" as const, + + encode(message: RequestLoadSnapshotChunk, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.height !== 0) { + writer.uint32(8).uint64(message.height); + } + if (message.format !== 0) { + writer.uint32(16).uint32(message.format); + } + if (message.chunk !== 0) { + writer.uint32(24).uint32(message.chunk); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): RequestLoadSnapshotChunk { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRequestLoadSnapshotChunk(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.height = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.format = reader.uint32(); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.chunk = reader.uint32(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): RequestLoadSnapshotChunk { + return { + height: isSet(object.height) ? globalThis.Number(object.height) : 0, + format: isSet(object.format) ? globalThis.Number(object.format) : 0, + chunk: isSet(object.chunk) ? globalThis.Number(object.chunk) : 0, + }; + }, + + toJSON(message: RequestLoadSnapshotChunk): unknown { + const obj: any = {}; + if (message.height !== 0) { + obj.height = Math.round(message.height); + } + if (message.format !== 0) { + obj.format = Math.round(message.format); + } + if (message.chunk !== 0) { + obj.chunk = Math.round(message.chunk); + } + return obj; + }, + + create, I>>(base?: I): RequestLoadSnapshotChunk { + return RequestLoadSnapshotChunk.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): RequestLoadSnapshotChunk { + const message = createBaseRequestLoadSnapshotChunk(); + message.height = object.height ?? 0; + message.format = object.format ?? 0; + message.chunk = object.chunk ?? 0; + return message; + }, +}; + +export const RequestApplySnapshotChunk: MessageFns = { + $type: "tendermint.abci.RequestApplySnapshotChunk" as const, + + encode(message: RequestApplySnapshotChunk, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.index !== 0) { + writer.uint32(8).uint32(message.index); + } + if (message.chunk.length !== 0) { + writer.uint32(18).bytes(message.chunk); + } + if (message.sender !== "") { + writer.uint32(26).string(message.sender); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): RequestApplySnapshotChunk { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRequestApplySnapshotChunk(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.index = reader.uint32(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.chunk = reader.bytes(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.sender = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): RequestApplySnapshotChunk { + return { + index: isSet(object.index) ? globalThis.Number(object.index) : 0, + chunk: isSet(object.chunk) ? bytesFromBase64(object.chunk) : new Uint8Array(0), + sender: isSet(object.sender) ? globalThis.String(object.sender) : "", + }; + }, + + toJSON(message: RequestApplySnapshotChunk): unknown { + const obj: any = {}; + if (message.index !== 0) { + obj.index = Math.round(message.index); + } + if (message.chunk.length !== 0) { + obj.chunk = base64FromBytes(message.chunk); + } + if (message.sender !== "") { + obj.sender = message.sender; + } + return obj; + }, + + create, I>>(base?: I): RequestApplySnapshotChunk { + return RequestApplySnapshotChunk.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): RequestApplySnapshotChunk { + const message = createBaseRequestApplySnapshotChunk(); + message.index = object.index ?? 0; + message.chunk = object.chunk ?? new Uint8Array(0); + message.sender = object.sender ?? ""; + return message; + }, +}; + +export const RequestPrepareProposal: MessageFns = { + $type: "tendermint.abci.RequestPrepareProposal" as const, + + encode(message: RequestPrepareProposal, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.max_tx_bytes !== 0) { + writer.uint32(8).int64(message.max_tx_bytes); + } + for (const v of message.txs) { + writer.uint32(18).bytes(v!); + } + if (message.local_last_commit !== undefined) { + ExtendedCommitInfo.encode(message.local_last_commit, writer.uint32(26).fork()).join(); + } + for (const v of message.byzantine_validators) { + Misbehavior.encode(v!, writer.uint32(34).fork()).join(); + } + if (message.height !== 0) { + writer.uint32(40).int64(message.height); + } + if (message.time !== undefined) { + Timestamp.encode(toTimestamp(message.time), writer.uint32(50).fork()).join(); + } + if (message.next_validators_hash.length !== 0) { + writer.uint32(58).bytes(message.next_validators_hash); + } + if (message.proposer_address.length !== 0) { + writer.uint32(66).bytes(message.proposer_address); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): RequestPrepareProposal { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRequestPrepareProposal(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.max_tx_bytes = longToNumber(reader.int64()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.txs.push(reader.bytes()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.local_last_commit = ExtendedCommitInfo.decode(reader, reader.uint32()); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.byzantine_validators.push(Misbehavior.decode(reader, reader.uint32())); + continue; + case 5: + if (tag !== 40) { + break; + } + + message.height = longToNumber(reader.int64()); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.time = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.next_validators_hash = reader.bytes(); + continue; + case 8: + if (tag !== 66) { + break; + } + + message.proposer_address = reader.bytes(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): RequestPrepareProposal { + return { + max_tx_bytes: isSet(object.max_tx_bytes) ? globalThis.Number(object.max_tx_bytes) : 0, + txs: globalThis.Array.isArray(object?.txs) ? object.txs.map((e: any) => bytesFromBase64(e)) : [], + local_last_commit: isSet(object.local_last_commit) ? ExtendedCommitInfo.fromJSON(object.local_last_commit) : undefined, + byzantine_validators: globalThis.Array.isArray(object?.byzantine_validators) ? object.byzantine_validators.map((e: any) => Misbehavior.fromJSON(e)) : [], + height: isSet(object.height) ? globalThis.Number(object.height) : 0, + time: isSet(object.time) ? fromJsonTimestamp(object.time) : undefined, + next_validators_hash: isSet(object.next_validators_hash) ? bytesFromBase64(object.next_validators_hash) : new Uint8Array(0), + proposer_address: isSet(object.proposer_address) ? bytesFromBase64(object.proposer_address) : new Uint8Array(0), + }; + }, + + toJSON(message: RequestPrepareProposal): unknown { + const obj: any = {}; + if (message.max_tx_bytes !== 0) { + obj.max_tx_bytes = Math.round(message.max_tx_bytes); + } + if (message.txs?.length) { + obj.txs = message.txs.map((e) => base64FromBytes(e)); + } + if (message.local_last_commit !== undefined) { + obj.local_last_commit = ExtendedCommitInfo.toJSON(message.local_last_commit); + } + if (message.byzantine_validators?.length) { + obj.byzantine_validators = message.byzantine_validators.map((e) => Misbehavior.toJSON(e)); + } + if (message.height !== 0) { + obj.height = Math.round(message.height); + } + if (message.time !== undefined) { + obj.time = message.time.toISOString(); + } + if (message.next_validators_hash.length !== 0) { + obj.next_validators_hash = base64FromBytes(message.next_validators_hash); + } + if (message.proposer_address.length !== 0) { + obj.proposer_address = base64FromBytes(message.proposer_address); + } + return obj; + }, + + create, I>>(base?: I): RequestPrepareProposal { + return RequestPrepareProposal.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): RequestPrepareProposal { + const message = createBaseRequestPrepareProposal(); + message.max_tx_bytes = object.max_tx_bytes ?? 0; + message.txs = object.txs?.map((e) => e) || []; + message.local_last_commit = + object.local_last_commit !== undefined && object.local_last_commit !== null ? ExtendedCommitInfo.fromPartial(object.local_last_commit) : undefined; + message.byzantine_validators = object.byzantine_validators?.map((e) => Misbehavior.fromPartial(e)) || []; + message.height = object.height ?? 0; + message.time = object.time ?? undefined; + message.next_validators_hash = object.next_validators_hash ?? new Uint8Array(0); + message.proposer_address = object.proposer_address ?? new Uint8Array(0); + return message; + }, +}; + +export const RequestProcessProposal: MessageFns = { + $type: "tendermint.abci.RequestProcessProposal" as const, + + encode(message: RequestProcessProposal, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.txs) { + writer.uint32(10).bytes(v!); + } + if (message.proposed_last_commit !== undefined) { + CommitInfo.encode(message.proposed_last_commit, writer.uint32(18).fork()).join(); + } + for (const v of message.byzantine_validators) { + Misbehavior.encode(v!, writer.uint32(26).fork()).join(); + } + if (message.hash.length !== 0) { + writer.uint32(34).bytes(message.hash); + } + if (message.height !== 0) { + writer.uint32(40).int64(message.height); + } + if (message.time !== undefined) { + Timestamp.encode(toTimestamp(message.time), writer.uint32(50).fork()).join(); + } + if (message.next_validators_hash.length !== 0) { + writer.uint32(58).bytes(message.next_validators_hash); + } + if (message.proposer_address.length !== 0) { + writer.uint32(66).bytes(message.proposer_address); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): RequestProcessProposal { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRequestProcessProposal(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.txs.push(reader.bytes()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.proposed_last_commit = CommitInfo.decode(reader, reader.uint32()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.byzantine_validators.push(Misbehavior.decode(reader, reader.uint32())); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.hash = reader.bytes(); + continue; + case 5: + if (tag !== 40) { + break; + } + + message.height = longToNumber(reader.int64()); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.time = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.next_validators_hash = reader.bytes(); + continue; + case 8: + if (tag !== 66) { + break; + } + + message.proposer_address = reader.bytes(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): RequestProcessProposal { + return { + txs: globalThis.Array.isArray(object?.txs) ? object.txs.map((e: any) => bytesFromBase64(e)) : [], + proposed_last_commit: isSet(object.proposed_last_commit) ? CommitInfo.fromJSON(object.proposed_last_commit) : undefined, + byzantine_validators: globalThis.Array.isArray(object?.byzantine_validators) ? object.byzantine_validators.map((e: any) => Misbehavior.fromJSON(e)) : [], + hash: isSet(object.hash) ? bytesFromBase64(object.hash) : new Uint8Array(0), + height: isSet(object.height) ? globalThis.Number(object.height) : 0, + time: isSet(object.time) ? fromJsonTimestamp(object.time) : undefined, + next_validators_hash: isSet(object.next_validators_hash) ? bytesFromBase64(object.next_validators_hash) : new Uint8Array(0), + proposer_address: isSet(object.proposer_address) ? bytesFromBase64(object.proposer_address) : new Uint8Array(0), + }; + }, + + toJSON(message: RequestProcessProposal): unknown { + const obj: any = {}; + if (message.txs?.length) { + obj.txs = message.txs.map((e) => base64FromBytes(e)); + } + if (message.proposed_last_commit !== undefined) { + obj.proposed_last_commit = CommitInfo.toJSON(message.proposed_last_commit); + } + if (message.byzantine_validators?.length) { + obj.byzantine_validators = message.byzantine_validators.map((e) => Misbehavior.toJSON(e)); + } + if (message.hash.length !== 0) { + obj.hash = base64FromBytes(message.hash); + } + if (message.height !== 0) { + obj.height = Math.round(message.height); + } + if (message.time !== undefined) { + obj.time = message.time.toISOString(); + } + if (message.next_validators_hash.length !== 0) { + obj.next_validators_hash = base64FromBytes(message.next_validators_hash); + } + if (message.proposer_address.length !== 0) { + obj.proposer_address = base64FromBytes(message.proposer_address); + } + return obj; + }, + + create, I>>(base?: I): RequestProcessProposal { + return RequestProcessProposal.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): RequestProcessProposal { + const message = createBaseRequestProcessProposal(); + message.txs = object.txs?.map((e) => e) || []; + message.proposed_last_commit = + object.proposed_last_commit !== undefined && object.proposed_last_commit !== null ? CommitInfo.fromPartial(object.proposed_last_commit) : undefined; + message.byzantine_validators = object.byzantine_validators?.map((e) => Misbehavior.fromPartial(e)) || []; + message.hash = object.hash ?? new Uint8Array(0); + message.height = object.height ?? 0; + message.time = object.time ?? undefined; + message.next_validators_hash = object.next_validators_hash ?? new Uint8Array(0); + message.proposer_address = object.proposer_address ?? new Uint8Array(0); + return message; + }, +}; + +export const RequestExtendVote: MessageFns = { + $type: "tendermint.abci.RequestExtendVote" as const, + + encode(message: RequestExtendVote, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.hash.length !== 0) { + writer.uint32(10).bytes(message.hash); + } + if (message.height !== 0) { + writer.uint32(16).int64(message.height); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): RequestExtendVote { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRequestExtendVote(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.hash = reader.bytes(); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.height = longToNumber(reader.int64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): RequestExtendVote { + return { + hash: isSet(object.hash) ? bytesFromBase64(object.hash) : new Uint8Array(0), + height: isSet(object.height) ? globalThis.Number(object.height) : 0, + }; + }, + + toJSON(message: RequestExtendVote): unknown { + const obj: any = {}; + if (message.hash.length !== 0) { + obj.hash = base64FromBytes(message.hash); + } + if (message.height !== 0) { + obj.height = Math.round(message.height); + } + return obj; + }, + + create, I>>(base?: I): RequestExtendVote { + return RequestExtendVote.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): RequestExtendVote { + const message = createBaseRequestExtendVote(); + message.hash = object.hash ?? new Uint8Array(0); + message.height = object.height ?? 0; + return message; + }, +}; + +export const RequestVerifyVoteExtension: MessageFns = { + $type: "tendermint.abci.RequestVerifyVoteExtension" as const, + + encode(message: RequestVerifyVoteExtension, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.hash.length !== 0) { + writer.uint32(10).bytes(message.hash); + } + if (message.validator_address.length !== 0) { + writer.uint32(18).bytes(message.validator_address); + } + if (message.height !== 0) { + writer.uint32(24).int64(message.height); + } + if (message.vote_extension.length !== 0) { + writer.uint32(34).bytes(message.vote_extension); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): RequestVerifyVoteExtension { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRequestVerifyVoteExtension(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.hash = reader.bytes(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.validator_address = reader.bytes(); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.height = longToNumber(reader.int64()); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.vote_extension = reader.bytes(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): RequestVerifyVoteExtension { + return { + hash: isSet(object.hash) ? bytesFromBase64(object.hash) : new Uint8Array(0), + validator_address: isSet(object.validator_address) ? bytesFromBase64(object.validator_address) : new Uint8Array(0), + height: isSet(object.height) ? globalThis.Number(object.height) : 0, + vote_extension: isSet(object.vote_extension) ? bytesFromBase64(object.vote_extension) : new Uint8Array(0), + }; + }, + + toJSON(message: RequestVerifyVoteExtension): unknown { + const obj: any = {}; + if (message.hash.length !== 0) { + obj.hash = base64FromBytes(message.hash); + } + if (message.validator_address.length !== 0) { + obj.validator_address = base64FromBytes(message.validator_address); + } + if (message.height !== 0) { + obj.height = Math.round(message.height); + } + if (message.vote_extension.length !== 0) { + obj.vote_extension = base64FromBytes(message.vote_extension); + } + return obj; + }, + + create, I>>(base?: I): RequestVerifyVoteExtension { + return RequestVerifyVoteExtension.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): RequestVerifyVoteExtension { + const message = createBaseRequestVerifyVoteExtension(); + message.hash = object.hash ?? new Uint8Array(0); + message.validator_address = object.validator_address ?? new Uint8Array(0); + message.height = object.height ?? 0; + message.vote_extension = object.vote_extension ?? new Uint8Array(0); + return message; + }, +}; + +export const RequestFinalizeBlock: MessageFns = { + $type: "tendermint.abci.RequestFinalizeBlock" as const, + + encode(message: RequestFinalizeBlock, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.txs) { + writer.uint32(10).bytes(v!); + } + if (message.decided_last_commit !== undefined) { + CommitInfo.encode(message.decided_last_commit, writer.uint32(18).fork()).join(); + } + for (const v of message.byzantine_validators) { + Misbehavior.encode(v!, writer.uint32(26).fork()).join(); + } + if (message.hash.length !== 0) { + writer.uint32(34).bytes(message.hash); + } + if (message.height !== 0) { + writer.uint32(40).int64(message.height); + } + if (message.time !== undefined) { + Timestamp.encode(toTimestamp(message.time), writer.uint32(50).fork()).join(); + } + if (message.next_validators_hash.length !== 0) { + writer.uint32(58).bytes(message.next_validators_hash); + } + if (message.proposer_address.length !== 0) { + writer.uint32(66).bytes(message.proposer_address); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): RequestFinalizeBlock { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRequestFinalizeBlock(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.txs.push(reader.bytes()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.decided_last_commit = CommitInfo.decode(reader, reader.uint32()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.byzantine_validators.push(Misbehavior.decode(reader, reader.uint32())); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.hash = reader.bytes(); + continue; + case 5: + if (tag !== 40) { + break; + } + + message.height = longToNumber(reader.int64()); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.time = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.next_validators_hash = reader.bytes(); + continue; + case 8: + if (tag !== 66) { + break; + } + + message.proposer_address = reader.bytes(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): RequestFinalizeBlock { + return { + txs: globalThis.Array.isArray(object?.txs) ? object.txs.map((e: any) => bytesFromBase64(e)) : [], + decided_last_commit: isSet(object.decided_last_commit) ? CommitInfo.fromJSON(object.decided_last_commit) : undefined, + byzantine_validators: globalThis.Array.isArray(object?.byzantine_validators) ? object.byzantine_validators.map((e: any) => Misbehavior.fromJSON(e)) : [], + hash: isSet(object.hash) ? bytesFromBase64(object.hash) : new Uint8Array(0), + height: isSet(object.height) ? globalThis.Number(object.height) : 0, + time: isSet(object.time) ? fromJsonTimestamp(object.time) : undefined, + next_validators_hash: isSet(object.next_validators_hash) ? bytesFromBase64(object.next_validators_hash) : new Uint8Array(0), + proposer_address: isSet(object.proposer_address) ? bytesFromBase64(object.proposer_address) : new Uint8Array(0), + }; + }, + + toJSON(message: RequestFinalizeBlock): unknown { + const obj: any = {}; + if (message.txs?.length) { + obj.txs = message.txs.map((e) => base64FromBytes(e)); + } + if (message.decided_last_commit !== undefined) { + obj.decided_last_commit = CommitInfo.toJSON(message.decided_last_commit); + } + if (message.byzantine_validators?.length) { + obj.byzantine_validators = message.byzantine_validators.map((e) => Misbehavior.toJSON(e)); + } + if (message.hash.length !== 0) { + obj.hash = base64FromBytes(message.hash); + } + if (message.height !== 0) { + obj.height = Math.round(message.height); + } + if (message.time !== undefined) { + obj.time = message.time.toISOString(); + } + if (message.next_validators_hash.length !== 0) { + obj.next_validators_hash = base64FromBytes(message.next_validators_hash); + } + if (message.proposer_address.length !== 0) { + obj.proposer_address = base64FromBytes(message.proposer_address); + } + return obj; + }, + + create, I>>(base?: I): RequestFinalizeBlock { + return RequestFinalizeBlock.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): RequestFinalizeBlock { + const message = createBaseRequestFinalizeBlock(); + message.txs = object.txs?.map((e) => e) || []; + message.decided_last_commit = + object.decided_last_commit !== undefined && object.decided_last_commit !== null ? CommitInfo.fromPartial(object.decided_last_commit) : undefined; + message.byzantine_validators = object.byzantine_validators?.map((e) => Misbehavior.fromPartial(e)) || []; + message.hash = object.hash ?? new Uint8Array(0); + message.height = object.height ?? 0; + message.time = object.time ?? undefined; + message.next_validators_hash = object.next_validators_hash ?? new Uint8Array(0); + message.proposer_address = object.proposer_address ?? new Uint8Array(0); + return message; + }, +}; + +export const Response: MessageFns = { + $type: "tendermint.abci.Response" as const, + + encode(message: Response, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.exception !== undefined) { + ResponseException.encode(message.exception, writer.uint32(10).fork()).join(); + } + if (message.echo !== undefined) { + ResponseEcho.encode(message.echo, writer.uint32(18).fork()).join(); + } + if (message.flush !== undefined) { + ResponseFlush.encode(message.flush, writer.uint32(26).fork()).join(); + } + if (message.info !== undefined) { + ResponseInfo.encode(message.info, writer.uint32(34).fork()).join(); + } + if (message.init_chain !== undefined) { + ResponseInitChain.encode(message.init_chain, writer.uint32(42).fork()).join(); + } + if (message.query !== undefined) { + ResponseQuery.encode(message.query, writer.uint32(50).fork()).join(); + } + if (message.check_tx !== undefined) { + ResponseCheckTx.encode(message.check_tx, writer.uint32(66).fork()).join(); + } + if (message.commit !== undefined) { + ResponseCommit.encode(message.commit, writer.uint32(90).fork()).join(); + } + if (message.list_snapshots !== undefined) { + ResponseListSnapshots.encode(message.list_snapshots, writer.uint32(98).fork()).join(); + } + if (message.offer_snapshot !== undefined) { + ResponseOfferSnapshot.encode(message.offer_snapshot, writer.uint32(106).fork()).join(); + } + if (message.load_snapshot_chunk !== undefined) { + ResponseLoadSnapshotChunk.encode(message.load_snapshot_chunk, writer.uint32(114).fork()).join(); + } + if (message.apply_snapshot_chunk !== undefined) { + ResponseApplySnapshotChunk.encode(message.apply_snapshot_chunk, writer.uint32(122).fork()).join(); + } + if (message.prepare_proposal !== undefined) { + ResponsePrepareProposal.encode(message.prepare_proposal, writer.uint32(130).fork()).join(); + } + if (message.process_proposal !== undefined) { + ResponseProcessProposal.encode(message.process_proposal, writer.uint32(138).fork()).join(); + } + if (message.extend_vote !== undefined) { + ResponseExtendVote.encode(message.extend_vote, writer.uint32(146).fork()).join(); + } + if (message.verify_vote_extension !== undefined) { + ResponseVerifyVoteExtension.encode(message.verify_vote_extension, writer.uint32(154).fork()).join(); + } + if (message.finalize_block !== undefined) { + ResponseFinalizeBlock.encode(message.finalize_block, writer.uint32(162).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Response { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.exception = ResponseException.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.echo = ResponseEcho.decode(reader, reader.uint32()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.flush = ResponseFlush.decode(reader, reader.uint32()); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.info = ResponseInfo.decode(reader, reader.uint32()); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.init_chain = ResponseInitChain.decode(reader, reader.uint32()); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.query = ResponseQuery.decode(reader, reader.uint32()); + continue; + case 8: + if (tag !== 66) { + break; + } + + message.check_tx = ResponseCheckTx.decode(reader, reader.uint32()); + continue; + case 11: + if (tag !== 90) { + break; + } + + message.commit = ResponseCommit.decode(reader, reader.uint32()); + continue; + case 12: + if (tag !== 98) { + break; + } + + message.list_snapshots = ResponseListSnapshots.decode(reader, reader.uint32()); + continue; + case 13: + if (tag !== 106) { + break; + } + + message.offer_snapshot = ResponseOfferSnapshot.decode(reader, reader.uint32()); + continue; + case 14: + if (tag !== 114) { + break; + } + + message.load_snapshot_chunk = ResponseLoadSnapshotChunk.decode(reader, reader.uint32()); + continue; + case 15: + if (tag !== 122) { + break; + } + + message.apply_snapshot_chunk = ResponseApplySnapshotChunk.decode(reader, reader.uint32()); + continue; + case 16: + if (tag !== 130) { + break; + } + + message.prepare_proposal = ResponsePrepareProposal.decode(reader, reader.uint32()); + continue; + case 17: + if (tag !== 138) { + break; + } + + message.process_proposal = ResponseProcessProposal.decode(reader, reader.uint32()); + continue; + case 18: + if (tag !== 146) { + break; + } + + message.extend_vote = ResponseExtendVote.decode(reader, reader.uint32()); + continue; + case 19: + if (tag !== 154) { + break; + } + + message.verify_vote_extension = ResponseVerifyVoteExtension.decode(reader, reader.uint32()); + continue; + case 20: + if (tag !== 162) { + break; + } + + message.finalize_block = ResponseFinalizeBlock.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Response { + return { + exception: isSet(object.exception) ? ResponseException.fromJSON(object.exception) : undefined, + echo: isSet(object.echo) ? ResponseEcho.fromJSON(object.echo) : undefined, + flush: isSet(object.flush) ? ResponseFlush.fromJSON(object.flush) : undefined, + info: isSet(object.info) ? ResponseInfo.fromJSON(object.info) : undefined, + init_chain: isSet(object.init_chain) ? ResponseInitChain.fromJSON(object.init_chain) : undefined, + query: isSet(object.query) ? ResponseQuery.fromJSON(object.query) : undefined, + check_tx: isSet(object.check_tx) ? ResponseCheckTx.fromJSON(object.check_tx) : undefined, + commit: isSet(object.commit) ? ResponseCommit.fromJSON(object.commit) : undefined, + list_snapshots: isSet(object.list_snapshots) ? ResponseListSnapshots.fromJSON(object.list_snapshots) : undefined, + offer_snapshot: isSet(object.offer_snapshot) ? ResponseOfferSnapshot.fromJSON(object.offer_snapshot) : undefined, + load_snapshot_chunk: isSet(object.load_snapshot_chunk) ? ResponseLoadSnapshotChunk.fromJSON(object.load_snapshot_chunk) : undefined, + apply_snapshot_chunk: isSet(object.apply_snapshot_chunk) ? ResponseApplySnapshotChunk.fromJSON(object.apply_snapshot_chunk) : undefined, + prepare_proposal: isSet(object.prepare_proposal) ? ResponsePrepareProposal.fromJSON(object.prepare_proposal) : undefined, + process_proposal: isSet(object.process_proposal) ? ResponseProcessProposal.fromJSON(object.process_proposal) : undefined, + extend_vote: isSet(object.extend_vote) ? ResponseExtendVote.fromJSON(object.extend_vote) : undefined, + verify_vote_extension: isSet(object.verify_vote_extension) ? ResponseVerifyVoteExtension.fromJSON(object.verify_vote_extension) : undefined, + finalize_block: isSet(object.finalize_block) ? ResponseFinalizeBlock.fromJSON(object.finalize_block) : undefined, + }; + }, + + toJSON(message: Response): unknown { + const obj: any = {}; + if (message.exception !== undefined) { + obj.exception = ResponseException.toJSON(message.exception); + } + if (message.echo !== undefined) { + obj.echo = ResponseEcho.toJSON(message.echo); + } + if (message.flush !== undefined) { + obj.flush = ResponseFlush.toJSON(message.flush); + } + if (message.info !== undefined) { + obj.info = ResponseInfo.toJSON(message.info); + } + if (message.init_chain !== undefined) { + obj.init_chain = ResponseInitChain.toJSON(message.init_chain); + } + if (message.query !== undefined) { + obj.query = ResponseQuery.toJSON(message.query); + } + if (message.check_tx !== undefined) { + obj.check_tx = ResponseCheckTx.toJSON(message.check_tx); + } + if (message.commit !== undefined) { + obj.commit = ResponseCommit.toJSON(message.commit); + } + if (message.list_snapshots !== undefined) { + obj.list_snapshots = ResponseListSnapshots.toJSON(message.list_snapshots); + } + if (message.offer_snapshot !== undefined) { + obj.offer_snapshot = ResponseOfferSnapshot.toJSON(message.offer_snapshot); + } + if (message.load_snapshot_chunk !== undefined) { + obj.load_snapshot_chunk = ResponseLoadSnapshotChunk.toJSON(message.load_snapshot_chunk); + } + if (message.apply_snapshot_chunk !== undefined) { + obj.apply_snapshot_chunk = ResponseApplySnapshotChunk.toJSON(message.apply_snapshot_chunk); + } + if (message.prepare_proposal !== undefined) { + obj.prepare_proposal = ResponsePrepareProposal.toJSON(message.prepare_proposal); + } + if (message.process_proposal !== undefined) { + obj.process_proposal = ResponseProcessProposal.toJSON(message.process_proposal); + } + if (message.extend_vote !== undefined) { + obj.extend_vote = ResponseExtendVote.toJSON(message.extend_vote); + } + if (message.verify_vote_extension !== undefined) { + obj.verify_vote_extension = ResponseVerifyVoteExtension.toJSON(message.verify_vote_extension); + } + if (message.finalize_block !== undefined) { + obj.finalize_block = ResponseFinalizeBlock.toJSON(message.finalize_block); + } + return obj; + }, + + create, I>>(base?: I): Response { + return Response.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Response { + const message = createBaseResponse(); + message.exception = object.exception !== undefined && object.exception !== null ? ResponseException.fromPartial(object.exception) : undefined; + message.echo = object.echo !== undefined && object.echo !== null ? ResponseEcho.fromPartial(object.echo) : undefined; + message.flush = object.flush !== undefined && object.flush !== null ? ResponseFlush.fromPartial(object.flush) : undefined; + message.info = object.info !== undefined && object.info !== null ? ResponseInfo.fromPartial(object.info) : undefined; + message.init_chain = object.init_chain !== undefined && object.init_chain !== null ? ResponseInitChain.fromPartial(object.init_chain) : undefined; + message.query = object.query !== undefined && object.query !== null ? ResponseQuery.fromPartial(object.query) : undefined; + message.check_tx = object.check_tx !== undefined && object.check_tx !== null ? ResponseCheckTx.fromPartial(object.check_tx) : undefined; + message.commit = object.commit !== undefined && object.commit !== null ? ResponseCommit.fromPartial(object.commit) : undefined; + message.list_snapshots = + object.list_snapshots !== undefined && object.list_snapshots !== null ? ResponseListSnapshots.fromPartial(object.list_snapshots) : undefined; + message.offer_snapshot = + object.offer_snapshot !== undefined && object.offer_snapshot !== null ? ResponseOfferSnapshot.fromPartial(object.offer_snapshot) : undefined; + message.load_snapshot_chunk = + object.load_snapshot_chunk !== undefined && object.load_snapshot_chunk !== null + ? ResponseLoadSnapshotChunk.fromPartial(object.load_snapshot_chunk) + : undefined; + message.apply_snapshot_chunk = + object.apply_snapshot_chunk !== undefined && object.apply_snapshot_chunk !== null + ? ResponseApplySnapshotChunk.fromPartial(object.apply_snapshot_chunk) + : undefined; + message.prepare_proposal = + object.prepare_proposal !== undefined && object.prepare_proposal !== null ? ResponsePrepareProposal.fromPartial(object.prepare_proposal) : undefined; + message.process_proposal = + object.process_proposal !== undefined && object.process_proposal !== null ? ResponseProcessProposal.fromPartial(object.process_proposal) : undefined; + message.extend_vote = object.extend_vote !== undefined && object.extend_vote !== null ? ResponseExtendVote.fromPartial(object.extend_vote) : undefined; + message.verify_vote_extension = + object.verify_vote_extension !== undefined && object.verify_vote_extension !== null + ? ResponseVerifyVoteExtension.fromPartial(object.verify_vote_extension) + : undefined; + message.finalize_block = + object.finalize_block !== undefined && object.finalize_block !== null ? ResponseFinalizeBlock.fromPartial(object.finalize_block) : undefined; + return message; + }, +}; + +export const ResponseException: MessageFns = { + $type: "tendermint.abci.ResponseException" as const, + + encode(message: ResponseException, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.error !== "") { + writer.uint32(10).string(message.error); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ResponseException { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseResponseException(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.error = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ResponseException { + return { error: isSet(object.error) ? globalThis.String(object.error) : "" }; + }, + + toJSON(message: ResponseException): unknown { + const obj: any = {}; + if (message.error !== "") { + obj.error = message.error; + } + return obj; + }, + + create, I>>(base?: I): ResponseException { + return ResponseException.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ResponseException { + const message = createBaseResponseException(); + message.error = object.error ?? ""; + return message; + }, +}; + +export const ResponseEcho: MessageFns = { + $type: "tendermint.abci.ResponseEcho" as const, + + encode(message: ResponseEcho, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.message !== "") { + writer.uint32(10).string(message.message); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ResponseEcho { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseResponseEcho(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.message = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ResponseEcho { + return { message: isSet(object.message) ? globalThis.String(object.message) : "" }; + }, + + toJSON(message: ResponseEcho): unknown { + const obj: any = {}; + if (message.message !== "") { + obj.message = message.message; + } + return obj; + }, + + create, I>>(base?: I): ResponseEcho { + return ResponseEcho.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ResponseEcho { + const message = createBaseResponseEcho(); + message.message = object.message ?? ""; + return message; + }, +}; + +export const ResponseFlush: MessageFns = { + $type: "tendermint.abci.ResponseFlush" as const, + + encode(_: ResponseFlush, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ResponseFlush { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseResponseFlush(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): ResponseFlush { + return {}; + }, + + toJSON(_: ResponseFlush): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): ResponseFlush { + return ResponseFlush.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): ResponseFlush { + const message = createBaseResponseFlush(); + return message; + }, +}; + +export const ResponseInfo: MessageFns = { + $type: "tendermint.abci.ResponseInfo" as const, + + encode(message: ResponseInfo, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.data !== "") { + writer.uint32(10).string(message.data); + } + if (message.version !== "") { + writer.uint32(18).string(message.version); + } + if (message.app_version !== 0) { + writer.uint32(24).uint64(message.app_version); + } + if (message.last_block_height !== 0) { + writer.uint32(32).int64(message.last_block_height); + } + if (message.last_block_app_hash.length !== 0) { + writer.uint32(42).bytes(message.last_block_app_hash); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ResponseInfo { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseResponseInfo(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.data = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.version = reader.string(); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.app_version = longToNumber(reader.uint64()); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.last_block_height = longToNumber(reader.int64()); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.last_block_app_hash = reader.bytes(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ResponseInfo { + return { + data: isSet(object.data) ? globalThis.String(object.data) : "", + version: isSet(object.version) ? globalThis.String(object.version) : "", + app_version: isSet(object.app_version) ? globalThis.Number(object.app_version) : 0, + last_block_height: isSet(object.last_block_height) ? globalThis.Number(object.last_block_height) : 0, + last_block_app_hash: isSet(object.last_block_app_hash) ? bytesFromBase64(object.last_block_app_hash) : new Uint8Array(0), + }; + }, + + toJSON(message: ResponseInfo): unknown { + const obj: any = {}; + if (message.data !== "") { + obj.data = message.data; + } + if (message.version !== "") { + obj.version = message.version; + } + if (message.app_version !== 0) { + obj.app_version = Math.round(message.app_version); + } + if (message.last_block_height !== 0) { + obj.last_block_height = Math.round(message.last_block_height); + } + if (message.last_block_app_hash.length !== 0) { + obj.last_block_app_hash = base64FromBytes(message.last_block_app_hash); + } + return obj; + }, + + create, I>>(base?: I): ResponseInfo { + return ResponseInfo.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ResponseInfo { + const message = createBaseResponseInfo(); + message.data = object.data ?? ""; + message.version = object.version ?? ""; + message.app_version = object.app_version ?? 0; + message.last_block_height = object.last_block_height ?? 0; + message.last_block_app_hash = object.last_block_app_hash ?? new Uint8Array(0); + return message; + }, +}; + +export const ResponseInitChain: MessageFns = { + $type: "tendermint.abci.ResponseInitChain" as const, + + encode(message: ResponseInitChain, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.consensus_params !== undefined) { + ConsensusParams.encode(message.consensus_params, writer.uint32(10).fork()).join(); + } + for (const v of message.validators) { + ValidatorUpdate.encode(v!, writer.uint32(18).fork()).join(); + } + if (message.app_hash.length !== 0) { + writer.uint32(26).bytes(message.app_hash); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ResponseInitChain { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseResponseInitChain(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.consensus_params = ConsensusParams.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.validators.push(ValidatorUpdate.decode(reader, reader.uint32())); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.app_hash = reader.bytes(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ResponseInitChain { + return { + consensus_params: isSet(object.consensus_params) ? ConsensusParams.fromJSON(object.consensus_params) : undefined, + validators: globalThis.Array.isArray(object?.validators) ? object.validators.map((e: any) => ValidatorUpdate.fromJSON(e)) : [], + app_hash: isSet(object.app_hash) ? bytesFromBase64(object.app_hash) : new Uint8Array(0), + }; + }, + + toJSON(message: ResponseInitChain): unknown { + const obj: any = {}; + if (message.consensus_params !== undefined) { + obj.consensus_params = ConsensusParams.toJSON(message.consensus_params); + } + if (message.validators?.length) { + obj.validators = message.validators.map((e) => ValidatorUpdate.toJSON(e)); + } + if (message.app_hash.length !== 0) { + obj.app_hash = base64FromBytes(message.app_hash); + } + return obj; + }, + + create, I>>(base?: I): ResponseInitChain { + return ResponseInitChain.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ResponseInitChain { + const message = createBaseResponseInitChain(); + message.consensus_params = + object.consensus_params !== undefined && object.consensus_params !== null ? ConsensusParams.fromPartial(object.consensus_params) : undefined; + message.validators = object.validators?.map((e) => ValidatorUpdate.fromPartial(e)) || []; + message.app_hash = object.app_hash ?? new Uint8Array(0); + return message; + }, +}; + +export const ResponseQuery: MessageFns = { + $type: "tendermint.abci.ResponseQuery" as const, + + encode(message: ResponseQuery, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + 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); + } + if (message.index !== 0) { + writer.uint32(40).int64(message.index); + } + if (message.key.length !== 0) { + writer.uint32(50).bytes(message.key); + } + if (message.value.length !== 0) { + writer.uint32(58).bytes(message.value); + } + if (message.proof_ops !== undefined) { + ProofOps.encode(message.proof_ops, writer.uint32(66).fork()).join(); + } + if (message.height !== 0) { + writer.uint32(72).int64(message.height); + } + if (message.codespace !== "") { + writer.uint32(82).string(message.codespace); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ResponseQuery { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseResponseQuery(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.code = reader.uint32(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.log = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.info = reader.string(); + continue; + case 5: + if (tag !== 40) { + break; + } + + message.index = longToNumber(reader.int64()); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.key = reader.bytes(); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.value = reader.bytes(); + continue; + case 8: + if (tag !== 66) { + break; + } + + message.proof_ops = ProofOps.decode(reader, reader.uint32()); + continue; + case 9: + if (tag !== 72) { + break; + } + + message.height = longToNumber(reader.int64()); + continue; + case 10: + if (tag !== 82) { + break; + } + + message.codespace = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ResponseQuery { + return { + code: isSet(object.code) ? globalThis.Number(object.code) : 0, + log: isSet(object.log) ? globalThis.String(object.log) : "", + info: isSet(object.info) ? globalThis.String(object.info) : "", + index: isSet(object.index) ? globalThis.Number(object.index) : 0, + key: isSet(object.key) ? bytesFromBase64(object.key) : new Uint8Array(0), + value: isSet(object.value) ? bytesFromBase64(object.value) : new Uint8Array(0), + proof_ops: isSet(object.proof_ops) ? ProofOps.fromJSON(object.proof_ops) : undefined, + height: isSet(object.height) ? globalThis.Number(object.height) : 0, + codespace: isSet(object.codespace) ? globalThis.String(object.codespace) : "", + }; + }, + + toJSON(message: ResponseQuery): unknown { + const obj: any = {}; + if (message.code !== 0) { + obj.code = Math.round(message.code); + } + if (message.log !== "") { + obj.log = message.log; + } + if (message.info !== "") { + obj.info = message.info; + } + if (message.index !== 0) { + obj.index = Math.round(message.index); + } + if (message.key.length !== 0) { + obj.key = base64FromBytes(message.key); + } + if (message.value.length !== 0) { + obj.value = base64FromBytes(message.value); + } + if (message.proof_ops !== undefined) { + obj.proof_ops = ProofOps.toJSON(message.proof_ops); + } + if (message.height !== 0) { + obj.height = Math.round(message.height); + } + if (message.codespace !== "") { + obj.codespace = message.codespace; + } + return obj; + }, + + create, I>>(base?: I): ResponseQuery { + return ResponseQuery.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ResponseQuery { + const message = createBaseResponseQuery(); + message.code = object.code ?? 0; + message.log = object.log ?? ""; + message.info = object.info ?? ""; + message.index = object.index ?? 0; + message.key = object.key ?? new Uint8Array(0); + message.value = object.value ?? new Uint8Array(0); + message.proof_ops = object.proof_ops !== undefined && object.proof_ops !== null ? ProofOps.fromPartial(object.proof_ops) : undefined; + message.height = object.height ?? 0; + message.codespace = object.codespace ?? ""; + return message; + }, +}; + +export const ResponseCheckTx: MessageFns = { + $type: "tendermint.abci.ResponseCheckTx" as const, + + encode(message: ResponseCheckTx, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.code !== 0) { + writer.uint32(8).uint32(message.code); + } + if (message.data.length !== 0) { + writer.uint32(18).bytes(message.data); + } + if (message.gas_wanted !== 0) { + writer.uint32(40).int64(message.gas_wanted); + } + if (message.codespace !== "") { + writer.uint32(66).string(message.codespace); + } + if (message.sender !== "") { + writer.uint32(74).string(message.sender); + } + if (message.priority !== 0) { + writer.uint32(80).int64(message.priority); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ResponseCheckTx { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseResponseCheckTx(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.code = reader.uint32(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.data = reader.bytes(); + continue; + case 5: + if (tag !== 40) { + break; + } + + message.gas_wanted = longToNumber(reader.int64()); + continue; + case 8: + if (tag !== 66) { + break; + } + + message.codespace = reader.string(); + continue; + case 9: + if (tag !== 74) { + break; + } + + message.sender = reader.string(); + continue; + case 10: + if (tag !== 80) { + break; + } + + message.priority = longToNumber(reader.int64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ResponseCheckTx { + return { + code: isSet(object.code) ? globalThis.Number(object.code) : 0, + data: isSet(object.data) ? bytesFromBase64(object.data) : new Uint8Array(0), + gas_wanted: isSet(object.gas_wanted) ? globalThis.Number(object.gas_wanted) : 0, + codespace: isSet(object.codespace) ? globalThis.String(object.codespace) : "", + sender: isSet(object.sender) ? globalThis.String(object.sender) : "", + priority: isSet(object.priority) ? globalThis.Number(object.priority) : 0, + }; + }, + + toJSON(message: ResponseCheckTx): unknown { + const obj: any = {}; + if (message.code !== 0) { + obj.code = Math.round(message.code); + } + if (message.data.length !== 0) { + obj.data = base64FromBytes(message.data); + } + if (message.gas_wanted !== 0) { + obj.gas_wanted = Math.round(message.gas_wanted); + } + if (message.codespace !== "") { + obj.codespace = message.codespace; + } + if (message.sender !== "") { + obj.sender = message.sender; + } + if (message.priority !== 0) { + obj.priority = Math.round(message.priority); + } + return obj; + }, + + create, I>>(base?: I): ResponseCheckTx { + return ResponseCheckTx.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ResponseCheckTx { + const message = createBaseResponseCheckTx(); + message.code = object.code ?? 0; + message.data = object.data ?? new Uint8Array(0); + message.gas_wanted = object.gas_wanted ?? 0; + message.codespace = object.codespace ?? ""; + message.sender = object.sender ?? ""; + message.priority = object.priority ?? 0; + return message; + }, +}; + +export const ResponseDeliverTx: MessageFns = { + $type: "tendermint.abci.ResponseDeliverTx" as const, + + encode(message: ResponseDeliverTx, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.code !== 0) { + writer.uint32(8).uint32(message.code); + } + if (message.data.length !== 0) { + writer.uint32(18).bytes(message.data); + } + if (message.log !== "") { + writer.uint32(26).string(message.log); + } + if (message.info !== "") { + writer.uint32(34).string(message.info); + } + if (message.gas_wanted !== 0) { + writer.uint32(40).int64(message.gas_wanted); + } + if (message.gas_used !== 0) { + writer.uint32(48).int64(message.gas_used); + } + for (const v of message.events) { + Event.encode(v!, writer.uint32(58).fork()).join(); + } + if (message.codespace !== "") { + writer.uint32(66).string(message.codespace); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ResponseDeliverTx { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseResponseDeliverTx(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.code = reader.uint32(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.data = reader.bytes(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.log = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.info = reader.string(); + continue; + case 5: + if (tag !== 40) { + break; + } + + message.gas_wanted = longToNumber(reader.int64()); + continue; + case 6: + if (tag !== 48) { + break; + } + + message.gas_used = longToNumber(reader.int64()); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.events.push(Event.decode(reader, reader.uint32())); + continue; + case 8: + if (tag !== 66) { + break; + } + + message.codespace = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ResponseDeliverTx { + return { + code: isSet(object.code) ? globalThis.Number(object.code) : 0, + data: isSet(object.data) ? bytesFromBase64(object.data) : new Uint8Array(0), + log: isSet(object.log) ? globalThis.String(object.log) : "", + info: isSet(object.info) ? globalThis.String(object.info) : "", + gas_wanted: isSet(object.gas_wanted) ? globalThis.Number(object.gas_wanted) : 0, + gas_used: isSet(object.gas_used) ? globalThis.Number(object.gas_used) : 0, + events: globalThis.Array.isArray(object?.events) ? object.events.map((e: any) => Event.fromJSON(e)) : [], + codespace: isSet(object.codespace) ? globalThis.String(object.codespace) : "", + }; + }, + + toJSON(message: ResponseDeliverTx): unknown { + const obj: any = {}; + if (message.code !== 0) { + obj.code = Math.round(message.code); + } + if (message.data.length !== 0) { + obj.data = base64FromBytes(message.data); + } + if (message.log !== "") { + obj.log = message.log; + } + if (message.info !== "") { + obj.info = message.info; + } + if (message.gas_wanted !== 0) { + obj.gas_wanted = Math.round(message.gas_wanted); + } + if (message.gas_used !== 0) { + obj.gas_used = Math.round(message.gas_used); + } + if (message.events?.length) { + obj.events = message.events.map((e) => Event.toJSON(e)); + } + if (message.codespace !== "") { + obj.codespace = message.codespace; + } + return obj; + }, + + create, I>>(base?: I): ResponseDeliverTx { + return ResponseDeliverTx.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ResponseDeliverTx { + const message = createBaseResponseDeliverTx(); + message.code = object.code ?? 0; + message.data = object.data ?? new Uint8Array(0); + message.log = object.log ?? ""; + message.info = object.info ?? ""; + message.gas_wanted = object.gas_wanted ?? 0; + message.gas_used = object.gas_used ?? 0; + message.events = object.events?.map((e) => Event.fromPartial(e)) || []; + message.codespace = object.codespace ?? ""; + return message; + }, +}; + +export const ResponseCommit: MessageFns = { + $type: "tendermint.abci.ResponseCommit" as const, + + encode(message: ResponseCommit, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.retain_height !== 0) { + writer.uint32(24).int64(message.retain_height); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ResponseCommit { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseResponseCommit(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 3: + if (tag !== 24) { + break; + } + + message.retain_height = longToNumber(reader.int64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ResponseCommit { + return { retain_height: isSet(object.retain_height) ? globalThis.Number(object.retain_height) : 0 }; + }, + + toJSON(message: ResponseCommit): unknown { + const obj: any = {}; + if (message.retain_height !== 0) { + obj.retain_height = Math.round(message.retain_height); + } + return obj; + }, + + create, I>>(base?: I): ResponseCommit { + return ResponseCommit.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ResponseCommit { + const message = createBaseResponseCommit(); + message.retain_height = object.retain_height ?? 0; + return message; + }, +}; + +export const ResponseListSnapshots: MessageFns = { + $type: "tendermint.abci.ResponseListSnapshots" as const, + + encode(message: ResponseListSnapshots, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.snapshots) { + Snapshot.encode(v!, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ResponseListSnapshots { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseResponseListSnapshots(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.snapshots.push(Snapshot.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ResponseListSnapshots { + return { + snapshots: globalThis.Array.isArray(object?.snapshots) ? object.snapshots.map((e: any) => Snapshot.fromJSON(e)) : [], + }; + }, + + toJSON(message: ResponseListSnapshots): unknown { + const obj: any = {}; + if (message.snapshots?.length) { + obj.snapshots = message.snapshots.map((e) => Snapshot.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): ResponseListSnapshots { + return ResponseListSnapshots.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ResponseListSnapshots { + const message = createBaseResponseListSnapshots(); + message.snapshots = object.snapshots?.map((e) => Snapshot.fromPartial(e)) || []; + return message; + }, +}; + +export const ResponseOfferSnapshot: MessageFns = { + $type: "tendermint.abci.ResponseOfferSnapshot" as const, + + encode(message: ResponseOfferSnapshot, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.result !== 0) { + writer.uint32(8).int32(message.result); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ResponseOfferSnapshot { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseResponseOfferSnapshot(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.result = reader.int32() as any; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ResponseOfferSnapshot { + return { result: isSet(object.result) ? responseOfferSnapshotResultFromJSON(object.result) : 0 }; + }, + + toJSON(message: ResponseOfferSnapshot): unknown { + const obj: any = {}; + if (message.result !== 0) { + obj.result = responseOfferSnapshotResultToJSON(message.result); + } + return obj; + }, + + create, I>>(base?: I): ResponseOfferSnapshot { + return ResponseOfferSnapshot.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ResponseOfferSnapshot { + const message = createBaseResponseOfferSnapshot(); + message.result = object.result ?? 0; + return message; + }, +}; + +export const ResponseLoadSnapshotChunk: MessageFns = { + $type: "tendermint.abci.ResponseLoadSnapshotChunk" as const, + + encode(message: ResponseLoadSnapshotChunk, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.chunk.length !== 0) { + writer.uint32(10).bytes(message.chunk); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ResponseLoadSnapshotChunk { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseResponseLoadSnapshotChunk(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.chunk = reader.bytes(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ResponseLoadSnapshotChunk { + return { chunk: isSet(object.chunk) ? bytesFromBase64(object.chunk) : new Uint8Array(0) }; + }, + + toJSON(message: ResponseLoadSnapshotChunk): unknown { + const obj: any = {}; + if (message.chunk.length !== 0) { + obj.chunk = base64FromBytes(message.chunk); + } + return obj; + }, + + create, I>>(base?: I): ResponseLoadSnapshotChunk { + return ResponseLoadSnapshotChunk.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ResponseLoadSnapshotChunk { + const message = createBaseResponseLoadSnapshotChunk(); + message.chunk = object.chunk ?? new Uint8Array(0); + return message; + }, +}; + +export const ResponseApplySnapshotChunk: MessageFns = { + $type: "tendermint.abci.ResponseApplySnapshotChunk" as const, + + encode(message: ResponseApplySnapshotChunk, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.result !== 0) { + writer.uint32(8).int32(message.result); + } + writer.uint32(18).fork(); + for (const v of message.refetch_chunks) { + writer.uint32(v); + } + writer.join(); + for (const v of message.reject_senders) { + writer.uint32(26).string(v!); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ResponseApplySnapshotChunk { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseResponseApplySnapshotChunk(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.result = reader.int32() as any; + continue; + case 2: + if (tag === 16) { + message.refetch_chunks.push(reader.uint32()); + + continue; + } + + if (tag === 18) { + const end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) { + message.refetch_chunks.push(reader.uint32()); + } + + continue; + } + + break; + case 3: + if (tag !== 26) { + break; + } + + message.reject_senders.push(reader.string()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ResponseApplySnapshotChunk { + return { + result: isSet(object.result) ? responseApplySnapshotChunkResultFromJSON(object.result) : 0, + refetch_chunks: globalThis.Array.isArray(object?.refetch_chunks) ? object.refetch_chunks.map((e: any) => globalThis.Number(e)) : [], + reject_senders: globalThis.Array.isArray(object?.reject_senders) ? object.reject_senders.map((e: any) => globalThis.String(e)) : [], + }; + }, + + toJSON(message: ResponseApplySnapshotChunk): unknown { + const obj: any = {}; + if (message.result !== 0) { + obj.result = responseApplySnapshotChunkResultToJSON(message.result); + } + if (message.refetch_chunks?.length) { + obj.refetch_chunks = message.refetch_chunks.map((e) => Math.round(e)); + } + if (message.reject_senders?.length) { + obj.reject_senders = message.reject_senders; + } + return obj; + }, + + create, I>>(base?: I): ResponseApplySnapshotChunk { + return ResponseApplySnapshotChunk.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ResponseApplySnapshotChunk { + const message = createBaseResponseApplySnapshotChunk(); + message.result = object.result ?? 0; + message.refetch_chunks = object.refetch_chunks?.map((e) => e) || []; + message.reject_senders = object.reject_senders?.map((e) => e) || []; + return message; + }, +}; + +export const ResponsePrepareProposal: MessageFns = { + $type: "tendermint.abci.ResponsePrepareProposal" as const, + + encode(message: ResponsePrepareProposal, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.tx_records) { + TxRecord.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.app_hash.length !== 0) { + writer.uint32(18).bytes(message.app_hash); + } + for (const v of message.tx_results) { + ExecTxResult.encode(v!, writer.uint32(26).fork()).join(); + } + for (const v of message.validator_updates) { + ValidatorUpdate.encode(v!, writer.uint32(34).fork()).join(); + } + if (message.consensus_param_updates !== undefined) { + ConsensusParams.encode(message.consensus_param_updates, writer.uint32(42).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ResponsePrepareProposal { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseResponsePrepareProposal(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.tx_records.push(TxRecord.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.app_hash = reader.bytes(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.tx_results.push(ExecTxResult.decode(reader, reader.uint32())); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.validator_updates.push(ValidatorUpdate.decode(reader, reader.uint32())); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.consensus_param_updates = ConsensusParams.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ResponsePrepareProposal { + return { + tx_records: globalThis.Array.isArray(object?.tx_records) ? object.tx_records.map((e: any) => TxRecord.fromJSON(e)) : [], + app_hash: isSet(object.app_hash) ? bytesFromBase64(object.app_hash) : new Uint8Array(0), + tx_results: globalThis.Array.isArray(object?.tx_results) ? object.tx_results.map((e: any) => ExecTxResult.fromJSON(e)) : [], + validator_updates: globalThis.Array.isArray(object?.validator_updates) ? object.validator_updates.map((e: any) => ValidatorUpdate.fromJSON(e)) : [], + consensus_param_updates: isSet(object.consensus_param_updates) ? ConsensusParams.fromJSON(object.consensus_param_updates) : undefined, + }; + }, + + toJSON(message: ResponsePrepareProposal): unknown { + const obj: any = {}; + if (message.tx_records?.length) { + obj.tx_records = message.tx_records.map((e) => TxRecord.toJSON(e)); + } + if (message.app_hash.length !== 0) { + obj.app_hash = base64FromBytes(message.app_hash); + } + if (message.tx_results?.length) { + obj.tx_results = message.tx_results.map((e) => ExecTxResult.toJSON(e)); + } + if (message.validator_updates?.length) { + obj.validator_updates = message.validator_updates.map((e) => ValidatorUpdate.toJSON(e)); + } + if (message.consensus_param_updates !== undefined) { + obj.consensus_param_updates = ConsensusParams.toJSON(message.consensus_param_updates); + } + return obj; + }, + + create, I>>(base?: I): ResponsePrepareProposal { + return ResponsePrepareProposal.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ResponsePrepareProposal { + const message = createBaseResponsePrepareProposal(); + message.tx_records = object.tx_records?.map((e) => TxRecord.fromPartial(e)) || []; + message.app_hash = object.app_hash ?? new Uint8Array(0); + message.tx_results = object.tx_results?.map((e) => ExecTxResult.fromPartial(e)) || []; + message.validator_updates = object.validator_updates?.map((e) => ValidatorUpdate.fromPartial(e)) || []; + message.consensus_param_updates = + object.consensus_param_updates !== undefined && object.consensus_param_updates !== null + ? ConsensusParams.fromPartial(object.consensus_param_updates) + : undefined; + return message; + }, +}; + +export const ResponseProcessProposal: MessageFns = { + $type: "tendermint.abci.ResponseProcessProposal" as const, + + encode(message: ResponseProcessProposal, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.status !== 0) { + writer.uint32(8).int32(message.status); + } + if (message.app_hash.length !== 0) { + writer.uint32(18).bytes(message.app_hash); + } + for (const v of message.tx_results) { + ExecTxResult.encode(v!, writer.uint32(26).fork()).join(); + } + for (const v of message.validator_updates) { + ValidatorUpdate.encode(v!, writer.uint32(34).fork()).join(); + } + if (message.consensus_param_updates !== undefined) { + ConsensusParams.encode(message.consensus_param_updates, writer.uint32(42).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ResponseProcessProposal { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseResponseProcessProposal(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.status = reader.int32() as any; + continue; + case 2: + if (tag !== 18) { + break; + } + + message.app_hash = reader.bytes(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.tx_results.push(ExecTxResult.decode(reader, reader.uint32())); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.validator_updates.push(ValidatorUpdate.decode(reader, reader.uint32())); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.consensus_param_updates = ConsensusParams.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ResponseProcessProposal { + return { + status: isSet(object.status) ? responseProcessProposalProposalStatusFromJSON(object.status) : 0, + app_hash: isSet(object.app_hash) ? bytesFromBase64(object.app_hash) : new Uint8Array(0), + tx_results: globalThis.Array.isArray(object?.tx_results) ? object.tx_results.map((e: any) => ExecTxResult.fromJSON(e)) : [], + validator_updates: globalThis.Array.isArray(object?.validator_updates) ? object.validator_updates.map((e: any) => ValidatorUpdate.fromJSON(e)) : [], + consensus_param_updates: isSet(object.consensus_param_updates) ? ConsensusParams.fromJSON(object.consensus_param_updates) : undefined, + }; + }, + + toJSON(message: ResponseProcessProposal): unknown { + const obj: any = {}; + if (message.status !== 0) { + obj.status = responseProcessProposalProposalStatusToJSON(message.status); + } + if (message.app_hash.length !== 0) { + obj.app_hash = base64FromBytes(message.app_hash); + } + if (message.tx_results?.length) { + obj.tx_results = message.tx_results.map((e) => ExecTxResult.toJSON(e)); + } + if (message.validator_updates?.length) { + obj.validator_updates = message.validator_updates.map((e) => ValidatorUpdate.toJSON(e)); + } + if (message.consensus_param_updates !== undefined) { + obj.consensus_param_updates = ConsensusParams.toJSON(message.consensus_param_updates); + } + return obj; + }, + + create, I>>(base?: I): ResponseProcessProposal { + return ResponseProcessProposal.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ResponseProcessProposal { + const message = createBaseResponseProcessProposal(); + message.status = object.status ?? 0; + message.app_hash = object.app_hash ?? new Uint8Array(0); + message.tx_results = object.tx_results?.map((e) => ExecTxResult.fromPartial(e)) || []; + message.validator_updates = object.validator_updates?.map((e) => ValidatorUpdate.fromPartial(e)) || []; + message.consensus_param_updates = + object.consensus_param_updates !== undefined && object.consensus_param_updates !== null + ? ConsensusParams.fromPartial(object.consensus_param_updates) + : undefined; + return message; + }, +}; + +export const ResponseExtendVote: MessageFns = { + $type: "tendermint.abci.ResponseExtendVote" as const, + + encode(message: ResponseExtendVote, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.vote_extension.length !== 0) { + writer.uint32(10).bytes(message.vote_extension); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ResponseExtendVote { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseResponseExtendVote(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.vote_extension = reader.bytes(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ResponseExtendVote { + return { + vote_extension: isSet(object.vote_extension) ? bytesFromBase64(object.vote_extension) : new Uint8Array(0), + }; + }, + + toJSON(message: ResponseExtendVote): unknown { + const obj: any = {}; + if (message.vote_extension.length !== 0) { + obj.vote_extension = base64FromBytes(message.vote_extension); + } + return obj; + }, + + create, I>>(base?: I): ResponseExtendVote { + return ResponseExtendVote.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ResponseExtendVote { + const message = createBaseResponseExtendVote(); + message.vote_extension = object.vote_extension ?? new Uint8Array(0); + return message; + }, +}; + +export const ResponseVerifyVoteExtension: MessageFns = { + $type: "tendermint.abci.ResponseVerifyVoteExtension" as const, + + encode(message: ResponseVerifyVoteExtension, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.status !== 0) { + writer.uint32(8).int32(message.status); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ResponseVerifyVoteExtension { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseResponseVerifyVoteExtension(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.status = reader.int32() as any; + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ResponseVerifyVoteExtension { + return { status: isSet(object.status) ? responseVerifyVoteExtensionVerifyStatusFromJSON(object.status) : 0 }; + }, + + toJSON(message: ResponseVerifyVoteExtension): unknown { + const obj: any = {}; + if (message.status !== 0) { + obj.status = responseVerifyVoteExtensionVerifyStatusToJSON(message.status); + } + return obj; + }, + + create, I>>(base?: I): ResponseVerifyVoteExtension { + return ResponseVerifyVoteExtension.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ResponseVerifyVoteExtension { + const message = createBaseResponseVerifyVoteExtension(); + message.status = object.status ?? 0; + return message; + }, +}; + +export const ResponseFinalizeBlock: MessageFns = { + $type: "tendermint.abci.ResponseFinalizeBlock" as const, + + encode(message: ResponseFinalizeBlock, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.events) { + Event.encode(v!, writer.uint32(10).fork()).join(); + } + for (const v of message.tx_results) { + ExecTxResult.encode(v!, writer.uint32(18).fork()).join(); + } + for (const v of message.validator_updates) { + ValidatorUpdate.encode(v!, writer.uint32(26).fork()).join(); + } + if (message.consensus_param_updates !== undefined) { + ConsensusParams.encode(message.consensus_param_updates, writer.uint32(34).fork()).join(); + } + if (message.app_hash.length !== 0) { + writer.uint32(42).bytes(message.app_hash); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ResponseFinalizeBlock { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseResponseFinalizeBlock(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.events.push(Event.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.tx_results.push(ExecTxResult.decode(reader, reader.uint32())); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.validator_updates.push(ValidatorUpdate.decode(reader, reader.uint32())); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.consensus_param_updates = ConsensusParams.decode(reader, reader.uint32()); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.app_hash = reader.bytes(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ResponseFinalizeBlock { + return { + events: globalThis.Array.isArray(object?.events) ? object.events.map((e: any) => Event.fromJSON(e)) : [], + tx_results: globalThis.Array.isArray(object?.tx_results) ? object.tx_results.map((e: any) => ExecTxResult.fromJSON(e)) : [], + validator_updates: globalThis.Array.isArray(object?.validator_updates) ? object.validator_updates.map((e: any) => ValidatorUpdate.fromJSON(e)) : [], + consensus_param_updates: isSet(object.consensus_param_updates) ? ConsensusParams.fromJSON(object.consensus_param_updates) : undefined, + app_hash: isSet(object.app_hash) ? bytesFromBase64(object.app_hash) : new Uint8Array(0), + }; + }, + + toJSON(message: ResponseFinalizeBlock): unknown { + const obj: any = {}; + if (message.events?.length) { + obj.events = message.events.map((e) => Event.toJSON(e)); + } + if (message.tx_results?.length) { + obj.tx_results = message.tx_results.map((e) => ExecTxResult.toJSON(e)); + } + if (message.validator_updates?.length) { + obj.validator_updates = message.validator_updates.map((e) => ValidatorUpdate.toJSON(e)); + } + if (message.consensus_param_updates !== undefined) { + obj.consensus_param_updates = ConsensusParams.toJSON(message.consensus_param_updates); + } + if (message.app_hash.length !== 0) { + obj.app_hash = base64FromBytes(message.app_hash); + } + return obj; + }, + + create, I>>(base?: I): ResponseFinalizeBlock { + return ResponseFinalizeBlock.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ResponseFinalizeBlock { + const message = createBaseResponseFinalizeBlock(); + message.events = object.events?.map((e) => Event.fromPartial(e)) || []; + message.tx_results = object.tx_results?.map((e) => ExecTxResult.fromPartial(e)) || []; + message.validator_updates = object.validator_updates?.map((e) => ValidatorUpdate.fromPartial(e)) || []; + message.consensus_param_updates = + object.consensus_param_updates !== undefined && object.consensus_param_updates !== null + ? ConsensusParams.fromPartial(object.consensus_param_updates) + : undefined; + message.app_hash = object.app_hash ?? new Uint8Array(0); + return message; + }, +}; + +export const CommitInfo: MessageFns = { + $type: "tendermint.abci.CommitInfo" as const, + + encode(message: CommitInfo, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.round !== 0) { + writer.uint32(8).int32(message.round); + } + for (const v of message.votes) { + VoteInfo.encode(v!, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): CommitInfo { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseCommitInfo(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.round = reader.int32(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.votes.push(VoteInfo.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): CommitInfo { + return { + round: isSet(object.round) ? globalThis.Number(object.round) : 0, + votes: globalThis.Array.isArray(object?.votes) ? object.votes.map((e: any) => VoteInfo.fromJSON(e)) : [], + }; + }, + + toJSON(message: CommitInfo): unknown { + const obj: any = {}; + if (message.round !== 0) { + obj.round = Math.round(message.round); + } + if (message.votes?.length) { + obj.votes = message.votes.map((e) => VoteInfo.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): CommitInfo { + return CommitInfo.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): CommitInfo { + const message = createBaseCommitInfo(); + message.round = object.round ?? 0; + message.votes = object.votes?.map((e) => VoteInfo.fromPartial(e)) || []; + return message; + }, +}; + +export const ExtendedCommitInfo: MessageFns = { + $type: "tendermint.abci.ExtendedCommitInfo" as const, + + encode(message: ExtendedCommitInfo, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.round !== 0) { + writer.uint32(8).int32(message.round); + } + for (const v of message.votes) { + ExtendedVoteInfo.encode(v!, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ExtendedCommitInfo { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseExtendedCommitInfo(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.round = reader.int32(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.votes.push(ExtendedVoteInfo.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ExtendedCommitInfo { + return { + round: isSet(object.round) ? globalThis.Number(object.round) : 0, + votes: globalThis.Array.isArray(object?.votes) ? object.votes.map((e: any) => ExtendedVoteInfo.fromJSON(e)) : [], + }; + }, + + toJSON(message: ExtendedCommitInfo): unknown { + const obj: any = {}; + if (message.round !== 0) { + obj.round = Math.round(message.round); + } + if (message.votes?.length) { + obj.votes = message.votes.map((e) => ExtendedVoteInfo.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): ExtendedCommitInfo { + return ExtendedCommitInfo.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ExtendedCommitInfo { + const message = createBaseExtendedCommitInfo(); + message.round = object.round ?? 0; + message.votes = object.votes?.map((e) => ExtendedVoteInfo.fromPartial(e)) || []; + return message; + }, +}; + +export const Event: MessageFns = { + $type: "tendermint.abci.Event" as const, + + encode(message: Event, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.type !== "") { + writer.uint32(10).string(message.type); + } + for (const v of message.attributes) { + EventAttribute.encode(v!, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Event { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEvent(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.type = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.attributes.push(EventAttribute.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Event { + return { + type: isSet(object.type) ? globalThis.String(object.type) : "", + attributes: globalThis.Array.isArray(object?.attributes) ? object.attributes.map((e: any) => EventAttribute.fromJSON(e)) : [], + }; + }, + + toJSON(message: Event): unknown { + const obj: any = {}; + if (message.type !== "") { + obj.type = message.type; + } + if (message.attributes?.length) { + obj.attributes = message.attributes.map((e) => EventAttribute.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): Event { + return Event.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Event { + const message = createBaseEvent(); + message.type = object.type ?? ""; + message.attributes = object.attributes?.map((e) => EventAttribute.fromPartial(e)) || []; + return message; + }, +}; + +export const EventAttribute: MessageFns = { + $type: "tendermint.abci.EventAttribute" as const, + + encode(message: EventAttribute, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.key !== "") { + writer.uint32(10).string(message.key); + } + if (message.value !== "") { + writer.uint32(18).string(message.value); + } + if (message.index !== false) { + writer.uint32(24).bool(message.index); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): EventAttribute { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEventAttribute(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.key = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.value = reader.string(); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.index = reader.bool(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): EventAttribute { + return { + key: isSet(object.key) ? globalThis.String(object.key) : "", + value: isSet(object.value) ? globalThis.String(object.value) : "", + index: isSet(object.index) ? globalThis.Boolean(object.index) : false, + }; + }, + + toJSON(message: EventAttribute): unknown { + const obj: any = {}; + if (message.key !== "") { + obj.key = message.key; + } + if (message.value !== "") { + obj.value = message.value; + } + if (message.index !== false) { + obj.index = message.index; + } + return obj; + }, + + create, I>>(base?: I): EventAttribute { + return EventAttribute.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): EventAttribute { + const message = createBaseEventAttribute(); + message.key = object.key ?? ""; + message.value = object.value ?? ""; + message.index = object.index ?? false; + return message; + }, +}; + +export const ExecTxResult: MessageFns = { + $type: "tendermint.abci.ExecTxResult" as const, + + encode(message: ExecTxResult, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.code !== 0) { + writer.uint32(8).uint32(message.code); + } + if (message.data.length !== 0) { + writer.uint32(18).bytes(message.data); + } + if (message.log !== "") { + writer.uint32(26).string(message.log); + } + if (message.info !== "") { + writer.uint32(34).string(message.info); + } + if (message.gas_wanted !== 0) { + writer.uint32(40).int64(message.gas_wanted); + } + if (message.gas_used !== 0) { + writer.uint32(48).int64(message.gas_used); + } + for (const v of message.events) { + Event.encode(v!, writer.uint32(58).fork()).join(); + } + if (message.codespace !== "") { + writer.uint32(66).string(message.codespace); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ExecTxResult { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseExecTxResult(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.code = reader.uint32(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.data = reader.bytes(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.log = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.info = reader.string(); + continue; + case 5: + if (tag !== 40) { + break; + } + + message.gas_wanted = longToNumber(reader.int64()); + continue; + case 6: + if (tag !== 48) { + break; + } + + message.gas_used = longToNumber(reader.int64()); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.events.push(Event.decode(reader, reader.uint32())); + continue; + case 8: + if (tag !== 66) { + break; + } + + message.codespace = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ExecTxResult { + return { + code: isSet(object.code) ? globalThis.Number(object.code) : 0, + data: isSet(object.data) ? bytesFromBase64(object.data) : new Uint8Array(0), + log: isSet(object.log) ? globalThis.String(object.log) : "", + info: isSet(object.info) ? globalThis.String(object.info) : "", + gas_wanted: isSet(object.gas_wanted) ? globalThis.Number(object.gas_wanted) : 0, + gas_used: isSet(object.gas_used) ? globalThis.Number(object.gas_used) : 0, + events: globalThis.Array.isArray(object?.events) ? object.events.map((e: any) => Event.fromJSON(e)) : [], + codespace: isSet(object.codespace) ? globalThis.String(object.codespace) : "", + }; + }, + + toJSON(message: ExecTxResult): unknown { + const obj: any = {}; + if (message.code !== 0) { + obj.code = Math.round(message.code); + } + if (message.data.length !== 0) { + obj.data = base64FromBytes(message.data); + } + if (message.log !== "") { + obj.log = message.log; + } + if (message.info !== "") { + obj.info = message.info; + } + if (message.gas_wanted !== 0) { + obj.gas_wanted = Math.round(message.gas_wanted); + } + if (message.gas_used !== 0) { + obj.gas_used = Math.round(message.gas_used); + } + if (message.events?.length) { + obj.events = message.events.map((e) => Event.toJSON(e)); + } + if (message.codespace !== "") { + obj.codespace = message.codespace; + } + return obj; + }, + + create, I>>(base?: I): ExecTxResult { + return ExecTxResult.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ExecTxResult { + const message = createBaseExecTxResult(); + message.code = object.code ?? 0; + message.data = object.data ?? new Uint8Array(0); + message.log = object.log ?? ""; + message.info = object.info ?? ""; + message.gas_wanted = object.gas_wanted ?? 0; + message.gas_used = object.gas_used ?? 0; + message.events = object.events?.map((e) => Event.fromPartial(e)) || []; + message.codespace = object.codespace ?? ""; + return message; + }, +}; + +export const TxResult: MessageFns = { + $type: "tendermint.abci.TxResult" as const, + + encode(message: TxResult, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.height !== 0) { + writer.uint32(8).int64(message.height); + } + if (message.index !== 0) { + writer.uint32(16).uint32(message.index); + } + if (message.tx.length !== 0) { + writer.uint32(26).bytes(message.tx); + } + if (message.result !== undefined) { + ExecTxResult.encode(message.result, writer.uint32(34).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): TxResult { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseTxResult(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.height = longToNumber(reader.int64()); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.index = reader.uint32(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.tx = reader.bytes(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.result = ExecTxResult.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): TxResult { + return { + height: isSet(object.height) ? globalThis.Number(object.height) : 0, + index: isSet(object.index) ? globalThis.Number(object.index) : 0, + tx: isSet(object.tx) ? bytesFromBase64(object.tx) : new Uint8Array(0), + result: isSet(object.result) ? ExecTxResult.fromJSON(object.result) : undefined, + }; + }, + + toJSON(message: TxResult): unknown { + const obj: any = {}; + if (message.height !== 0) { + obj.height = Math.round(message.height); + } + if (message.index !== 0) { + obj.index = Math.round(message.index); + } + if (message.tx.length !== 0) { + obj.tx = base64FromBytes(message.tx); + } + if (message.result !== undefined) { + obj.result = ExecTxResult.toJSON(message.result); + } + return obj; + }, + + create, I>>(base?: I): TxResult { + return TxResult.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): TxResult { + const message = createBaseTxResult(); + message.height = object.height ?? 0; + message.index = object.index ?? 0; + message.tx = object.tx ?? new Uint8Array(0); + message.result = object.result !== undefined && object.result !== null ? ExecTxResult.fromPartial(object.result) : undefined; + return message; + }, +}; + +export const TxRecord: MessageFns = { + $type: "tendermint.abci.TxRecord" as const, + + encode(message: TxRecord, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.action !== 0) { + writer.uint32(8).int32(message.action); + } + if (message.tx.length !== 0) { + writer.uint32(18).bytes(message.tx); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): TxRecord { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseTxRecord(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.action = reader.int32() as any; + continue; + case 2: + if (tag !== 18) { + break; + } + + message.tx = reader.bytes(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): TxRecord { + return { + action: isSet(object.action) ? txRecordTxActionFromJSON(object.action) : 0, + tx: isSet(object.tx) ? bytesFromBase64(object.tx) : new Uint8Array(0), + }; + }, + + toJSON(message: TxRecord): unknown { + const obj: any = {}; + if (message.action !== 0) { + obj.action = txRecordTxActionToJSON(message.action); + } + if (message.tx.length !== 0) { + obj.tx = base64FromBytes(message.tx); + } + return obj; + }, + + create, I>>(base?: I): TxRecord { + return TxRecord.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): TxRecord { + const message = createBaseTxRecord(); + message.action = object.action ?? 0; + message.tx = object.tx ?? new Uint8Array(0); + return message; + }, +}; + +export const Validator: MessageFns = { + $type: "tendermint.abci.Validator" as const, + + encode(message: Validator, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.address.length !== 0) { + writer.uint32(10).bytes(message.address); + } + if (message.power !== 0) { + writer.uint32(24).int64(message.power); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Validator { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseValidator(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.address = reader.bytes(); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.power = longToNumber(reader.int64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Validator { + return { + address: isSet(object.address) ? bytesFromBase64(object.address) : new Uint8Array(0), + power: isSet(object.power) ? globalThis.Number(object.power) : 0, + }; + }, + + toJSON(message: Validator): unknown { + const obj: any = {}; + if (message.address.length !== 0) { + obj.address = base64FromBytes(message.address); + } + if (message.power !== 0) { + obj.power = Math.round(message.power); + } + return obj; + }, + + create, I>>(base?: I): Validator { + return Validator.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Validator { + const message = createBaseValidator(); + message.address = object.address ?? new Uint8Array(0); + message.power = object.power ?? 0; + return message; + }, +}; + +export const ValidatorUpdate: MessageFns = { + $type: "tendermint.abci.ValidatorUpdate" as const, + + encode(message: ValidatorUpdate, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.pub_key !== undefined) { + PublicKey.encode(message.pub_key, writer.uint32(10).fork()).join(); + } + if (message.power !== 0) { + writer.uint32(16).int64(message.power); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ValidatorUpdate { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseValidatorUpdate(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.pub_key = PublicKey.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.power = longToNumber(reader.int64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ValidatorUpdate { + return { + pub_key: isSet(object.pub_key) ? PublicKey.fromJSON(object.pub_key) : undefined, + power: isSet(object.power) ? globalThis.Number(object.power) : 0, + }; + }, + + toJSON(message: ValidatorUpdate): unknown { + const obj: any = {}; + if (message.pub_key !== undefined) { + obj.pub_key = PublicKey.toJSON(message.pub_key); + } + if (message.power !== 0) { + obj.power = Math.round(message.power); + } + return obj; + }, + + create, I>>(base?: I): ValidatorUpdate { + return ValidatorUpdate.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ValidatorUpdate { + const message = createBaseValidatorUpdate(); + message.pub_key = object.pub_key !== undefined && object.pub_key !== null ? PublicKey.fromPartial(object.pub_key) : undefined; + message.power = object.power ?? 0; + return message; + }, +}; + +export const VoteInfo: MessageFns = { + $type: "tendermint.abci.VoteInfo" as const, + + encode(message: VoteInfo, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.validator !== undefined) { + Validator.encode(message.validator, writer.uint32(10).fork()).join(); + } + if (message.signed_last_block !== false) { + writer.uint32(16).bool(message.signed_last_block); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): VoteInfo { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseVoteInfo(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.validator = Validator.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.signed_last_block = reader.bool(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): VoteInfo { + return { + validator: isSet(object.validator) ? Validator.fromJSON(object.validator) : undefined, + signed_last_block: isSet(object.signed_last_block) ? globalThis.Boolean(object.signed_last_block) : false, + }; + }, + + toJSON(message: VoteInfo): unknown { + const obj: any = {}; + if (message.validator !== undefined) { + obj.validator = Validator.toJSON(message.validator); + } + if (message.signed_last_block !== false) { + obj.signed_last_block = message.signed_last_block; + } + return obj; + }, + + create, I>>(base?: I): VoteInfo { + return VoteInfo.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): VoteInfo { + const message = createBaseVoteInfo(); + message.validator = object.validator !== undefined && object.validator !== null ? Validator.fromPartial(object.validator) : undefined; + message.signed_last_block = object.signed_last_block ?? false; + return message; + }, +}; + +export const ExtendedVoteInfo: MessageFns = { + $type: "tendermint.abci.ExtendedVoteInfo" as const, + + encode(message: ExtendedVoteInfo, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.validator !== undefined) { + Validator.encode(message.validator, writer.uint32(10).fork()).join(); + } + if (message.signed_last_block !== false) { + writer.uint32(16).bool(message.signed_last_block); + } + if (message.vote_extension.length !== 0) { + writer.uint32(26).bytes(message.vote_extension); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ExtendedVoteInfo { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseExtendedVoteInfo(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.validator = Validator.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.signed_last_block = reader.bool(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.vote_extension = reader.bytes(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ExtendedVoteInfo { + return { + validator: isSet(object.validator) ? Validator.fromJSON(object.validator) : undefined, + signed_last_block: isSet(object.signed_last_block) ? globalThis.Boolean(object.signed_last_block) : false, + vote_extension: isSet(object.vote_extension) ? bytesFromBase64(object.vote_extension) : new Uint8Array(0), + }; + }, + + toJSON(message: ExtendedVoteInfo): unknown { + const obj: any = {}; + if (message.validator !== undefined) { + obj.validator = Validator.toJSON(message.validator); + } + if (message.signed_last_block !== false) { + obj.signed_last_block = message.signed_last_block; + } + if (message.vote_extension.length !== 0) { + obj.vote_extension = base64FromBytes(message.vote_extension); + } + return obj; + }, + + create, I>>(base?: I): ExtendedVoteInfo { + return ExtendedVoteInfo.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ExtendedVoteInfo { + const message = createBaseExtendedVoteInfo(); + message.validator = object.validator !== undefined && object.validator !== null ? Validator.fromPartial(object.validator) : undefined; + message.signed_last_block = object.signed_last_block ?? false; + message.vote_extension = object.vote_extension ?? new Uint8Array(0); + return message; + }, +}; + +export const Misbehavior: MessageFns = { + $type: "tendermint.abci.Misbehavior" as const, + + encode(message: Misbehavior, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.type !== 0) { + writer.uint32(8).int32(message.type); + } + if (message.validator !== undefined) { + Validator.encode(message.validator, writer.uint32(18).fork()).join(); + } + if (message.height !== 0) { + writer.uint32(24).int64(message.height); + } + if (message.time !== undefined) { + Timestamp.encode(toTimestamp(message.time), writer.uint32(34).fork()).join(); + } + if (message.total_voting_power !== 0) { + writer.uint32(40).int64(message.total_voting_power); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Misbehavior { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMisbehavior(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.type = reader.int32() as any; + continue; + case 2: + if (tag !== 18) { + break; + } + + message.validator = Validator.decode(reader, reader.uint32()); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.height = longToNumber(reader.int64()); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.time = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + continue; + case 5: + if (tag !== 40) { + break; + } + + message.total_voting_power = longToNumber(reader.int64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Misbehavior { + return { + type: isSet(object.type) ? misbehaviorTypeFromJSON(object.type) : 0, + validator: isSet(object.validator) ? Validator.fromJSON(object.validator) : undefined, + height: isSet(object.height) ? globalThis.Number(object.height) : 0, + time: isSet(object.time) ? fromJsonTimestamp(object.time) : undefined, + total_voting_power: isSet(object.total_voting_power) ? globalThis.Number(object.total_voting_power) : 0, + }; + }, + + toJSON(message: Misbehavior): unknown { + const obj: any = {}; + if (message.type !== 0) { + obj.type = misbehaviorTypeToJSON(message.type); + } + if (message.validator !== undefined) { + obj.validator = Validator.toJSON(message.validator); + } + if (message.height !== 0) { + obj.height = Math.round(message.height); + } + if (message.time !== undefined) { + obj.time = message.time.toISOString(); + } + if (message.total_voting_power !== 0) { + obj.total_voting_power = Math.round(message.total_voting_power); + } + return obj; + }, + + create, I>>(base?: I): Misbehavior { + return Misbehavior.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Misbehavior { + const message = createBaseMisbehavior(); + message.type = object.type ?? 0; + message.validator = object.validator !== undefined && object.validator !== null ? Validator.fromPartial(object.validator) : undefined; + message.height = object.height ?? 0; + message.time = object.time ?? undefined; + message.total_voting_power = object.total_voting_power ?? 0; + return message; + }, +}; + +export const Snapshot: MessageFns = { + $type: "tendermint.abci.Snapshot" as const, + + encode(message: Snapshot, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.height !== 0) { + writer.uint32(8).uint64(message.height); + } + if (message.format !== 0) { + writer.uint32(16).uint32(message.format); + } + if (message.chunks !== 0) { + writer.uint32(24).uint32(message.chunks); + } + if (message.hash.length !== 0) { + writer.uint32(34).bytes(message.hash); + } + if (message.metadata.length !== 0) { + writer.uint32(42).bytes(message.metadata); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Snapshot { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseSnapshot(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.height = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.format = reader.uint32(); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.chunks = reader.uint32(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.hash = reader.bytes(); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.metadata = reader.bytes(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Snapshot { + return { + height: isSet(object.height) ? globalThis.Number(object.height) : 0, + format: isSet(object.format) ? globalThis.Number(object.format) : 0, + chunks: isSet(object.chunks) ? globalThis.Number(object.chunks) : 0, + hash: isSet(object.hash) ? bytesFromBase64(object.hash) : new Uint8Array(0), + metadata: isSet(object.metadata) ? bytesFromBase64(object.metadata) : new Uint8Array(0), + }; + }, + + toJSON(message: Snapshot): unknown { + const obj: any = {}; + if (message.height !== 0) { + obj.height = Math.round(message.height); + } + if (message.format !== 0) { + obj.format = Math.round(message.format); + } + if (message.chunks !== 0) { + obj.chunks = Math.round(message.chunks); + } + if (message.hash.length !== 0) { + obj.hash = base64FromBytes(message.hash); + } + if (message.metadata.length !== 0) { + obj.metadata = base64FromBytes(message.metadata); + } + return obj; + }, + + create, I>>(base?: I): Snapshot { + return Snapshot.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Snapshot { + const message = createBaseSnapshot(); + message.height = object.height ?? 0; + message.format = object.format ?? 0; + message.chunks = object.chunks ?? 0; + message.hash = object.hash ?? new Uint8Array(0); + message.metadata = object.metadata ?? new Uint8Array(0); + return message; + }, +}; + +export function checkTxTypeFromJSON(object: any): CheckTxType { + switch (object) { + case 0: + case "NEW": + return CheckTxType.NEW; + case 1: + case "RECHECK": + return CheckTxType.RECHECK; + case -1: + case "UNRECOGNIZED": + default: + return CheckTxType.UNRECOGNIZED; + } +} + +export function checkTxTypeToJSON(object: CheckTxType): string { + switch (object) { + case CheckTxType.NEW: + return "NEW"; + case CheckTxType.RECHECK: + return "RECHECK"; + case CheckTxType.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +export function misbehaviorTypeFromJSON(object: any): MisbehaviorType { + switch (object) { + case 0: + case "UNKNOWN": + return MisbehaviorType.UNKNOWN; + case 1: + case "DUPLICATE_VOTE": + return MisbehaviorType.DUPLICATE_VOTE; + case 2: + case "LIGHT_CLIENT_ATTACK": + return MisbehaviorType.LIGHT_CLIENT_ATTACK; + case -1: + case "UNRECOGNIZED": + default: + return MisbehaviorType.UNRECOGNIZED; + } +} + +export function misbehaviorTypeToJSON(object: MisbehaviorType): string { + switch (object) { + case MisbehaviorType.UNKNOWN: + return "UNKNOWN"; + case MisbehaviorType.DUPLICATE_VOTE: + return "DUPLICATE_VOTE"; + case MisbehaviorType.LIGHT_CLIENT_ATTACK: + return "LIGHT_CLIENT_ATTACK"; + case MisbehaviorType.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +export function responseOfferSnapshotResultFromJSON(object: any): ResponseOfferSnapshotResult { + switch (object) { + case 0: + case "UNKNOWN": + return ResponseOfferSnapshotResult.UNKNOWN; + case 1: + case "ACCEPT": + return ResponseOfferSnapshotResult.ACCEPT; + case 2: + case "ABORT": + return ResponseOfferSnapshotResult.ABORT; + case 3: + case "REJECT": + return ResponseOfferSnapshotResult.REJECT; + case 4: + case "REJECT_FORMAT": + return ResponseOfferSnapshotResult.REJECT_FORMAT; + case 5: + case "REJECT_SENDER": + return ResponseOfferSnapshotResult.REJECT_SENDER; + case -1: + case "UNRECOGNIZED": + default: + return ResponseOfferSnapshotResult.UNRECOGNIZED; + } +} + +export function responseOfferSnapshotResultToJSON(object: ResponseOfferSnapshotResult): string { + switch (object) { + case ResponseOfferSnapshotResult.UNKNOWN: + return "UNKNOWN"; + case ResponseOfferSnapshotResult.ACCEPT: + return "ACCEPT"; + case ResponseOfferSnapshotResult.ABORT: + return "ABORT"; + case ResponseOfferSnapshotResult.REJECT: + return "REJECT"; + case ResponseOfferSnapshotResult.REJECT_FORMAT: + return "REJECT_FORMAT"; + case ResponseOfferSnapshotResult.REJECT_SENDER: + return "REJECT_SENDER"; + case ResponseOfferSnapshotResult.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +export function responseApplySnapshotChunkResultFromJSON(object: any): ResponseApplySnapshotChunkResult { + switch (object) { + case 0: + case "UNKNOWN": + return ResponseApplySnapshotChunkResult.UNKNOWN; + case 1: + case "ACCEPT": + return ResponseApplySnapshotChunkResult.ACCEPT; + case 2: + case "ABORT": + return ResponseApplySnapshotChunkResult.ABORT; + case 3: + case "RETRY": + return ResponseApplySnapshotChunkResult.RETRY; + case 4: + case "RETRY_SNAPSHOT": + return ResponseApplySnapshotChunkResult.RETRY_SNAPSHOT; + case 5: + case "REJECT_SNAPSHOT": + return ResponseApplySnapshotChunkResult.REJECT_SNAPSHOT; + case -1: + case "UNRECOGNIZED": + default: + return ResponseApplySnapshotChunkResult.UNRECOGNIZED; + } +} + +export function responseApplySnapshotChunkResultToJSON(object: ResponseApplySnapshotChunkResult): string { + switch (object) { + case ResponseApplySnapshotChunkResult.UNKNOWN: + return "UNKNOWN"; + case ResponseApplySnapshotChunkResult.ACCEPT: + return "ACCEPT"; + case ResponseApplySnapshotChunkResult.ABORT: + return "ABORT"; + case ResponseApplySnapshotChunkResult.RETRY: + return "RETRY"; + case ResponseApplySnapshotChunkResult.RETRY_SNAPSHOT: + return "RETRY_SNAPSHOT"; + case ResponseApplySnapshotChunkResult.REJECT_SNAPSHOT: + return "REJECT_SNAPSHOT"; + case ResponseApplySnapshotChunkResult.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +export function responseProcessProposalProposalStatusFromJSON(object: any): ResponseProcessProposalProposalStatus { + switch (object) { + case 0: + case "UNKNOWN": + return ResponseProcessProposalProposalStatus.UNKNOWN; + case 1: + case "ACCEPT": + return ResponseProcessProposalProposalStatus.ACCEPT; + case 2: + case "REJECT": + return ResponseProcessProposalProposalStatus.REJECT; + case -1: + case "UNRECOGNIZED": + default: + return ResponseProcessProposalProposalStatus.UNRECOGNIZED; + } +} + +export function responseProcessProposalProposalStatusToJSON(object: ResponseProcessProposalProposalStatus): string { + switch (object) { + case ResponseProcessProposalProposalStatus.UNKNOWN: + return "UNKNOWN"; + case ResponseProcessProposalProposalStatus.ACCEPT: + return "ACCEPT"; + case ResponseProcessProposalProposalStatus.REJECT: + return "REJECT"; + case ResponseProcessProposalProposalStatus.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +export function responseVerifyVoteExtensionVerifyStatusFromJSON(object: any): ResponseVerifyVoteExtensionVerifyStatus { + switch (object) { + case 0: + case "UNKNOWN": + return ResponseVerifyVoteExtensionVerifyStatus.UNKNOWN; + case 1: + case "ACCEPT": + return ResponseVerifyVoteExtensionVerifyStatus.ACCEPT; + case 2: + case "REJECT": + return ResponseVerifyVoteExtensionVerifyStatus.REJECT; + case -1: + case "UNRECOGNIZED": + default: + return ResponseVerifyVoteExtensionVerifyStatus.UNRECOGNIZED; + } +} + +export function responseVerifyVoteExtensionVerifyStatusToJSON(object: ResponseVerifyVoteExtensionVerifyStatus): string { + switch (object) { + case ResponseVerifyVoteExtensionVerifyStatus.UNKNOWN: + return "UNKNOWN"; + case ResponseVerifyVoteExtensionVerifyStatus.ACCEPT: + return "ACCEPT"; + case ResponseVerifyVoteExtensionVerifyStatus.REJECT: + return "REJECT"; + case ResponseVerifyVoteExtensionVerifyStatus.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +export function txRecordTxActionFromJSON(object: any): TxRecordTxAction { + switch (object) { + case 0: + case "UNKNOWN": + return TxRecordTxAction.UNKNOWN; + case 1: + case "UNMODIFIED": + return TxRecordTxAction.UNMODIFIED; + case 2: + case "ADDED": + return TxRecordTxAction.ADDED; + case 3: + case "REMOVED": + return TxRecordTxAction.REMOVED; + case -1: + case "UNRECOGNIZED": + default: + return TxRecordTxAction.UNRECOGNIZED; + } +} + +export function txRecordTxActionToJSON(object: TxRecordTxAction): string { + switch (object) { + case TxRecordTxAction.UNKNOWN: + return "UNKNOWN"; + case TxRecordTxAction.UNMODIFIED: + return "UNMODIFIED"; + case TxRecordTxAction.ADDED: + return "ADDED"; + case TxRecordTxAction.REMOVED: + return "REMOVED"; + case TxRecordTxAction.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +function createBaseRequest(): Request { + return { + echo: undefined, + flush: undefined, + info: undefined, + init_chain: undefined, + query: undefined, + check_tx: undefined, + commit: undefined, + list_snapshots: undefined, + offer_snapshot: undefined, + load_snapshot_chunk: undefined, + apply_snapshot_chunk: undefined, + prepare_proposal: undefined, + process_proposal: undefined, + extend_vote: undefined, + verify_vote_extension: undefined, + finalize_block: undefined, + }; +} + +function createBaseRequestEcho(): RequestEcho { + return { message: "" }; +} + +function createBaseRequestFlush(): RequestFlush { + return {}; +} + +function createBaseRequestInfo(): RequestInfo { + return { version: "", block_version: 0, p2p_version: 0, abci_version: "" }; +} + +function createBaseRequestInitChain(): RequestInitChain { + return { + time: undefined, + chain_id: "", + consensus_params: undefined, + validators: [], + app_state_bytes: new Uint8Array(0), + initial_height: 0, + }; +} + +function createBaseRequestQuery(): RequestQuery { + return { data: new Uint8Array(0), path: "", height: 0, prove: false }; +} + +function createBaseRequestCheckTx(): RequestCheckTx { + return { tx: new Uint8Array(0), type: 0 }; +} + +function createBaseRequestCommit(): RequestCommit { + return {}; +} + +function createBaseRequestListSnapshots(): RequestListSnapshots { + return {}; +} + +function createBaseRequestOfferSnapshot(): RequestOfferSnapshot { + return { snapshot: undefined, app_hash: new Uint8Array(0) }; +} + +function createBaseRequestLoadSnapshotChunk(): RequestLoadSnapshotChunk { + return { height: 0, format: 0, chunk: 0 }; +} + +function createBaseRequestApplySnapshotChunk(): RequestApplySnapshotChunk { + return { index: 0, chunk: new Uint8Array(0), sender: "" }; +} + +function createBaseRequestPrepareProposal(): RequestPrepareProposal { + return { + max_tx_bytes: 0, + txs: [], + local_last_commit: undefined, + byzantine_validators: [], + height: 0, + time: undefined, + next_validators_hash: new Uint8Array(0), + proposer_address: new Uint8Array(0), + }; +} + +function createBaseRequestProcessProposal(): RequestProcessProposal { + return { + txs: [], + proposed_last_commit: undefined, + byzantine_validators: [], + hash: new Uint8Array(0), + height: 0, + time: undefined, + next_validators_hash: new Uint8Array(0), + proposer_address: new Uint8Array(0), + }; +} + +function createBaseRequestExtendVote(): RequestExtendVote { + return { hash: new Uint8Array(0), height: 0 }; +} + +function createBaseRequestVerifyVoteExtension(): RequestVerifyVoteExtension { + return { + hash: new Uint8Array(0), + validator_address: new Uint8Array(0), + height: 0, + vote_extension: new Uint8Array(0), + }; +} + +function createBaseRequestFinalizeBlock(): RequestFinalizeBlock { + return { + txs: [], + decided_last_commit: undefined, + byzantine_validators: [], + hash: new Uint8Array(0), + height: 0, + time: undefined, + next_validators_hash: new Uint8Array(0), + proposer_address: new Uint8Array(0), + }; +} + +function createBaseResponse(): Response { + return { + exception: undefined, + echo: undefined, + flush: undefined, + info: undefined, + init_chain: undefined, + query: undefined, + check_tx: undefined, + commit: undefined, + list_snapshots: undefined, + offer_snapshot: undefined, + load_snapshot_chunk: undefined, + apply_snapshot_chunk: undefined, + prepare_proposal: undefined, + process_proposal: undefined, + extend_vote: undefined, + verify_vote_extension: undefined, + finalize_block: undefined, + }; +} + +function createBaseResponseException(): ResponseException { + return { error: "" }; +} + +function createBaseResponseEcho(): ResponseEcho { + return { message: "" }; +} + +function createBaseResponseFlush(): ResponseFlush { + return {}; +} + +function createBaseResponseInfo(): ResponseInfo { + return { data: "", version: "", app_version: 0, last_block_height: 0, last_block_app_hash: new Uint8Array(0) }; +} + +function createBaseResponseInitChain(): ResponseInitChain { + return { consensus_params: undefined, validators: [], app_hash: new Uint8Array(0) }; +} + +function createBaseResponseQuery(): ResponseQuery { + return { + code: 0, + log: "", + info: "", + index: 0, + key: new Uint8Array(0), + value: new Uint8Array(0), + proof_ops: undefined, + height: 0, + codespace: "", + }; +} + +function createBaseResponseCheckTx(): ResponseCheckTx { + return { code: 0, data: new Uint8Array(0), gas_wanted: 0, codespace: "", sender: "", priority: 0 }; +} + +function createBaseResponseDeliverTx(): ResponseDeliverTx { + return { code: 0, data: new Uint8Array(0), log: "", info: "", gas_wanted: 0, gas_used: 0, events: [], codespace: "" }; +} + +function createBaseResponseCommit(): ResponseCommit { + return { retain_height: 0 }; +} + +function createBaseResponseListSnapshots(): ResponseListSnapshots { + return { snapshots: [] }; +} + +function createBaseResponseOfferSnapshot(): ResponseOfferSnapshot { + return { result: 0 }; +} + +function createBaseResponseLoadSnapshotChunk(): ResponseLoadSnapshotChunk { + return { chunk: new Uint8Array(0) }; +} + +function createBaseResponseApplySnapshotChunk(): ResponseApplySnapshotChunk { + return { result: 0, refetch_chunks: [], reject_senders: [] }; +} + +function createBaseResponsePrepareProposal(): ResponsePrepareProposal { + return { + tx_records: [], + app_hash: new Uint8Array(0), + tx_results: [], + validator_updates: [], + consensus_param_updates: undefined, + }; +} + +function createBaseResponseProcessProposal(): ResponseProcessProposal { + return { + status: 0, + app_hash: new Uint8Array(0), + tx_results: [], + validator_updates: [], + consensus_param_updates: undefined, + }; +} + +function createBaseResponseExtendVote(): ResponseExtendVote { + return { vote_extension: new Uint8Array(0) }; +} + +function createBaseResponseVerifyVoteExtension(): ResponseVerifyVoteExtension { + return { status: 0 }; +} + +function createBaseResponseFinalizeBlock(): ResponseFinalizeBlock { + return { + events: [], + tx_results: [], + validator_updates: [], + consensus_param_updates: undefined, + app_hash: new Uint8Array(0), + }; +} + +function createBaseCommitInfo(): CommitInfo { + return { round: 0, votes: [] }; +} + +function createBaseExtendedCommitInfo(): ExtendedCommitInfo { + return { round: 0, votes: [] }; +} + +function createBaseEvent(): Event { + return { type: "", attributes: [] }; +} + +function createBaseEventAttribute(): EventAttribute { + return { key: "", value: "", index: false }; +} + +function createBaseExecTxResult(): ExecTxResult { + return { code: 0, data: new Uint8Array(0), log: "", info: "", gas_wanted: 0, gas_used: 0, events: [], codespace: "" }; +} + +function createBaseTxResult(): TxResult { + return { height: 0, index: 0, tx: new Uint8Array(0), result: undefined }; +} + +function createBaseTxRecord(): TxRecord { + return { action: 0, tx: new Uint8Array(0) }; +} + +function createBaseValidator(): Validator { + return { address: new Uint8Array(0), power: 0 }; +} + +function createBaseValidatorUpdate(): ValidatorUpdate { + return { pub_key: undefined, power: 0 }; +} + +function createBaseVoteInfo(): VoteInfo { + return { validator: undefined, signed_last_block: false }; +} + +function createBaseExtendedVoteInfo(): ExtendedVoteInfo { + return { validator: undefined, signed_last_block: false, vote_extension: new Uint8Array(0) }; +} + +function createBaseMisbehavior(): Misbehavior { + return { type: 0, validator: undefined, height: 0, time: undefined, total_voting_power: 0 }; +} + +function createBaseSnapshot(): Snapshot { + return { height: 0, format: 0, chunks: 0, hash: new Uint8Array(0), metadata: new Uint8Array(0) }; +} + +function bytesFromBase64(b64: string): Uint8Array { + if ((globalThis as any).Buffer) { + return Uint8Array.from(globalThis.Buffer.from(b64, "base64")); + } else { + const bin = globalThis.atob(b64); + const arr = new Uint8Array(bin.length); + for (let i = 0; i < bin.length; ++i) { + arr[i] = bin.charCodeAt(i); + } + return arr; + } +} + +function base64FromBytes(arr: Uint8Array): string { + if ((globalThis as any).Buffer) { + return globalThis.Buffer.from(arr).toString("base64"); + } else { + const bin: string[] = []; + arr.forEach((byte) => { + bin.push(globalThis.String.fromCharCode(byte)); + }); + return globalThis.btoa(bin.join("")); + } +} + +function toTimestamp(date: Date): Timestamp { + const seconds = Math.trunc(date.getTime() / 1_000); + const nanos = (date.getTime() % 1_000) * 1_000_000; + return { seconds, nanos }; +} + +function fromTimestamp(t: Timestamp): Date { + let millis = (t.seconds || 0) * 1_000; + millis += (t.nanos || 0) / 1_000_000; + return new globalThis.Date(millis); +} + +function fromJsonTimestamp(o: any): Date { + if (o instanceof globalThis.Date) { + return o; + } else if (typeof o === "string") { + return new globalThis.Date(o); + } else { + return fromTimestamp(Timestamp.fromJSON(o)); + } +} + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} +export const registry: Array<[string, GeneratedType]> = [ + ["/tendermint.abci.Request", Request as never], + ["/tendermint.abci.RequestEcho", RequestEcho as never], + ["/tendermint.abci.RequestFlush", RequestFlush as never], + ["/tendermint.abci.RequestInfo", RequestInfo as never], + ["/tendermint.abci.RequestInitChain", RequestInitChain as never], + ["/tendermint.abci.RequestQuery", RequestQuery as never], + ["/tendermint.abci.RequestCheckTx", RequestCheckTx as never], + ["/tendermint.abci.RequestCommit", RequestCommit as never], + ["/tendermint.abci.RequestListSnapshots", RequestListSnapshots as never], + ["/tendermint.abci.RequestOfferSnapshot", RequestOfferSnapshot as never], + ["/tendermint.abci.RequestPrepareProposal", RequestPrepareProposal as never], + ["/tendermint.abci.RequestProcessProposal", RequestProcessProposal as never], + ["/tendermint.abci.RequestExtendVote", RequestExtendVote as never], + ["/tendermint.abci.RequestFinalizeBlock", RequestFinalizeBlock as never], + ["/tendermint.abci.Response", Response as never], + ["/tendermint.abci.ResponseException", ResponseException as never], + ["/tendermint.abci.ResponseEcho", ResponseEcho as never], + ["/tendermint.abci.ResponseFlush", ResponseFlush as never], + ["/tendermint.abci.ResponseInfo", ResponseInfo as never], + ["/tendermint.abci.ResponseInitChain", ResponseInitChain as never], + ["/tendermint.abci.ResponseQuery", ResponseQuery as never], + ["/tendermint.abci.ResponseCheckTx", ResponseCheckTx as never], + ["/tendermint.abci.ResponseDeliverTx", ResponseDeliverTx as never], + ["/tendermint.abci.ResponseCommit", ResponseCommit as never], + ["/tendermint.abci.ResponseListSnapshots", ResponseListSnapshots as never], + ["/tendermint.abci.ResponseOfferSnapshot", ResponseOfferSnapshot as never], + ["/tendermint.abci.ResponsePrepareProposal", ResponsePrepareProposal as never], + ["/tendermint.abci.ResponseProcessProposal", ResponseProcessProposal as never], + ["/tendermint.abci.ResponseExtendVote", ResponseExtendVote as never], + ["/tendermint.abci.ResponseFinalizeBlock", ResponseFinalizeBlock as never], + ["/tendermint.abci.CommitInfo", CommitInfo as never], + ["/tendermint.abci.ExtendedCommitInfo", ExtendedCommitInfo as never], + ["/tendermint.abci.Event", Event as never], + ["/tendermint.abci.EventAttribute", EventAttribute as never], + ["/tendermint.abci.ExecTxResult", ExecTxResult as never], + ["/tendermint.abci.TxResult", TxResult as never], + ["/tendermint.abci.TxRecord", TxRecord as never], + ["/tendermint.abci.Validator", Validator as never], + ["/tendermint.abci.ValidatorUpdate", ValidatorUpdate as never], + ["/tendermint.abci.VoteInfo", VoteInfo as never], + ["/tendermint.abci.ExtendedVoteInfo", ExtendedVoteInfo as never], + ["/tendermint.abci.Misbehavior", Misbehavior as never], + ["/tendermint.abci.Snapshot", Snapshot as never], +]; +export const aminoConverters = { + "/tendermint.abci.Request": { + aminoType: "tendermint.abci.Request", + toAmino: (message: Request) => ({ ...message }), + fromAmino: (object: Request) => ({ ...object }), + }, + + "/tendermint.abci.RequestEcho": { + aminoType: "tendermint.abci.RequestEcho", + toAmino: (message: RequestEcho) => ({ ...message }), + fromAmino: (object: RequestEcho) => ({ ...object }), + }, + + "/tendermint.abci.RequestFlush": { + aminoType: "tendermint.abci.RequestFlush", + toAmino: (message: RequestFlush) => ({ ...message }), + fromAmino: (object: RequestFlush) => ({ ...object }), + }, + + "/tendermint.abci.RequestInfo": { + aminoType: "tendermint.abci.RequestInfo", + toAmino: (message: RequestInfo) => ({ ...message }), + fromAmino: (object: RequestInfo) => ({ ...object }), + }, + + "/tendermint.abci.RequestInitChain": { + aminoType: "tendermint.abci.RequestInitChain", + toAmino: (message: RequestInitChain) => ({ ...message }), + fromAmino: (object: RequestInitChain) => ({ ...object }), + }, + + "/tendermint.abci.RequestQuery": { + aminoType: "tendermint.abci.RequestQuery", + toAmino: (message: RequestQuery) => ({ ...message }), + fromAmino: (object: RequestQuery) => ({ ...object }), + }, + + "/tendermint.abci.RequestCheckTx": { + aminoType: "tendermint.abci.RequestCheckTx", + toAmino: (message: RequestCheckTx) => ({ ...message }), + fromAmino: (object: RequestCheckTx) => ({ ...object }), + }, + + "/tendermint.abci.RequestCommit": { + aminoType: "tendermint.abci.RequestCommit", + toAmino: (message: RequestCommit) => ({ ...message }), + fromAmino: (object: RequestCommit) => ({ ...object }), + }, + + "/tendermint.abci.RequestListSnapshots": { + aminoType: "tendermint.abci.RequestListSnapshots", + toAmino: (message: RequestListSnapshots) => ({ ...message }), + fromAmino: (object: RequestListSnapshots) => ({ ...object }), + }, + + "/tendermint.abci.RequestOfferSnapshot": { + aminoType: "tendermint.abci.RequestOfferSnapshot", + toAmino: (message: RequestOfferSnapshot) => ({ ...message }), + fromAmino: (object: RequestOfferSnapshot) => ({ ...object }), + }, + + "/tendermint.abci.RequestPrepareProposal": { + aminoType: "tendermint.abci.RequestPrepareProposal", + toAmino: (message: RequestPrepareProposal) => ({ ...message }), + fromAmino: (object: RequestPrepareProposal) => ({ ...object }), + }, + + "/tendermint.abci.RequestProcessProposal": { + aminoType: "tendermint.abci.RequestProcessProposal", + toAmino: (message: RequestProcessProposal) => ({ ...message }), + fromAmino: (object: RequestProcessProposal) => ({ ...object }), + }, + + "/tendermint.abci.RequestExtendVote": { + aminoType: "tendermint.abci.RequestExtendVote", + toAmino: (message: RequestExtendVote) => ({ ...message }), + fromAmino: (object: RequestExtendVote) => ({ ...object }), + }, + + "/tendermint.abci.RequestFinalizeBlock": { + aminoType: "tendermint.abci.RequestFinalizeBlock", + toAmino: (message: RequestFinalizeBlock) => ({ ...message }), + fromAmino: (object: RequestFinalizeBlock) => ({ ...object }), + }, + + "/tendermint.abci.Response": { + aminoType: "tendermint.abci.Response", + toAmino: (message: Response) => ({ ...message }), + fromAmino: (object: Response) => ({ ...object }), + }, + + "/tendermint.abci.ResponseException": { + aminoType: "tendermint.abci.ResponseException", + toAmino: (message: ResponseException) => ({ ...message }), + fromAmino: (object: ResponseException) => ({ ...object }), + }, + + "/tendermint.abci.ResponseEcho": { + aminoType: "tendermint.abci.ResponseEcho", + toAmino: (message: ResponseEcho) => ({ ...message }), + fromAmino: (object: ResponseEcho) => ({ ...object }), + }, + + "/tendermint.abci.ResponseFlush": { + aminoType: "tendermint.abci.ResponseFlush", + toAmino: (message: ResponseFlush) => ({ ...message }), + fromAmino: (object: ResponseFlush) => ({ ...object }), + }, + + "/tendermint.abci.ResponseInfo": { + aminoType: "tendermint.abci.ResponseInfo", + toAmino: (message: ResponseInfo) => ({ ...message }), + fromAmino: (object: ResponseInfo) => ({ ...object }), + }, + + "/tendermint.abci.ResponseInitChain": { + aminoType: "tendermint.abci.ResponseInitChain", + toAmino: (message: ResponseInitChain) => ({ ...message }), + fromAmino: (object: ResponseInitChain) => ({ ...object }), + }, + + "/tendermint.abci.ResponseQuery": { + aminoType: "tendermint.abci.ResponseQuery", + toAmino: (message: ResponseQuery) => ({ ...message }), + fromAmino: (object: ResponseQuery) => ({ ...object }), + }, + + "/tendermint.abci.ResponseCheckTx": { + aminoType: "tendermint.abci.ResponseCheckTx", + toAmino: (message: ResponseCheckTx) => ({ ...message }), + fromAmino: (object: ResponseCheckTx) => ({ ...object }), + }, + + "/tendermint.abci.ResponseDeliverTx": { + aminoType: "tendermint.abci.ResponseDeliverTx", + toAmino: (message: ResponseDeliverTx) => ({ ...message }), + fromAmino: (object: ResponseDeliverTx) => ({ ...object }), + }, + + "/tendermint.abci.ResponseCommit": { + aminoType: "tendermint.abci.ResponseCommit", + toAmino: (message: ResponseCommit) => ({ ...message }), + fromAmino: (object: ResponseCommit) => ({ ...object }), + }, + + "/tendermint.abci.ResponseListSnapshots": { + aminoType: "tendermint.abci.ResponseListSnapshots", + toAmino: (message: ResponseListSnapshots) => ({ ...message }), + fromAmino: (object: ResponseListSnapshots) => ({ ...object }), + }, + + "/tendermint.abci.ResponseOfferSnapshot": { + aminoType: "tendermint.abci.ResponseOfferSnapshot", + toAmino: (message: ResponseOfferSnapshot) => ({ ...message }), + fromAmino: (object: ResponseOfferSnapshot) => ({ ...object }), + }, + + "/tendermint.abci.ResponsePrepareProposal": { + aminoType: "tendermint.abci.ResponsePrepareProposal", + toAmino: (message: ResponsePrepareProposal) => ({ ...message }), + fromAmino: (object: ResponsePrepareProposal) => ({ ...object }), + }, + + "/tendermint.abci.ResponseProcessProposal": { + aminoType: "tendermint.abci.ResponseProcessProposal", + toAmino: (message: ResponseProcessProposal) => ({ ...message }), + fromAmino: (object: ResponseProcessProposal) => ({ ...object }), + }, + + "/tendermint.abci.ResponseExtendVote": { + aminoType: "tendermint.abci.ResponseExtendVote", + toAmino: (message: ResponseExtendVote) => ({ ...message }), + fromAmino: (object: ResponseExtendVote) => ({ ...object }), + }, + + "/tendermint.abci.ResponseFinalizeBlock": { + aminoType: "tendermint.abci.ResponseFinalizeBlock", + toAmino: (message: ResponseFinalizeBlock) => ({ ...message }), + fromAmino: (object: ResponseFinalizeBlock) => ({ ...object }), + }, + + "/tendermint.abci.CommitInfo": { + aminoType: "tendermint.abci.CommitInfo", + toAmino: (message: CommitInfo) => ({ ...message }), + fromAmino: (object: CommitInfo) => ({ ...object }), + }, + + "/tendermint.abci.ExtendedCommitInfo": { + aminoType: "tendermint.abci.ExtendedCommitInfo", + toAmino: (message: ExtendedCommitInfo) => ({ ...message }), + fromAmino: (object: ExtendedCommitInfo) => ({ ...object }), + }, + + "/tendermint.abci.Event": { + aminoType: "tendermint.abci.Event", + toAmino: (message: Event) => ({ ...message }), + fromAmino: (object: Event) => ({ ...object }), + }, + + "/tendermint.abci.EventAttribute": { + aminoType: "tendermint.abci.EventAttribute", + toAmino: (message: EventAttribute) => ({ ...message }), + fromAmino: (object: EventAttribute) => ({ ...object }), + }, + + "/tendermint.abci.ExecTxResult": { + aminoType: "tendermint.abci.ExecTxResult", + toAmino: (message: ExecTxResult) => ({ ...message }), + fromAmino: (object: ExecTxResult) => ({ ...object }), + }, + + "/tendermint.abci.TxResult": { + aminoType: "tendermint.abci.TxResult", + toAmino: (message: TxResult) => ({ ...message }), + fromAmino: (object: TxResult) => ({ ...object }), + }, + + "/tendermint.abci.TxRecord": { + aminoType: "tendermint.abci.TxRecord", + toAmino: (message: TxRecord) => ({ ...message }), + fromAmino: (object: TxRecord) => ({ ...object }), + }, + + "/tendermint.abci.Validator": { + aminoType: "tendermint.abci.Validator", + toAmino: (message: Validator) => ({ ...message }), + fromAmino: (object: Validator) => ({ ...object }), + }, + + "/tendermint.abci.ValidatorUpdate": { + aminoType: "tendermint.abci.ValidatorUpdate", + toAmino: (message: ValidatorUpdate) => ({ ...message }), + fromAmino: (object: ValidatorUpdate) => ({ ...object }), + }, + + "/tendermint.abci.VoteInfo": { + aminoType: "tendermint.abci.VoteInfo", + toAmino: (message: VoteInfo) => ({ ...message }), + fromAmino: (object: VoteInfo) => ({ ...object }), + }, + + "/tendermint.abci.ExtendedVoteInfo": { + aminoType: "tendermint.abci.ExtendedVoteInfo", + toAmino: (message: ExtendedVoteInfo) => ({ ...message }), + fromAmino: (object: ExtendedVoteInfo) => ({ ...object }), + }, + + "/tendermint.abci.Misbehavior": { + aminoType: "tendermint.abci.Misbehavior", + toAmino: (message: Misbehavior) => ({ ...message }), + fromAmino: (object: Misbehavior) => ({ ...object }), + }, + + "/tendermint.abci.Snapshot": { + aminoType: "tendermint.abci.Snapshot", + toAmino: (message: Snapshot) => ({ ...message }), + fromAmino: (object: Snapshot) => ({ ...object }), + }, +}; diff --git a/packages/cosmos/generated/encoding/tendermint/crypto/index.ts b/packages/cosmos/generated/encoding/tendermint/crypto/index.ts new file mode 100644 index 000000000..8a292eb60 --- /dev/null +++ b/packages/cosmos/generated/encoding/tendermint/crypto/index.ts @@ -0,0 +1,4 @@ +// @ts-nocheck + +export * from './keys'; +export * from './proof'; \ No newline at end of file diff --git a/packages/cosmos/generated/encoding/tendermint/crypto/keys.ts b/packages/cosmos/generated/encoding/tendermint/crypto/keys.ts new file mode 100644 index 000000000..bb80d376d --- /dev/null +++ b/packages/cosmos/generated/encoding/tendermint/crypto/keys.ts @@ -0,0 +1,137 @@ +import type { GeneratedType } from "@cosmjs/proto-signing"; + +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +import type { PublicKey as PublicKey_type } from "../../../types/tendermint/crypto"; + +import type { DeepPartial, Exact, MessageFns } from "../../common"; + +export interface PublicKey extends PublicKey_type {} + +export const PublicKey: MessageFns = { + $type: "tendermint.crypto.PublicKey" as const, + + encode(message: PublicKey, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.ed25519 !== undefined) { + writer.uint32(10).bytes(message.ed25519); + } + if (message.secp256k1 !== undefined) { + writer.uint32(18).bytes(message.secp256k1); + } + if (message.sr25519 !== undefined) { + writer.uint32(26).bytes(message.sr25519); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): PublicKey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePublicKey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.ed25519 = reader.bytes(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.secp256k1 = reader.bytes(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.sr25519 = reader.bytes(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): PublicKey { + return { + ed25519: isSet(object.ed25519) ? bytesFromBase64(object.ed25519) : undefined, + secp256k1: isSet(object.secp256k1) ? bytesFromBase64(object.secp256k1) : undefined, + sr25519: isSet(object.sr25519) ? bytesFromBase64(object.sr25519) : undefined, + }; + }, + + toJSON(message: PublicKey): unknown { + const obj: any = {}; + if (message.ed25519 !== undefined) { + obj.ed25519 = base64FromBytes(message.ed25519); + } + if (message.secp256k1 !== undefined) { + obj.secp256k1 = base64FromBytes(message.secp256k1); + } + if (message.sr25519 !== undefined) { + obj.sr25519 = base64FromBytes(message.sr25519); + } + return obj; + }, + + create, I>>(base?: I): PublicKey { + return PublicKey.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): PublicKey { + const message = createBasePublicKey(); + message.ed25519 = object.ed25519 ?? undefined; + message.secp256k1 = object.secp256k1 ?? undefined; + message.sr25519 = object.sr25519 ?? undefined; + return message; + }, +}; + +function createBasePublicKey(): PublicKey { + return { ed25519: undefined, secp256k1: undefined, sr25519: undefined }; +} + +function bytesFromBase64(b64: string): Uint8Array { + if ((globalThis as any).Buffer) { + return Uint8Array.from(globalThis.Buffer.from(b64, "base64")); + } else { + const bin = globalThis.atob(b64); + const arr = new Uint8Array(bin.length); + for (let i = 0; i < bin.length; ++i) { + arr[i] = bin.charCodeAt(i); + } + return arr; + } +} + +function base64FromBytes(arr: Uint8Array): string { + if ((globalThis as any).Buffer) { + return globalThis.Buffer.from(arr).toString("base64"); + } else { + const bin: string[] = []; + arr.forEach((byte) => { + bin.push(globalThis.String.fromCharCode(byte)); + }); + return globalThis.btoa(bin.join("")); + } +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} +export const registry: Array<[string, GeneratedType]> = [["/tendermint.crypto.PublicKey", PublicKey as never]]; +export const aminoConverters = { + "/tendermint.crypto.PublicKey": { + aminoType: "tendermint.crypto.PublicKey", + toAmino: (message: PublicKey) => ({ ...message }), + fromAmino: (object: PublicKey) => ({ ...object }), + }, +}; diff --git a/packages/cosmos/generated/encoding/tendermint/crypto/proof.ts b/packages/cosmos/generated/encoding/tendermint/crypto/proof.ts new file mode 100644 index 000000000..c5de29dc6 --- /dev/null +++ b/packages/cosmos/generated/encoding/tendermint/crypto/proof.ts @@ -0,0 +1,520 @@ +import type { GeneratedType } from "@cosmjs/proto-signing"; + +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +import type { + DominoOp as DominoOp_type, + ProofOp as ProofOp_type, + ProofOps as ProofOps_type, + Proof as Proof_type, + ValueOp as ValueOp_type, +} from "../../../types/tendermint/crypto"; + +import type { DeepPartial, Exact, MessageFns } from "../../common"; + +export interface Proof extends Proof_type {} +export interface ValueOp extends ValueOp_type {} +export interface DominoOp extends DominoOp_type {} +export interface ProofOp extends ProofOp_type {} +export interface ProofOps extends ProofOps_type {} + +export const Proof: MessageFns = { + $type: "tendermint.crypto.Proof" as const, + + encode(message: Proof, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.total !== 0) { + writer.uint32(8).int64(message.total); + } + if (message.index !== 0) { + writer.uint32(16).int64(message.index); + } + if (message.leaf_hash.length !== 0) { + writer.uint32(26).bytes(message.leaf_hash); + } + for (const v of message.aunts) { + writer.uint32(34).bytes(v!); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Proof { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseProof(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.total = longToNumber(reader.int64()); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.index = longToNumber(reader.int64()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.leaf_hash = reader.bytes(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.aunts.push(reader.bytes()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Proof { + return { + total: isSet(object.total) ? globalThis.Number(object.total) : 0, + index: isSet(object.index) ? globalThis.Number(object.index) : 0, + leaf_hash: isSet(object.leaf_hash) ? bytesFromBase64(object.leaf_hash) : new Uint8Array(0), + aunts: globalThis.Array.isArray(object?.aunts) ? object.aunts.map((e: any) => bytesFromBase64(e)) : [], + }; + }, + + toJSON(message: Proof): unknown { + const obj: any = {}; + if (message.total !== 0) { + obj.total = Math.round(message.total); + } + if (message.index !== 0) { + obj.index = Math.round(message.index); + } + if (message.leaf_hash.length !== 0) { + obj.leaf_hash = base64FromBytes(message.leaf_hash); + } + if (message.aunts?.length) { + obj.aunts = message.aunts.map((e) => base64FromBytes(e)); + } + return obj; + }, + + create, I>>(base?: I): Proof { + return Proof.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Proof { + const message = createBaseProof(); + message.total = object.total ?? 0; + message.index = object.index ?? 0; + message.leaf_hash = object.leaf_hash ?? new Uint8Array(0); + message.aunts = object.aunts?.map((e) => e) || []; + return message; + }, +}; + +export const ValueOp: MessageFns = { + $type: "tendermint.crypto.ValueOp" as const, + + encode(message: ValueOp, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.key.length !== 0) { + writer.uint32(10).bytes(message.key); + } + if (message.proof !== undefined) { + Proof.encode(message.proof, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ValueOp { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseValueOp(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.key = reader.bytes(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.proof = Proof.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ValueOp { + return { + key: isSet(object.key) ? bytesFromBase64(object.key) : new Uint8Array(0), + proof: isSet(object.proof) ? Proof.fromJSON(object.proof) : undefined, + }; + }, + + toJSON(message: ValueOp): unknown { + const obj: any = {}; + if (message.key.length !== 0) { + obj.key = base64FromBytes(message.key); + } + if (message.proof !== undefined) { + obj.proof = Proof.toJSON(message.proof); + } + return obj; + }, + + create, I>>(base?: I): ValueOp { + return ValueOp.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ValueOp { + const message = createBaseValueOp(); + message.key = object.key ?? new Uint8Array(0); + message.proof = object.proof !== undefined && object.proof !== null ? Proof.fromPartial(object.proof) : undefined; + return message; + }, +}; + +export const DominoOp: MessageFns = { + $type: "tendermint.crypto.DominoOp" as const, + + encode(message: DominoOp, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.key !== "") { + writer.uint32(10).string(message.key); + } + if (message.input !== "") { + writer.uint32(18).string(message.input); + } + if (message.output !== "") { + writer.uint32(26).string(message.output); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): DominoOp { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDominoOp(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.key = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.input = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.output = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): DominoOp { + return { + key: isSet(object.key) ? globalThis.String(object.key) : "", + input: isSet(object.input) ? globalThis.String(object.input) : "", + output: isSet(object.output) ? globalThis.String(object.output) : "", + }; + }, + + toJSON(message: DominoOp): unknown { + const obj: any = {}; + if (message.key !== "") { + obj.key = message.key; + } + if (message.input !== "") { + obj.input = message.input; + } + if (message.output !== "") { + obj.output = message.output; + } + return obj; + }, + + create, I>>(base?: I): DominoOp { + return DominoOp.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): DominoOp { + const message = createBaseDominoOp(); + message.key = object.key ?? ""; + message.input = object.input ?? ""; + message.output = object.output ?? ""; + return message; + }, +}; + +export const ProofOp: MessageFns = { + $type: "tendermint.crypto.ProofOp" as const, + + encode(message: ProofOp, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.type !== "") { + writer.uint32(10).string(message.type); + } + if (message.key.length !== 0) { + writer.uint32(18).bytes(message.key); + } + if (message.data.length !== 0) { + writer.uint32(26).bytes(message.data); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ProofOp { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseProofOp(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.type = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.key = reader.bytes(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.data = reader.bytes(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ProofOp { + return { + type: isSet(object.type) ? globalThis.String(object.type) : "", + key: isSet(object.key) ? bytesFromBase64(object.key) : new Uint8Array(0), + data: isSet(object.data) ? bytesFromBase64(object.data) : new Uint8Array(0), + }; + }, + + toJSON(message: ProofOp): unknown { + const obj: any = {}; + if (message.type !== "") { + obj.type = message.type; + } + if (message.key.length !== 0) { + obj.key = base64FromBytes(message.key); + } + if (message.data.length !== 0) { + obj.data = base64FromBytes(message.data); + } + return obj; + }, + + create, I>>(base?: I): ProofOp { + return ProofOp.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ProofOp { + const message = createBaseProofOp(); + message.type = object.type ?? ""; + message.key = object.key ?? new Uint8Array(0); + message.data = object.data ?? new Uint8Array(0); + return message; + }, +}; + +export const ProofOps: MessageFns = { + $type: "tendermint.crypto.ProofOps" as const, + + encode(message: ProofOps, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.ops) { + ProofOp.encode(v!, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ProofOps { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseProofOps(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.ops.push(ProofOp.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ProofOps { + return { ops: globalThis.Array.isArray(object?.ops) ? object.ops.map((e: any) => ProofOp.fromJSON(e)) : [] }; + }, + + toJSON(message: ProofOps): unknown { + const obj: any = {}; + if (message.ops?.length) { + obj.ops = message.ops.map((e) => ProofOp.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): ProofOps { + return ProofOps.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ProofOps { + const message = createBaseProofOps(); + message.ops = object.ops?.map((e) => ProofOp.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseProof(): Proof { + return { total: 0, index: 0, leaf_hash: new Uint8Array(0), aunts: [] }; +} + +function createBaseValueOp(): ValueOp { + return { key: new Uint8Array(0), proof: undefined }; +} + +function createBaseDominoOp(): DominoOp { + return { key: "", input: "", output: "" }; +} + +function createBaseProofOp(): ProofOp { + return { type: "", key: new Uint8Array(0), data: new Uint8Array(0) }; +} + +function createBaseProofOps(): ProofOps { + return { ops: [] }; +} + +function bytesFromBase64(b64: string): Uint8Array { + if ((globalThis as any).Buffer) { + return Uint8Array.from(globalThis.Buffer.from(b64, "base64")); + } else { + const bin = globalThis.atob(b64); + const arr = new Uint8Array(bin.length); + for (let i = 0; i < bin.length; ++i) { + arr[i] = bin.charCodeAt(i); + } + return arr; + } +} + +function base64FromBytes(arr: Uint8Array): string { + if ((globalThis as any).Buffer) { + return globalThis.Buffer.from(arr).toString("base64"); + } else { + const bin: string[] = []; + arr.forEach((byte) => { + bin.push(globalThis.String.fromCharCode(byte)); + }); + return globalThis.btoa(bin.join("")); + } +} + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} +export const registry: Array<[string, GeneratedType]> = [ + ["/tendermint.crypto.Proof", Proof as never], + ["/tendermint.crypto.ValueOp", ValueOp as never], + ["/tendermint.crypto.DominoOp", DominoOp as never], + ["/tendermint.crypto.ProofOp", ProofOp as never], + ["/tendermint.crypto.ProofOps", ProofOps as never], +]; +export const aminoConverters = { + "/tendermint.crypto.Proof": { + aminoType: "tendermint.crypto.Proof", + toAmino: (message: Proof) => ({ ...message }), + fromAmino: (object: Proof) => ({ ...object }), + }, + + "/tendermint.crypto.ValueOp": { + aminoType: "tendermint.crypto.ValueOp", + toAmino: (message: ValueOp) => ({ ...message }), + fromAmino: (object: ValueOp) => ({ ...object }), + }, + + "/tendermint.crypto.DominoOp": { + aminoType: "tendermint.crypto.DominoOp", + toAmino: (message: DominoOp) => ({ ...message }), + fromAmino: (object: DominoOp) => ({ ...object }), + }, + + "/tendermint.crypto.ProofOp": { + aminoType: "tendermint.crypto.ProofOp", + toAmino: (message: ProofOp) => ({ ...message }), + fromAmino: (object: ProofOp) => ({ ...object }), + }, + + "/tendermint.crypto.ProofOps": { + aminoType: "tendermint.crypto.ProofOps", + toAmino: (message: ProofOps) => ({ ...message }), + fromAmino: (object: ProofOps) => ({ ...object }), + }, +}; diff --git a/packages/cosmos/generated/encoding/tendermint/libs/bits/index.ts b/packages/cosmos/generated/encoding/tendermint/libs/bits/index.ts new file mode 100644 index 000000000..316cec4f0 --- /dev/null +++ b/packages/cosmos/generated/encoding/tendermint/libs/bits/index.ts @@ -0,0 +1,3 @@ +// @ts-nocheck + +export * from './types'; \ No newline at end of file diff --git a/packages/cosmos/generated/encoding/tendermint/libs/bits/types.ts b/packages/cosmos/generated/encoding/tendermint/libs/bits/types.ts new file mode 100644 index 000000000..b1f325a07 --- /dev/null +++ b/packages/cosmos/generated/encoding/tendermint/libs/bits/types.ts @@ -0,0 +1,120 @@ +import type { GeneratedType } from "@cosmjs/proto-signing"; + +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +import type { BitArray as BitArray_type } from "../../../../types/tendermint/libs/bits"; + +import type { DeepPartial, Exact, MessageFns } from "../../../common"; + +export interface BitArray extends BitArray_type {} + +export const BitArray: MessageFns = { + $type: "tendermint.libs.bits.BitArray" as const, + + encode(message: BitArray, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.bits !== 0) { + writer.uint32(8).int64(message.bits); + } + writer.uint32(18).fork(); + for (const v of message.elems) { + writer.uint64(v); + } + writer.join(); + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): BitArray { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseBitArray(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.bits = longToNumber(reader.int64()); + continue; + case 2: + if (tag === 16) { + message.elems.push(longToNumber(reader.uint64())); + + continue; + } + + if (tag === 18) { + const end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) { + message.elems.push(longToNumber(reader.uint64())); + } + + continue; + } + + break; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): BitArray { + return { + bits: isSet(object.bits) ? globalThis.Number(object.bits) : 0, + elems: globalThis.Array.isArray(object?.elems) ? object.elems.map((e: any) => globalThis.Number(e)) : [], + }; + }, + + toJSON(message: BitArray): unknown { + const obj: any = {}; + if (message.bits !== 0) { + obj.bits = Math.round(message.bits); + } + if (message.elems?.length) { + obj.elems = message.elems.map((e) => Math.round(e)); + } + return obj; + }, + + create, I>>(base?: I): BitArray { + return BitArray.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): BitArray { + const message = createBaseBitArray(); + message.bits = object.bits ?? 0; + message.elems = object.elems?.map((e) => e) || []; + return message; + }, +}; + +function createBaseBitArray(): BitArray { + return { bits: 0, elems: [] }; +} + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} +export const registry: Array<[string, GeneratedType]> = [["/tendermint.libs.bits.BitArray", BitArray as never]]; +export const aminoConverters = { + "/tendermint.libs.bits.BitArray": { + aminoType: "tendermint.libs.bits.BitArray", + toAmino: (message: BitArray) => ({ ...message }), + fromAmino: (object: BitArray) => ({ ...object }), + }, +}; diff --git a/packages/cosmos/generated/encoding/tendermint/p2p/index.ts b/packages/cosmos/generated/encoding/tendermint/p2p/index.ts new file mode 100644 index 000000000..316cec4f0 --- /dev/null +++ b/packages/cosmos/generated/encoding/tendermint/p2p/index.ts @@ -0,0 +1,3 @@ +// @ts-nocheck + +export * from './types'; \ No newline at end of file diff --git a/packages/cosmos/generated/encoding/tendermint/p2p/types.ts b/packages/cosmos/generated/encoding/tendermint/p2p/types.ts new file mode 100644 index 000000000..5ccd19983 --- /dev/null +++ b/packages/cosmos/generated/encoding/tendermint/p2p/types.ts @@ -0,0 +1,661 @@ +import type { GeneratedType } from "@cosmjs/proto-signing"; + +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +import { Timestamp } from "../../google/protobuf/timestamp"; + +import type { + NodeInfoOther as NodeInfoOther_type, + NodeInfo as NodeInfo_type, + PeerAddressInfo as PeerAddressInfo_type, + PeerInfo as PeerInfo_type, + ProtocolVersion as ProtocolVersion_type, +} from "../../../types/tendermint/p2p"; + +import type { DeepPartial, Exact, MessageFns } from "../../common"; + +export interface ProtocolVersion extends ProtocolVersion_type {} +export interface NodeInfo extends NodeInfo_type {} +export interface NodeInfoOther extends NodeInfoOther_type {} +export interface PeerInfo extends PeerInfo_type {} +export interface PeerAddressInfo extends PeerAddressInfo_type {} + +export const ProtocolVersion: MessageFns = { + $type: "tendermint.p2p.ProtocolVersion" as const, + + encode(message: ProtocolVersion, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.p2p !== 0) { + writer.uint32(8).uint64(message.p2p); + } + if (message.block !== 0) { + writer.uint32(16).uint64(message.block); + } + if (message.app !== 0) { + writer.uint32(24).uint64(message.app); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ProtocolVersion { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseProtocolVersion(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.p2p = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.block = longToNumber(reader.uint64()); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.app = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ProtocolVersion { + return { + p2p: isSet(object.p2p) ? globalThis.Number(object.p2p) : 0, + block: isSet(object.block) ? globalThis.Number(object.block) : 0, + app: isSet(object.app) ? globalThis.Number(object.app) : 0, + }; + }, + + toJSON(message: ProtocolVersion): unknown { + const obj: any = {}; + if (message.p2p !== 0) { + obj.p2p = Math.round(message.p2p); + } + if (message.block !== 0) { + obj.block = Math.round(message.block); + } + if (message.app !== 0) { + obj.app = Math.round(message.app); + } + return obj; + }, + + create, I>>(base?: I): ProtocolVersion { + return ProtocolVersion.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ProtocolVersion { + const message = createBaseProtocolVersion(); + message.p2p = object.p2p ?? 0; + message.block = object.block ?? 0; + message.app = object.app ?? 0; + return message; + }, +}; + +export const NodeInfo: MessageFns = { + $type: "tendermint.p2p.NodeInfo" as const, + + encode(message: NodeInfo, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.protocol_version !== undefined) { + ProtocolVersion.encode(message.protocol_version, writer.uint32(10).fork()).join(); + } + if (message.node_id !== "") { + writer.uint32(18).string(message.node_id); + } + if (message.listen_addr !== "") { + writer.uint32(26).string(message.listen_addr); + } + if (message.network !== "") { + writer.uint32(34).string(message.network); + } + if (message.version !== "") { + writer.uint32(42).string(message.version); + } + if (message.channels.length !== 0) { + writer.uint32(50).bytes(message.channels); + } + if (message.moniker !== "") { + writer.uint32(58).string(message.moniker); + } + if (message.other !== undefined) { + NodeInfoOther.encode(message.other, writer.uint32(66).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): NodeInfo { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseNodeInfo(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.protocol_version = ProtocolVersion.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.node_id = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.listen_addr = reader.string(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.network = reader.string(); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.version = reader.string(); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.channels = reader.bytes(); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.moniker = reader.string(); + continue; + case 8: + if (tag !== 66) { + break; + } + + message.other = NodeInfoOther.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): NodeInfo { + return { + protocol_version: isSet(object.protocol_version) ? ProtocolVersion.fromJSON(object.protocol_version) : undefined, + node_id: isSet(object.node_id) ? globalThis.String(object.node_id) : "", + listen_addr: isSet(object.listen_addr) ? globalThis.String(object.listen_addr) : "", + network: isSet(object.network) ? globalThis.String(object.network) : "", + version: isSet(object.version) ? globalThis.String(object.version) : "", + channels: isSet(object.channels) ? bytesFromBase64(object.channels) : new Uint8Array(0), + moniker: isSet(object.moniker) ? globalThis.String(object.moniker) : "", + other: isSet(object.other) ? NodeInfoOther.fromJSON(object.other) : undefined, + }; + }, + + toJSON(message: NodeInfo): unknown { + const obj: any = {}; + if (message.protocol_version !== undefined) { + obj.protocol_version = ProtocolVersion.toJSON(message.protocol_version); + } + if (message.node_id !== "") { + obj.node_id = message.node_id; + } + if (message.listen_addr !== "") { + obj.listen_addr = message.listen_addr; + } + if (message.network !== "") { + obj.network = message.network; + } + if (message.version !== "") { + obj.version = message.version; + } + if (message.channels.length !== 0) { + obj.channels = base64FromBytes(message.channels); + } + if (message.moniker !== "") { + obj.moniker = message.moniker; + } + if (message.other !== undefined) { + obj.other = NodeInfoOther.toJSON(message.other); + } + return obj; + }, + + create, I>>(base?: I): NodeInfo { + return NodeInfo.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): NodeInfo { + const message = createBaseNodeInfo(); + message.protocol_version = + object.protocol_version !== undefined && object.protocol_version !== null ? ProtocolVersion.fromPartial(object.protocol_version) : undefined; + message.node_id = object.node_id ?? ""; + message.listen_addr = object.listen_addr ?? ""; + message.network = object.network ?? ""; + message.version = object.version ?? ""; + message.channels = object.channels ?? new Uint8Array(0); + message.moniker = object.moniker ?? ""; + message.other = object.other !== undefined && object.other !== null ? NodeInfoOther.fromPartial(object.other) : undefined; + return message; + }, +}; + +export const NodeInfoOther: MessageFns = { + $type: "tendermint.p2p.NodeInfoOther" as const, + + encode(message: NodeInfoOther, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.tx_index !== "") { + writer.uint32(10).string(message.tx_index); + } + if (message.rpc_address !== "") { + writer.uint32(18).string(message.rpc_address); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): NodeInfoOther { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseNodeInfoOther(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.tx_index = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.rpc_address = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): NodeInfoOther { + return { + tx_index: isSet(object.tx_index) ? globalThis.String(object.tx_index) : "", + rpc_address: isSet(object.rpc_address) ? globalThis.String(object.rpc_address) : "", + }; + }, + + toJSON(message: NodeInfoOther): unknown { + const obj: any = {}; + if (message.tx_index !== "") { + obj.tx_index = message.tx_index; + } + if (message.rpc_address !== "") { + obj.rpc_address = message.rpc_address; + } + return obj; + }, + + create, I>>(base?: I): NodeInfoOther { + return NodeInfoOther.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): NodeInfoOther { + const message = createBaseNodeInfoOther(); + message.tx_index = object.tx_index ?? ""; + message.rpc_address = object.rpc_address ?? ""; + return message; + }, +}; + +export const PeerInfo: MessageFns = { + $type: "tendermint.p2p.PeerInfo" as const, + + encode(message: PeerInfo, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.id !== "") { + writer.uint32(10).string(message.id); + } + for (const v of message.address_info) { + PeerAddressInfo.encode(v!, writer.uint32(18).fork()).join(); + } + if (message.last_connected !== undefined) { + Timestamp.encode(toTimestamp(message.last_connected), writer.uint32(26).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): PeerInfo { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePeerInfo(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.id = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.address_info.push(PeerAddressInfo.decode(reader, reader.uint32())); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.last_connected = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): PeerInfo { + return { + id: isSet(object.id) ? globalThis.String(object.id) : "", + address_info: globalThis.Array.isArray(object?.address_info) ? object.address_info.map((e: any) => PeerAddressInfo.fromJSON(e)) : [], + last_connected: isSet(object.last_connected) ? fromJsonTimestamp(object.last_connected) : undefined, + }; + }, + + toJSON(message: PeerInfo): unknown { + const obj: any = {}; + if (message.id !== "") { + obj.id = message.id; + } + if (message.address_info?.length) { + obj.address_info = message.address_info.map((e) => PeerAddressInfo.toJSON(e)); + } + if (message.last_connected !== undefined) { + obj.last_connected = message.last_connected.toISOString(); + } + return obj; + }, + + create, I>>(base?: I): PeerInfo { + return PeerInfo.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): PeerInfo { + const message = createBasePeerInfo(); + message.id = object.id ?? ""; + message.address_info = object.address_info?.map((e) => PeerAddressInfo.fromPartial(e)) || []; + message.last_connected = object.last_connected ?? undefined; + return message; + }, +}; + +export const PeerAddressInfo: MessageFns = { + $type: "tendermint.p2p.PeerAddressInfo" as const, + + encode(message: PeerAddressInfo, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.address !== "") { + writer.uint32(10).string(message.address); + } + if (message.last_dial_success !== undefined) { + Timestamp.encode(toTimestamp(message.last_dial_success), writer.uint32(18).fork()).join(); + } + if (message.last_dial_failure !== undefined) { + Timestamp.encode(toTimestamp(message.last_dial_failure), writer.uint32(26).fork()).join(); + } + if (message.dial_failures !== 0) { + writer.uint32(32).uint32(message.dial_failures); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): PeerAddressInfo { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePeerAddressInfo(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.address = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.last_dial_success = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.last_dial_failure = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.dial_failures = reader.uint32(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): PeerAddressInfo { + return { + address: isSet(object.address) ? globalThis.String(object.address) : "", + last_dial_success: isSet(object.last_dial_success) ? fromJsonTimestamp(object.last_dial_success) : undefined, + last_dial_failure: isSet(object.last_dial_failure) ? fromJsonTimestamp(object.last_dial_failure) : undefined, + dial_failures: isSet(object.dial_failures) ? globalThis.Number(object.dial_failures) : 0, + }; + }, + + toJSON(message: PeerAddressInfo): unknown { + const obj: any = {}; + if (message.address !== "") { + obj.address = message.address; + } + if (message.last_dial_success !== undefined) { + obj.last_dial_success = message.last_dial_success.toISOString(); + } + if (message.last_dial_failure !== undefined) { + obj.last_dial_failure = message.last_dial_failure.toISOString(); + } + if (message.dial_failures !== 0) { + obj.dial_failures = Math.round(message.dial_failures); + } + return obj; + }, + + create, I>>(base?: I): PeerAddressInfo { + return PeerAddressInfo.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): PeerAddressInfo { + const message = createBasePeerAddressInfo(); + message.address = object.address ?? ""; + message.last_dial_success = object.last_dial_success ?? undefined; + message.last_dial_failure = object.last_dial_failure ?? undefined; + message.dial_failures = object.dial_failures ?? 0; + return message; + }, +}; + +function createBaseProtocolVersion(): ProtocolVersion { + return { p2p: 0, block: 0, app: 0 }; +} + +function createBaseNodeInfo(): NodeInfo { + return { + protocol_version: undefined, + node_id: "", + listen_addr: "", + network: "", + version: "", + channels: new Uint8Array(0), + moniker: "", + other: undefined, + }; +} + +function createBaseNodeInfoOther(): NodeInfoOther { + return { tx_index: "", rpc_address: "" }; +} + +function createBasePeerInfo(): PeerInfo { + return { id: "", address_info: [], last_connected: undefined }; +} + +function createBasePeerAddressInfo(): PeerAddressInfo { + return { address: "", last_dial_success: undefined, last_dial_failure: undefined, dial_failures: 0 }; +} + +function bytesFromBase64(b64: string): Uint8Array { + if ((globalThis as any).Buffer) { + return Uint8Array.from(globalThis.Buffer.from(b64, "base64")); + } else { + const bin = globalThis.atob(b64); + const arr = new Uint8Array(bin.length); + for (let i = 0; i < bin.length; ++i) { + arr[i] = bin.charCodeAt(i); + } + return arr; + } +} + +function base64FromBytes(arr: Uint8Array): string { + if ((globalThis as any).Buffer) { + return globalThis.Buffer.from(arr).toString("base64"); + } else { + const bin: string[] = []; + arr.forEach((byte) => { + bin.push(globalThis.String.fromCharCode(byte)); + }); + return globalThis.btoa(bin.join("")); + } +} + +function toTimestamp(date: Date): Timestamp { + const seconds = Math.trunc(date.getTime() / 1_000); + const nanos = (date.getTime() % 1_000) * 1_000_000; + return { seconds, nanos }; +} + +function fromTimestamp(t: Timestamp): Date { + let millis = (t.seconds || 0) * 1_000; + millis += (t.nanos || 0) / 1_000_000; + return new globalThis.Date(millis); +} + +function fromJsonTimestamp(o: any): Date { + if (o instanceof globalThis.Date) { + return o; + } else if (typeof o === "string") { + return new globalThis.Date(o); + } else { + return fromTimestamp(Timestamp.fromJSON(o)); + } +} + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} +export const registry: Array<[string, GeneratedType]> = [ + ["/tendermint.p2p.ProtocolVersion", ProtocolVersion as never], + ["/tendermint.p2p.NodeInfo", NodeInfo as never], + ["/tendermint.p2p.NodeInfoOther", NodeInfoOther as never], + ["/tendermint.p2p.PeerInfo", PeerInfo as never], + ["/tendermint.p2p.PeerAddressInfo", PeerAddressInfo as never], +]; +export const aminoConverters = { + "/tendermint.p2p.ProtocolVersion": { + aminoType: "tendermint.p2p.ProtocolVersion", + toAmino: (message: ProtocolVersion) => ({ ...message }), + fromAmino: (object: ProtocolVersion) => ({ ...object }), + }, + + "/tendermint.p2p.NodeInfo": { + aminoType: "tendermint.p2p.NodeInfo", + toAmino: (message: NodeInfo) => ({ ...message }), + fromAmino: (object: NodeInfo) => ({ ...object }), + }, + + "/tendermint.p2p.NodeInfoOther": { + aminoType: "tendermint.p2p.NodeInfoOther", + toAmino: (message: NodeInfoOther) => ({ ...message }), + fromAmino: (object: NodeInfoOther) => ({ ...object }), + }, + + "/tendermint.p2p.PeerInfo": { + aminoType: "tendermint.p2p.PeerInfo", + toAmino: (message: PeerInfo) => ({ ...message }), + fromAmino: (object: PeerInfo) => ({ ...object }), + }, + + "/tendermint.p2p.PeerAddressInfo": { + aminoType: "tendermint.p2p.PeerAddressInfo", + toAmino: (message: PeerAddressInfo) => ({ ...message }), + fromAmino: (object: PeerAddressInfo) => ({ ...object }), + }, +}; diff --git a/packages/cosmos/generated/encoding/tendermint/types/block.ts b/packages/cosmos/generated/encoding/tendermint/types/block.ts new file mode 100644 index 000000000..33b81628b --- /dev/null +++ b/packages/cosmos/generated/encoding/tendermint/types/block.ts @@ -0,0 +1,131 @@ +import type { GeneratedType } from "@cosmjs/proto-signing"; + +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +import { EvidenceList } from "./evidence"; + +import { Commit, Data, Header } from "./types"; + +import type { Block as Block_type } from "../../../types/tendermint/types"; + +import type { DeepPartial, Exact, MessageFns } from "../../common"; + +export interface Block extends Block_type {} + +export const Block: MessageFns = { + $type: "tendermint.types.Block" as const, + + encode(message: Block, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.header !== undefined) { + Header.encode(message.header, writer.uint32(10).fork()).join(); + } + if (message.data !== undefined) { + Data.encode(message.data, writer.uint32(18).fork()).join(); + } + if (message.evidence !== undefined) { + EvidenceList.encode(message.evidence, writer.uint32(26).fork()).join(); + } + if (message.last_commit !== undefined) { + Commit.encode(message.last_commit, writer.uint32(34).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Block { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseBlock(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.header = Header.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.data = Data.decode(reader, reader.uint32()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.evidence = EvidenceList.decode(reader, reader.uint32()); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.last_commit = Commit.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Block { + return { + header: isSet(object.header) ? Header.fromJSON(object.header) : undefined, + data: isSet(object.data) ? Data.fromJSON(object.data) : undefined, + evidence: isSet(object.evidence) ? EvidenceList.fromJSON(object.evidence) : undefined, + last_commit: isSet(object.last_commit) ? Commit.fromJSON(object.last_commit) : undefined, + }; + }, + + toJSON(message: Block): unknown { + const obj: any = {}; + if (message.header !== undefined) { + obj.header = Header.toJSON(message.header); + } + if (message.data !== undefined) { + obj.data = Data.toJSON(message.data); + } + if (message.evidence !== undefined) { + obj.evidence = EvidenceList.toJSON(message.evidence); + } + if (message.last_commit !== undefined) { + obj.last_commit = Commit.toJSON(message.last_commit); + } + return obj; + }, + + create, I>>(base?: I): Block { + return Block.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Block { + const message = createBaseBlock(); + message.header = object.header !== undefined && object.header !== null ? Header.fromPartial(object.header) : undefined; + message.data = object.data !== undefined && object.data !== null ? Data.fromPartial(object.data) : undefined; + message.evidence = object.evidence !== undefined && object.evidence !== null ? EvidenceList.fromPartial(object.evidence) : undefined; + message.last_commit = object.last_commit !== undefined && object.last_commit !== null ? Commit.fromPartial(object.last_commit) : undefined; + return message; + }, +}; + +function createBaseBlock(): Block { + return { header: undefined, data: undefined, evidence: undefined, last_commit: undefined }; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} +export const registry: Array<[string, GeneratedType]> = [["/tendermint.types.Block", Block as never]]; +export const aminoConverters = { + "/tendermint.types.Block": { + aminoType: "tendermint.types.Block", + toAmino: (message: Block) => ({ ...message }), + fromAmino: (object: Block) => ({ ...object }), + }, +}; diff --git a/packages/cosmos/generated/encoding/tendermint/types/evidence.ts b/packages/cosmos/generated/encoding/tendermint/types/evidence.ts new file mode 100644 index 000000000..4fb608965 --- /dev/null +++ b/packages/cosmos/generated/encoding/tendermint/types/evidence.ts @@ -0,0 +1,478 @@ +import type { GeneratedType } from "@cosmjs/proto-signing"; + +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +import { Timestamp } from "../../google/protobuf/timestamp"; + +import { LightBlock, Vote } from "./types"; + +import { Validator } from "./validator"; + +import type { + DuplicateVoteEvidence as DuplicateVoteEvidence_type, + EvidenceList as EvidenceList_type, + Evidence as Evidence_type, + LightClientAttackEvidence as LightClientAttackEvidence_type, +} from "../../../types/tendermint/types"; + +import type { DeepPartial, Exact, MessageFns } from "../../common"; + +export interface Evidence extends Evidence_type {} +export interface DuplicateVoteEvidence extends DuplicateVoteEvidence_type {} +export interface LightClientAttackEvidence extends LightClientAttackEvidence_type {} +export interface EvidenceList extends EvidenceList_type {} + +export const Evidence: MessageFns = { + $type: "tendermint.types.Evidence" as const, + + encode(message: Evidence, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.duplicate_vote_evidence !== undefined) { + DuplicateVoteEvidence.encode(message.duplicate_vote_evidence, writer.uint32(10).fork()).join(); + } + if (message.light_client_attack_evidence !== undefined) { + LightClientAttackEvidence.encode(message.light_client_attack_evidence, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Evidence { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEvidence(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.duplicate_vote_evidence = DuplicateVoteEvidence.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.light_client_attack_evidence = LightClientAttackEvidence.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Evidence { + return { + duplicate_vote_evidence: isSet(object.duplicate_vote_evidence) ? DuplicateVoteEvidence.fromJSON(object.duplicate_vote_evidence) : undefined, + light_client_attack_evidence: isSet(object.light_client_attack_evidence) + ? LightClientAttackEvidence.fromJSON(object.light_client_attack_evidence) + : undefined, + }; + }, + + toJSON(message: Evidence): unknown { + const obj: any = {}; + if (message.duplicate_vote_evidence !== undefined) { + obj.duplicate_vote_evidence = DuplicateVoteEvidence.toJSON(message.duplicate_vote_evidence); + } + if (message.light_client_attack_evidence !== undefined) { + obj.light_client_attack_evidence = LightClientAttackEvidence.toJSON(message.light_client_attack_evidence); + } + return obj; + }, + + create, I>>(base?: I): Evidence { + return Evidence.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Evidence { + const message = createBaseEvidence(); + message.duplicate_vote_evidence = + object.duplicate_vote_evidence !== undefined && object.duplicate_vote_evidence !== null + ? DuplicateVoteEvidence.fromPartial(object.duplicate_vote_evidence) + : undefined; + message.light_client_attack_evidence = + object.light_client_attack_evidence !== undefined && object.light_client_attack_evidence !== null + ? LightClientAttackEvidence.fromPartial(object.light_client_attack_evidence) + : undefined; + return message; + }, +}; + +export const DuplicateVoteEvidence: MessageFns = { + $type: "tendermint.types.DuplicateVoteEvidence" as const, + + encode(message: DuplicateVoteEvidence, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.vote_a !== undefined) { + Vote.encode(message.vote_a, writer.uint32(10).fork()).join(); + } + if (message.vote_b !== undefined) { + Vote.encode(message.vote_b, writer.uint32(18).fork()).join(); + } + if (message.total_voting_power !== 0) { + writer.uint32(24).int64(message.total_voting_power); + } + if (message.validator_power !== 0) { + writer.uint32(32).int64(message.validator_power); + } + if (message.timestamp !== undefined) { + Timestamp.encode(toTimestamp(message.timestamp), writer.uint32(42).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): DuplicateVoteEvidence { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDuplicateVoteEvidence(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.vote_a = Vote.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.vote_b = Vote.decode(reader, reader.uint32()); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.total_voting_power = longToNumber(reader.int64()); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.validator_power = longToNumber(reader.int64()); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.timestamp = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): DuplicateVoteEvidence { + return { + vote_a: isSet(object.vote_a) ? Vote.fromJSON(object.vote_a) : undefined, + vote_b: isSet(object.vote_b) ? Vote.fromJSON(object.vote_b) : undefined, + total_voting_power: isSet(object.total_voting_power) ? globalThis.Number(object.total_voting_power) : 0, + validator_power: isSet(object.validator_power) ? globalThis.Number(object.validator_power) : 0, + timestamp: isSet(object.timestamp) ? fromJsonTimestamp(object.timestamp) : undefined, + }; + }, + + toJSON(message: DuplicateVoteEvidence): unknown { + const obj: any = {}; + if (message.vote_a !== undefined) { + obj.vote_a = Vote.toJSON(message.vote_a); + } + if (message.vote_b !== undefined) { + obj.vote_b = Vote.toJSON(message.vote_b); + } + if (message.total_voting_power !== 0) { + obj.total_voting_power = Math.round(message.total_voting_power); + } + if (message.validator_power !== 0) { + obj.validator_power = Math.round(message.validator_power); + } + if (message.timestamp !== undefined) { + obj.timestamp = message.timestamp.toISOString(); + } + return obj; + }, + + create, I>>(base?: I): DuplicateVoteEvidence { + return DuplicateVoteEvidence.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): DuplicateVoteEvidence { + const message = createBaseDuplicateVoteEvidence(); + message.vote_a = object.vote_a !== undefined && object.vote_a !== null ? Vote.fromPartial(object.vote_a) : undefined; + message.vote_b = object.vote_b !== undefined && object.vote_b !== null ? Vote.fromPartial(object.vote_b) : undefined; + message.total_voting_power = object.total_voting_power ?? 0; + message.validator_power = object.validator_power ?? 0; + message.timestamp = object.timestamp ?? undefined; + return message; + }, +}; + +export const LightClientAttackEvidence: MessageFns = { + $type: "tendermint.types.LightClientAttackEvidence" as const, + + encode(message: LightClientAttackEvidence, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.conflicting_block !== undefined) { + LightBlock.encode(message.conflicting_block, writer.uint32(10).fork()).join(); + } + if (message.common_height !== 0) { + writer.uint32(16).int64(message.common_height); + } + for (const v of message.byzantine_validators) { + Validator.encode(v!, writer.uint32(26).fork()).join(); + } + if (message.total_voting_power !== 0) { + writer.uint32(32).int64(message.total_voting_power); + } + if (message.timestamp !== undefined) { + Timestamp.encode(toTimestamp(message.timestamp), writer.uint32(42).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): LightClientAttackEvidence { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseLightClientAttackEvidence(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.conflicting_block = LightBlock.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.common_height = longToNumber(reader.int64()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.byzantine_validators.push(Validator.decode(reader, reader.uint32())); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.total_voting_power = longToNumber(reader.int64()); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.timestamp = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): LightClientAttackEvidence { + return { + conflicting_block: isSet(object.conflicting_block) ? LightBlock.fromJSON(object.conflicting_block) : undefined, + common_height: isSet(object.common_height) ? globalThis.Number(object.common_height) : 0, + byzantine_validators: globalThis.Array.isArray(object?.byzantine_validators) ? object.byzantine_validators.map((e: any) => Validator.fromJSON(e)) : [], + total_voting_power: isSet(object.total_voting_power) ? globalThis.Number(object.total_voting_power) : 0, + timestamp: isSet(object.timestamp) ? fromJsonTimestamp(object.timestamp) : undefined, + }; + }, + + toJSON(message: LightClientAttackEvidence): unknown { + const obj: any = {}; + if (message.conflicting_block !== undefined) { + obj.conflicting_block = LightBlock.toJSON(message.conflicting_block); + } + if (message.common_height !== 0) { + obj.common_height = Math.round(message.common_height); + } + if (message.byzantine_validators?.length) { + obj.byzantine_validators = message.byzantine_validators.map((e) => Validator.toJSON(e)); + } + if (message.total_voting_power !== 0) { + obj.total_voting_power = Math.round(message.total_voting_power); + } + if (message.timestamp !== undefined) { + obj.timestamp = message.timestamp.toISOString(); + } + return obj; + }, + + create, I>>(base?: I): LightClientAttackEvidence { + return LightClientAttackEvidence.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): LightClientAttackEvidence { + const message = createBaseLightClientAttackEvidence(); + message.conflicting_block = + object.conflicting_block !== undefined && object.conflicting_block !== null ? LightBlock.fromPartial(object.conflicting_block) : undefined; + message.common_height = object.common_height ?? 0; + message.byzantine_validators = object.byzantine_validators?.map((e) => Validator.fromPartial(e)) || []; + message.total_voting_power = object.total_voting_power ?? 0; + message.timestamp = object.timestamp ?? undefined; + return message; + }, +}; + +export const EvidenceList: MessageFns = { + $type: "tendermint.types.EvidenceList" as const, + + encode(message: EvidenceList, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.evidence) { + Evidence.encode(v!, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): EvidenceList { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEvidenceList(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.evidence.push(Evidence.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): EvidenceList { + return { + evidence: globalThis.Array.isArray(object?.evidence) ? object.evidence.map((e: any) => Evidence.fromJSON(e)) : [], + }; + }, + + toJSON(message: EvidenceList): unknown { + const obj: any = {}; + if (message.evidence?.length) { + obj.evidence = message.evidence.map((e) => Evidence.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): EvidenceList { + return EvidenceList.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): EvidenceList { + const message = createBaseEvidenceList(); + message.evidence = object.evidence?.map((e) => Evidence.fromPartial(e)) || []; + return message; + }, +}; + +function createBaseEvidence(): Evidence { + return { duplicate_vote_evidence: undefined, light_client_attack_evidence: undefined }; +} + +function createBaseDuplicateVoteEvidence(): DuplicateVoteEvidence { + return { vote_a: undefined, vote_b: undefined, total_voting_power: 0, validator_power: 0, timestamp: undefined }; +} + +function createBaseLightClientAttackEvidence(): LightClientAttackEvidence { + return { + conflicting_block: undefined, + common_height: 0, + byzantine_validators: [], + total_voting_power: 0, + timestamp: undefined, + }; +} + +function createBaseEvidenceList(): EvidenceList { + return { evidence: [] }; +} + +function toTimestamp(date: Date): Timestamp { + const seconds = Math.trunc(date.getTime() / 1_000); + const nanos = (date.getTime() % 1_000) * 1_000_000; + return { seconds, nanos }; +} + +function fromTimestamp(t: Timestamp): Date { + let millis = (t.seconds || 0) * 1_000; + millis += (t.nanos || 0) / 1_000_000; + return new globalThis.Date(millis); +} + +function fromJsonTimestamp(o: any): Date { + if (o instanceof globalThis.Date) { + return o; + } else if (typeof o === "string") { + return new globalThis.Date(o); + } else { + return fromTimestamp(Timestamp.fromJSON(o)); + } +} + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} +export const registry: Array<[string, GeneratedType]> = [ + ["/tendermint.types.Evidence", Evidence as never], + ["/tendermint.types.DuplicateVoteEvidence", DuplicateVoteEvidence as never], + ["/tendermint.types.EvidenceList", EvidenceList as never], +]; +export const aminoConverters = { + "/tendermint.types.Evidence": { + aminoType: "tendermint.types.Evidence", + toAmino: (message: Evidence) => ({ ...message }), + fromAmino: (object: Evidence) => ({ ...object }), + }, + + "/tendermint.types.DuplicateVoteEvidence": { + aminoType: "tendermint.types.DuplicateVoteEvidence", + toAmino: (message: DuplicateVoteEvidence) => ({ ...message }), + fromAmino: (object: DuplicateVoteEvidence) => ({ ...object }), + }, + + "/tendermint.types.EvidenceList": { + aminoType: "tendermint.types.EvidenceList", + toAmino: (message: EvidenceList) => ({ ...message }), + fromAmino: (object: EvidenceList) => ({ ...object }), + }, +}; diff --git a/packages/cosmos/generated/encoding/tendermint/types/index.ts b/packages/cosmos/generated/encoding/tendermint/types/index.ts new file mode 100644 index 000000000..8485741a4 --- /dev/null +++ b/packages/cosmos/generated/encoding/tendermint/types/index.ts @@ -0,0 +1,7 @@ +// @ts-nocheck + +export * from './block'; +export * from './evidence'; +export * from './params'; +export * from './types'; +export * from './validator'; \ No newline at end of file diff --git a/packages/cosmos/generated/encoding/tendermint/types/params.ts b/packages/cosmos/generated/encoding/tendermint/types/params.ts new file mode 100644 index 000000000..49a69b98d --- /dev/null +++ b/packages/cosmos/generated/encoding/tendermint/types/params.ts @@ -0,0 +1,928 @@ +import type { GeneratedType } from "@cosmjs/proto-signing"; + +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +import { Duration } from "../../google/protobuf/duration"; + +import type { + ABCIParams as ABCIParams_type, + BlockParams as BlockParams_type, + ConsensusParams as ConsensusParams_type, + EvidenceParams as EvidenceParams_type, + HashedParams as HashedParams_type, + SynchronyParams as SynchronyParams_type, + TimeoutParams as TimeoutParams_type, + ValidatorParams as ValidatorParams_type, + VersionParams as VersionParams_type, +} from "../../../types/tendermint/types"; + +import type { DeepPartial, Exact, MessageFns } from "../../common"; + +export interface ConsensusParams extends ConsensusParams_type {} +export interface BlockParams extends BlockParams_type {} +export interface EvidenceParams extends EvidenceParams_type {} +export interface ValidatorParams extends ValidatorParams_type {} +export interface VersionParams extends VersionParams_type {} +export interface HashedParams extends HashedParams_type {} +export interface SynchronyParams extends SynchronyParams_type {} +export interface TimeoutParams extends TimeoutParams_type {} +export interface ABCIParams extends ABCIParams_type {} + +export const ConsensusParams: MessageFns = { + $type: "tendermint.types.ConsensusParams" as const, + + encode(message: ConsensusParams, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.block !== undefined) { + BlockParams.encode(message.block, writer.uint32(10).fork()).join(); + } + if (message.evidence !== undefined) { + EvidenceParams.encode(message.evidence, writer.uint32(18).fork()).join(); + } + if (message.validator !== undefined) { + ValidatorParams.encode(message.validator, writer.uint32(26).fork()).join(); + } + if (message.version !== undefined) { + VersionParams.encode(message.version, writer.uint32(34).fork()).join(); + } + if (message.synchrony !== undefined) { + SynchronyParams.encode(message.synchrony, writer.uint32(42).fork()).join(); + } + if (message.timeout !== undefined) { + TimeoutParams.encode(message.timeout, writer.uint32(50).fork()).join(); + } + if (message.abci !== undefined) { + ABCIParams.encode(message.abci, writer.uint32(58).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ConsensusParams { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseConsensusParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.block = BlockParams.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.evidence = EvidenceParams.decode(reader, reader.uint32()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.validator = ValidatorParams.decode(reader, reader.uint32()); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.version = VersionParams.decode(reader, reader.uint32()); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.synchrony = SynchronyParams.decode(reader, reader.uint32()); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.timeout = TimeoutParams.decode(reader, reader.uint32()); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.abci = ABCIParams.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ConsensusParams { + 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, + synchrony: isSet(object.synchrony) ? SynchronyParams.fromJSON(object.synchrony) : undefined, + timeout: isSet(object.timeout) ? TimeoutParams.fromJSON(object.timeout) : undefined, + abci: isSet(object.abci) ? ABCIParams.fromJSON(object.abci) : undefined, + }; + }, + + toJSON(message: ConsensusParams): unknown { + const obj: any = {}; + if (message.block !== undefined) { + obj.block = BlockParams.toJSON(message.block); + } + if (message.evidence !== undefined) { + obj.evidence = EvidenceParams.toJSON(message.evidence); + } + if (message.validator !== undefined) { + obj.validator = ValidatorParams.toJSON(message.validator); + } + if (message.version !== undefined) { + obj.version = VersionParams.toJSON(message.version); + } + if (message.synchrony !== undefined) { + obj.synchrony = SynchronyParams.toJSON(message.synchrony); + } + if (message.timeout !== undefined) { + obj.timeout = TimeoutParams.toJSON(message.timeout); + } + if (message.abci !== undefined) { + obj.abci = ABCIParams.toJSON(message.abci); + } + return obj; + }, + + create, I>>(base?: I): ConsensusParams { + return ConsensusParams.fromPartial(base ?? ({} as any)); + }, + 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; + message.synchrony = object.synchrony !== undefined && object.synchrony !== null ? SynchronyParams.fromPartial(object.synchrony) : undefined; + message.timeout = object.timeout !== undefined && object.timeout !== null ? TimeoutParams.fromPartial(object.timeout) : undefined; + message.abci = object.abci !== undefined && object.abci !== null ? ABCIParams.fromPartial(object.abci) : undefined; + return message; + }, +}; + +export const BlockParams: MessageFns = { + $type: "tendermint.types.BlockParams" as const, + + encode(message: BlockParams, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.max_bytes !== 0) { + writer.uint32(8).int64(message.max_bytes); + } + if (message.max_gas !== 0) { + writer.uint32(16).int64(message.max_gas); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): BlockParams { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseBlockParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.max_bytes = longToNumber(reader.int64()); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.max_gas = longToNumber(reader.int64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): BlockParams { + return { + max_bytes: isSet(object.max_bytes) ? globalThis.Number(object.max_bytes) : 0, + max_gas: isSet(object.max_gas) ? globalThis.Number(object.max_gas) : 0, + }; + }, + + toJSON(message: BlockParams): unknown { + const obj: any = {}; + if (message.max_bytes !== 0) { + obj.max_bytes = Math.round(message.max_bytes); + } + if (message.max_gas !== 0) { + obj.max_gas = Math.round(message.max_gas); + } + return obj; + }, + + create, I>>(base?: I): BlockParams { + return BlockParams.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): BlockParams { + const message = createBaseBlockParams(); + message.max_bytes = object.max_bytes ?? 0; + message.max_gas = object.max_gas ?? 0; + return message; + }, +}; + +export const EvidenceParams: MessageFns = { + $type: "tendermint.types.EvidenceParams" as const, + + encode(message: EvidenceParams, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.max_age_num_blocks !== 0) { + writer.uint32(8).int64(message.max_age_num_blocks); + } + if (message.max_age_duration !== undefined) { + Duration.encode(message.max_age_duration, writer.uint32(18).fork()).join(); + } + if (message.max_bytes !== 0) { + writer.uint32(24).int64(message.max_bytes); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): EvidenceParams { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEvidenceParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.max_age_num_blocks = longToNumber(reader.int64()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.max_age_duration = Duration.decode(reader, reader.uint32()); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.max_bytes = longToNumber(reader.int64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): EvidenceParams { + return { + max_age_num_blocks: isSet(object.max_age_num_blocks) ? globalThis.Number(object.max_age_num_blocks) : 0, + max_age_duration: isSet(object.max_age_duration) ? Duration.fromJSON(object.max_age_duration) : undefined, + max_bytes: isSet(object.max_bytes) ? globalThis.Number(object.max_bytes) : 0, + }; + }, + + toJSON(message: EvidenceParams): unknown { + const obj: any = {}; + if (message.max_age_num_blocks !== 0) { + obj.max_age_num_blocks = Math.round(message.max_age_num_blocks); + } + if (message.max_age_duration !== undefined) { + obj.max_age_duration = Duration.toJSON(message.max_age_duration); + } + if (message.max_bytes !== 0) { + obj.max_bytes = Math.round(message.max_bytes); + } + return obj; + }, + + create, I>>(base?: I): EvidenceParams { + return EvidenceParams.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): EvidenceParams { + const message = createBaseEvidenceParams(); + message.max_age_num_blocks = object.max_age_num_blocks ?? 0; + message.max_age_duration = + object.max_age_duration !== undefined && object.max_age_duration !== null ? Duration.fromPartial(object.max_age_duration) : undefined; + message.max_bytes = object.max_bytes ?? 0; + return message; + }, +}; + +export const ValidatorParams: MessageFns = { + $type: "tendermint.types.ValidatorParams" as const, + + encode(message: ValidatorParams, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.pub_key_types) { + writer.uint32(10).string(v!); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ValidatorParams { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseValidatorParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.pub_key_types.push(reader.string()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ValidatorParams { + return { + pub_key_types: globalThis.Array.isArray(object?.pub_key_types) ? object.pub_key_types.map((e: any) => globalThis.String(e)) : [], + }; + }, + + toJSON(message: ValidatorParams): unknown { + const obj: any = {}; + if (message.pub_key_types?.length) { + obj.pub_key_types = message.pub_key_types; + } + return obj; + }, + + create, I>>(base?: I): ValidatorParams { + return ValidatorParams.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ValidatorParams { + const message = createBaseValidatorParams(); + message.pub_key_types = object.pub_key_types?.map((e) => e) || []; + return message; + }, +}; + +export const VersionParams: MessageFns = { + $type: "tendermint.types.VersionParams" as const, + + encode(message: VersionParams, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.app_version !== 0) { + writer.uint32(8).uint64(message.app_version); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): VersionParams { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseVersionParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.app_version = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): VersionParams { + return { app_version: isSet(object.app_version) ? globalThis.Number(object.app_version) : 0 }; + }, + + toJSON(message: VersionParams): unknown { + const obj: any = {}; + if (message.app_version !== 0) { + obj.app_version = Math.round(message.app_version); + } + return obj; + }, + + create, I>>(base?: I): VersionParams { + return VersionParams.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): VersionParams { + const message = createBaseVersionParams(); + message.app_version = object.app_version ?? 0; + return message; + }, +}; + +export const HashedParams: MessageFns = { + $type: "tendermint.types.HashedParams" as const, + + encode(message: HashedParams, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.block_max_bytes !== 0) { + writer.uint32(8).int64(message.block_max_bytes); + } + if (message.block_max_gas !== 0) { + writer.uint32(16).int64(message.block_max_gas); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): HashedParams { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseHashedParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.block_max_bytes = longToNumber(reader.int64()); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.block_max_gas = longToNumber(reader.int64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): HashedParams { + return { + block_max_bytes: isSet(object.block_max_bytes) ? globalThis.Number(object.block_max_bytes) : 0, + block_max_gas: isSet(object.block_max_gas) ? globalThis.Number(object.block_max_gas) : 0, + }; + }, + + toJSON(message: HashedParams): unknown { + const obj: any = {}; + if (message.block_max_bytes !== 0) { + obj.block_max_bytes = Math.round(message.block_max_bytes); + } + if (message.block_max_gas !== 0) { + obj.block_max_gas = Math.round(message.block_max_gas); + } + return obj; + }, + + create, I>>(base?: I): HashedParams { + return HashedParams.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): HashedParams { + const message = createBaseHashedParams(); + message.block_max_bytes = object.block_max_bytes ?? 0; + message.block_max_gas = object.block_max_gas ?? 0; + return message; + }, +}; + +export const SynchronyParams: MessageFns = { + $type: "tendermint.types.SynchronyParams" as const, + + encode(message: SynchronyParams, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.message_delay !== undefined) { + Duration.encode(message.message_delay, writer.uint32(10).fork()).join(); + } + if (message.precision !== undefined) { + Duration.encode(message.precision, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): SynchronyParams { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseSynchronyParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.message_delay = Duration.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.precision = Duration.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): SynchronyParams { + return { + message_delay: isSet(object.message_delay) ? Duration.fromJSON(object.message_delay) : undefined, + precision: isSet(object.precision) ? Duration.fromJSON(object.precision) : undefined, + }; + }, + + toJSON(message: SynchronyParams): unknown { + const obj: any = {}; + if (message.message_delay !== undefined) { + obj.message_delay = Duration.toJSON(message.message_delay); + } + if (message.precision !== undefined) { + obj.precision = Duration.toJSON(message.precision); + } + return obj; + }, + + create, I>>(base?: I): SynchronyParams { + return SynchronyParams.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): SynchronyParams { + const message = createBaseSynchronyParams(); + message.message_delay = object.message_delay !== undefined && object.message_delay !== null ? Duration.fromPartial(object.message_delay) : undefined; + message.precision = object.precision !== undefined && object.precision !== null ? Duration.fromPartial(object.precision) : undefined; + return message; + }, +}; + +export const TimeoutParams: MessageFns = { + $type: "tendermint.types.TimeoutParams" as const, + + encode(message: TimeoutParams, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.propose !== undefined) { + Duration.encode(message.propose, writer.uint32(10).fork()).join(); + } + if (message.propose_delta !== undefined) { + Duration.encode(message.propose_delta, writer.uint32(18).fork()).join(); + } + if (message.vote !== undefined) { + Duration.encode(message.vote, writer.uint32(26).fork()).join(); + } + if (message.vote_delta !== undefined) { + Duration.encode(message.vote_delta, writer.uint32(34).fork()).join(); + } + if (message.commit !== undefined) { + Duration.encode(message.commit, writer.uint32(42).fork()).join(); + } + if (message.bypass_commit_timeout !== false) { + writer.uint32(48).bool(message.bypass_commit_timeout); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): TimeoutParams { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseTimeoutParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.propose = Duration.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.propose_delta = Duration.decode(reader, reader.uint32()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.vote = Duration.decode(reader, reader.uint32()); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.vote_delta = Duration.decode(reader, reader.uint32()); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.commit = Duration.decode(reader, reader.uint32()); + continue; + case 6: + if (tag !== 48) { + break; + } + + message.bypass_commit_timeout = reader.bool(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): TimeoutParams { + return { + propose: isSet(object.propose) ? Duration.fromJSON(object.propose) : undefined, + propose_delta: isSet(object.propose_delta) ? Duration.fromJSON(object.propose_delta) : undefined, + vote: isSet(object.vote) ? Duration.fromJSON(object.vote) : undefined, + vote_delta: isSet(object.vote_delta) ? Duration.fromJSON(object.vote_delta) : undefined, + commit: isSet(object.commit) ? Duration.fromJSON(object.commit) : undefined, + bypass_commit_timeout: isSet(object.bypass_commit_timeout) ? globalThis.Boolean(object.bypass_commit_timeout) : false, + }; + }, + + toJSON(message: TimeoutParams): unknown { + const obj: any = {}; + if (message.propose !== undefined) { + obj.propose = Duration.toJSON(message.propose); + } + if (message.propose_delta !== undefined) { + obj.propose_delta = Duration.toJSON(message.propose_delta); + } + if (message.vote !== undefined) { + obj.vote = Duration.toJSON(message.vote); + } + if (message.vote_delta !== undefined) { + obj.vote_delta = Duration.toJSON(message.vote_delta); + } + if (message.commit !== undefined) { + obj.commit = Duration.toJSON(message.commit); + } + if (message.bypass_commit_timeout !== false) { + obj.bypass_commit_timeout = message.bypass_commit_timeout; + } + return obj; + }, + + create, I>>(base?: I): TimeoutParams { + return TimeoutParams.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): TimeoutParams { + const message = createBaseTimeoutParams(); + message.propose = object.propose !== undefined && object.propose !== null ? Duration.fromPartial(object.propose) : undefined; + message.propose_delta = object.propose_delta !== undefined && object.propose_delta !== null ? Duration.fromPartial(object.propose_delta) : undefined; + message.vote = object.vote !== undefined && object.vote !== null ? Duration.fromPartial(object.vote) : undefined; + message.vote_delta = object.vote_delta !== undefined && object.vote_delta !== null ? Duration.fromPartial(object.vote_delta) : undefined; + message.commit = object.commit !== undefined && object.commit !== null ? Duration.fromPartial(object.commit) : undefined; + message.bypass_commit_timeout = object.bypass_commit_timeout ?? false; + return message; + }, +}; + +export const ABCIParams: MessageFns = { + $type: "tendermint.types.ABCIParams" as const, + + encode(message: ABCIParams, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.vote_extensions_enable_height !== 0) { + writer.uint32(8).int64(message.vote_extensions_enable_height); + } + if (message.recheck_tx !== false) { + writer.uint32(16).bool(message.recheck_tx); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ABCIParams { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseABCIParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.vote_extensions_enable_height = longToNumber(reader.int64()); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.recheck_tx = reader.bool(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ABCIParams { + return { + vote_extensions_enable_height: isSet(object.vote_extensions_enable_height) ? globalThis.Number(object.vote_extensions_enable_height) : 0, + recheck_tx: isSet(object.recheck_tx) ? globalThis.Boolean(object.recheck_tx) : false, + }; + }, + + toJSON(message: ABCIParams): unknown { + const obj: any = {}; + if (message.vote_extensions_enable_height !== 0) { + obj.vote_extensions_enable_height = Math.round(message.vote_extensions_enable_height); + } + if (message.recheck_tx !== false) { + obj.recheck_tx = message.recheck_tx; + } + return obj; + }, + + create, I>>(base?: I): ABCIParams { + return ABCIParams.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ABCIParams { + const message = createBaseABCIParams(); + message.vote_extensions_enable_height = object.vote_extensions_enable_height ?? 0; + message.recheck_tx = object.recheck_tx ?? false; + return message; + }, +}; + +function createBaseConsensusParams(): ConsensusParams { + return { + block: undefined, + evidence: undefined, + validator: undefined, + version: undefined, + synchrony: undefined, + timeout: undefined, + abci: undefined, + }; +} + +function createBaseBlockParams(): BlockParams { + return { max_bytes: 0, max_gas: 0 }; +} + +function createBaseEvidenceParams(): EvidenceParams { + return { max_age_num_blocks: 0, max_age_duration: undefined, max_bytes: 0 }; +} + +function createBaseValidatorParams(): ValidatorParams { + return { pub_key_types: [] }; +} + +function createBaseVersionParams(): VersionParams { + return { app_version: 0 }; +} + +function createBaseHashedParams(): HashedParams { + return { block_max_bytes: 0, block_max_gas: 0 }; +} + +function createBaseSynchronyParams(): SynchronyParams { + return { message_delay: undefined, precision: undefined }; +} + +function createBaseTimeoutParams(): TimeoutParams { + return { + propose: undefined, + propose_delta: undefined, + vote: undefined, + vote_delta: undefined, + commit: undefined, + bypass_commit_timeout: false, + }; +} + +function createBaseABCIParams(): ABCIParams { + return { vote_extensions_enable_height: 0, recheck_tx: false }; +} + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} +export const registry: Array<[string, GeneratedType]> = [ + ["/tendermint.types.ConsensusParams", ConsensusParams as never], + ["/tendermint.types.BlockParams", BlockParams as never], + ["/tendermint.types.EvidenceParams", EvidenceParams as never], + ["/tendermint.types.ValidatorParams", ValidatorParams as never], + ["/tendermint.types.VersionParams", VersionParams as never], + ["/tendermint.types.HashedParams", HashedParams as never], + ["/tendermint.types.SynchronyParams", SynchronyParams as never], + ["/tendermint.types.TimeoutParams", TimeoutParams as never], + ["/tendermint.types.ABCIParams", ABCIParams as never], +]; +export const aminoConverters = { + "/tendermint.types.ConsensusParams": { + aminoType: "tendermint.types.ConsensusParams", + toAmino: (message: ConsensusParams) => ({ ...message }), + fromAmino: (object: ConsensusParams) => ({ ...object }), + }, + + "/tendermint.types.BlockParams": { + aminoType: "tendermint.types.BlockParams", + toAmino: (message: BlockParams) => ({ ...message }), + fromAmino: (object: BlockParams) => ({ ...object }), + }, + + "/tendermint.types.EvidenceParams": { + aminoType: "tendermint.types.EvidenceParams", + toAmino: (message: EvidenceParams) => ({ ...message }), + fromAmino: (object: EvidenceParams) => ({ ...object }), + }, + + "/tendermint.types.ValidatorParams": { + aminoType: "tendermint.types.ValidatorParams", + toAmino: (message: ValidatorParams) => ({ ...message }), + fromAmino: (object: ValidatorParams) => ({ ...object }), + }, + + "/tendermint.types.VersionParams": { + aminoType: "tendermint.types.VersionParams", + toAmino: (message: VersionParams) => ({ ...message }), + fromAmino: (object: VersionParams) => ({ ...object }), + }, + + "/tendermint.types.HashedParams": { + aminoType: "tendermint.types.HashedParams", + toAmino: (message: HashedParams) => ({ ...message }), + fromAmino: (object: HashedParams) => ({ ...object }), + }, + + "/tendermint.types.SynchronyParams": { + aminoType: "tendermint.types.SynchronyParams", + toAmino: (message: SynchronyParams) => ({ ...message }), + fromAmino: (object: SynchronyParams) => ({ ...object }), + }, + + "/tendermint.types.TimeoutParams": { + aminoType: "tendermint.types.TimeoutParams", + toAmino: (message: TimeoutParams) => ({ ...message }), + fromAmino: (object: TimeoutParams) => ({ ...object }), + }, + + "/tendermint.types.ABCIParams": { + aminoType: "tendermint.types.ABCIParams", + toAmino: (message: ABCIParams) => ({ ...message }), + fromAmino: (object: ABCIParams) => ({ ...object }), + }, +}; diff --git a/packages/cosmos/generated/encoding/tendermint/types/types.ts b/packages/cosmos/generated/encoding/tendermint/types/types.ts new file mode 100644 index 000000000..08be84eae --- /dev/null +++ b/packages/cosmos/generated/encoding/tendermint/types/types.ts @@ -0,0 +1,2045 @@ +import type { GeneratedType } from "@cosmjs/proto-signing"; + +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +import { Timestamp } from "../../google/protobuf/timestamp"; + +import { Proof } from "../crypto/proof"; + +import { Consensus } from "../version/types"; + +import { ValidatorSet } from "./validator"; + +import type { + BlockID as BlockID_type, + BlockMeta as BlockMeta_type, + CommitSig as CommitSig_type, + Commit as Commit_type, + Data as Data_type, + ExtendedCommitSig as ExtendedCommitSig_type, + ExtendedCommit as ExtendedCommit_type, + Header as Header_type, + LightBlock as LightBlock_type, + PartSetHeader as PartSetHeader_type, + Part as Part_type, + Proposal as Proposal_type, + SignedHeader as SignedHeader_type, + TxProof as TxProof_type, + Vote as Vote_type, +} from "../../../types/tendermint/types"; + +import { BlockIDFlag, SignedMsgType } from "../../../types/tendermint/types"; + +import type { DeepPartial, Exact, MessageFns } from "../../common"; + +export interface PartSetHeader extends PartSetHeader_type {} +export interface Part extends Part_type {} +export interface BlockID extends BlockID_type {} +export interface Header extends Header_type {} +export interface Data extends Data_type {} +export interface Vote extends Vote_type {} +export interface Commit extends Commit_type {} +export interface CommitSig extends CommitSig_type {} +export interface ExtendedCommit extends ExtendedCommit_type {} +export interface ExtendedCommitSig extends ExtendedCommitSig_type {} +export interface Proposal extends Proposal_type {} +export interface SignedHeader extends SignedHeader_type {} +export interface LightBlock extends LightBlock_type {} +export interface BlockMeta extends BlockMeta_type {} +export interface TxProof extends TxProof_type {} + +export const PartSetHeader: MessageFns = { + $type: "tendermint.types.PartSetHeader" as const, + + encode(message: PartSetHeader, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.total !== 0) { + writer.uint32(8).uint32(message.total); + } + if (message.hash.length !== 0) { + writer.uint32(18).bytes(message.hash); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): PartSetHeader { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePartSetHeader(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.total = reader.uint32(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.hash = reader.bytes(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): PartSetHeader { + return { + total: isSet(object.total) ? globalThis.Number(object.total) : 0, + hash: isSet(object.hash) ? bytesFromBase64(object.hash) : new Uint8Array(0), + }; + }, + + toJSON(message: PartSetHeader): unknown { + const obj: any = {}; + if (message.total !== 0) { + obj.total = Math.round(message.total); + } + if (message.hash.length !== 0) { + obj.hash = base64FromBytes(message.hash); + } + return obj; + }, + + create, I>>(base?: I): PartSetHeader { + return PartSetHeader.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): PartSetHeader { + const message = createBasePartSetHeader(); + message.total = object.total ?? 0; + message.hash = object.hash ?? new Uint8Array(0); + return message; + }, +}; + +export const Part: MessageFns = { + $type: "tendermint.types.Part" as const, + + encode(message: Part, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.index !== 0) { + writer.uint32(8).uint32(message.index); + } + if (message.bytes.length !== 0) { + writer.uint32(18).bytes(message.bytes); + } + if (message.proof !== undefined) { + Proof.encode(message.proof, writer.uint32(26).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Part { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePart(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.index = reader.uint32(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.bytes = reader.bytes(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.proof = Proof.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Part { + return { + index: isSet(object.index) ? globalThis.Number(object.index) : 0, + bytes: isSet(object.bytes) ? bytesFromBase64(object.bytes) : new Uint8Array(0), + proof: isSet(object.proof) ? Proof.fromJSON(object.proof) : undefined, + }; + }, + + toJSON(message: Part): unknown { + const obj: any = {}; + if (message.index !== 0) { + obj.index = Math.round(message.index); + } + if (message.bytes.length !== 0) { + obj.bytes = base64FromBytes(message.bytes); + } + if (message.proof !== undefined) { + obj.proof = Proof.toJSON(message.proof); + } + return obj; + }, + + create, I>>(base?: I): Part { + return Part.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Part { + const message = createBasePart(); + message.index = object.index ?? 0; + message.bytes = object.bytes ?? new Uint8Array(0); + message.proof = object.proof !== undefined && object.proof !== null ? Proof.fromPartial(object.proof) : undefined; + return message; + }, +}; + +export const BlockID: MessageFns = { + $type: "tendermint.types.BlockID" as const, + + encode(message: BlockID, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.hash.length !== 0) { + writer.uint32(10).bytes(message.hash); + } + if (message.part_set_header !== undefined) { + PartSetHeader.encode(message.part_set_header, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): BlockID { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseBlockID(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.hash = reader.bytes(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.part_set_header = PartSetHeader.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): BlockID { + return { + hash: isSet(object.hash) ? bytesFromBase64(object.hash) : new Uint8Array(0), + part_set_header: isSet(object.part_set_header) ? PartSetHeader.fromJSON(object.part_set_header) : undefined, + }; + }, + + toJSON(message: BlockID): unknown { + const obj: any = {}; + if (message.hash.length !== 0) { + obj.hash = base64FromBytes(message.hash); + } + if (message.part_set_header !== undefined) { + obj.part_set_header = PartSetHeader.toJSON(message.part_set_header); + } + return obj; + }, + + create, I>>(base?: I): BlockID { + return BlockID.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): BlockID { + const message = createBaseBlockID(); + message.hash = object.hash ?? new Uint8Array(0); + message.part_set_header = + object.part_set_header !== undefined && object.part_set_header !== null ? PartSetHeader.fromPartial(object.part_set_header) : undefined; + return message; + }, +}; + +export const Header: MessageFns = { + $type: "tendermint.types.Header" as const, + + encode(message: Header, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.version !== undefined) { + Consensus.encode(message.version, writer.uint32(10).fork()).join(); + } + if (message.chain_id !== "") { + writer.uint32(18).string(message.chain_id); + } + if (message.height !== 0) { + writer.uint32(24).int64(message.height); + } + if (message.time !== undefined) { + Timestamp.encode(toTimestamp(message.time), writer.uint32(34).fork()).join(); + } + if (message.last_block_id !== undefined) { + BlockID.encode(message.last_block_id, writer.uint32(42).fork()).join(); + } + if (message.last_commit_hash.length !== 0) { + writer.uint32(50).bytes(message.last_commit_hash); + } + if (message.data_hash.length !== 0) { + writer.uint32(58).bytes(message.data_hash); + } + if (message.validators_hash.length !== 0) { + writer.uint32(66).bytes(message.validators_hash); + } + if (message.next_validators_hash.length !== 0) { + writer.uint32(74).bytes(message.next_validators_hash); + } + if (message.consensus_hash.length !== 0) { + writer.uint32(82).bytes(message.consensus_hash); + } + if (message.app_hash.length !== 0) { + writer.uint32(90).bytes(message.app_hash); + } + if (message.last_results_hash.length !== 0) { + writer.uint32(98).bytes(message.last_results_hash); + } + if (message.evidence_hash.length !== 0) { + writer.uint32(106).bytes(message.evidence_hash); + } + if (message.proposer_address.length !== 0) { + writer.uint32(114).bytes(message.proposer_address); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Header { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseHeader(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.version = Consensus.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.chain_id = reader.string(); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.height = longToNumber(reader.int64()); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.time = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.last_block_id = BlockID.decode(reader, reader.uint32()); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.last_commit_hash = reader.bytes(); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.data_hash = reader.bytes(); + continue; + case 8: + if (tag !== 66) { + break; + } + + message.validators_hash = reader.bytes(); + continue; + case 9: + if (tag !== 74) { + break; + } + + message.next_validators_hash = reader.bytes(); + continue; + case 10: + if (tag !== 82) { + break; + } + + message.consensus_hash = reader.bytes(); + continue; + case 11: + if (tag !== 90) { + break; + } + + message.app_hash = reader.bytes(); + continue; + case 12: + if (tag !== 98) { + break; + } + + message.last_results_hash = reader.bytes(); + continue; + case 13: + if (tag !== 106) { + break; + } + + message.evidence_hash = reader.bytes(); + continue; + case 14: + if (tag !== 114) { + break; + } + + message.proposer_address = reader.bytes(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Header { + return { + version: isSet(object.version) ? Consensus.fromJSON(object.version) : undefined, + chain_id: isSet(object.chain_id) ? globalThis.String(object.chain_id) : "", + height: isSet(object.height) ? globalThis.Number(object.height) : 0, + time: isSet(object.time) ? fromJsonTimestamp(object.time) : undefined, + last_block_id: isSet(object.last_block_id) ? BlockID.fromJSON(object.last_block_id) : undefined, + last_commit_hash: isSet(object.last_commit_hash) ? bytesFromBase64(object.last_commit_hash) : new Uint8Array(0), + data_hash: isSet(object.data_hash) ? bytesFromBase64(object.data_hash) : new Uint8Array(0), + validators_hash: isSet(object.validators_hash) ? bytesFromBase64(object.validators_hash) : new Uint8Array(0), + next_validators_hash: isSet(object.next_validators_hash) ? bytesFromBase64(object.next_validators_hash) : new Uint8Array(0), + consensus_hash: isSet(object.consensus_hash) ? bytesFromBase64(object.consensus_hash) : new Uint8Array(0), + app_hash: isSet(object.app_hash) ? bytesFromBase64(object.app_hash) : new Uint8Array(0), + last_results_hash: isSet(object.last_results_hash) ? bytesFromBase64(object.last_results_hash) : new Uint8Array(0), + evidence_hash: isSet(object.evidence_hash) ? bytesFromBase64(object.evidence_hash) : new Uint8Array(0), + proposer_address: isSet(object.proposer_address) ? bytesFromBase64(object.proposer_address) : new Uint8Array(0), + }; + }, + + toJSON(message: Header): unknown { + const obj: any = {}; + if (message.version !== undefined) { + obj.version = Consensus.toJSON(message.version); + } + if (message.chain_id !== "") { + obj.chain_id = message.chain_id; + } + if (message.height !== 0) { + obj.height = Math.round(message.height); + } + if (message.time !== undefined) { + obj.time = message.time.toISOString(); + } + if (message.last_block_id !== undefined) { + obj.last_block_id = BlockID.toJSON(message.last_block_id); + } + if (message.last_commit_hash.length !== 0) { + obj.last_commit_hash = base64FromBytes(message.last_commit_hash); + } + if (message.data_hash.length !== 0) { + obj.data_hash = base64FromBytes(message.data_hash); + } + if (message.validators_hash.length !== 0) { + obj.validators_hash = base64FromBytes(message.validators_hash); + } + if (message.next_validators_hash.length !== 0) { + obj.next_validators_hash = base64FromBytes(message.next_validators_hash); + } + if (message.consensus_hash.length !== 0) { + obj.consensus_hash = base64FromBytes(message.consensus_hash); + } + if (message.app_hash.length !== 0) { + obj.app_hash = base64FromBytes(message.app_hash); + } + if (message.last_results_hash.length !== 0) { + obj.last_results_hash = base64FromBytes(message.last_results_hash); + } + if (message.evidence_hash.length !== 0) { + obj.evidence_hash = base64FromBytes(message.evidence_hash); + } + if (message.proposer_address.length !== 0) { + obj.proposer_address = base64FromBytes(message.proposer_address); + } + return obj; + }, + + create, I>>(base?: I): Header { + return Header.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Header { + const message = createBaseHeader(); + message.version = object.version !== undefined && object.version !== null ? Consensus.fromPartial(object.version) : undefined; + message.chain_id = object.chain_id ?? ""; + message.height = object.height ?? 0; + message.time = object.time ?? undefined; + message.last_block_id = object.last_block_id !== undefined && object.last_block_id !== null ? BlockID.fromPartial(object.last_block_id) : undefined; + message.last_commit_hash = object.last_commit_hash ?? new Uint8Array(0); + message.data_hash = object.data_hash ?? new Uint8Array(0); + message.validators_hash = object.validators_hash ?? new Uint8Array(0); + message.next_validators_hash = object.next_validators_hash ?? new Uint8Array(0); + message.consensus_hash = object.consensus_hash ?? new Uint8Array(0); + message.app_hash = object.app_hash ?? new Uint8Array(0); + message.last_results_hash = object.last_results_hash ?? new Uint8Array(0); + message.evidence_hash = object.evidence_hash ?? new Uint8Array(0); + message.proposer_address = object.proposer_address ?? new Uint8Array(0); + return message; + }, +}; + +export const Data: MessageFns = { + $type: "tendermint.types.Data" as const, + + encode(message: Data, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.txs) { + writer.uint32(10).bytes(v!); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Data { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseData(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.txs.push(reader.bytes()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Data { + return { txs: globalThis.Array.isArray(object?.txs) ? object.txs.map((e: any) => bytesFromBase64(e)) : [] }; + }, + + toJSON(message: Data): unknown { + const obj: any = {}; + if (message.txs?.length) { + obj.txs = message.txs.map((e) => base64FromBytes(e)); + } + return obj; + }, + + create, I>>(base?: I): Data { + return Data.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Data { + const message = createBaseData(); + message.txs = object.txs?.map((e) => e) || []; + return message; + }, +}; + +export const Vote: MessageFns = { + $type: "tendermint.types.Vote" as const, + + encode(message: Vote, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.type !== 0) { + writer.uint32(8).int32(message.type); + } + if (message.height !== 0) { + writer.uint32(16).int64(message.height); + } + if (message.round !== 0) { + writer.uint32(24).int32(message.round); + } + if (message.block_id !== undefined) { + BlockID.encode(message.block_id, writer.uint32(34).fork()).join(); + } + if (message.timestamp !== undefined) { + Timestamp.encode(toTimestamp(message.timestamp), writer.uint32(42).fork()).join(); + } + if (message.validator_address.length !== 0) { + writer.uint32(50).bytes(message.validator_address); + } + if (message.validator_index !== 0) { + writer.uint32(56).int32(message.validator_index); + } + if (message.signature.length !== 0) { + writer.uint32(66).bytes(message.signature); + } + if (message.extension.length !== 0) { + writer.uint32(74).bytes(message.extension); + } + if (message.extension_signature.length !== 0) { + writer.uint32(82).bytes(message.extension_signature); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Vote { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseVote(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.type = reader.int32() as any; + continue; + case 2: + if (tag !== 16) { + break; + } + + message.height = longToNumber(reader.int64()); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.round = reader.int32(); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.block_id = BlockID.decode(reader, reader.uint32()); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.timestamp = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.validator_address = reader.bytes(); + continue; + case 7: + if (tag !== 56) { + break; + } + + message.validator_index = reader.int32(); + continue; + case 8: + if (tag !== 66) { + break; + } + + message.signature = reader.bytes(); + continue; + case 9: + if (tag !== 74) { + break; + } + + message.extension = reader.bytes(); + continue; + case 10: + if (tag !== 82) { + break; + } + + message.extension_signature = reader.bytes(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Vote { + return { + type: isSet(object.type) ? signedMsgTypeFromJSON(object.type) : 0, + height: isSet(object.height) ? globalThis.Number(object.height) : 0, + round: isSet(object.round) ? globalThis.Number(object.round) : 0, + block_id: isSet(object.block_id) ? BlockID.fromJSON(object.block_id) : undefined, + timestamp: isSet(object.timestamp) ? fromJsonTimestamp(object.timestamp) : undefined, + validator_address: isSet(object.validator_address) ? bytesFromBase64(object.validator_address) : new Uint8Array(0), + validator_index: isSet(object.validator_index) ? globalThis.Number(object.validator_index) : 0, + signature: isSet(object.signature) ? bytesFromBase64(object.signature) : new Uint8Array(0), + extension: isSet(object.extension) ? bytesFromBase64(object.extension) : new Uint8Array(0), + extension_signature: isSet(object.extension_signature) ? bytesFromBase64(object.extension_signature) : new Uint8Array(0), + }; + }, + + toJSON(message: Vote): unknown { + const obj: any = {}; + if (message.type !== 0) { + obj.type = signedMsgTypeToJSON(message.type); + } + if (message.height !== 0) { + obj.height = Math.round(message.height); + } + if (message.round !== 0) { + obj.round = Math.round(message.round); + } + if (message.block_id !== undefined) { + obj.block_id = BlockID.toJSON(message.block_id); + } + if (message.timestamp !== undefined) { + obj.timestamp = message.timestamp.toISOString(); + } + if (message.validator_address.length !== 0) { + obj.validator_address = base64FromBytes(message.validator_address); + } + if (message.validator_index !== 0) { + obj.validator_index = Math.round(message.validator_index); + } + if (message.signature.length !== 0) { + obj.signature = base64FromBytes(message.signature); + } + if (message.extension.length !== 0) { + obj.extension = base64FromBytes(message.extension); + } + if (message.extension_signature.length !== 0) { + obj.extension_signature = base64FromBytes(message.extension_signature); + } + return obj; + }, + + create, I>>(base?: I): Vote { + return Vote.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Vote { + const message = createBaseVote(); + message.type = object.type ?? 0; + message.height = object.height ?? 0; + message.round = object.round ?? 0; + message.block_id = object.block_id !== undefined && object.block_id !== null ? BlockID.fromPartial(object.block_id) : undefined; + message.timestamp = object.timestamp ?? undefined; + message.validator_address = object.validator_address ?? new Uint8Array(0); + message.validator_index = object.validator_index ?? 0; + message.signature = object.signature ?? new Uint8Array(0); + message.extension = object.extension ?? new Uint8Array(0); + message.extension_signature = object.extension_signature ?? new Uint8Array(0); + return message; + }, +}; + +export const Commit: MessageFns = { + $type: "tendermint.types.Commit" as const, + + encode(message: Commit, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.height !== 0) { + writer.uint32(8).int64(message.height); + } + if (message.round !== 0) { + writer.uint32(16).int32(message.round); + } + if (message.block_id !== undefined) { + BlockID.encode(message.block_id, writer.uint32(26).fork()).join(); + } + for (const v of message.signatures) { + CommitSig.encode(v!, writer.uint32(34).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Commit { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseCommit(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.height = longToNumber(reader.int64()); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.round = reader.int32(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.block_id = BlockID.decode(reader, reader.uint32()); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.signatures.push(CommitSig.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Commit { + return { + height: isSet(object.height) ? globalThis.Number(object.height) : 0, + round: isSet(object.round) ? globalThis.Number(object.round) : 0, + block_id: isSet(object.block_id) ? BlockID.fromJSON(object.block_id) : undefined, + signatures: globalThis.Array.isArray(object?.signatures) ? object.signatures.map((e: any) => CommitSig.fromJSON(e)) : [], + }; + }, + + toJSON(message: Commit): unknown { + const obj: any = {}; + if (message.height !== 0) { + obj.height = Math.round(message.height); + } + if (message.round !== 0) { + obj.round = Math.round(message.round); + } + if (message.block_id !== undefined) { + obj.block_id = BlockID.toJSON(message.block_id); + } + if (message.signatures?.length) { + obj.signatures = message.signatures.map((e) => CommitSig.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): Commit { + return Commit.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Commit { + const message = createBaseCommit(); + message.height = object.height ?? 0; + message.round = object.round ?? 0; + message.block_id = object.block_id !== undefined && object.block_id !== null ? BlockID.fromPartial(object.block_id) : undefined; + message.signatures = object.signatures?.map((e) => CommitSig.fromPartial(e)) || []; + return message; + }, +}; + +export const CommitSig: MessageFns = { + $type: "tendermint.types.CommitSig" as const, + + encode(message: CommitSig, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.block_id_flag !== 0) { + writer.uint32(8).int32(message.block_id_flag); + } + if (message.validator_address.length !== 0) { + writer.uint32(18).bytes(message.validator_address); + } + if (message.timestamp !== undefined) { + Timestamp.encode(toTimestamp(message.timestamp), writer.uint32(26).fork()).join(); + } + if (message.signature.length !== 0) { + writer.uint32(34).bytes(message.signature); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): CommitSig { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseCommitSig(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.block_id_flag = reader.int32() as any; + continue; + case 2: + if (tag !== 18) { + break; + } + + message.validator_address = reader.bytes(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.timestamp = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.signature = reader.bytes(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): CommitSig { + return { + block_id_flag: isSet(object.block_id_flag) ? blockIDFlagFromJSON(object.block_id_flag) : 0, + validator_address: isSet(object.validator_address) ? bytesFromBase64(object.validator_address) : new Uint8Array(0), + timestamp: isSet(object.timestamp) ? fromJsonTimestamp(object.timestamp) : undefined, + signature: isSet(object.signature) ? bytesFromBase64(object.signature) : new Uint8Array(0), + }; + }, + + toJSON(message: CommitSig): unknown { + const obj: any = {}; + if (message.block_id_flag !== 0) { + obj.block_id_flag = blockIDFlagToJSON(message.block_id_flag); + } + if (message.validator_address.length !== 0) { + obj.validator_address = base64FromBytes(message.validator_address); + } + if (message.timestamp !== undefined) { + obj.timestamp = message.timestamp.toISOString(); + } + if (message.signature.length !== 0) { + obj.signature = base64FromBytes(message.signature); + } + return obj; + }, + + create, I>>(base?: I): CommitSig { + return CommitSig.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): CommitSig { + const message = createBaseCommitSig(); + message.block_id_flag = object.block_id_flag ?? 0; + message.validator_address = object.validator_address ?? new Uint8Array(0); + message.timestamp = object.timestamp ?? undefined; + message.signature = object.signature ?? new Uint8Array(0); + return message; + }, +}; + +export const ExtendedCommit: MessageFns = { + $type: "tendermint.types.ExtendedCommit" as const, + + encode(message: ExtendedCommit, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.height !== 0) { + writer.uint32(8).int64(message.height); + } + if (message.round !== 0) { + writer.uint32(16).int32(message.round); + } + if (message.block_id !== undefined) { + BlockID.encode(message.block_id, writer.uint32(26).fork()).join(); + } + for (const v of message.extended_signatures) { + ExtendedCommitSig.encode(v!, writer.uint32(34).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ExtendedCommit { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseExtendedCommit(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.height = longToNumber(reader.int64()); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.round = reader.int32(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.block_id = BlockID.decode(reader, reader.uint32()); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.extended_signatures.push(ExtendedCommitSig.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ExtendedCommit { + return { + height: isSet(object.height) ? globalThis.Number(object.height) : 0, + round: isSet(object.round) ? globalThis.Number(object.round) : 0, + block_id: isSet(object.block_id) ? BlockID.fromJSON(object.block_id) : undefined, + extended_signatures: globalThis.Array.isArray(object?.extended_signatures) + ? object.extended_signatures.map((e: any) => ExtendedCommitSig.fromJSON(e)) + : [], + }; + }, + + toJSON(message: ExtendedCommit): unknown { + const obj: any = {}; + if (message.height !== 0) { + obj.height = Math.round(message.height); + } + if (message.round !== 0) { + obj.round = Math.round(message.round); + } + if (message.block_id !== undefined) { + obj.block_id = BlockID.toJSON(message.block_id); + } + if (message.extended_signatures?.length) { + obj.extended_signatures = message.extended_signatures.map((e) => ExtendedCommitSig.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): ExtendedCommit { + return ExtendedCommit.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ExtendedCommit { + const message = createBaseExtendedCommit(); + message.height = object.height ?? 0; + message.round = object.round ?? 0; + message.block_id = object.block_id !== undefined && object.block_id !== null ? BlockID.fromPartial(object.block_id) : undefined; + message.extended_signatures = object.extended_signatures?.map((e) => ExtendedCommitSig.fromPartial(e)) || []; + return message; + }, +}; + +export const ExtendedCommitSig: MessageFns = { + $type: "tendermint.types.ExtendedCommitSig" as const, + + encode(message: ExtendedCommitSig, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.block_id_flag !== 0) { + writer.uint32(8).int32(message.block_id_flag); + } + if (message.validator_address.length !== 0) { + writer.uint32(18).bytes(message.validator_address); + } + if (message.timestamp !== undefined) { + Timestamp.encode(toTimestamp(message.timestamp), writer.uint32(26).fork()).join(); + } + if (message.signature.length !== 0) { + writer.uint32(34).bytes(message.signature); + } + if (message.extension.length !== 0) { + writer.uint32(42).bytes(message.extension); + } + if (message.extension_signature.length !== 0) { + writer.uint32(50).bytes(message.extension_signature); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ExtendedCommitSig { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseExtendedCommitSig(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.block_id_flag = reader.int32() as any; + continue; + case 2: + if (tag !== 18) { + break; + } + + message.validator_address = reader.bytes(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.timestamp = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + continue; + case 4: + if (tag !== 34) { + break; + } + + message.signature = reader.bytes(); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.extension = reader.bytes(); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.extension_signature = reader.bytes(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ExtendedCommitSig { + return { + block_id_flag: isSet(object.block_id_flag) ? blockIDFlagFromJSON(object.block_id_flag) : 0, + validator_address: isSet(object.validator_address) ? bytesFromBase64(object.validator_address) : new Uint8Array(0), + timestamp: isSet(object.timestamp) ? fromJsonTimestamp(object.timestamp) : undefined, + signature: isSet(object.signature) ? bytesFromBase64(object.signature) : new Uint8Array(0), + extension: isSet(object.extension) ? bytesFromBase64(object.extension) : new Uint8Array(0), + extension_signature: isSet(object.extension_signature) ? bytesFromBase64(object.extension_signature) : new Uint8Array(0), + }; + }, + + toJSON(message: ExtendedCommitSig): unknown { + const obj: any = {}; + if (message.block_id_flag !== 0) { + obj.block_id_flag = blockIDFlagToJSON(message.block_id_flag); + } + if (message.validator_address.length !== 0) { + obj.validator_address = base64FromBytes(message.validator_address); + } + if (message.timestamp !== undefined) { + obj.timestamp = message.timestamp.toISOString(); + } + if (message.signature.length !== 0) { + obj.signature = base64FromBytes(message.signature); + } + if (message.extension.length !== 0) { + obj.extension = base64FromBytes(message.extension); + } + if (message.extension_signature.length !== 0) { + obj.extension_signature = base64FromBytes(message.extension_signature); + } + return obj; + }, + + create, I>>(base?: I): ExtendedCommitSig { + return ExtendedCommitSig.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ExtendedCommitSig { + const message = createBaseExtendedCommitSig(); + message.block_id_flag = object.block_id_flag ?? 0; + message.validator_address = object.validator_address ?? new Uint8Array(0); + message.timestamp = object.timestamp ?? undefined; + message.signature = object.signature ?? new Uint8Array(0); + message.extension = object.extension ?? new Uint8Array(0); + message.extension_signature = object.extension_signature ?? new Uint8Array(0); + return message; + }, +}; + +export const Proposal: MessageFns = { + $type: "tendermint.types.Proposal" as const, + + encode(message: Proposal, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.type !== 0) { + writer.uint32(8).int32(message.type); + } + if (message.height !== 0) { + writer.uint32(16).int64(message.height); + } + if (message.round !== 0) { + writer.uint32(24).int32(message.round); + } + if (message.pol_round !== 0) { + writer.uint32(32).int32(message.pol_round); + } + if (message.block_id !== undefined) { + BlockID.encode(message.block_id, writer.uint32(42).fork()).join(); + } + if (message.timestamp !== undefined) { + Timestamp.encode(toTimestamp(message.timestamp), writer.uint32(50).fork()).join(); + } + if (message.signature.length !== 0) { + writer.uint32(58).bytes(message.signature); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Proposal { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseProposal(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.type = reader.int32() as any; + continue; + case 2: + if (tag !== 16) { + break; + } + + message.height = longToNumber(reader.int64()); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.round = reader.int32(); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.pol_round = reader.int32(); + continue; + case 5: + if (tag !== 42) { + break; + } + + message.block_id = BlockID.decode(reader, reader.uint32()); + continue; + case 6: + if (tag !== 50) { + break; + } + + message.timestamp = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + continue; + case 7: + if (tag !== 58) { + break; + } + + message.signature = reader.bytes(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Proposal { + return { + type: isSet(object.type) ? signedMsgTypeFromJSON(object.type) : 0, + height: isSet(object.height) ? globalThis.Number(object.height) : 0, + round: isSet(object.round) ? globalThis.Number(object.round) : 0, + pol_round: isSet(object.pol_round) ? globalThis.Number(object.pol_round) : 0, + block_id: isSet(object.block_id) ? BlockID.fromJSON(object.block_id) : undefined, + timestamp: isSet(object.timestamp) ? fromJsonTimestamp(object.timestamp) : undefined, + signature: isSet(object.signature) ? bytesFromBase64(object.signature) : new Uint8Array(0), + }; + }, + + toJSON(message: Proposal): unknown { + const obj: any = {}; + if (message.type !== 0) { + obj.type = signedMsgTypeToJSON(message.type); + } + if (message.height !== 0) { + obj.height = Math.round(message.height); + } + if (message.round !== 0) { + obj.round = Math.round(message.round); + } + if (message.pol_round !== 0) { + obj.pol_round = Math.round(message.pol_round); + } + if (message.block_id !== undefined) { + obj.block_id = BlockID.toJSON(message.block_id); + } + if (message.timestamp !== undefined) { + obj.timestamp = message.timestamp.toISOString(); + } + if (message.signature.length !== 0) { + obj.signature = base64FromBytes(message.signature); + } + return obj; + }, + + create, I>>(base?: I): Proposal { + return Proposal.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Proposal { + const message = createBaseProposal(); + message.type = object.type ?? 0; + message.height = object.height ?? 0; + message.round = object.round ?? 0; + message.pol_round = object.pol_round ?? 0; + message.block_id = object.block_id !== undefined && object.block_id !== null ? BlockID.fromPartial(object.block_id) : undefined; + message.timestamp = object.timestamp ?? undefined; + message.signature = object.signature ?? new Uint8Array(0); + return message; + }, +}; + +export const SignedHeader: MessageFns = { + $type: "tendermint.types.SignedHeader" as const, + + encode(message: SignedHeader, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.header !== undefined) { + Header.encode(message.header, writer.uint32(10).fork()).join(); + } + if (message.commit !== undefined) { + Commit.encode(message.commit, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): SignedHeader { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseSignedHeader(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.header = Header.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.commit = Commit.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): SignedHeader { + return { + header: isSet(object.header) ? Header.fromJSON(object.header) : undefined, + commit: isSet(object.commit) ? Commit.fromJSON(object.commit) : undefined, + }; + }, + + toJSON(message: SignedHeader): unknown { + const obj: any = {}; + if (message.header !== undefined) { + obj.header = Header.toJSON(message.header); + } + if (message.commit !== undefined) { + obj.commit = Commit.toJSON(message.commit); + } + return obj; + }, + + create, I>>(base?: I): SignedHeader { + return SignedHeader.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): SignedHeader { + const message = createBaseSignedHeader(); + message.header = object.header !== undefined && object.header !== null ? Header.fromPartial(object.header) : undefined; + message.commit = object.commit !== undefined && object.commit !== null ? Commit.fromPartial(object.commit) : undefined; + return message; + }, +}; + +export const LightBlock: MessageFns = { + $type: "tendermint.types.LightBlock" as const, + + encode(message: LightBlock, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.signed_header !== undefined) { + SignedHeader.encode(message.signed_header, writer.uint32(10).fork()).join(); + } + if (message.validator_set !== undefined) { + ValidatorSet.encode(message.validator_set, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): LightBlock { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseLightBlock(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.signed_header = SignedHeader.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.validator_set = ValidatorSet.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): LightBlock { + return { + signed_header: isSet(object.signed_header) ? SignedHeader.fromJSON(object.signed_header) : undefined, + validator_set: isSet(object.validator_set) ? ValidatorSet.fromJSON(object.validator_set) : undefined, + }; + }, + + toJSON(message: LightBlock): unknown { + const obj: any = {}; + if (message.signed_header !== undefined) { + obj.signed_header = SignedHeader.toJSON(message.signed_header); + } + if (message.validator_set !== undefined) { + obj.validator_set = ValidatorSet.toJSON(message.validator_set); + } + return obj; + }, + + create, I>>(base?: I): LightBlock { + return LightBlock.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): LightBlock { + const message = createBaseLightBlock(); + message.signed_header = object.signed_header !== undefined && object.signed_header !== null ? SignedHeader.fromPartial(object.signed_header) : undefined; + message.validator_set = object.validator_set !== undefined && object.validator_set !== null ? ValidatorSet.fromPartial(object.validator_set) : undefined; + return message; + }, +}; + +export const BlockMeta: MessageFns = { + $type: "tendermint.types.BlockMeta" as const, + + encode(message: BlockMeta, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.block_id !== undefined) { + BlockID.encode(message.block_id, writer.uint32(10).fork()).join(); + } + if (message.block_size !== 0) { + writer.uint32(16).int64(message.block_size); + } + if (message.header !== undefined) { + Header.encode(message.header, writer.uint32(26).fork()).join(); + } + if (message.num_txs !== 0) { + writer.uint32(32).int64(message.num_txs); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): BlockMeta { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseBlockMeta(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.block_id = BlockID.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.block_size = longToNumber(reader.int64()); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.header = Header.decode(reader, reader.uint32()); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.num_txs = longToNumber(reader.int64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): BlockMeta { + return { + block_id: isSet(object.block_id) ? BlockID.fromJSON(object.block_id) : undefined, + block_size: isSet(object.block_size) ? globalThis.Number(object.block_size) : 0, + header: isSet(object.header) ? Header.fromJSON(object.header) : undefined, + num_txs: isSet(object.num_txs) ? globalThis.Number(object.num_txs) : 0, + }; + }, + + toJSON(message: BlockMeta): unknown { + const obj: any = {}; + if (message.block_id !== undefined) { + obj.block_id = BlockID.toJSON(message.block_id); + } + if (message.block_size !== 0) { + obj.block_size = Math.round(message.block_size); + } + if (message.header !== undefined) { + obj.header = Header.toJSON(message.header); + } + if (message.num_txs !== 0) { + obj.num_txs = Math.round(message.num_txs); + } + return obj; + }, + + create, I>>(base?: I): BlockMeta { + return BlockMeta.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): BlockMeta { + const message = createBaseBlockMeta(); + message.block_id = object.block_id !== undefined && object.block_id !== null ? BlockID.fromPartial(object.block_id) : undefined; + message.block_size = object.block_size ?? 0; + message.header = object.header !== undefined && object.header !== null ? Header.fromPartial(object.header) : undefined; + message.num_txs = object.num_txs ?? 0; + return message; + }, +}; + +export const TxProof: MessageFns = { + $type: "tendermint.types.TxProof" as const, + + encode(message: TxProof, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.root_hash.length !== 0) { + writer.uint32(10).bytes(message.root_hash); + } + if (message.data.length !== 0) { + writer.uint32(18).bytes(message.data); + } + if (message.proof !== undefined) { + Proof.encode(message.proof, writer.uint32(26).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): TxProof { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseTxProof(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.root_hash = reader.bytes(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.data = reader.bytes(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.proof = Proof.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): TxProof { + return { + root_hash: isSet(object.root_hash) ? bytesFromBase64(object.root_hash) : new Uint8Array(0), + data: isSet(object.data) ? bytesFromBase64(object.data) : new Uint8Array(0), + proof: isSet(object.proof) ? Proof.fromJSON(object.proof) : undefined, + }; + }, + + toJSON(message: TxProof): unknown { + const obj: any = {}; + if (message.root_hash.length !== 0) { + obj.root_hash = base64FromBytes(message.root_hash); + } + if (message.data.length !== 0) { + obj.data = base64FromBytes(message.data); + } + if (message.proof !== undefined) { + obj.proof = Proof.toJSON(message.proof); + } + return obj; + }, + + create, I>>(base?: I): TxProof { + return TxProof.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): TxProof { + const message = createBaseTxProof(); + message.root_hash = object.root_hash ?? new Uint8Array(0); + message.data = object.data ?? new Uint8Array(0); + message.proof = object.proof !== undefined && object.proof !== null ? Proof.fromPartial(object.proof) : undefined; + return message; + }, +}; + +export function blockIDFlagFromJSON(object: any): BlockIDFlag { + switch (object) { + case 0: + case "BLOCK_ID_FLAG_UNKNOWN": + return BlockIDFlag.BLOCK_ID_FLAG_UNKNOWN; + case 1: + case "BLOCK_ID_FLAG_ABSENT": + return BlockIDFlag.BLOCK_ID_FLAG_ABSENT; + case 2: + case "BLOCK_ID_FLAG_COMMIT": + return BlockIDFlag.BLOCK_ID_FLAG_COMMIT; + case 3: + case "BLOCK_ID_FLAG_NIL": + return BlockIDFlag.BLOCK_ID_FLAG_NIL; + case -1: + case "UNRECOGNIZED": + default: + return BlockIDFlag.UNRECOGNIZED; + } +} + +export function blockIDFlagToJSON(object: BlockIDFlag): string { + switch (object) { + case BlockIDFlag.BLOCK_ID_FLAG_UNKNOWN: + return "BLOCK_ID_FLAG_UNKNOWN"; + case BlockIDFlag.BLOCK_ID_FLAG_ABSENT: + return "BLOCK_ID_FLAG_ABSENT"; + case BlockIDFlag.BLOCK_ID_FLAG_COMMIT: + return "BLOCK_ID_FLAG_COMMIT"; + case BlockIDFlag.BLOCK_ID_FLAG_NIL: + return "BLOCK_ID_FLAG_NIL"; + case BlockIDFlag.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +export function signedMsgTypeFromJSON(object: any): SignedMsgType { + switch (object) { + case 0: + case "SIGNED_MSG_TYPE_UNKNOWN": + return SignedMsgType.SIGNED_MSG_TYPE_UNKNOWN; + case 1: + case "SIGNED_MSG_TYPE_PREVOTE": + return SignedMsgType.SIGNED_MSG_TYPE_PREVOTE; + case 2: + case "SIGNED_MSG_TYPE_PRECOMMIT": + return SignedMsgType.SIGNED_MSG_TYPE_PRECOMMIT; + case 32: + case "SIGNED_MSG_TYPE_PROPOSAL": + return SignedMsgType.SIGNED_MSG_TYPE_PROPOSAL; + case -1: + case "UNRECOGNIZED": + default: + return SignedMsgType.UNRECOGNIZED; + } +} + +export function signedMsgTypeToJSON(object: SignedMsgType): string { + switch (object) { + case SignedMsgType.SIGNED_MSG_TYPE_UNKNOWN: + return "SIGNED_MSG_TYPE_UNKNOWN"; + case SignedMsgType.SIGNED_MSG_TYPE_PREVOTE: + return "SIGNED_MSG_TYPE_PREVOTE"; + case SignedMsgType.SIGNED_MSG_TYPE_PRECOMMIT: + return "SIGNED_MSG_TYPE_PRECOMMIT"; + case SignedMsgType.SIGNED_MSG_TYPE_PROPOSAL: + return "SIGNED_MSG_TYPE_PROPOSAL"; + case SignedMsgType.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} + +function createBasePartSetHeader(): PartSetHeader { + return { total: 0, hash: new Uint8Array(0) }; +} + +function createBasePart(): Part { + return { index: 0, bytes: new Uint8Array(0), proof: undefined }; +} + +function createBaseBlockID(): BlockID { + return { hash: new Uint8Array(0), part_set_header: undefined }; +} + +function createBaseHeader(): Header { + return { + version: undefined, + chain_id: "", + height: 0, + time: undefined, + last_block_id: undefined, + last_commit_hash: new Uint8Array(0), + data_hash: new Uint8Array(0), + validators_hash: new Uint8Array(0), + next_validators_hash: new Uint8Array(0), + consensus_hash: new Uint8Array(0), + app_hash: new Uint8Array(0), + last_results_hash: new Uint8Array(0), + evidence_hash: new Uint8Array(0), + proposer_address: new Uint8Array(0), + }; +} + +function createBaseData(): Data { + return { txs: [] }; +} + +function createBaseVote(): Vote { + return { + type: 0, + height: 0, + round: 0, + block_id: undefined, + timestamp: undefined, + validator_address: new Uint8Array(0), + validator_index: 0, + signature: new Uint8Array(0), + extension: new Uint8Array(0), + extension_signature: new Uint8Array(0), + }; +} + +function createBaseCommit(): Commit { + return { height: 0, round: 0, block_id: undefined, signatures: [] }; +} + +function createBaseCommitSig(): CommitSig { + return { block_id_flag: 0, validator_address: new Uint8Array(0), timestamp: undefined, signature: new Uint8Array(0) }; +} + +function createBaseExtendedCommit(): ExtendedCommit { + return { height: 0, round: 0, block_id: undefined, extended_signatures: [] }; +} + +function createBaseExtendedCommitSig(): ExtendedCommitSig { + return { + block_id_flag: 0, + validator_address: new Uint8Array(0), + timestamp: undefined, + signature: new Uint8Array(0), + extension: new Uint8Array(0), + extension_signature: new Uint8Array(0), + }; +} + +function createBaseProposal(): Proposal { + return { + type: 0, + height: 0, + round: 0, + pol_round: 0, + block_id: undefined, + timestamp: undefined, + signature: new Uint8Array(0), + }; +} + +function createBaseSignedHeader(): SignedHeader { + return { header: undefined, commit: undefined }; +} + +function createBaseLightBlock(): LightBlock { + return { signed_header: undefined, validator_set: undefined }; +} + +function createBaseBlockMeta(): BlockMeta { + return { block_id: undefined, block_size: 0, header: undefined, num_txs: 0 }; +} + +function createBaseTxProof(): TxProof { + return { root_hash: new Uint8Array(0), data: new Uint8Array(0), proof: undefined }; +} + +function bytesFromBase64(b64: string): Uint8Array { + if ((globalThis as any).Buffer) { + return Uint8Array.from(globalThis.Buffer.from(b64, "base64")); + } else { + const bin = globalThis.atob(b64); + const arr = new Uint8Array(bin.length); + for (let i = 0; i < bin.length; ++i) { + arr[i] = bin.charCodeAt(i); + } + return arr; + } +} + +function base64FromBytes(arr: Uint8Array): string { + if ((globalThis as any).Buffer) { + return globalThis.Buffer.from(arr).toString("base64"); + } else { + const bin: string[] = []; + arr.forEach((byte) => { + bin.push(globalThis.String.fromCharCode(byte)); + }); + return globalThis.btoa(bin.join("")); + } +} + +function toTimestamp(date: Date): Timestamp { + const seconds = Math.trunc(date.getTime() / 1_000); + const nanos = (date.getTime() % 1_000) * 1_000_000; + return { seconds, nanos }; +} + +function fromTimestamp(t: Timestamp): Date { + let millis = (t.seconds || 0) * 1_000; + millis += (t.nanos || 0) / 1_000_000; + return new globalThis.Date(millis); +} + +function fromJsonTimestamp(o: any): Date { + if (o instanceof globalThis.Date) { + return o; + } else if (typeof o === "string") { + return new globalThis.Date(o); + } else { + return fromTimestamp(Timestamp.fromJSON(o)); + } +} + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} +export const registry: Array<[string, GeneratedType]> = [ + ["/tendermint.types.PartSetHeader", PartSetHeader as never], + ["/tendermint.types.Part", Part as never], + ["/tendermint.types.BlockID", BlockID as never], + ["/tendermint.types.Header", Header as never], + ["/tendermint.types.Data", Data as never], + ["/tendermint.types.Vote", Vote as never], + ["/tendermint.types.Commit", Commit as never], + ["/tendermint.types.CommitSig", CommitSig as never], + ["/tendermint.types.ExtendedCommit", ExtendedCommit as never], + ["/tendermint.types.ExtendedCommitSig", ExtendedCommitSig as never], + ["/tendermint.types.Proposal", Proposal as never], + ["/tendermint.types.SignedHeader", SignedHeader as never], + ["/tendermint.types.LightBlock", LightBlock as never], + ["/tendermint.types.BlockMeta", BlockMeta as never], + ["/tendermint.types.TxProof", TxProof as never], +]; +export const aminoConverters = { + "/tendermint.types.PartSetHeader": { + aminoType: "tendermint.types.PartSetHeader", + toAmino: (message: PartSetHeader) => ({ ...message }), + fromAmino: (object: PartSetHeader) => ({ ...object }), + }, + + "/tendermint.types.Part": { + aminoType: "tendermint.types.Part", + toAmino: (message: Part) => ({ ...message }), + fromAmino: (object: Part) => ({ ...object }), + }, + + "/tendermint.types.BlockID": { + aminoType: "tendermint.types.BlockID", + toAmino: (message: BlockID) => ({ ...message }), + fromAmino: (object: BlockID) => ({ ...object }), + }, + + "/tendermint.types.Header": { + aminoType: "tendermint.types.Header", + toAmino: (message: Header) => ({ ...message }), + fromAmino: (object: Header) => ({ ...object }), + }, + + "/tendermint.types.Data": { + aminoType: "tendermint.types.Data", + toAmino: (message: Data) => ({ ...message }), + fromAmino: (object: Data) => ({ ...object }), + }, + + "/tendermint.types.Vote": { + aminoType: "tendermint.types.Vote", + toAmino: (message: Vote) => ({ ...message }), + fromAmino: (object: Vote) => ({ ...object }), + }, + + "/tendermint.types.Commit": { + aminoType: "tendermint.types.Commit", + toAmino: (message: Commit) => ({ ...message }), + fromAmino: (object: Commit) => ({ ...object }), + }, + + "/tendermint.types.CommitSig": { + aminoType: "tendermint.types.CommitSig", + toAmino: (message: CommitSig) => ({ ...message }), + fromAmino: (object: CommitSig) => ({ ...object }), + }, + + "/tendermint.types.ExtendedCommit": { + aminoType: "tendermint.types.ExtendedCommit", + toAmino: (message: ExtendedCommit) => ({ ...message }), + fromAmino: (object: ExtendedCommit) => ({ ...object }), + }, + + "/tendermint.types.ExtendedCommitSig": { + aminoType: "tendermint.types.ExtendedCommitSig", + toAmino: (message: ExtendedCommitSig) => ({ ...message }), + fromAmino: (object: ExtendedCommitSig) => ({ ...object }), + }, + + "/tendermint.types.Proposal": { + aminoType: "tendermint.types.Proposal", + toAmino: (message: Proposal) => ({ ...message }), + fromAmino: (object: Proposal) => ({ ...object }), + }, + + "/tendermint.types.SignedHeader": { + aminoType: "tendermint.types.SignedHeader", + toAmino: (message: SignedHeader) => ({ ...message }), + fromAmino: (object: SignedHeader) => ({ ...object }), + }, + + "/tendermint.types.LightBlock": { + aminoType: "tendermint.types.LightBlock", + toAmino: (message: LightBlock) => ({ ...message }), + fromAmino: (object: LightBlock) => ({ ...object }), + }, + + "/tendermint.types.BlockMeta": { + aminoType: "tendermint.types.BlockMeta", + toAmino: (message: BlockMeta) => ({ ...message }), + fromAmino: (object: BlockMeta) => ({ ...object }), + }, + + "/tendermint.types.TxProof": { + aminoType: "tendermint.types.TxProof", + toAmino: (message: TxProof) => ({ ...message }), + fromAmino: (object: TxProof) => ({ ...object }), + }, +}; diff --git a/packages/cosmos/generated/encoding/tendermint/types/validator.ts b/packages/cosmos/generated/encoding/tendermint/types/validator.ts new file mode 100644 index 000000000..70d93daaf --- /dev/null +++ b/packages/cosmos/generated/encoding/tendermint/types/validator.ts @@ -0,0 +1,350 @@ +import type { GeneratedType } from "@cosmjs/proto-signing"; + +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +import { PublicKey } from "../crypto/keys"; + +import type { SimpleValidator as SimpleValidator_type, ValidatorSet as ValidatorSet_type, Validator as Validator_type } from "../../../types/tendermint/types"; + +import type { DeepPartial, Exact, MessageFns } from "../../common"; + +export interface ValidatorSet extends ValidatorSet_type {} +export interface Validator extends Validator_type {} +export interface SimpleValidator extends SimpleValidator_type {} + +export const ValidatorSet: MessageFns = { + $type: "tendermint.types.ValidatorSet" as const, + + encode(message: ValidatorSet, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.validators) { + Validator.encode(v!, writer.uint32(10).fork()).join(); + } + if (message.proposer !== undefined) { + Validator.encode(message.proposer, writer.uint32(18).fork()).join(); + } + if (message.total_voting_power !== 0) { + writer.uint32(24).int64(message.total_voting_power); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): ValidatorSet { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseValidatorSet(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.validators.push(Validator.decode(reader, reader.uint32())); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.proposer = Validator.decode(reader, reader.uint32()); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.total_voting_power = longToNumber(reader.int64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): ValidatorSet { + return { + validators: globalThis.Array.isArray(object?.validators) ? object.validators.map((e: any) => Validator.fromJSON(e)) : [], + proposer: isSet(object.proposer) ? Validator.fromJSON(object.proposer) : undefined, + total_voting_power: isSet(object.total_voting_power) ? globalThis.Number(object.total_voting_power) : 0, + }; + }, + + toJSON(message: ValidatorSet): unknown { + const obj: any = {}; + if (message.validators?.length) { + obj.validators = message.validators.map((e) => Validator.toJSON(e)); + } + if (message.proposer !== undefined) { + obj.proposer = Validator.toJSON(message.proposer); + } + if (message.total_voting_power !== 0) { + obj.total_voting_power = Math.round(message.total_voting_power); + } + return obj; + }, + + create, I>>(base?: I): ValidatorSet { + return ValidatorSet.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): ValidatorSet { + const message = createBaseValidatorSet(); + message.validators = object.validators?.map((e) => Validator.fromPartial(e)) || []; + message.proposer = object.proposer !== undefined && object.proposer !== null ? Validator.fromPartial(object.proposer) : undefined; + message.total_voting_power = object.total_voting_power ?? 0; + return message; + }, +}; + +export const Validator: MessageFns = { + $type: "tendermint.types.Validator" as const, + + encode(message: Validator, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.address.length !== 0) { + writer.uint32(10).bytes(message.address); + } + if (message.pub_key !== undefined) { + PublicKey.encode(message.pub_key, writer.uint32(18).fork()).join(); + } + if (message.voting_power !== 0) { + writer.uint32(24).int64(message.voting_power); + } + if (message.proposer_priority !== 0) { + writer.uint32(32).int64(message.proposer_priority); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Validator { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseValidator(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.address = reader.bytes(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.pub_key = PublicKey.decode(reader, reader.uint32()); + continue; + case 3: + if (tag !== 24) { + break; + } + + message.voting_power = longToNumber(reader.int64()); + continue; + case 4: + if (tag !== 32) { + break; + } + + message.proposer_priority = longToNumber(reader.int64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Validator { + return { + address: isSet(object.address) ? bytesFromBase64(object.address) : new Uint8Array(0), + pub_key: isSet(object.pub_key) ? PublicKey.fromJSON(object.pub_key) : undefined, + voting_power: isSet(object.voting_power) ? globalThis.Number(object.voting_power) : 0, + proposer_priority: isSet(object.proposer_priority) ? globalThis.Number(object.proposer_priority) : 0, + }; + }, + + toJSON(message: Validator): unknown { + const obj: any = {}; + if (message.address.length !== 0) { + obj.address = base64FromBytes(message.address); + } + if (message.pub_key !== undefined) { + obj.pub_key = PublicKey.toJSON(message.pub_key); + } + if (message.voting_power !== 0) { + obj.voting_power = Math.round(message.voting_power); + } + if (message.proposer_priority !== 0) { + obj.proposer_priority = Math.round(message.proposer_priority); + } + return obj; + }, + + create, I>>(base?: I): Validator { + return Validator.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Validator { + const message = createBaseValidator(); + message.address = object.address ?? new Uint8Array(0); + message.pub_key = object.pub_key !== undefined && object.pub_key !== null ? PublicKey.fromPartial(object.pub_key) : undefined; + message.voting_power = object.voting_power ?? 0; + message.proposer_priority = object.proposer_priority ?? 0; + return message; + }, +}; + +export const SimpleValidator: MessageFns = { + $type: "tendermint.types.SimpleValidator" as const, + + encode(message: SimpleValidator, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.pub_key !== undefined) { + PublicKey.encode(message.pub_key, writer.uint32(10).fork()).join(); + } + if (message.voting_power !== 0) { + writer.uint32(16).int64(message.voting_power); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): SimpleValidator { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseSimpleValidator(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.pub_key = PublicKey.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.voting_power = longToNumber(reader.int64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): SimpleValidator { + return { + pub_key: isSet(object.pub_key) ? PublicKey.fromJSON(object.pub_key) : undefined, + voting_power: isSet(object.voting_power) ? globalThis.Number(object.voting_power) : 0, + }; + }, + + toJSON(message: SimpleValidator): unknown { + const obj: any = {}; + if (message.pub_key !== undefined) { + obj.pub_key = PublicKey.toJSON(message.pub_key); + } + if (message.voting_power !== 0) { + obj.voting_power = Math.round(message.voting_power); + } + return obj; + }, + + create, I>>(base?: I): SimpleValidator { + return SimpleValidator.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): SimpleValidator { + const message = createBaseSimpleValidator(); + message.pub_key = object.pub_key !== undefined && object.pub_key !== null ? PublicKey.fromPartial(object.pub_key) : undefined; + message.voting_power = object.voting_power ?? 0; + return message; + }, +}; + +function createBaseValidatorSet(): ValidatorSet { + return { validators: [], proposer: undefined, total_voting_power: 0 }; +} + +function createBaseValidator(): Validator { + return { address: new Uint8Array(0), pub_key: undefined, voting_power: 0, proposer_priority: 0 }; +} + +function createBaseSimpleValidator(): SimpleValidator { + return { pub_key: undefined, voting_power: 0 }; +} + +function bytesFromBase64(b64: string): Uint8Array { + if ((globalThis as any).Buffer) { + return Uint8Array.from(globalThis.Buffer.from(b64, "base64")); + } else { + const bin = globalThis.atob(b64); + const arr = new Uint8Array(bin.length); + for (let i = 0; i < bin.length; ++i) { + arr[i] = bin.charCodeAt(i); + } + return arr; + } +} + +function base64FromBytes(arr: Uint8Array): string { + if ((globalThis as any).Buffer) { + return globalThis.Buffer.from(arr).toString("base64"); + } else { + const bin: string[] = []; + arr.forEach((byte) => { + bin.push(globalThis.String.fromCharCode(byte)); + }); + return globalThis.btoa(bin.join("")); + } +} + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} +export const registry: Array<[string, GeneratedType]> = [ + ["/tendermint.types.ValidatorSet", ValidatorSet as never], + ["/tendermint.types.Validator", Validator as never], + ["/tendermint.types.SimpleValidator", SimpleValidator as never], +]; +export const aminoConverters = { + "/tendermint.types.ValidatorSet": { + aminoType: "tendermint.types.ValidatorSet", + toAmino: (message: ValidatorSet) => ({ ...message }), + fromAmino: (object: ValidatorSet) => ({ ...object }), + }, + + "/tendermint.types.Validator": { + aminoType: "tendermint.types.Validator", + toAmino: (message: Validator) => ({ ...message }), + fromAmino: (object: Validator) => ({ ...object }), + }, + + "/tendermint.types.SimpleValidator": { + aminoType: "tendermint.types.SimpleValidator", + toAmino: (message: SimpleValidator) => ({ ...message }), + fromAmino: (object: SimpleValidator) => ({ ...object }), + }, +}; diff --git a/packages/cosmos/generated/encoding/tendermint/version/index.ts b/packages/cosmos/generated/encoding/tendermint/version/index.ts new file mode 100644 index 000000000..316cec4f0 --- /dev/null +++ b/packages/cosmos/generated/encoding/tendermint/version/index.ts @@ -0,0 +1,3 @@ +// @ts-nocheck + +export * from './types'; \ No newline at end of file diff --git a/packages/cosmos/generated/encoding/tendermint/version/types.ts b/packages/cosmos/generated/encoding/tendermint/version/types.ts new file mode 100644 index 000000000..9f2ecaac7 --- /dev/null +++ b/packages/cosmos/generated/encoding/tendermint/version/types.ts @@ -0,0 +1,194 @@ +import type { GeneratedType } from "@cosmjs/proto-signing"; + +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +import type { App as App_type, Consensus as Consensus_type } from "../../../types/tendermint/version"; + +import type { DeepPartial, Exact, MessageFns } from "../../common"; + +export interface App extends App_type {} +export interface Consensus extends Consensus_type {} + +export const App: MessageFns = { + $type: "tendermint.version.App" as const, + + encode(message: App, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.protocol !== 0) { + writer.uint32(8).uint64(message.protocol); + } + if (message.software !== "") { + writer.uint32(18).string(message.software); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): App { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseApp(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.protocol = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.software = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): App { + return { + protocol: isSet(object.protocol) ? globalThis.Number(object.protocol) : 0, + software: isSet(object.software) ? globalThis.String(object.software) : "", + }; + }, + + toJSON(message: App): unknown { + const obj: any = {}; + if (message.protocol !== 0) { + obj.protocol = Math.round(message.protocol); + } + if (message.software !== "") { + obj.software = message.software; + } + return obj; + }, + + create, I>>(base?: I): App { + return App.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): App { + const message = createBaseApp(); + message.protocol = object.protocol ?? 0; + message.software = object.software ?? ""; + return message; + }, +}; + +export const Consensus: MessageFns = { + $type: "tendermint.version.Consensus" as const, + + encode(message: Consensus, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.block !== 0) { + writer.uint32(8).uint64(message.block); + } + if (message.app !== 0) { + writer.uint32(16).uint64(message.app); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Consensus { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseConsensus(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 8) { + break; + } + + message.block = longToNumber(reader.uint64()); + continue; + case 2: + if (tag !== 16) { + break; + } + + message.app = longToNumber(reader.uint64()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): Consensus { + return { + block: isSet(object.block) ? globalThis.Number(object.block) : 0, + app: isSet(object.app) ? globalThis.Number(object.app) : 0, + }; + }, + + toJSON(message: Consensus): unknown { + const obj: any = {}; + if (message.block !== 0) { + obj.block = Math.round(message.block); + } + if (message.app !== 0) { + obj.app = Math.round(message.app); + } + return obj; + }, + + create, I>>(base?: I): Consensus { + return Consensus.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): Consensus { + const message = createBaseConsensus(); + message.block = object.block ?? 0; + message.app = object.app ?? 0; + return message; + }, +}; + +function createBaseApp(): App { + return { protocol: 0, software: "" }; +} + +function createBaseConsensus(): Consensus { + return { block: 0, app: 0 }; +} + +function longToNumber(int64: { toString(): string }): number { + const num = globalThis.Number(int64.toString()); + if (num > globalThis.Number.MAX_SAFE_INTEGER) { + throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); + } + if (num < globalThis.Number.MIN_SAFE_INTEGER) { + throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER"); + } + return num; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} +export const registry: Array<[string, GeneratedType]> = [ + ["/tendermint.version.App", App as never], + ["/tendermint.version.Consensus", Consensus as never], +]; +export const aminoConverters = { + "/tendermint.version.App": { + aminoType: "tendermint.version.App", + toAmino: (message: App) => ({ ...message }), + fromAmino: (object: App) => ({ ...object }), + }, + + "/tendermint.version.Consensus": { + aminoType: "tendermint.version.Consensus", + toAmino: (message: Consensus) => ({ ...message }), + fromAmino: (object: Consensus) => ({ ...object }), + }, +}; diff --git a/packages/cosmos/generated/encoding/tokenfactory/authorityMetadata.ts b/packages/cosmos/generated/encoding/tokenfactory/authorityMetadata.ts new file mode 100644 index 000000000..febcddce3 --- /dev/null +++ b/packages/cosmos/generated/encoding/tokenfactory/authorityMetadata.ts @@ -0,0 +1,70 @@ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +import type { DenomAuthorityMetadata as DenomAuthorityMetadata_type } from "../../types/tokenfactory"; + +import type { DeepPartial, Exact, MessageFns } from "../common"; + +export interface DenomAuthorityMetadata extends DenomAuthorityMetadata_type {} + +export const DenomAuthorityMetadata: MessageFns = { + $type: "seiprotocol.seichain.tokenfactory.DenomAuthorityMetadata" as const, + + encode(message: DenomAuthorityMetadata, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.admin !== "") { + writer.uint32(10).string(message.admin); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): DenomAuthorityMetadata { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDenomAuthorityMetadata(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.admin = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): DenomAuthorityMetadata { + return { admin: isSet(object.admin) ? globalThis.String(object.admin) : "" }; + }, + + toJSON(message: DenomAuthorityMetadata): unknown { + const obj: any = {}; + if (message.admin !== "") { + obj.admin = message.admin; + } + return obj; + }, + + create, I>>(base?: I): DenomAuthorityMetadata { + return DenomAuthorityMetadata.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): DenomAuthorityMetadata { + const message = createBaseDenomAuthorityMetadata(); + message.admin = object.admin ?? ""; + return message; + }, +}; + +function createBaseDenomAuthorityMetadata(): DenomAuthorityMetadata { + return { admin: "" }; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} diff --git a/packages/cosmos/generated/encoding/tokenfactory/genesis.ts b/packages/cosmos/generated/encoding/tokenfactory/genesis.ts new file mode 100644 index 000000000..c56efa040 --- /dev/null +++ b/packages/cosmos/generated/encoding/tokenfactory/genesis.ts @@ -0,0 +1,188 @@ +import type { GeneratedType } from "@cosmjs/proto-signing"; + +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +import { DenomAuthorityMetadata } from "./authorityMetadata"; + +import { Params } from "./params"; + +import type { GenesisDenom as GenesisDenom_type, GenesisState as GenesisState_type } from "../../types/tokenfactory"; + +import type { DeepPartial, Exact, MessageFns } from "../common"; + +export interface GenesisState extends GenesisState_type {} +export interface GenesisDenom extends GenesisDenom_type {} + +export const GenesisState: MessageFns = { + $type: "seiprotocol.seichain.tokenfactory.GenesisState" as const, + + encode(message: GenesisState, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(10).fork()).join(); + } + for (const v of message.factory_denoms) { + GenesisDenom.encode(v!, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GenesisState { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGenesisState(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.params = Params.decode(reader, reader.uint32()); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.factory_denoms.push(GenesisDenom.decode(reader, reader.uint32())); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GenesisState { + return { + params: isSet(object.params) ? Params.fromJSON(object.params) : undefined, + factory_denoms: globalThis.Array.isArray(object?.factory_denoms) ? object.factory_denoms.map((e: any) => GenesisDenom.fromJSON(e)) : [], + }; + }, + + toJSON(message: GenesisState): unknown { + const obj: any = {}; + if (message.params !== undefined) { + obj.params = Params.toJSON(message.params); + } + if (message.factory_denoms?.length) { + obj.factory_denoms = message.factory_denoms.map((e) => GenesisDenom.toJSON(e)); + } + return obj; + }, + + create, I>>(base?: I): GenesisState { + return GenesisState.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): GenesisState { + const message = createBaseGenesisState(); + message.params = object.params !== undefined && object.params !== null ? Params.fromPartial(object.params) : undefined; + message.factory_denoms = object.factory_denoms?.map((e) => GenesisDenom.fromPartial(e)) || []; + return message; + }, +}; + +export const GenesisDenom: MessageFns = { + $type: "seiprotocol.seichain.tokenfactory.GenesisDenom" as const, + + encode(message: GenesisDenom, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.denom !== "") { + writer.uint32(10).string(message.denom); + } + if (message.authority_metadata !== undefined) { + DenomAuthorityMetadata.encode(message.authority_metadata, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): GenesisDenom { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGenesisDenom(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.denom = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.authority_metadata = DenomAuthorityMetadata.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): GenesisDenom { + return { + denom: isSet(object.denom) ? globalThis.String(object.denom) : "", + authority_metadata: isSet(object.authority_metadata) ? DenomAuthorityMetadata.fromJSON(object.authority_metadata) : undefined, + }; + }, + + toJSON(message: GenesisDenom): unknown { + const obj: any = {}; + if (message.denom !== "") { + obj.denom = message.denom; + } + if (message.authority_metadata !== undefined) { + obj.authority_metadata = DenomAuthorityMetadata.toJSON(message.authority_metadata); + } + return obj; + }, + + create, I>>(base?: I): GenesisDenom { + return GenesisDenom.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): GenesisDenom { + const message = createBaseGenesisDenom(); + message.denom = object.denom ?? ""; + message.authority_metadata = + object.authority_metadata !== undefined && object.authority_metadata !== null ? DenomAuthorityMetadata.fromPartial(object.authority_metadata) : undefined; + return message; + }, +}; + +function createBaseGenesisState(): GenesisState { + return { params: undefined, factory_denoms: [] }; +} + +function createBaseGenesisDenom(): GenesisDenom { + return { denom: "", authority_metadata: undefined }; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} +export const registry: Array<[string, GeneratedType]> = [ + ["/seiprotocol.seichain.tokenfactory.GenesisState", GenesisState as never], + ["/seiprotocol.seichain.tokenfactory.GenesisDenom", GenesisDenom as never], +]; +export const aminoConverters = { + "/seiprotocol.seichain.tokenfactory.GenesisState": { + aminoType: "tokenfactory/GenesisState", + toAmino: (message: GenesisState) => ({ ...message }), + fromAmino: (object: GenesisState) => ({ ...object }), + }, + + "/seiprotocol.seichain.tokenfactory.GenesisDenom": { + aminoType: "tokenfactory/GenesisDenom", + toAmino: (message: GenesisDenom) => ({ ...message }), + fromAmino: (object: GenesisDenom) => ({ ...object }), + }, +}; diff --git a/packages/cosmos/generated/encoding/tokenfactory/index.ts b/packages/cosmos/generated/encoding/tokenfactory/index.ts new file mode 100644 index 000000000..8b1f142e2 --- /dev/null +++ b/packages/cosmos/generated/encoding/tokenfactory/index.ts @@ -0,0 +1,7 @@ +// @ts-nocheck + +export * from './authorityMetadata'; +export * from './genesis'; +export * from './params'; +export * from './query'; +export * from './tx'; \ No newline at end of file diff --git a/packages/cosmos/generated/encoding/tokenfactory/params.ts b/packages/cosmos/generated/encoding/tokenfactory/params.ts new file mode 100644 index 000000000..f45446be2 --- /dev/null +++ b/packages/cosmos/generated/encoding/tokenfactory/params.ts @@ -0,0 +1,62 @@ +import type { GeneratedType } from "@cosmjs/proto-signing"; + +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +import type { Params as Params_type } from "../../types/tokenfactory"; + +import type { DeepPartial, Exact, MessageFns } from "../common"; + +export interface Params extends Params_type {} + +export const Params: MessageFns = { + $type: "seiprotocol.seichain.tokenfactory.Params" as const, + + encode(_: Params, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): Params { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): Params { + return {}; + }, + + toJSON(_: Params): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): Params { + return Params.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): Params { + const message = createBaseParams(); + return message; + }, +}; + +function createBaseParams(): Params { + return {}; +} +export const registry: Array<[string, GeneratedType]> = [["/seiprotocol.seichain.tokenfactory.Params", Params as never]]; +export const aminoConverters = { + "/seiprotocol.seichain.tokenfactory.Params": { + aminoType: "tokenfactory/Params", + toAmino: (message: Params) => ({ ...message }), + fromAmino: (object: Params) => ({ ...object }), + }, +}; diff --git a/packages/cosmos/generated/encoding/tokenfactory/query.ts b/packages/cosmos/generated/encoding/tokenfactory/query.ts new file mode 100644 index 000000000..2c6358ff1 --- /dev/null +++ b/packages/cosmos/generated/encoding/tokenfactory/query.ts @@ -0,0 +1,624 @@ +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +import { AllowList, Metadata } from "../cosmos/bank/v1beta1/bank"; + +import { DenomAuthorityMetadata } from "./authorityMetadata"; + +import { Params } from "./params"; + +import type { + QueryDenomAllowListRequest as QueryDenomAllowListRequest_type, + QueryDenomAllowListResponse as QueryDenomAllowListResponse_type, + QueryDenomAuthorityMetadataRequest as QueryDenomAuthorityMetadataRequest_type, + QueryDenomAuthorityMetadataResponse as QueryDenomAuthorityMetadataResponse_type, + QueryDenomMetadataRequest as QueryDenomMetadataRequest_type, + QueryDenomMetadataResponse as QueryDenomMetadataResponse_type, + QueryDenomsFromCreatorRequest as QueryDenomsFromCreatorRequest_type, + QueryDenomsFromCreatorResponse as QueryDenomsFromCreatorResponse_type, + QueryParamsRequest as QueryParamsRequest_type, + QueryParamsResponse as QueryParamsResponse_type, +} from "../../types/tokenfactory"; + +import type { DeepPartial, Exact, MessageFns } from "../common"; + +export interface QueryParamsRequest extends QueryParamsRequest_type {} +export interface QueryParamsResponse extends QueryParamsResponse_type {} +export interface QueryDenomAuthorityMetadataRequest extends QueryDenomAuthorityMetadataRequest_type {} +export interface QueryDenomAuthorityMetadataResponse extends QueryDenomAuthorityMetadataResponse_type {} +export interface QueryDenomsFromCreatorRequest extends QueryDenomsFromCreatorRequest_type {} +export interface QueryDenomsFromCreatorResponse extends QueryDenomsFromCreatorResponse_type {} +export interface QueryDenomMetadataRequest extends QueryDenomMetadataRequest_type {} +export interface QueryDenomMetadataResponse extends QueryDenomMetadataResponse_type {} +export interface QueryDenomAllowListRequest extends QueryDenomAllowListRequest_type {} +export interface QueryDenomAllowListResponse extends QueryDenomAllowListResponse_type {} + +export const QueryParamsRequest: MessageFns = { + $type: "seiprotocol.seichain.tokenfactory.QueryParamsRequest" as const, + + encode(_: QueryParamsRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryParamsRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryParamsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): QueryParamsRequest { + return {}; + }, + + toJSON(_: QueryParamsRequest): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): QueryParamsRequest { + return QueryParamsRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): QueryParamsRequest { + const message = createBaseQueryParamsRequest(); + return message; + }, +}; + +export const QueryParamsResponse: MessageFns = { + $type: "seiprotocol.seichain.tokenfactory.QueryParamsResponse" as const, + + encode(message: QueryParamsResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryParamsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryParamsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.params = Params.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryParamsResponse { + return { params: isSet(object.params) ? Params.fromJSON(object.params) : undefined }; + }, + + toJSON(message: QueryParamsResponse): unknown { + const obj: any = {}; + if (message.params !== undefined) { + obj.params = Params.toJSON(message.params); + } + return obj; + }, + + create, I>>(base?: I): QueryParamsResponse { + return QueryParamsResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryParamsResponse { + const message = createBaseQueryParamsResponse(); + message.params = object.params !== undefined && object.params !== null ? Params.fromPartial(object.params) : undefined; + return message; + }, +}; + +export const QueryDenomAuthorityMetadataRequest: MessageFns< + QueryDenomAuthorityMetadataRequest, + "seiprotocol.seichain.tokenfactory.QueryDenomAuthorityMetadataRequest" +> = { + $type: "seiprotocol.seichain.tokenfactory.QueryDenomAuthorityMetadataRequest" as const, + + encode(message: QueryDenomAuthorityMetadataRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.denom !== "") { + writer.uint32(10).string(message.denom); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryDenomAuthorityMetadataRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDenomAuthorityMetadataRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.denom = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDenomAuthorityMetadataRequest { + return { denom: isSet(object.denom) ? globalThis.String(object.denom) : "" }; + }, + + toJSON(message: QueryDenomAuthorityMetadataRequest): unknown { + const obj: any = {}; + if (message.denom !== "") { + obj.denom = message.denom; + } + return obj; + }, + + create, I>>(base?: I): QueryDenomAuthorityMetadataRequest { + return QueryDenomAuthorityMetadataRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryDenomAuthorityMetadataRequest { + const message = createBaseQueryDenomAuthorityMetadataRequest(); + message.denom = object.denom ?? ""; + return message; + }, +}; + +export const QueryDenomAuthorityMetadataResponse: MessageFns< + QueryDenomAuthorityMetadataResponse, + "seiprotocol.seichain.tokenfactory.QueryDenomAuthorityMetadataResponse" +> = { + $type: "seiprotocol.seichain.tokenfactory.QueryDenomAuthorityMetadataResponse" as const, + + encode(message: QueryDenomAuthorityMetadataResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.authority_metadata !== undefined) { + DenomAuthorityMetadata.encode(message.authority_metadata, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryDenomAuthorityMetadataResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDenomAuthorityMetadataResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.authority_metadata = DenomAuthorityMetadata.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDenomAuthorityMetadataResponse { + return { + authority_metadata: isSet(object.authority_metadata) ? DenomAuthorityMetadata.fromJSON(object.authority_metadata) : undefined, + }; + }, + + toJSON(message: QueryDenomAuthorityMetadataResponse): unknown { + const obj: any = {}; + if (message.authority_metadata !== undefined) { + obj.authority_metadata = DenomAuthorityMetadata.toJSON(message.authority_metadata); + } + return obj; + }, + + create, I>>(base?: I): QueryDenomAuthorityMetadataResponse { + return QueryDenomAuthorityMetadataResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryDenomAuthorityMetadataResponse { + const message = createBaseQueryDenomAuthorityMetadataResponse(); + message.authority_metadata = + object.authority_metadata !== undefined && object.authority_metadata !== null ? DenomAuthorityMetadata.fromPartial(object.authority_metadata) : undefined; + return message; + }, +}; + +export const QueryDenomsFromCreatorRequest: MessageFns = { + $type: "seiprotocol.seichain.tokenfactory.QueryDenomsFromCreatorRequest" as const, + + encode(message: QueryDenomsFromCreatorRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.creator !== "") { + writer.uint32(10).string(message.creator); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryDenomsFromCreatorRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDenomsFromCreatorRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.creator = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDenomsFromCreatorRequest { + return { creator: isSet(object.creator) ? globalThis.String(object.creator) : "" }; + }, + + toJSON(message: QueryDenomsFromCreatorRequest): unknown { + const obj: any = {}; + if (message.creator !== "") { + obj.creator = message.creator; + } + return obj; + }, + + create, I>>(base?: I): QueryDenomsFromCreatorRequest { + return QueryDenomsFromCreatorRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryDenomsFromCreatorRequest { + const message = createBaseQueryDenomsFromCreatorRequest(); + message.creator = object.creator ?? ""; + return message; + }, +}; + +export const QueryDenomsFromCreatorResponse: MessageFns = { + $type: "seiprotocol.seichain.tokenfactory.QueryDenomsFromCreatorResponse" as const, + + encode(message: QueryDenomsFromCreatorResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + for (const v of message.denoms) { + writer.uint32(10).string(v!); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryDenomsFromCreatorResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDenomsFromCreatorResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.denoms.push(reader.string()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDenomsFromCreatorResponse { + return { + denoms: globalThis.Array.isArray(object?.denoms) ? object.denoms.map((e: any) => globalThis.String(e)) : [], + }; + }, + + toJSON(message: QueryDenomsFromCreatorResponse): unknown { + const obj: any = {}; + if (message.denoms?.length) { + obj.denoms = message.denoms; + } + return obj; + }, + + create, I>>(base?: I): QueryDenomsFromCreatorResponse { + return QueryDenomsFromCreatorResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryDenomsFromCreatorResponse { + const message = createBaseQueryDenomsFromCreatorResponse(); + message.denoms = object.denoms?.map((e) => e) || []; + return message; + }, +}; + +export const QueryDenomMetadataRequest: MessageFns = { + $type: "seiprotocol.seichain.tokenfactory.QueryDenomMetadataRequest" as const, + + encode(message: QueryDenomMetadataRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.denom !== "") { + writer.uint32(10).string(message.denom); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryDenomMetadataRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDenomMetadataRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.denom = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDenomMetadataRequest { + return { denom: isSet(object.denom) ? globalThis.String(object.denom) : "" }; + }, + + toJSON(message: QueryDenomMetadataRequest): unknown { + const obj: any = {}; + if (message.denom !== "") { + obj.denom = message.denom; + } + return obj; + }, + + create, I>>(base?: I): QueryDenomMetadataRequest { + return QueryDenomMetadataRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryDenomMetadataRequest { + const message = createBaseQueryDenomMetadataRequest(); + message.denom = object.denom ?? ""; + return message; + }, +}; + +export const QueryDenomMetadataResponse: MessageFns = { + $type: "seiprotocol.seichain.tokenfactory.QueryDenomMetadataResponse" as const, + + encode(message: QueryDenomMetadataResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.metadata !== undefined) { + Metadata.encode(message.metadata, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryDenomMetadataResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDenomMetadataResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.metadata = Metadata.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDenomMetadataResponse { + return { metadata: isSet(object.metadata) ? Metadata.fromJSON(object.metadata) : undefined }; + }, + + toJSON(message: QueryDenomMetadataResponse): unknown { + const obj: any = {}; + if (message.metadata !== undefined) { + obj.metadata = Metadata.toJSON(message.metadata); + } + return obj; + }, + + create, I>>(base?: I): QueryDenomMetadataResponse { + return QueryDenomMetadataResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryDenomMetadataResponse { + const message = createBaseQueryDenomMetadataResponse(); + message.metadata = object.metadata !== undefined && object.metadata !== null ? Metadata.fromPartial(object.metadata) : undefined; + return message; + }, +}; + +export const QueryDenomAllowListRequest: MessageFns = { + $type: "seiprotocol.seichain.tokenfactory.QueryDenomAllowListRequest" as const, + + encode(message: QueryDenomAllowListRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.denom !== "") { + writer.uint32(10).string(message.denom); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryDenomAllowListRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDenomAllowListRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.denom = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDenomAllowListRequest { + return { denom: isSet(object.denom) ? globalThis.String(object.denom) : "" }; + }, + + toJSON(message: QueryDenomAllowListRequest): unknown { + const obj: any = {}; + if (message.denom !== "") { + obj.denom = message.denom; + } + return obj; + }, + + create, I>>(base?: I): QueryDenomAllowListRequest { + return QueryDenomAllowListRequest.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryDenomAllowListRequest { + const message = createBaseQueryDenomAllowListRequest(); + message.denom = object.denom ?? ""; + return message; + }, +}; + +export const QueryDenomAllowListResponse: MessageFns = { + $type: "seiprotocol.seichain.tokenfactory.QueryDenomAllowListResponse" as const, + + encode(message: QueryDenomAllowListResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.allow_list !== undefined) { + AllowList.encode(message.allow_list, writer.uint32(10).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): QueryDenomAllowListResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDenomAllowListResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.allow_list = AllowList.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): QueryDenomAllowListResponse { + return { allow_list: isSet(object.allow_list) ? AllowList.fromJSON(object.allow_list) : undefined }; + }, + + toJSON(message: QueryDenomAllowListResponse): unknown { + const obj: any = {}; + if (message.allow_list !== undefined) { + obj.allow_list = AllowList.toJSON(message.allow_list); + } + return obj; + }, + + create, I>>(base?: I): QueryDenomAllowListResponse { + return QueryDenomAllowListResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): QueryDenomAllowListResponse { + const message = createBaseQueryDenomAllowListResponse(); + message.allow_list = object.allow_list !== undefined && object.allow_list !== null ? AllowList.fromPartial(object.allow_list) : undefined; + return message; + }, +}; + +function createBaseQueryParamsRequest(): QueryParamsRequest { + return {}; +} + +function createBaseQueryParamsResponse(): QueryParamsResponse { + return { params: undefined }; +} + +function createBaseQueryDenomAuthorityMetadataRequest(): QueryDenomAuthorityMetadataRequest { + return { denom: "" }; +} + +function createBaseQueryDenomAuthorityMetadataResponse(): QueryDenomAuthorityMetadataResponse { + return { authority_metadata: undefined }; +} + +function createBaseQueryDenomsFromCreatorRequest(): QueryDenomsFromCreatorRequest { + return { creator: "" }; +} + +function createBaseQueryDenomsFromCreatorResponse(): QueryDenomsFromCreatorResponse { + return { denoms: [] }; +} + +function createBaseQueryDenomMetadataRequest(): QueryDenomMetadataRequest { + return { denom: "" }; +} + +function createBaseQueryDenomMetadataResponse(): QueryDenomMetadataResponse { + return { metadata: undefined }; +} + +function createBaseQueryDenomAllowListRequest(): QueryDenomAllowListRequest { + return { denom: "" }; +} + +function createBaseQueryDenomAllowListResponse(): QueryDenomAllowListResponse { + return { allow_list: undefined }; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} diff --git a/packages/cosmos/generated/encoding/tokenfactory/tx.ts b/packages/cosmos/generated/encoding/tokenfactory/tx.ts new file mode 100644 index 000000000..1e8ecaed2 --- /dev/null +++ b/packages/cosmos/generated/encoding/tokenfactory/tx.ts @@ -0,0 +1,878 @@ +import type { GeneratedType } from "@cosmjs/proto-signing"; + +import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +import { AllowList, Metadata } from "../cosmos/bank/v1beta1/bank"; + +import { Coin } from "../cosmos/base/v1beta1/coin"; + +import type { + MsgBurnResponse as MsgBurnResponse_type, + MsgBurn as MsgBurn_type, + MsgChangeAdminResponse as MsgChangeAdminResponse_type, + MsgChangeAdmin as MsgChangeAdmin_type, + MsgCreateDenomResponse as MsgCreateDenomResponse_type, + MsgCreateDenom as MsgCreateDenom_type, + MsgMintResponse as MsgMintResponse_type, + MsgMint as MsgMint_type, + MsgSetDenomMetadataResponse as MsgSetDenomMetadataResponse_type, + MsgSetDenomMetadata as MsgSetDenomMetadata_type, + MsgUpdateDenomResponse as MsgUpdateDenomResponse_type, + MsgUpdateDenom as MsgUpdateDenom_type, +} from "../../types/tokenfactory"; + +import type { DeepPartial, Exact, MessageFns } from "../common"; + +export interface MsgCreateDenom extends MsgCreateDenom_type {} +export interface MsgCreateDenomResponse extends MsgCreateDenomResponse_type {} +export interface MsgMint extends MsgMint_type {} +export interface MsgMintResponse extends MsgMintResponse_type {} +export interface MsgBurn extends MsgBurn_type {} +export interface MsgBurnResponse extends MsgBurnResponse_type {} +export interface MsgChangeAdmin extends MsgChangeAdmin_type {} +export interface MsgChangeAdminResponse extends MsgChangeAdminResponse_type {} +export interface MsgSetDenomMetadata extends MsgSetDenomMetadata_type {} +export interface MsgSetDenomMetadataResponse extends MsgSetDenomMetadataResponse_type {} +export interface MsgUpdateDenom extends MsgUpdateDenom_type {} +export interface MsgUpdateDenomResponse extends MsgUpdateDenomResponse_type {} + +export const MsgCreateDenom: MessageFns = { + $type: "seiprotocol.seichain.tokenfactory.MsgCreateDenom" as const, + + encode(message: MsgCreateDenom, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.sender !== "") { + writer.uint32(10).string(message.sender); + } + if (message.subdenom !== "") { + writer.uint32(18).string(message.subdenom); + } + if (message.allow_list !== undefined) { + AllowList.encode(message.allow_list, writer.uint32(26).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgCreateDenom { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgCreateDenom(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.sender = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.subdenom = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.allow_list = AllowList.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgCreateDenom { + return { + sender: isSet(object.sender) ? globalThis.String(object.sender) : "", + subdenom: isSet(object.subdenom) ? globalThis.String(object.subdenom) : "", + allow_list: isSet(object.allow_list) ? AllowList.fromJSON(object.allow_list) : undefined, + }; + }, + + toJSON(message: MsgCreateDenom): unknown { + const obj: any = {}; + if (message.sender !== "") { + obj.sender = message.sender; + } + if (message.subdenom !== "") { + obj.subdenom = message.subdenom; + } + if (message.allow_list !== undefined) { + obj.allow_list = AllowList.toJSON(message.allow_list); + } + return obj; + }, + + create, I>>(base?: I): MsgCreateDenom { + return MsgCreateDenom.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgCreateDenom { + const message = createBaseMsgCreateDenom(); + message.sender = object.sender ?? ""; + message.subdenom = object.subdenom ?? ""; + message.allow_list = object.allow_list !== undefined && object.allow_list !== null ? AllowList.fromPartial(object.allow_list) : undefined; + return message; + }, +}; + +export const MsgCreateDenomResponse: MessageFns = { + $type: "seiprotocol.seichain.tokenfactory.MsgCreateDenomResponse" as const, + + encode(message: MsgCreateDenomResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.new_token_denom !== "") { + writer.uint32(10).string(message.new_token_denom); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgCreateDenomResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgCreateDenomResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.new_token_denom = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgCreateDenomResponse { + return { new_token_denom: isSet(object.new_token_denom) ? globalThis.String(object.new_token_denom) : "" }; + }, + + toJSON(message: MsgCreateDenomResponse): unknown { + const obj: any = {}; + if (message.new_token_denom !== "") { + obj.new_token_denom = message.new_token_denom; + } + return obj; + }, + + create, I>>(base?: I): MsgCreateDenomResponse { + return MsgCreateDenomResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgCreateDenomResponse { + const message = createBaseMsgCreateDenomResponse(); + message.new_token_denom = object.new_token_denom ?? ""; + return message; + }, +}; + +export const MsgMint: MessageFns = { + $type: "seiprotocol.seichain.tokenfactory.MsgMint" as const, + + encode(message: MsgMint, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.sender !== "") { + writer.uint32(10).string(message.sender); + } + if (message.amount !== undefined) { + Coin.encode(message.amount, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgMint { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgMint(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.sender = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.amount = Coin.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgMint { + return { + sender: isSet(object.sender) ? globalThis.String(object.sender) : "", + amount: isSet(object.amount) ? Coin.fromJSON(object.amount) : undefined, + }; + }, + + toJSON(message: MsgMint): unknown { + const obj: any = {}; + if (message.sender !== "") { + obj.sender = message.sender; + } + if (message.amount !== undefined) { + obj.amount = Coin.toJSON(message.amount); + } + return obj; + }, + + create, I>>(base?: I): MsgMint { + return MsgMint.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgMint { + const message = createBaseMsgMint(); + message.sender = object.sender ?? ""; + message.amount = object.amount !== undefined && object.amount !== null ? Coin.fromPartial(object.amount) : undefined; + return message; + }, +}; + +export const MsgMintResponse: MessageFns = { + $type: "seiprotocol.seichain.tokenfactory.MsgMintResponse" as const, + + encode(_: MsgMintResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgMintResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgMintResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgMintResponse { + return {}; + }, + + toJSON(_: MsgMintResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgMintResponse { + return MsgMintResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgMintResponse { + const message = createBaseMsgMintResponse(); + return message; + }, +}; + +export const MsgBurn: MessageFns = { + $type: "seiprotocol.seichain.tokenfactory.MsgBurn" as const, + + encode(message: MsgBurn, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.sender !== "") { + writer.uint32(10).string(message.sender); + } + if (message.amount !== undefined) { + Coin.encode(message.amount, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgBurn { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgBurn(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.sender = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.amount = Coin.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgBurn { + return { + sender: isSet(object.sender) ? globalThis.String(object.sender) : "", + amount: isSet(object.amount) ? Coin.fromJSON(object.amount) : undefined, + }; + }, + + toJSON(message: MsgBurn): unknown { + const obj: any = {}; + if (message.sender !== "") { + obj.sender = message.sender; + } + if (message.amount !== undefined) { + obj.amount = Coin.toJSON(message.amount); + } + return obj; + }, + + create, I>>(base?: I): MsgBurn { + return MsgBurn.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgBurn { + const message = createBaseMsgBurn(); + message.sender = object.sender ?? ""; + message.amount = object.amount !== undefined && object.amount !== null ? Coin.fromPartial(object.amount) : undefined; + return message; + }, +}; + +export const MsgBurnResponse: MessageFns = { + $type: "seiprotocol.seichain.tokenfactory.MsgBurnResponse" as const, + + encode(_: MsgBurnResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgBurnResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgBurnResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgBurnResponse { + return {}; + }, + + toJSON(_: MsgBurnResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgBurnResponse { + return MsgBurnResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgBurnResponse { + const message = createBaseMsgBurnResponse(); + return message; + }, +}; + +export const MsgChangeAdmin: MessageFns = { + $type: "seiprotocol.seichain.tokenfactory.MsgChangeAdmin" as const, + + encode(message: MsgChangeAdmin, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.sender !== "") { + writer.uint32(10).string(message.sender); + } + if (message.denom !== "") { + writer.uint32(18).string(message.denom); + } + if (message.new_admin !== "") { + writer.uint32(26).string(message.new_admin); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgChangeAdmin { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgChangeAdmin(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.sender = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.denom = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.new_admin = reader.string(); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgChangeAdmin { + return { + sender: isSet(object.sender) ? globalThis.String(object.sender) : "", + denom: isSet(object.denom) ? globalThis.String(object.denom) : "", + new_admin: isSet(object.new_admin) ? globalThis.String(object.new_admin) : "", + }; + }, + + toJSON(message: MsgChangeAdmin): unknown { + const obj: any = {}; + if (message.sender !== "") { + obj.sender = message.sender; + } + if (message.denom !== "") { + obj.denom = message.denom; + } + if (message.new_admin !== "") { + obj.new_admin = message.new_admin; + } + return obj; + }, + + create, I>>(base?: I): MsgChangeAdmin { + return MsgChangeAdmin.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgChangeAdmin { + const message = createBaseMsgChangeAdmin(); + message.sender = object.sender ?? ""; + message.denom = object.denom ?? ""; + message.new_admin = object.new_admin ?? ""; + return message; + }, +}; + +export const MsgChangeAdminResponse: MessageFns = { + $type: "seiprotocol.seichain.tokenfactory.MsgChangeAdminResponse" as const, + + encode(_: MsgChangeAdminResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgChangeAdminResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgChangeAdminResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgChangeAdminResponse { + return {}; + }, + + toJSON(_: MsgChangeAdminResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgChangeAdminResponse { + return MsgChangeAdminResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgChangeAdminResponse { + const message = createBaseMsgChangeAdminResponse(); + return message; + }, +}; + +export const MsgSetDenomMetadata: MessageFns = { + $type: "seiprotocol.seichain.tokenfactory.MsgSetDenomMetadata" as const, + + encode(message: MsgSetDenomMetadata, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.sender !== "") { + writer.uint32(10).string(message.sender); + } + if (message.metadata !== undefined) { + Metadata.encode(message.metadata, writer.uint32(18).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgSetDenomMetadata { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSetDenomMetadata(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.sender = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.metadata = Metadata.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgSetDenomMetadata { + return { + sender: isSet(object.sender) ? globalThis.String(object.sender) : "", + metadata: isSet(object.metadata) ? Metadata.fromJSON(object.metadata) : undefined, + }; + }, + + toJSON(message: MsgSetDenomMetadata): unknown { + const obj: any = {}; + if (message.sender !== "") { + obj.sender = message.sender; + } + if (message.metadata !== undefined) { + obj.metadata = Metadata.toJSON(message.metadata); + } + return obj; + }, + + create, I>>(base?: I): MsgSetDenomMetadata { + return MsgSetDenomMetadata.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgSetDenomMetadata { + const message = createBaseMsgSetDenomMetadata(); + message.sender = object.sender ?? ""; + message.metadata = object.metadata !== undefined && object.metadata !== null ? Metadata.fromPartial(object.metadata) : undefined; + return message; + }, +}; + +export const MsgSetDenomMetadataResponse: MessageFns = { + $type: "seiprotocol.seichain.tokenfactory.MsgSetDenomMetadataResponse" as const, + + encode(_: MsgSetDenomMetadataResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgSetDenomMetadataResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSetDenomMetadataResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgSetDenomMetadataResponse { + return {}; + }, + + toJSON(_: MsgSetDenomMetadataResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgSetDenomMetadataResponse { + return MsgSetDenomMetadataResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgSetDenomMetadataResponse { + const message = createBaseMsgSetDenomMetadataResponse(); + return message; + }, +}; + +export const MsgUpdateDenom: MessageFns = { + $type: "seiprotocol.seichain.tokenfactory.MsgUpdateDenom" as const, + + encode(message: MsgUpdateDenom, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + if (message.sender !== "") { + writer.uint32(10).string(message.sender); + } + if (message.denom !== "") { + writer.uint32(18).string(message.denom); + } + if (message.allow_list !== undefined) { + AllowList.encode(message.allow_list, writer.uint32(26).fork()).join(); + } + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateDenom { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateDenom(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if (tag !== 10) { + break; + } + + message.sender = reader.string(); + continue; + case 2: + if (tag !== 18) { + break; + } + + message.denom = reader.string(); + continue; + case 3: + if (tag !== 26) { + break; + } + + message.allow_list = AllowList.decode(reader, reader.uint32()); + continue; + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(object: any): MsgUpdateDenom { + return { + sender: isSet(object.sender) ? globalThis.String(object.sender) : "", + denom: isSet(object.denom) ? globalThis.String(object.denom) : "", + allow_list: isSet(object.allow_list) ? AllowList.fromJSON(object.allow_list) : undefined, + }; + }, + + toJSON(message: MsgUpdateDenom): unknown { + const obj: any = {}; + if (message.sender !== "") { + obj.sender = message.sender; + } + if (message.denom !== "") { + obj.denom = message.denom; + } + if (message.allow_list !== undefined) { + obj.allow_list = AllowList.toJSON(message.allow_list); + } + return obj; + }, + + create, I>>(base?: I): MsgUpdateDenom { + return MsgUpdateDenom.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(object: I): MsgUpdateDenom { + const message = createBaseMsgUpdateDenom(); + message.sender = object.sender ?? ""; + message.denom = object.denom ?? ""; + message.allow_list = object.allow_list !== undefined && object.allow_list !== null ? AllowList.fromPartial(object.allow_list) : undefined; + return message; + }, +}; + +export const MsgUpdateDenomResponse: MessageFns = { + $type: "seiprotocol.seichain.tokenfactory.MsgUpdateDenomResponse" as const, + + encode(_: MsgUpdateDenomResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter { + return writer; + }, + + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateDenomResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + const end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateDenomResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + } + if ((tag & 7) === 4 || tag === 0) { + break; + } + reader.skip(tag & 7); + } + return message; + }, + + fromJSON(_: any): MsgUpdateDenomResponse { + return {}; + }, + + toJSON(_: MsgUpdateDenomResponse): unknown { + const obj: any = {}; + return obj; + }, + + create, I>>(base?: I): MsgUpdateDenomResponse { + return MsgUpdateDenomResponse.fromPartial(base ?? ({} as any)); + }, + fromPartial, I>>(_: I): MsgUpdateDenomResponse { + const message = createBaseMsgUpdateDenomResponse(); + return message; + }, +}; + +function createBaseMsgCreateDenom(): MsgCreateDenom { + return { sender: "", subdenom: "", allow_list: undefined }; +} + +function createBaseMsgCreateDenomResponse(): MsgCreateDenomResponse { + return { new_token_denom: "" }; +} + +function createBaseMsgMint(): MsgMint { + return { sender: "", amount: undefined }; +} + +function createBaseMsgMintResponse(): MsgMintResponse { + return {}; +} + +function createBaseMsgBurn(): MsgBurn { + return { sender: "", amount: undefined }; +} + +function createBaseMsgBurnResponse(): MsgBurnResponse { + return {}; +} + +function createBaseMsgChangeAdmin(): MsgChangeAdmin { + return { sender: "", denom: "", new_admin: "" }; +} + +function createBaseMsgChangeAdminResponse(): MsgChangeAdminResponse { + return {}; +} + +function createBaseMsgSetDenomMetadata(): MsgSetDenomMetadata { + return { sender: "", metadata: undefined }; +} + +function createBaseMsgSetDenomMetadataResponse(): MsgSetDenomMetadataResponse { + return {}; +} + +function createBaseMsgUpdateDenom(): MsgUpdateDenom { + return { sender: "", denom: "", allow_list: undefined }; +} + +function createBaseMsgUpdateDenomResponse(): MsgUpdateDenomResponse { + return {}; +} + +function isSet(value: any): boolean { + return value !== null && value !== undefined; +} +export const registry: Array<[string, GeneratedType]> = [ + ["/seiprotocol.seichain.tokenfactory.MsgCreateDenom", MsgCreateDenom as never], + ["/seiprotocol.seichain.tokenfactory.MsgMint", MsgMint as never], + ["/seiprotocol.seichain.tokenfactory.MsgMintResponse", MsgMintResponse as never], + ["/seiprotocol.seichain.tokenfactory.MsgBurn", MsgBurn as never], + ["/seiprotocol.seichain.tokenfactory.MsgBurnResponse", MsgBurnResponse as never], + ["/seiprotocol.seichain.tokenfactory.MsgChangeAdmin", MsgChangeAdmin as never], + ["/seiprotocol.seichain.tokenfactory.MsgUpdateDenom", MsgUpdateDenom as never], +]; +export const aminoConverters = { + "/seiprotocol.seichain.tokenfactory.MsgCreateDenom": { + aminoType: "tokenfactory/MsgCreateDenom", + toAmino: (message: MsgCreateDenom) => ({ ...message }), + fromAmino: (object: MsgCreateDenom) => ({ ...object }), + }, + + "/seiprotocol.seichain.tokenfactory.MsgMint": { + aminoType: "tokenfactory/MsgMint", + toAmino: (message: MsgMint) => ({ ...message }), + fromAmino: (object: MsgMint) => ({ ...object }), + }, + + "/seiprotocol.seichain.tokenfactory.MsgMintResponse": { + aminoType: "tokenfactory/MsgMintResponse", + toAmino: (message: MsgMintResponse) => ({ ...message }), + fromAmino: (object: MsgMintResponse) => ({ ...object }), + }, + + "/seiprotocol.seichain.tokenfactory.MsgBurn": { + aminoType: "tokenfactory/MsgBurn", + toAmino: (message: MsgBurn) => ({ ...message }), + fromAmino: (object: MsgBurn) => ({ ...object }), + }, + + "/seiprotocol.seichain.tokenfactory.MsgBurnResponse": { + aminoType: "tokenfactory/MsgBurnResponse", + toAmino: (message: MsgBurnResponse) => ({ ...message }), + fromAmino: (object: MsgBurnResponse) => ({ ...object }), + }, + + "/seiprotocol.seichain.tokenfactory.MsgChangeAdmin": { + aminoType: "tokenfactory/MsgChangeAdmin", + toAmino: (message: MsgChangeAdmin) => ({ ...message }), + fromAmino: (object: MsgChangeAdmin) => ({ ...object }), + }, + + "/seiprotocol.seichain.tokenfactory.MsgUpdateDenom": { + aminoType: "tokenfactory/MsgUpdateDenom", + toAmino: (message: MsgUpdateDenom) => ({ ...message }), + fromAmino: (object: MsgUpdateDenom) => ({ ...object }), + }, +}; diff --git a/packages/cosmos/generated/rest/cosmos/accesscontrol_x/query.ts b/packages/cosmos/generated/rest/cosmos/accesscontrol_x/query.ts new file mode 100644 index 000000000..1f3473f2b --- /dev/null +++ b/packages/cosmos/generated/rest/cosmos/accesscontrol_x/query.ts @@ -0,0 +1,50 @@ +import * as fm from "../../fetch"; + +import type { + ListResourceDependencyMappingRequest, + ListResourceDependencyMappingResponse, + ListWasmDependencyMappingRequest, + ListWasmDependencyMappingResponse, + QueryParamsRequest, + QueryParamsResponse, + ResourceDependencyMappingFromMessageKeyRequest, + ResourceDependencyMappingFromMessageKeyResponse, + WasmDependencyMappingRequest, + WasmDependencyMappingResponse, +} from "../../../types/cosmos/accesscontrol_x/query.ts"; + +export class Query { + static Params(req: QueryParamsRequest, initReq?: fm.InitReq): Promise { + return fm.fetchReq(`/cosmos/cosmos-sdk/accesscontrol/params?${fm.renderURLSearchParams(req, [])}`, { + ...initReq, + method: "GET", + }); + } + static ResourceDependencyMappingFromMessageKey( + req: ResourceDependencyMappingFromMessageKeyRequest, + initReq?: fm.InitReq, + ): Promise { + return fm.fetchReq( + `/cosmos/cosmos-sdk/accesscontrol/resource_dependency_mapping_from_message_key/${req["message_key"]}?${fm.renderURLSearchParams(req, ["message_key"])}`, + { ...initReq, method: "GET" }, + ); + } + static ListResourceDependencyMapping(req: ListResourceDependencyMappingRequest, initReq?: fm.InitReq): Promise { + return fm.fetchReq( + `/cosmos/cosmos-sdk/accesscontrol/list_resource_dependency_mapping?${fm.renderURLSearchParams(req, [])}`, + { ...initReq, method: "GET" }, + ); + } + static WasmDependencyMapping(req: WasmDependencyMappingRequest, initReq?: fm.InitReq): Promise { + return fm.fetchReq( + `/cosmos/cosmos-sdk/accesscontrol/wasm_dependency_mapping/${req["contract_address"]}?${fm.renderURLSearchParams(req, ["contract_address"])}`, + { ...initReq, method: "GET" }, + ); + } + static ListWasmDependencyMapping(req: ListWasmDependencyMappingRequest, initReq?: fm.InitReq): Promise { + return fm.fetchReq( + `/cosmos/cosmos-sdk/accesscontrol/list_wasm_dependency_mapping?${fm.renderURLSearchParams(req, [])}`, + { ...initReq, method: "GET" }, + ); + } +} diff --git a/packages/cosmos/generated/rest/cosmos/auth/v1beta1/query.ts b/packages/cosmos/generated/rest/cosmos/auth/v1beta1/query.ts new file mode 100644 index 000000000..a015913aa --- /dev/null +++ b/packages/cosmos/generated/rest/cosmos/auth/v1beta1/query.ts @@ -0,0 +1,39 @@ +import * as fm from "../../../fetch"; + +import type { + QueryAccountRequest, + QueryAccountResponse, + QueryAccountsRequest, + QueryAccountsResponse, + QueryNextAccountNumberRequest, + QueryNextAccountNumberResponse, + QueryParamsRequest, + QueryParamsResponse, +} from "../../../../types/cosmos/auth/v1beta1/query.ts"; + +export class Query { + static Accounts(req: QueryAccountsRequest, initReq?: fm.InitReq): Promise { + return fm.fetchReq(`/cosmos/auth/v1beta1/accounts?${fm.renderURLSearchParams(req, [])}`, { + ...initReq, + method: "GET", + }); + } + static Account(req: QueryAccountRequest, initReq?: fm.InitReq): Promise { + return fm.fetchReq( + `/cosmos/auth/v1beta1/accounts/${req["address"]}?${fm.renderURLSearchParams(req, ["address"])}`, + { ...initReq, method: "GET" }, + ); + } + static Params(req: QueryParamsRequest, initReq?: fm.InitReq): Promise { + return fm.fetchReq(`/cosmos/auth/v1beta1/params?${fm.renderURLSearchParams(req, [])}`, { + ...initReq, + method: "GET", + }); + } + static NextAccountNumber(req: QueryNextAccountNumberRequest, initReq?: fm.InitReq): Promise { + return fm.fetchReq( + `/cosmos/auth/v1beta1/nextaccountnumber?${fm.renderURLSearchParams(req, [])}`, + { ...initReq, method: "GET" }, + ); + } +} diff --git a/packages/cosmos/generated/rest/cosmos/authz/v1beta1/query.ts b/packages/cosmos/generated/rest/cosmos/authz/v1beta1/query.ts new file mode 100644 index 000000000..ce3e39f09 --- /dev/null +++ b/packages/cosmos/generated/rest/cosmos/authz/v1beta1/query.ts @@ -0,0 +1,31 @@ +import * as fm from "../../../fetch"; + +import type { + QueryGranteeGrantsRequest, + QueryGranteeGrantsResponse, + QueryGranterGrantsRequest, + QueryGranterGrantsResponse, + QueryGrantsRequest, + QueryGrantsResponse, +} from "../../../../types/cosmos/authz/v1beta1/query.ts"; + +export class Query { + static Grants(req: QueryGrantsRequest, initReq?: fm.InitReq): Promise { + return fm.fetchReq(`/cosmos/authz/v1beta1/grants?${fm.renderURLSearchParams(req, [])}`, { + ...initReq, + method: "GET", + }); + } + static GranterGrants(req: QueryGranterGrantsRequest, initReq?: fm.InitReq): Promise { + return fm.fetchReq( + `/cosmos/authz/v1beta1/grants/granter/${req["granter"]}?${fm.renderURLSearchParams(req, ["granter"])}`, + { ...initReq, method: "GET" }, + ); + } + static GranteeGrants(req: QueryGranteeGrantsRequest, initReq?: fm.InitReq): Promise { + return fm.fetchReq( + `/cosmos/authz/v1beta1/grants/grantee/${req["grantee"]}?${fm.renderURLSearchParams(req, ["grantee"])}`, + { ...initReq, method: "GET" }, + ); + } +} diff --git a/packages/cosmos/generated/rest/cosmos/bank/v1beta1/query.ts b/packages/cosmos/generated/rest/cosmos/bank/v1beta1/query.ts new file mode 100644 index 000000000..58447552f --- /dev/null +++ b/packages/cosmos/generated/rest/cosmos/bank/v1beta1/query.ts @@ -0,0 +1,71 @@ +import * as fm from "../../../fetch"; + +import type { + QueryAllBalancesRequest, + QueryAllBalancesResponse, + QueryBalanceRequest, + QueryBalanceResponse, + QueryDenomMetadataRequest, + QueryDenomMetadataResponse, + QueryDenomsMetadataRequest, + QueryDenomsMetadataResponse, + QueryParamsRequest, + QueryParamsResponse, + QuerySpendableBalancesRequest, + QuerySpendableBalancesResponse, + QuerySupplyOfRequest, + QuerySupplyOfResponse, + QueryTotalSupplyRequest, + QueryTotalSupplyResponse, +} from "../../../../types/cosmos/bank/v1beta1/query.ts"; + +export class Query { + static Balance(req: QueryBalanceRequest, initReq?: fm.InitReq): Promise { + return fm.fetchReq( + `/cosmos/bank/v1beta1/balances/${req["address"]}/by_denom?${fm.renderURLSearchParams(req, ["address"])}`, + { ...initReq, method: "GET" }, + ); + } + static AllBalances(req: QueryAllBalancesRequest, initReq?: fm.InitReq): Promise { + return fm.fetchReq( + `/cosmos/bank/v1beta1/balances/${req["address"]}?${fm.renderURLSearchParams(req, ["address"])}`, + { ...initReq, method: "GET" }, + ); + } + static SpendableBalances(req: QuerySpendableBalancesRequest, initReq?: fm.InitReq): Promise { + return fm.fetchReq( + `/cosmos/bank/v1beta1/spendable_balances/${req["address"]}?${fm.renderURLSearchParams(req, ["address"])}`, + { ...initReq, method: "GET" }, + ); + } + static TotalSupply(req: QueryTotalSupplyRequest, initReq?: fm.InitReq): Promise { + return fm.fetchReq(`/cosmos/bank/v1beta1/supply?${fm.renderURLSearchParams(req, [])}`, { + ...initReq, + method: "GET", + }); + } + static SupplyOf(req: QuerySupplyOfRequest, initReq?: fm.InitReq): Promise { + return fm.fetchReq(`/cosmos/bank/v1beta1/supply/${req["denom"]}?${fm.renderURLSearchParams(req, ["denom"])}`, { + ...initReq, + method: "GET", + }); + } + static Params(req: QueryParamsRequest, initReq?: fm.InitReq): Promise { + return fm.fetchReq(`/cosmos/bank/v1beta1/params?${fm.renderURLSearchParams(req, [])}`, { + ...initReq, + method: "GET", + }); + } + static DenomMetadata(req: QueryDenomMetadataRequest, initReq?: fm.InitReq): Promise { + return fm.fetchReq( + `/cosmos/bank/v1beta1/denoms_metadata/${req["denom"]}?${fm.renderURLSearchParams(req, ["denom"])}`, + { ...initReq, method: "GET" }, + ); + } + static DenomsMetadata(req: QueryDenomsMetadataRequest, initReq?: fm.InitReq): Promise { + return fm.fetchReq(`/cosmos/bank/v1beta1/denoms_metadata?${fm.renderURLSearchParams(req, [])}`, { + ...initReq, + method: "GET", + }); + } +} diff --git a/packages/cosmos/generated/rest/cosmos/distribution/v1beta1/query.ts b/packages/cosmos/generated/rest/cosmos/distribution/v1beta1/query.ts new file mode 100644 index 000000000..ea886d542 --- /dev/null +++ b/packages/cosmos/generated/rest/cosmos/distribution/v1beta1/query.ts @@ -0,0 +1,79 @@ +import * as fm from "../../../fetch"; + +import type { + QueryCommunityPoolRequest, + QueryCommunityPoolResponse, + QueryDelegationRewardsRequest, + QueryDelegationRewardsResponse, + QueryDelegationTotalRewardsRequest, + QueryDelegationTotalRewardsResponse, + QueryDelegatorValidatorsRequest, + QueryDelegatorValidatorsResponse, + QueryDelegatorWithdrawAddressRequest, + QueryDelegatorWithdrawAddressResponse, + QueryParamsRequest, + QueryParamsResponse, + QueryValidatorCommissionRequest, + QueryValidatorCommissionResponse, + QueryValidatorOutstandingRewardsRequest, + QueryValidatorOutstandingRewardsResponse, + QueryValidatorSlashesRequest, + QueryValidatorSlashesResponse, +} from "../../../../types/cosmos/distribution/v1beta1/query.ts"; + +export class Query { + static Params(req: QueryParamsRequest, initReq?: fm.InitReq): Promise { + return fm.fetchReq(`/cosmos/distribution/v1beta1/params?${fm.renderURLSearchParams(req, [])}`, { + ...initReq, + method: "GET", + }); + } + static ValidatorOutstandingRewards(req: QueryValidatorOutstandingRewardsRequest, initReq?: fm.InitReq): Promise { + return fm.fetchReq( + `/cosmos/distribution/v1beta1/validators/${req["validator_address"]}/outstanding_rewards?${fm.renderURLSearchParams(req, ["validator_address"])}`, + { ...initReq, method: "GET" }, + ); + } + static ValidatorCommission(req: QueryValidatorCommissionRequest, initReq?: fm.InitReq): Promise { + return fm.fetchReq( + `/cosmos/distribution/v1beta1/validators/${req["validator_address"]}/commission?${fm.renderURLSearchParams(req, ["validator_address"])}`, + { ...initReq, method: "GET" }, + ); + } + static ValidatorSlashes(req: QueryValidatorSlashesRequest, initReq?: fm.InitReq): Promise { + return fm.fetchReq( + `/cosmos/distribution/v1beta1/validators/${req["validator_address"]}/slashes?${fm.renderURLSearchParams(req, ["validator_address"])}`, + { ...initReq, method: "GET" }, + ); + } + static DelegationRewards(req: QueryDelegationRewardsRequest, initReq?: fm.InitReq): Promise { + return fm.fetchReq( + `/cosmos/distribution/v1beta1/delegators/${req["delegator_address"]}/rewards/${req["validator_address"]}?${fm.renderURLSearchParams(req, ["delegator_address", "validator_address"])}`, + { ...initReq, method: "GET" }, + ); + } + static DelegationTotalRewards(req: QueryDelegationTotalRewardsRequest, initReq?: fm.InitReq): Promise { + return fm.fetchReq( + `/cosmos/distribution/v1beta1/delegators/${req["delegator_address"]}/rewards?${fm.renderURLSearchParams(req, ["delegator_address"])}`, + { ...initReq, method: "GET" }, + ); + } + static DelegatorValidators(req: QueryDelegatorValidatorsRequest, initReq?: fm.InitReq): Promise { + return fm.fetchReq( + `/cosmos/distribution/v1beta1/delegators/${req["delegator_address"]}/validators?${fm.renderURLSearchParams(req, ["delegator_address"])}`, + { ...initReq, method: "GET" }, + ); + } + static DelegatorWithdrawAddress(req: QueryDelegatorWithdrawAddressRequest, initReq?: fm.InitReq): Promise { + return fm.fetchReq( + `/cosmos/distribution/v1beta1/delegators/${req["delegator_address"]}/withdraw_address?${fm.renderURLSearchParams(req, ["delegator_address"])}`, + { ...initReq, method: "GET" }, + ); + } + static CommunityPool(req: QueryCommunityPoolRequest, initReq?: fm.InitReq): Promise { + return fm.fetchReq( + `/cosmos/distribution/v1beta1/community_pool?${fm.renderURLSearchParams(req, [])}`, + { ...initReq, method: "GET" }, + ); + } +} diff --git a/packages/cosmos/generated/rest/cosmos/evidence/v1beta1/query.ts b/packages/cosmos/generated/rest/cosmos/evidence/v1beta1/query.ts new file mode 100644 index 000000000..2f39b3454 --- /dev/null +++ b/packages/cosmos/generated/rest/cosmos/evidence/v1beta1/query.ts @@ -0,0 +1,23 @@ +import * as fm from "../../../fetch"; + +import type { + QueryAllEvidenceRequest, + QueryAllEvidenceResponse, + QueryEvidenceRequest, + QueryEvidenceResponse, +} from "../../../../types/cosmos/evidence/v1beta1/query.ts"; + +export class Query { + static Evidence(req: QueryEvidenceRequest, initReq?: fm.InitReq): Promise { + return fm.fetchReq( + `/cosmos/evidence/v1beta1/evidence/${req["evidence_hash"]}?${fm.renderURLSearchParams(req, ["evidence_hash"])}`, + { ...initReq, method: "GET" }, + ); + } + static AllEvidence(req: QueryAllEvidenceRequest, initReq?: fm.InitReq): Promise { + return fm.fetchReq(`/cosmos/evidence/v1beta1/evidence?${fm.renderURLSearchParams(req, [])}`, { + ...initReq, + method: "GET", + }); + } +} diff --git a/packages/cosmos/generated/rest/cosmos/feegrant/v1beta1/query.ts b/packages/cosmos/generated/rest/cosmos/feegrant/v1beta1/query.ts new file mode 100644 index 000000000..17651dae9 --- /dev/null +++ b/packages/cosmos/generated/rest/cosmos/feegrant/v1beta1/query.ts @@ -0,0 +1,31 @@ +import * as fm from "../../../fetch"; + +import type { + QueryAllowanceRequest, + QueryAllowanceResponse, + QueryAllowancesByGranterRequest, + QueryAllowancesByGranterResponse, + QueryAllowancesRequest, + QueryAllowancesResponse, +} from "../../../../types/cosmos/feegrant/v1beta1/query.ts"; + +export class Query { + static Allowance(req: QueryAllowanceRequest, initReq?: fm.InitReq): Promise { + return fm.fetchReq( + `/cosmos/feegrant/v1beta1/allowance/${req["granter"]}/${req["grantee"]}?${fm.renderURLSearchParams(req, ["granter", "grantee"])}`, + { ...initReq, method: "GET" }, + ); + } + static Allowances(req: QueryAllowancesRequest, initReq?: fm.InitReq): Promise { + return fm.fetchReq( + `/cosmos/feegrant/v1beta1/allowances/${req["grantee"]}?${fm.renderURLSearchParams(req, ["grantee"])}`, + { ...initReq, method: "GET" }, + ); + } + static AllowancesByGranter(req: QueryAllowancesByGranterRequest, initReq?: fm.InitReq): Promise { + return fm.fetchReq( + `/cosmos/feegrant/v1beta1/issued/${req["granter"]}?${fm.renderURLSearchParams(req, ["granter"])}`, + { ...initReq, method: "GET" }, + ); + } +} diff --git a/packages/cosmos/generated/rest/cosmos/gov/v1beta1/query.ts b/packages/cosmos/generated/rest/cosmos/gov/v1beta1/query.ts new file mode 100644 index 000000000..f97aabaef --- /dev/null +++ b/packages/cosmos/generated/rest/cosmos/gov/v1beta1/query.ts @@ -0,0 +1,71 @@ +import * as fm from "../../../fetch"; + +import type { + QueryDepositRequest, + QueryDepositResponse, + QueryDepositsRequest, + QueryDepositsResponse, + QueryParamsRequest, + QueryParamsResponse, + QueryProposalRequest, + QueryProposalResponse, + QueryProposalsRequest, + QueryProposalsResponse, + QueryTallyResultRequest, + QueryTallyResultResponse, + QueryVoteRequest, + QueryVoteResponse, + QueryVotesRequest, + QueryVotesResponse, +} from "../../../../types/cosmos/gov/v1beta1/query.ts"; + +export class Query { + static Proposal(req: QueryProposalRequest, initReq?: fm.InitReq): Promise { + return fm.fetchReq( + `/cosmos/gov/v1beta1/proposals/${req["proposal_id"]}?${fm.renderURLSearchParams(req, ["proposal_id"])}`, + { ...initReq, method: "GET" }, + ); + } + static Proposals(req: QueryProposalsRequest, initReq?: fm.InitReq): Promise { + return fm.fetchReq(`/cosmos/gov/v1beta1/proposals?${fm.renderURLSearchParams(req, [])}`, { + ...initReq, + method: "GET", + }); + } + static Vote(req: QueryVoteRequest, initReq?: fm.InitReq): Promise { + return fm.fetchReq( + `/cosmos/gov/v1beta1/proposals/${req["proposal_id"]}/votes/${req["voter"]}?${fm.renderURLSearchParams(req, ["proposal_id", "voter"])}`, + { ...initReq, method: "GET" }, + ); + } + static Votes(req: QueryVotesRequest, initReq?: fm.InitReq): Promise { + return fm.fetchReq( + `/cosmos/gov/v1beta1/proposals/${req["proposal_id"]}/votes?${fm.renderURLSearchParams(req, ["proposal_id"])}`, + { ...initReq, method: "GET" }, + ); + } + static Params(req: QueryParamsRequest, initReq?: fm.InitReq): Promise { + return fm.fetchReq( + `/cosmos/gov/v1beta1/params/${req["params_type"]}?${fm.renderURLSearchParams(req, ["params_type"])}`, + { ...initReq, method: "GET" }, + ); + } + static Deposit(req: QueryDepositRequest, initReq?: fm.InitReq): Promise { + return fm.fetchReq( + `/cosmos/gov/v1beta1/proposals/${req["proposal_id"]}/deposits/${req["depositor"]}?${fm.renderURLSearchParams(req, ["proposal_id", "depositor"])}`, + { ...initReq, method: "GET" }, + ); + } + static Deposits(req: QueryDepositsRequest, initReq?: fm.InitReq): Promise { + return fm.fetchReq( + `/cosmos/gov/v1beta1/proposals/${req["proposal_id"]}/deposits?${fm.renderURLSearchParams(req, ["proposal_id"])}`, + { ...initReq, method: "GET" }, + ); + } + static TallyResult(req: QueryTallyResultRequest, initReq?: fm.InitReq): Promise { + return fm.fetchReq( + `/cosmos/gov/v1beta1/proposals/${req["proposal_id"]}/tally?${fm.renderURLSearchParams(req, ["proposal_id"])}`, + { ...initReq, method: "GET" }, + ); + } +} diff --git a/packages/cosmos/generated/rest/cosmos/mint/v1beta1/query.ts b/packages/cosmos/generated/rest/cosmos/mint/v1beta1/query.ts new file mode 100644 index 000000000..347a82b6e --- /dev/null +++ b/packages/cosmos/generated/rest/cosmos/mint/v1beta1/query.ts @@ -0,0 +1,31 @@ +import * as fm from "../../../fetch"; + +import type { + QueryAnnualProvisionsRequest, + QueryAnnualProvisionsResponse, + QueryInflationRequest, + QueryInflationResponse, + QueryParamsRequest, + QueryParamsResponse, +} from "../../../../types/cosmos/mint/v1beta1/query.ts"; + +export class Query { + static Params(req: QueryParamsRequest, initReq?: fm.InitReq): Promise { + return fm.fetchReq(`/cosmos/mint/v1beta1/params?${fm.renderURLSearchParams(req, [])}`, { + ...initReq, + method: "GET", + }); + } + static Inflation(req: QueryInflationRequest, initReq?: fm.InitReq): Promise { + return fm.fetchReq(`/cosmos/mint/v1beta1/inflation?${fm.renderURLSearchParams(req, [])}`, { + ...initReq, + method: "GET", + }); + } + static AnnualProvisions(req: QueryAnnualProvisionsRequest, initReq?: fm.InitReq): Promise { + return fm.fetchReq( + `/cosmos/mint/v1beta1/annual_provisions?${fm.renderURLSearchParams(req, [])}`, + { ...initReq, method: "GET" }, + ); + } +} diff --git a/packages/cosmos/generated/rest/cosmos/params/v1beta1/query.ts b/packages/cosmos/generated/rest/cosmos/params/v1beta1/query.ts new file mode 100644 index 000000000..2367631f6 --- /dev/null +++ b/packages/cosmos/generated/rest/cosmos/params/v1beta1/query.ts @@ -0,0 +1,12 @@ +import * as fm from "../../../fetch"; + +import type { QueryParamsRequest, QueryParamsResponse } from "../../../../types/cosmos/params/v1beta1/query.ts"; + +export class Query { + static Params(req: QueryParamsRequest, initReq?: fm.InitReq): Promise { + return fm.fetchReq(`/cosmos/params/v1beta1/params?${fm.renderURLSearchParams(req, [])}`, { + ...initReq, + method: "GET", + }); + } +} diff --git a/packages/cosmos/generated/rest/cosmos/slashing/v1beta1/query.ts b/packages/cosmos/generated/rest/cosmos/slashing/v1beta1/query.ts new file mode 100644 index 000000000..c815c5c15 --- /dev/null +++ b/packages/cosmos/generated/rest/cosmos/slashing/v1beta1/query.ts @@ -0,0 +1,31 @@ +import * as fm from "../../../fetch"; + +import type { + QueryParamsRequest, + QueryParamsResponse, + QuerySigningInfoRequest, + QuerySigningInfoResponse, + QuerySigningInfosRequest, + QuerySigningInfosResponse, +} from "../../../../types/cosmos/slashing/v1beta1/query.ts"; + +export class Query { + static Params(req: QueryParamsRequest, initReq?: fm.InitReq): Promise { + return fm.fetchReq(`/cosmos/slashing/v1beta1/params?${fm.renderURLSearchParams(req, [])}`, { + ...initReq, + method: "GET", + }); + } + static SigningInfo(req: QuerySigningInfoRequest, initReq?: fm.InitReq): Promise { + return fm.fetchReq( + `/cosmos/slashing/v1beta1/signing_infos/${req["cons_address"]}?${fm.renderURLSearchParams(req, ["cons_address"])}`, + { ...initReq, method: "GET" }, + ); + } + static SigningInfos(req: QuerySigningInfosRequest, initReq?: fm.InitReq): Promise { + return fm.fetchReq(`/cosmos/slashing/v1beta1/signing_infos?${fm.renderURLSearchParams(req, [])}`, { + ...initReq, + method: "GET", + }); + } +} diff --git a/packages/cosmos/generated/rest/cosmos/staking/v1beta1/query.ts b/packages/cosmos/generated/rest/cosmos/staking/v1beta1/query.ts new file mode 100644 index 000000000..4f18da4e4 --- /dev/null +++ b/packages/cosmos/generated/rest/cosmos/staking/v1beta1/query.ts @@ -0,0 +1,122 @@ +import * as fm from "../../../fetch"; + +import type { + QueryDelegationRequest, + QueryDelegationResponse, + QueryDelegatorDelegationsRequest, + QueryDelegatorDelegationsResponse, + QueryDelegatorUnbondingDelegationsRequest, + QueryDelegatorUnbondingDelegationsResponse, + QueryDelegatorValidatorRequest, + QueryDelegatorValidatorResponse, + QueryDelegatorValidatorsRequest, + QueryDelegatorValidatorsResponse, + QueryHistoricalInfoRequest, + QueryHistoricalInfoResponse, + QueryParamsRequest, + QueryParamsResponse, + QueryPoolRequest, + QueryPoolResponse, + QueryRedelegationsRequest, + QueryRedelegationsResponse, + QueryUnbondingDelegationRequest, + QueryUnbondingDelegationResponse, + QueryValidatorDelegationsRequest, + QueryValidatorDelegationsResponse, + QueryValidatorRequest, + QueryValidatorResponse, + QueryValidatorUnbondingDelegationsRequest, + QueryValidatorUnbondingDelegationsResponse, + QueryValidatorsRequest, + QueryValidatorsResponse, +} from "../../../../types/cosmos/staking/v1beta1/query.ts"; + +export class Query { + static Validators(req: QueryValidatorsRequest, initReq?: fm.InitReq): Promise { + return fm.fetchReq(`/cosmos/staking/v1beta1/validators?${fm.renderURLSearchParams(req, [])}`, { + ...initReq, + method: "GET", + }); + } + static Validator(req: QueryValidatorRequest, initReq?: fm.InitReq): Promise { + return fm.fetchReq( + `/cosmos/staking/v1beta1/validators/${req["validator_addr"]}?${fm.renderURLSearchParams(req, ["validator_addr"])}`, + { ...initReq, method: "GET" }, + ); + } + static ValidatorDelegations(req: QueryValidatorDelegationsRequest, initReq?: fm.InitReq): Promise { + return fm.fetchReq( + `/cosmos/staking/v1beta1/validators/${req["validator_addr"]}/delegations?${fm.renderURLSearchParams(req, ["validator_addr"])}`, + { ...initReq, method: "GET" }, + ); + } + static ValidatorUnbondingDelegations( + req: QueryValidatorUnbondingDelegationsRequest, + initReq?: fm.InitReq, + ): Promise { + return fm.fetchReq( + `/cosmos/staking/v1beta1/validators/${req["validator_addr"]}/unbonding_delegations?${fm.renderURLSearchParams(req, ["validator_addr"])}`, + { ...initReq, method: "GET" }, + ); + } + static Delegation(req: QueryDelegationRequest, initReq?: fm.InitReq): Promise { + return fm.fetchReq( + `/cosmos/staking/v1beta1/validators/${req["validator_addr"]}/delegations/${req["delegator_addr"]}?${fm.renderURLSearchParams(req, ["validator_addr", "delegator_addr"])}`, + { ...initReq, method: "GET" }, + ); + } + static UnbondingDelegation(req: QueryUnbondingDelegationRequest, initReq?: fm.InitReq): Promise { + return fm.fetchReq( + `/cosmos/staking/v1beta1/validators/${req["validator_addr"]}/delegations/${req["delegator_addr"]}/unbonding_delegation?${fm.renderURLSearchParams(req, ["validator_addr", "delegator_addr"])}`, + { ...initReq, method: "GET" }, + ); + } + static DelegatorDelegations(req: QueryDelegatorDelegationsRequest, initReq?: fm.InitReq): Promise { + return fm.fetchReq( + `/cosmos/staking/v1beta1/delegations/${req["delegator_addr"]}?${fm.renderURLSearchParams(req, ["delegator_addr"])}`, + { ...initReq, method: "GET" }, + ); + } + static DelegatorUnbondingDelegations( + req: QueryDelegatorUnbondingDelegationsRequest, + initReq?: fm.InitReq, + ): Promise { + return fm.fetchReq( + `/cosmos/staking/v1beta1/delegators/${req["delegator_addr"]}/unbonding_delegations?${fm.renderURLSearchParams(req, ["delegator_addr"])}`, + { ...initReq, method: "GET" }, + ); + } + static Redelegations(req: QueryRedelegationsRequest, initReq?: fm.InitReq): Promise { + return fm.fetchReq( + `/cosmos/staking/v1beta1/delegators/${req["delegator_addr"]}/redelegations?${fm.renderURLSearchParams(req, ["delegator_addr"])}`, + { ...initReq, method: "GET" }, + ); + } + static DelegatorValidators(req: QueryDelegatorValidatorsRequest, initReq?: fm.InitReq): Promise { + return fm.fetchReq( + `/cosmos/staking/v1beta1/delegators/${req["delegator_addr"]}/validators?${fm.renderURLSearchParams(req, ["delegator_addr"])}`, + { ...initReq, method: "GET" }, + ); + } + static DelegatorValidator(req: QueryDelegatorValidatorRequest, initReq?: fm.InitReq): Promise { + return fm.fetchReq( + `/cosmos/staking/v1beta1/delegators/${req["delegator_addr"]}/validators/${req["validator_addr"]}?${fm.renderURLSearchParams(req, ["delegator_addr", "validator_addr"])}`, + { ...initReq, method: "GET" }, + ); + } + static HistoricalInfo(req: QueryHistoricalInfoRequest, initReq?: fm.InitReq): Promise { + return fm.fetchReq( + `/cosmos/staking/v1beta1/historical_info/${req["height"]}?${fm.renderURLSearchParams(req, ["height"])}`, + { ...initReq, method: "GET" }, + ); + } + static Pool(req: QueryPoolRequest, initReq?: fm.InitReq): Promise { + return fm.fetchReq(`/cosmos/staking/v1beta1/pool?${fm.renderURLSearchParams(req, [])}`, { ...initReq, method: "GET" }); + } + static Params(req: QueryParamsRequest, initReq?: fm.InitReq): Promise { + return fm.fetchReq(`/cosmos/staking/v1beta1/params?${fm.renderURLSearchParams(req, [])}`, { + ...initReq, + method: "GET", + }); + } +} diff --git a/packages/cosmos/generated/rest/cosmos/upgrade/v1beta1/query.ts b/packages/cosmos/generated/rest/cosmos/upgrade/v1beta1/query.ts new file mode 100644 index 000000000..fce188095 --- /dev/null +++ b/packages/cosmos/generated/rest/cosmos/upgrade/v1beta1/query.ts @@ -0,0 +1,39 @@ +import * as fm from "../../../fetch"; + +import type { + QueryAppliedPlanRequest, + QueryAppliedPlanResponse, + QueryCurrentPlanRequest, + QueryCurrentPlanResponse, + QueryModuleVersionsRequest, + QueryModuleVersionsResponse, + QueryUpgradedConsensusStateRequest, + QueryUpgradedConsensusStateResponse, +} from "../../../../types/cosmos/upgrade/v1beta1/query.ts"; + +export class Query { + static CurrentPlan(req: QueryCurrentPlanRequest, initReq?: fm.InitReq): Promise { + return fm.fetchReq(`/cosmos/upgrade/v1beta1/current_plan?${fm.renderURLSearchParams(req, [])}`, { + ...initReq, + method: "GET", + }); + } + static AppliedPlan(req: QueryAppliedPlanRequest, initReq?: fm.InitReq): Promise { + return fm.fetchReq( + `/cosmos/upgrade/v1beta1/applied_plan/${req["name"]}?${fm.renderURLSearchParams(req, ["name"])}`, + { ...initReq, method: "GET" }, + ); + } + static UpgradedConsensusState(req: QueryUpgradedConsensusStateRequest, initReq?: fm.InitReq): Promise { + return fm.fetchReq( + `/cosmos/upgrade/v1beta1/upgraded_consensus_state/${req["last_height"]}?${fm.renderURLSearchParams(req, ["last_height"])}`, + { ...initReq, method: "GET" }, + ); + } + static ModuleVersions(req: QueryModuleVersionsRequest, initReq?: fm.InitReq): Promise { + return fm.fetchReq( + `/cosmos/upgrade/v1beta1/module_versions?${fm.renderURLSearchParams(req, [])}`, + { ...initReq, method: "GET" }, + ); + } +} diff --git a/packages/cosmos/generated/rest/epoch/query.ts b/packages/cosmos/generated/rest/epoch/query.ts new file mode 100644 index 000000000..f2b5f9236 --- /dev/null +++ b/packages/cosmos/generated/rest/epoch/query.ts @@ -0,0 +1,18 @@ +import * as fm from "../fetch"; + +import type { QueryEpochRequest, QueryEpochResponse, QueryParamsRequest, QueryParamsResponse } from "../../types/epoch/query.ts"; + +export class Query { + static Epoch(req: QueryEpochRequest, initReq?: fm.InitReq): Promise { + return fm.fetchReq(`/sei-protocol/seichain/epoch/epoch?${fm.renderURLSearchParams(req, [])}`, { + ...initReq, + method: "GET", + }); + } + static Params(req: QueryParamsRequest, initReq?: fm.InitReq): Promise { + return fm.fetchReq(`/sei-protocol/seichain/epoch/params?${fm.renderURLSearchParams(req, [])}`, { + ...initReq, + method: "GET", + }); + } +} diff --git a/packages/cosmos/generated/rest/evm/query.ts b/packages/cosmos/generated/rest/evm/query.ts new file mode 100644 index 000000000..cc6899b1f --- /dev/null +++ b/packages/cosmos/generated/rest/evm/query.ts @@ -0,0 +1,55 @@ +import * as fm from "../fetch"; + +import type { + QueryEVMAddressBySeiAddressRequest, + QueryEVMAddressBySeiAddressResponse, + QueryPointeeRequest, + QueryPointeeResponse, + QueryPointerRequest, + QueryPointerResponse, + QueryPointerVersionRequest, + QueryPointerVersionResponse, + QuerySeiAddressByEVMAddressRequest, + QuerySeiAddressByEVMAddressResponse, + QueryStaticCallRequest, + QueryStaticCallResponse, +} from "../../types/evm/query.ts"; + +export class Query { + static SeiAddressByEVMAddress(req: QuerySeiAddressByEVMAddressRequest, initReq?: fm.InitReq): Promise { + return fm.fetchReq( + `/sei-protocol/seichain/evm/sei_address?${fm.renderURLSearchParams(req, [])}`, + { ...initReq, method: "GET" }, + ); + } + static EVMAddressBySeiAddress(req: QueryEVMAddressBySeiAddressRequest, initReq?: fm.InitReq): Promise { + return fm.fetchReq( + `/sei-protocol/seichain/evm/evm_address?${fm.renderURLSearchParams(req, [])}`, + { ...initReq, method: "GET" }, + ); + } + static StaticCall(req: QueryStaticCallRequest, initReq?: fm.InitReq): Promise { + return fm.fetchReq(`/sei-protocol/seichain/evm/static_call?${fm.renderURLSearchParams(req, [])}`, { + ...initReq, + method: "GET", + }); + } + static Pointer(req: QueryPointerRequest, initReq?: fm.InitReq): Promise { + return fm.fetchReq(`/sei-protocol/seichain/evm/pointer?${fm.renderURLSearchParams(req, [])}`, { + ...initReq, + method: "GET", + }); + } + static PointerVersion(req: QueryPointerVersionRequest, initReq?: fm.InitReq): Promise { + return fm.fetchReq( + `/sei-protocol/seichain/evm/pointer_version?${fm.renderURLSearchParams(req, [])}`, + { ...initReq, method: "GET" }, + ); + } + static Pointee(req: QueryPointeeRequest, initReq?: fm.InitReq): Promise { + return fm.fetchReq(`/sei-protocol/seichain/evm/pointee?${fm.renderURLSearchParams(req, [])}`, { + ...initReq, + method: "GET", + }); + } +} diff --git a/packages/cosmos/generated/rest/fetch.ts b/packages/cosmos/generated/rest/fetch.ts new file mode 100644 index 000000000..08d74d196 --- /dev/null +++ b/packages/cosmos/generated/rest/fetch.ts @@ -0,0 +1,82 @@ +export interface InitReq extends RequestInit { + pathPrefix?: string; +} + +export function fetchReq<_I, O>(path: string, init?: InitReq): Promise { + const { pathPrefix, ...req } = init || {}; + + const url = pathPrefix ? `${pathPrefix}${path}` : path; + + return fetch(url, req).then((r) => + r.json().then((body: O) => { + if (!r.ok) { + throw body; + } + return body; + }), + ) as Promise; +} + +type Primitive = string | boolean | number; +type RequestPayload = Record; +type FlattenedRequestPayload = Record>; + +function isPlainObject(value: unknown): boolean { + const isObject = Object.prototype.toString.call(value).slice(8, -1) === "Object"; + const isObjLike = value !== null && isObject; + + if (!isObjLike || !isObject) { + return false; + } + + const proto = Object.getPrototypeOf(value); + + return typeof proto === "object" && proto.constructor === Object.prototype.constructor; +} + +function isPrimitive(value: unknown): boolean { + return typeof value === "string" || typeof value === "number" || typeof value === "boolean"; +} + +function isZeroValuePrimitive(value: Primitive): boolean { + return value === false || value === 0 || value === ""; +} + +function flattenRequestPayload(requestPayload: T, path = ""): FlattenedRequestPayload { + return Object.keys(requestPayload).reduce((acc: FlattenedRequestPayload, key: string): FlattenedRequestPayload => { + const value = requestPayload[key]; + const newPath = path ? [path, key].join(".") : key; + + const isNonEmptyPrimitiveArray = Array.isArray(value) && value.every((v) => isPrimitive(v)) && value.length > 0; + const isNonZeroValuePrimitive = isPrimitive(value) && !isZeroValuePrimitive(value as Primitive); + + if (isPlainObject(value)) { + // Recursively flatten objects + const nested = flattenRequestPayload(value as RequestPayload, newPath); + Object.assign(acc, nested); // Merge nested results into accumulator + } else if (isNonZeroValuePrimitive || isNonEmptyPrimitiveArray) { + // Add non-zero primitives or non-empty primitive arrays + acc[newPath] = value as Primitive | Primitive[]; + } + + return acc; + }, {} as FlattenedRequestPayload); +} +export function renderURLSearchParams(requestPayload: any, urlPathParams: string[] = []): string { + const flattenedRequestPayload = flattenRequestPayload(requestPayload); + + const urlSearchParams = Object.keys(flattenedRequestPayload).reduce((acc: string[][], key: string): string[][] => { + // key should not be present in the url path as a parameter + const value = flattenedRequestPayload[key]; + if (!urlPathParams.includes(key)) { + if (Array.isArray(value)) { + value.forEach((m) => acc.push([key, m.toString()])); + } else { + acc.push([key, value.toString()]); + } + } + return acc; + }, [] as string[][]); + + return new URLSearchParams(urlSearchParams).toString(); +} diff --git a/packages/cosmos/generated/rest/index.ts b/packages/cosmos/generated/rest/index.ts new file mode 100644 index 000000000..c91f1d23b --- /dev/null +++ b/packages/cosmos/generated/rest/index.ts @@ -0,0 +1,41 @@ +import { Query as cosmos_accesscontrol_x } from "./cosmos/accesscontrol_x/query"; +import { Query as cosmos_auth_v1beta1 } from "./cosmos/auth/v1beta1/query"; +import { Query as cosmos_authz_v1beta1 } from "./cosmos/authz/v1beta1/query"; +import { Query as cosmos_bank_v1beta1 } from "./cosmos/bank/v1beta1/query"; +import { Query as cosmos_distribution_v1beta1 } from "./cosmos/distribution/v1beta1/query"; +import { Query as cosmos_evidence_v1beta1 } from "./cosmos/evidence/v1beta1/query"; +import { Query as cosmos_feegrant_v1beta1 } from "./cosmos/feegrant/v1beta1/query"; +import { Query as cosmos_gov_v1beta1 } from "./cosmos/gov/v1beta1/query"; +import { Query as cosmos_mint_v1beta1 } from "./cosmos/mint/v1beta1/query"; +import { Query as cosmos_params_v1beta1 } from "./cosmos/params/v1beta1/query"; +import { Query as cosmos_slashing_v1beta1 } from "./cosmos/slashing/v1beta1/query"; +import { Query as cosmos_staking_v1beta1 } from "./cosmos/staking/v1beta1/query"; +import { Query as cosmos_upgrade_v1beta1 } from "./cosmos/upgrade/v1beta1/query"; +import { Query as epoch } from "./epoch/query"; +import { Query as evm } from "./evm/query"; +import { Query as mint_v1beta1 } from "./mint/v1beta1/query"; +import { Query as oracle } from "./oracle/query"; +import { Query as tokenfactory } from "./tokenfactory/query"; + +export const Querier = { + cosmos: { + accesscontrol_x: cosmos_accesscontrol_x, + auth: { v1beta1: cosmos_auth_v1beta1 }, + authz: { v1beta1: cosmos_authz_v1beta1 }, + bank: { v1beta1: cosmos_bank_v1beta1 }, + distribution: { v1beta1: cosmos_distribution_v1beta1 }, + evidence: { v1beta1: cosmos_evidence_v1beta1 }, + feegrant: { v1beta1: cosmos_feegrant_v1beta1 }, + gov: { v1beta1: cosmos_gov_v1beta1 }, + mint: { v1beta1: cosmos_mint_v1beta1 }, + params: { v1beta1: cosmos_params_v1beta1 }, + slashing: { v1beta1: cosmos_slashing_v1beta1 }, + staking: { v1beta1: cosmos_staking_v1beta1 }, + upgrade: { v1beta1: cosmos_upgrade_v1beta1 }, + }, + epoch: epoch, + evm: evm, + mint: { v1beta1: mint_v1beta1 }, + oracle: oracle, + tokenfactory: tokenfactory, +}; diff --git a/packages/cosmos/generated/rest/mint/v1beta1/query.ts b/packages/cosmos/generated/rest/mint/v1beta1/query.ts new file mode 100644 index 000000000..d893d5010 --- /dev/null +++ b/packages/cosmos/generated/rest/mint/v1beta1/query.ts @@ -0,0 +1,18 @@ +import * as fm from "../../fetch"; + +import type { QueryMinterRequest, QueryMinterResponse, QueryParamsRequest, QueryParamsResponse } from "../../../types/mint/v1beta1/query.ts"; + +export class Query { + static Params(req: QueryParamsRequest, initReq?: fm.InitReq): Promise { + return fm.fetchReq(`/seichain/mint/v1beta1/params?${fm.renderURLSearchParams(req, [])}`, { + ...initReq, + method: "GET", + }); + } + static Minter(req: QueryMinterRequest, initReq?: fm.InitReq): Promise { + return fm.fetchReq(`/seichain/mint/v1beta1/minter?${fm.renderURLSearchParams(req, [])}`, { + ...initReq, + method: "GET", + }); + } +} diff --git a/packages/cosmos/generated/rest/oracle/query.ts b/packages/cosmos/generated/rest/oracle/query.ts new file mode 100644 index 000000000..dd2de0904 --- /dev/null +++ b/packages/cosmos/generated/rest/oracle/query.ts @@ -0,0 +1,87 @@ +import * as fm from "../fetch"; + +import type { + QueryActivesRequest, + QueryActivesResponse, + QueryExchangeRateRequest, + QueryExchangeRateResponse, + QueryExchangeRatesRequest, + QueryExchangeRatesResponse, + QueryFeederDelegationRequest, + QueryFeederDelegationResponse, + QueryParamsRequest, + QueryParamsResponse, + QueryPriceSnapshotHistoryRequest, + QueryPriceSnapshotHistoryResponse, + QuerySlashWindowRequest, + QuerySlashWindowResponse, + QueryTwapsRequest, + QueryTwapsResponse, + QueryVotePenaltyCounterRequest, + QueryVotePenaltyCounterResponse, + QueryVoteTargetsRequest, + QueryVoteTargetsResponse, +} from "../../types/oracle/query.ts"; + +export class Query { + static ExchangeRate(req: QueryExchangeRateRequest, initReq?: fm.InitReq): Promise { + return fm.fetchReq( + `/sei-protocol/sei-chain/oracle/denoms/${req["denom"]}/exchange_rate?${fm.renderURLSearchParams(req, ["denom"])}`, + { ...initReq, method: "GET" }, + ); + } + static ExchangeRates(req: QueryExchangeRatesRequest, initReq?: fm.InitReq): Promise { + return fm.fetchReq( + `/sei-protocol/sei-chain/oracle/denoms/exchange_rates?${fm.renderURLSearchParams(req, [])}`, + { ...initReq, method: "GET" }, + ); + } + static Actives(req: QueryActivesRequest, initReq?: fm.InitReq): Promise { + return fm.fetchReq(`/sei-protocol/sei-chain/oracle/denoms/actives?${fm.renderURLSearchParams(req, [])}`, { + ...initReq, + method: "GET", + }); + } + static VoteTargets(req: QueryVoteTargetsRequest, initReq?: fm.InitReq): Promise { + return fm.fetchReq( + `/sei-protocol/sei-chain/oracle/denoms/vote_targets?${fm.renderURLSearchParams(req, [])}`, + { ...initReq, method: "GET" }, + ); + } + static PriceSnapshotHistory(req: QueryPriceSnapshotHistoryRequest, initReq?: fm.InitReq): Promise { + return fm.fetchReq( + `/sei-protocol/sei-chain/oracle/denoms/price_snapshot_history?${fm.renderURLSearchParams(req, [])}`, + { ...initReq, method: "GET" }, + ); + } + static Twaps(req: QueryTwapsRequest, initReq?: fm.InitReq): Promise { + return fm.fetchReq( + `/sei-protocol/sei-chain/oracle/denoms/twaps/${req["lookback_seconds"]}?${fm.renderURLSearchParams(req, ["lookback_seconds"])}`, + { ...initReq, method: "GET" }, + ); + } + static FeederDelegation(req: QueryFeederDelegationRequest, initReq?: fm.InitReq): Promise { + return fm.fetchReq( + `/sei-protocol/sei-chain/oracle/validators/${req["validator_addr"]}/feeder?${fm.renderURLSearchParams(req, ["validator_addr"])}`, + { ...initReq, method: "GET" }, + ); + } + static VotePenaltyCounter(req: QueryVotePenaltyCounterRequest, initReq?: fm.InitReq): Promise { + return fm.fetchReq( + `/sei-protocol/sei-chain/oracle/validators/${req["validator_addr"]}/vote_penalty_counter?${fm.renderURLSearchParams(req, ["validator_addr"])}`, + { ...initReq, method: "GET" }, + ); + } + static SlashWindow(req: QuerySlashWindowRequest, initReq?: fm.InitReq): Promise { + return fm.fetchReq(`/sei-protocol/sei-chain/oracle/slash_window?${fm.renderURLSearchParams(req, [])}`, { + ...initReq, + method: "GET", + }); + } + static Params(req: QueryParamsRequest, initReq?: fm.InitReq): Promise { + return fm.fetchReq(`/sei-protocol/sei-chain/oracle/params?${fm.renderURLSearchParams(req, [])}`, { + ...initReq, + method: "GET", + }); + } +} diff --git a/packages/cosmos/generated/rest/tokenfactory/query.ts b/packages/cosmos/generated/rest/tokenfactory/query.ts new file mode 100644 index 000000000..a213aebee --- /dev/null +++ b/packages/cosmos/generated/rest/tokenfactory/query.ts @@ -0,0 +1,47 @@ +import * as fm from "../fetch"; + +import type { + QueryDenomAllowListRequest, + QueryDenomAllowListResponse, + QueryDenomAuthorityMetadataRequest, + QueryDenomAuthorityMetadataResponse, + QueryDenomMetadataRequest, + QueryDenomMetadataResponse, + QueryDenomsFromCreatorRequest, + QueryDenomsFromCreatorResponse, + QueryParamsRequest, + QueryParamsResponse, +} from "../../types/tokenfactory/query.ts"; + +export class Query { + static Params(req: QueryParamsRequest, initReq?: fm.InitReq): Promise { + return fm.fetchReq(`/sei-protocol/seichain/tokenfactory/params?${fm.renderURLSearchParams(req, [])}`, { + ...initReq, + method: "GET", + }); + } + static DenomAuthorityMetadata(req: QueryDenomAuthorityMetadataRequest, initReq?: fm.InitReq): Promise { + return fm.fetchReq( + `/sei-protocol/seichain/tokenfactory/denoms/${req["denom"]}/authority_metadata?${fm.renderURLSearchParams(req, ["denom"])}`, + { ...initReq, method: "GET" }, + ); + } + static DenomMetadata(req: QueryDenomMetadataRequest, initReq?: fm.InitReq): Promise { + return fm.fetchReq( + `/sei-protocol/seichain/tokenfactory/denoms/metadata?${fm.renderURLSearchParams(req, [])}`, + { ...initReq, method: "GET" }, + ); + } + static DenomsFromCreator(req: QueryDenomsFromCreatorRequest, initReq?: fm.InitReq): Promise { + return fm.fetchReq( + `/sei-protocol/seichain/tokenfactory/denoms_from_creator/${req["creator"]}?${fm.renderURLSearchParams(req, ["creator"])}`, + { ...initReq, method: "GET" }, + ); + } + static DenomAllowList(req: QueryDenomAllowListRequest, initReq?: fm.InitReq): Promise { + return fm.fetchReq( + `/sei-protocol/seichain/tokenfactory/denoms/allow_list?${fm.renderURLSearchParams(req, [])}`, + { ...initReq, method: "GET" }, + ); + } +} diff --git a/packages/cosmos/generated/types/confio/index.ts b/packages/cosmos/generated/types/confio/index.ts new file mode 100644 index 000000000..187f37b08 --- /dev/null +++ b/packages/cosmos/generated/types/confio/index.ts @@ -0,0 +1,3 @@ +// @ts-nocheck + +export * from './proofs'; \ No newline at end of file diff --git a/packages/cosmos/generated/types/confio/proofs.ts b/packages/cosmos/generated/types/confio/proofs.ts new file mode 100644 index 000000000..30d7259c1 --- /dev/null +++ b/packages/cosmos/generated/types/confio/proofs.ts @@ -0,0 +1,135 @@ +export enum HashOp { + /** NO_HASH - NO_HASH is the default if no data passed. Note this is an illegal argument some places. */ + NO_HASH = 0, + SHA256 = 1, + SHA512 = 2, + KECCAK = 3, + RIPEMD160 = 4, + /** BITCOIN - ripemd160(sha256(x)) */ + BITCOIN = 5, + UNRECOGNIZED = -1, +} + +export enum LengthOp { + /** NO_PREFIX - NO_PREFIX don't include any length info */ + NO_PREFIX = 0, + /** VAR_PROTO - VAR_PROTO uses protobuf (and go-amino) varint encoding of the length */ + VAR_PROTO = 1, + /** VAR_RLP - VAR_RLP uses rlp int encoding of the length */ + VAR_RLP = 2, + /** FIXED32_BIG - FIXED32_BIG uses big-endian encoding of the length as a 32 bit integer */ + FIXED32_BIG = 3, + /** FIXED32_LITTLE - FIXED32_LITTLE uses little-endian encoding of the length as a 32 bit integer */ + FIXED32_LITTLE = 4, + /** FIXED64_BIG - FIXED64_BIG uses big-endian encoding of the length as a 64 bit integer */ + FIXED64_BIG = 5, + /** FIXED64_LITTLE - FIXED64_LITTLE uses little-endian encoding of the length as a 64 bit integer */ + FIXED64_LITTLE = 6, + /** REQUIRE_32_BYTES - REQUIRE_32_BYTES is like NONE, but will fail if the input is not exactly 32 bytes (sha256 output) */ + REQUIRE_32_BYTES = 7, + /** REQUIRE_64_BYTES - REQUIRE_64_BYTES is like NONE, but will fail if the input is not exactly 64 bytes (sha512 output) */ + REQUIRE_64_BYTES = 8, + UNRECOGNIZED = -1, +} + +export interface ExistenceProof { + key: Uint8Array; + value: Uint8Array; + leaf?: LeafOp; + path: InnerOp[]; +} + +export interface NonExistenceProof { + /** TODO: remove this as unnecessary??? we prove a range */ + key: Uint8Array; + left?: ExistenceProof; + right?: ExistenceProof; +} + +export interface CommitmentProof { + exist?: ExistenceProof; + nonexist?: NonExistenceProof; + batch?: BatchProof; + compressed?: CompressedBatchProof; +} + +export interface LeafOp { + 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 InnerOp { + hash: HashOp; + prefix: Uint8Array; + suffix: Uint8Array; +} + +export interface ProofSpec { + /** + * 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?: LeafOp; + inner_spec?: InnerSpec; + /** 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 InnerSpec { + /** + * 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 BatchProof { + entries: BatchEntry[]; +} + +export interface BatchEntry { + exist?: ExistenceProof; + nonexist?: NonExistenceProof; +} + +export interface CompressedBatchProof { + entries: CompressedBatchEntry[]; + lookup_inners: InnerOp[]; +} + +export interface CompressedBatchEntry { + exist?: CompressedExistenceProof; + nonexist?: CompressedNonExistenceProof; +} + +export interface CompressedExistenceProof { + key: Uint8Array; + value: Uint8Array; + leaf?: LeafOp; + /** these are indexes into the lookup_inners table in CompressedBatchProof */ + path: number[]; +} + +export interface CompressedNonExistenceProof { + /** TODO: remove this as unnecessary??? we prove a range */ + key: Uint8Array; + left?: CompressedExistenceProof; + right?: CompressedExistenceProof; +} diff --git a/packages/cosmos/generated/types/cosmos/accesscontrol/accesscontrol.ts b/packages/cosmos/generated/types/cosmos/accesscontrol/accesscontrol.ts new file mode 100644 index 000000000..f7af7a7fa --- /dev/null +++ b/packages/cosmos/generated/types/cosmos/accesscontrol/accesscontrol.ts @@ -0,0 +1,47 @@ +import type { AccessOperationSelectorType, AccessType, ResourceType, WasmMessageSubtype } from "./constants"; + +export interface AccessOperation { + access_type: AccessType; + resource_type: ResourceType; + identifier_template: string; +} + +export interface WasmAccessOperation { + operation?: AccessOperation; + selector_type: AccessOperationSelectorType; + selector: string; +} + +export interface WasmContractReference { + contract_address: string; + message_type: WasmMessageSubtype; + message_name: string; + json_translation_template: string; +} + +export interface WasmContractReferences { + message_name: string; + contract_references: WasmContractReference[]; +} + +export interface WasmAccessOperations { + message_name: string; + wasm_operations: WasmAccessOperation[]; +} + +export interface MessageDependencyMapping { + message_key: string; + access_ops: AccessOperation[]; + dynamic_enabled: boolean; +} + +export interface WasmDependencyMapping { + base_access_ops: WasmAccessOperation[]; + query_access_ops: WasmAccessOperations[]; + execute_access_ops: WasmAccessOperations[]; + base_contract_references: WasmContractReference[]; + query_contract_references: WasmContractReferences[]; + execute_contract_references: WasmContractReferences[]; + reset_reason: string; + contract_address: string; +} diff --git a/packages/cosmos/generated/types/cosmos/accesscontrol/constants.ts b/packages/cosmos/generated/types/cosmos/accesscontrol/constants.ts new file mode 100644 index 000000000..491355ec7 --- /dev/null +++ b/packages/cosmos/generated/types/cosmos/accesscontrol/constants.ts @@ -0,0 +1,190 @@ +export enum AccessType { + UNKNOWN = 0, + READ = 1, + WRITE = 2, + COMMIT = 3, + UNRECOGNIZED = -1, +} + +export enum AccessOperationSelectorType { + NONE = 0, + JQ = 1, + JQ_BECH32_ADDRESS = 2, + JQ_LENGTH_PREFIXED_ADDRESS = 3, + SENDER_BECH32_ADDRESS = 4, + SENDER_LENGTH_PREFIXED_ADDRESS = 5, + CONTRACT_ADDRESS = 6, + JQ_MESSAGE_CONDITIONAL = 7, + CONSTANT_STRING_TO_HEX = 8, + CONTRACT_REFERENCE = 9, + UNRECOGNIZED = -1, +} + +export enum ResourceType { + ANY = 0, + /** KV - child of ANY */ + KV = 1, + /** Mem - child of ANY */ + Mem = 2, + /** KV_BANK - child of KV */ + KV_BANK = 4, + /** KV_STAKING - child of KV */ + KV_STAKING = 5, + /** KV_WASM - child of KV */ + KV_WASM = 6, + /** KV_ORACLE - child of KV */ + KV_ORACLE = 7, + /** KV_EPOCH - child of KV */ + KV_EPOCH = 9, + /** KV_TOKENFACTORY - child of KV */ + KV_TOKENFACTORY = 10, + /** KV_ORACLE_VOTE_TARGETS - child of KV_ORACLE */ + KV_ORACLE_VOTE_TARGETS = 11, + /** KV_ORACLE_AGGREGATE_VOTES - child of KV_ORACLE */ + KV_ORACLE_AGGREGATE_VOTES = 12, + /** KV_ORACLE_FEEDERS - child of KV_ORACLE */ + KV_ORACLE_FEEDERS = 13, + /** KV_STAKING_DELEGATION - child of KV_STAKING */ + KV_STAKING_DELEGATION = 14, + /** KV_STAKING_VALIDATOR - child of KV_STAKING */ + KV_STAKING_VALIDATOR = 15, + /** KV_AUTH - child of KV */ + KV_AUTH = 16, + /** KV_AUTH_ADDRESS_STORE - child of KV */ + KV_AUTH_ADDRESS_STORE = 17, + /** KV_BANK_SUPPLY - child of KV_BANK */ + KV_BANK_SUPPLY = 18, + /** KV_BANK_DENOM - child of KV_BANK */ + KV_BANK_DENOM = 19, + /** KV_BANK_BALANCES - child of KV_BANK */ + KV_BANK_BALANCES = 20, + /** KV_TOKENFACTORY_DENOM - child of KV_TOKENFACTORY */ + KV_TOKENFACTORY_DENOM = 21, + /** KV_TOKENFACTORY_METADATA - child of KV_TOKENFACTORY */ + KV_TOKENFACTORY_METADATA = 22, + /** KV_TOKENFACTORY_ADMIN - child of KV_TOKENFACTORY */ + KV_TOKENFACTORY_ADMIN = 23, + /** KV_TOKENFACTORY_CREATOR - child of KV_TOKENFACTORY */ + KV_TOKENFACTORY_CREATOR = 24, + /** KV_ORACLE_EXCHANGE_RATE - child of KV_ORACLE */ + KV_ORACLE_EXCHANGE_RATE = 25, + /** KV_ORACLE_VOTE_PENALTY_COUNTER - child of KV_ORACLE */ + KV_ORACLE_VOTE_PENALTY_COUNTER = 26, + /** KV_ORACLE_PRICE_SNAPSHOT - child of KV_ORACLE */ + KV_ORACLE_PRICE_SNAPSHOT = 27, + /** KV_STAKING_VALIDATION_POWER - child of KV_STAKING */ + KV_STAKING_VALIDATION_POWER = 28, + /** KV_STAKING_TOTAL_POWER - child of KV_STAKING */ + KV_STAKING_TOTAL_POWER = 29, + /** KV_STAKING_VALIDATORS_CON_ADDR - child of KV_STAKING */ + KV_STAKING_VALIDATORS_CON_ADDR = 30, + /** KV_STAKING_UNBONDING_DELEGATION - child of KV_STAKING */ + KV_STAKING_UNBONDING_DELEGATION = 31, + /** KV_STAKING_UNBONDING_DELEGATION_VAL - child of KV_STAKING */ + KV_STAKING_UNBONDING_DELEGATION_VAL = 32, + /** KV_STAKING_REDELEGATION - child of KV_STAKING */ + KV_STAKING_REDELEGATION = 33, + /** KV_STAKING_REDELEGATION_VAL_SRC - child of KV_STAKING */ + KV_STAKING_REDELEGATION_VAL_SRC = 34, + /** KV_STAKING_REDELEGATION_VAL_DST - child of KV_STAKING */ + KV_STAKING_REDELEGATION_VAL_DST = 35, + /** KV_STAKING_REDELEGATION_QUEUE - child of KV_STAKING */ + KV_STAKING_REDELEGATION_QUEUE = 36, + /** KV_STAKING_VALIDATOR_QUEUE - child of KV_STAKING */ + KV_STAKING_VALIDATOR_QUEUE = 37, + /** KV_STAKING_HISTORICAL_INFO - child of KV_STAKING */ + KV_STAKING_HISTORICAL_INFO = 38, + /** KV_STAKING_UNBONDING - child of KV_STAKING */ + KV_STAKING_UNBONDING = 39, + /** KV_STAKING_VALIDATORS_BY_POWER - child of KV_STAKING */ + KV_STAKING_VALIDATORS_BY_POWER = 41, + /** KV_DISTRIBUTION - child of KV */ + KV_DISTRIBUTION = 40, + /** KV_DISTRIBUTION_FEE_POOL - child of KV_DISTRIBUTION */ + KV_DISTRIBUTION_FEE_POOL = 42, + /** KV_DISTRIBUTION_PROPOSER_KEY - child of KV_DISTRIBUTION */ + KV_DISTRIBUTION_PROPOSER_KEY = 43, + /** KV_DISTRIBUTION_OUTSTANDING_REWARDS - child of KV_DISTRIBUTION */ + KV_DISTRIBUTION_OUTSTANDING_REWARDS = 44, + /** KV_DISTRIBUTION_DELEGATOR_WITHDRAW_ADDR - child of KV_DISTRIBUTION */ + KV_DISTRIBUTION_DELEGATOR_WITHDRAW_ADDR = 45, + /** KV_DISTRIBUTION_DELEGATOR_STARTING_INFO - child of KV_DISTRIBUTION */ + KV_DISTRIBUTION_DELEGATOR_STARTING_INFO = 46, + /** KV_DISTRIBUTION_VAL_HISTORICAL_REWARDS - child of KV_DISTRIBUTION */ + KV_DISTRIBUTION_VAL_HISTORICAL_REWARDS = 47, + /** KV_DISTRIBUTION_VAL_CURRENT_REWARDS - child of KV_DISTRIBUTION */ + KV_DISTRIBUTION_VAL_CURRENT_REWARDS = 48, + /** KV_DISTRIBUTION_VAL_ACCUM_COMMISSION - child of KV_DISTRIBUTION */ + KV_DISTRIBUTION_VAL_ACCUM_COMMISSION = 49, + /** KV_DISTRIBUTION_SLASH_EVENT - child of KV_DISTRIBUTION */ + KV_DISTRIBUTION_SLASH_EVENT = 50, + /** KV_ACCESSCONTROL - child of KV */ + KV_ACCESSCONTROL = 71, + /** KV_ACCESSCONTROL_WASM_DEPENDENCY_MAPPING - child of KV_ACCESSCONTROL */ + KV_ACCESSCONTROL_WASM_DEPENDENCY_MAPPING = 72, + /** KV_WASM_CODE - child of KV_WASM */ + KV_WASM_CODE = 73, + /** KV_WASM_CONTRACT_ADDRESS - child of KV_WASM */ + KV_WASM_CONTRACT_ADDRESS = 74, + /** KV_WASM_CONTRACT_STORE - child of KV_WASM */ + KV_WASM_CONTRACT_STORE = 75, + /** KV_WASM_SEQUENCE_KEY - child of KV_WASM */ + KV_WASM_SEQUENCE_KEY = 76, + /** KV_WASM_CONTRACT_CODE_HISTORY - child of KV_WASM */ + KV_WASM_CONTRACT_CODE_HISTORY = 77, + /** KV_WASM_CONTRACT_BY_CODE_ID - child of KV_WASM */ + KV_WASM_CONTRACT_BY_CODE_ID = 78, + /** KV_WASM_PINNED_CODE_INDEX - child of KV_WASM */ + KV_WASM_PINNED_CODE_INDEX = 79, + /** KV_AUTH_GLOBAL_ACCOUNT_NUMBER - child of KV_AUTH */ + KV_AUTH_GLOBAL_ACCOUNT_NUMBER = 80, + /** KV_AUTHZ - child of KV */ + KV_AUTHZ = 81, + /** KV_FEEGRANT - child of KV */ + KV_FEEGRANT = 82, + /** KV_FEEGRANT_ALLOWANCE - child of KV_FEEGRANT */ + KV_FEEGRANT_ALLOWANCE = 83, + /** KV_SLASHING - child of KV */ + KV_SLASHING = 84, + /** KV_SLASHING_VAL_SIGNING_INFO - child of KV_SLASHING */ + KV_SLASHING_VAL_SIGNING_INFO = 85, + /** KV_SLASHING_ADDR_PUBKEY_RELATION_KEY - child of KV_SLASHING */ + KV_SLASHING_ADDR_PUBKEY_RELATION_KEY = 86, + /** KV_BANK_DEFERRED - child of KV */ + KV_BANK_DEFERRED = 93, + /** KV_BANK_DEFERRED_MODULE_TX_INDEX - child of KV_BANK_DEFERRED */ + KV_BANK_DEFERRED_MODULE_TX_INDEX = 95, + /** KV_EVM - child of KV */ + KV_EVM = 96, + /** KV_EVM_BALANCE - child of KV_EVM; deprecated */ + KV_EVM_BALANCE = 97, + /** KV_EVM_TRANSIENT - child of KV_EVM */ + KV_EVM_TRANSIENT = 98, + /** KV_EVM_ACCOUNT_TRANSIENT - child of KV_EVM */ + KV_EVM_ACCOUNT_TRANSIENT = 99, + /** KV_EVM_MODULE_TRANSIENT - child of KV_EVM */ + KV_EVM_MODULE_TRANSIENT = 100, + /** KV_EVM_NONCE - child of KV_EVM */ + KV_EVM_NONCE = 101, + /** KV_EVM_RECEIPT - child of KV_EVM */ + KV_EVM_RECEIPT = 102, + /** KV_EVM_S2E - child of KV_EVM */ + KV_EVM_S2E = 103, + /** KV_EVM_E2S - child of KV_EVM */ + KV_EVM_E2S = 104, + /** KV_EVM_CODE_HASH - child of KV_EVM */ + KV_EVM_CODE_HASH = 105, + /** KV_EVM_CODE - child of KV_EVM */ + KV_EVM_CODE = 106, + /** KV_EVM_CODE_SIZE - child of KV_EVM */ + KV_EVM_CODE_SIZE = 107, + /** KV_BANK_WEI_BALANCE - child of KV_BANK */ + KV_BANK_WEI_BALANCE = 108, + UNRECOGNIZED = -1, +} + +export enum WasmMessageSubtype { + QUERY = 0, + EXECUTE = 1, + UNRECOGNIZED = -1, +} diff --git a/packages/cosmos/generated/types/cosmos/accesscontrol/index.ts b/packages/cosmos/generated/types/cosmos/accesscontrol/index.ts new file mode 100644 index 000000000..26c6e4f62 --- /dev/null +++ b/packages/cosmos/generated/types/cosmos/accesscontrol/index.ts @@ -0,0 +1,5 @@ +// @ts-nocheck + +export * from './accesscontrol'; +export * from './constants'; +export * from './legacy'; \ No newline at end of file diff --git a/packages/cosmos/generated/types/cosmos/accesscontrol/legacy.ts b/packages/cosmos/generated/types/cosmos/accesscontrol/legacy.ts new file mode 100644 index 000000000..83b519c15 --- /dev/null +++ b/packages/cosmos/generated/types/cosmos/accesscontrol/legacy.ts @@ -0,0 +1,16 @@ +import type { AccessOperation } from "./accesscontrol"; + +import type { AccessOperationSelectorType } from "./constants"; + +export interface LegacyAccessOperationWithSelector { + operation?: AccessOperation; + selector_type: AccessOperationSelectorType; + selector: string; +} + +export interface LegacyWasmDependencyMapping { + enabled: boolean; + access_ops: LegacyAccessOperationWithSelector[]; + reset_reason: string; + contract_address: string; +} diff --git a/packages/cosmos/generated/types/cosmos/accesscontrol_x/genesis.ts b/packages/cosmos/generated/types/cosmos/accesscontrol_x/genesis.ts new file mode 100644 index 000000000..4633d07ef --- /dev/null +++ b/packages/cosmos/generated/types/cosmos/accesscontrol_x/genesis.ts @@ -0,0 +1,10 @@ +import type { MessageDependencyMapping, WasmDependencyMapping } from "../accesscontrol/accesscontrol"; + +export interface GenesisState { + params?: Params; + /** mapping between every message type and its predetermined resource read/write sequence */ + message_dependency_mapping: MessageDependencyMapping[]; + wasm_dependency_mappings: WasmDependencyMapping[]; +} + +export type Params = {}; diff --git a/packages/cosmos/generated/types/cosmos/accesscontrol_x/gov.ts b/packages/cosmos/generated/types/cosmos/accesscontrol_x/gov.ts new file mode 100644 index 000000000..2b3994cb8 --- /dev/null +++ b/packages/cosmos/generated/types/cosmos/accesscontrol_x/gov.ts @@ -0,0 +1,31 @@ +import type { MessageDependencyMapping, WasmDependencyMapping } from "../accesscontrol/accesscontrol"; + +export interface MsgUpdateResourceDependencyMappingProposal { + title: string; + description: string; + message_dependency_mapping: MessageDependencyMapping[]; +} + +export interface MsgUpdateResourceDependencyMappingProposalJsonFile { + title: string; + description: string; + deposit: string; + message_dependency_mapping: MessageDependencyMapping[]; +} + +export type MsgUpdateResourceDependencyMappingProposalResponse = {}; + +export interface MsgUpdateWasmDependencyMappingProposal { + title: string; + description: string; + contract_address: string; + wasm_dependency_mapping?: WasmDependencyMapping; +} + +export interface MsgUpdateWasmDependencyMappingProposalJsonFile { + title: string; + description: string; + deposit: string; + contract_address: string; + wasm_dependency_mapping?: WasmDependencyMapping; +} diff --git a/packages/cosmos/generated/types/cosmos/accesscontrol_x/index.ts b/packages/cosmos/generated/types/cosmos/accesscontrol_x/index.ts new file mode 100644 index 000000000..57dc0904c --- /dev/null +++ b/packages/cosmos/generated/types/cosmos/accesscontrol_x/index.ts @@ -0,0 +1,6 @@ +// @ts-nocheck + +export * from './genesis'; +export * from './gov'; +export * from './query'; +export * from './tx'; \ No newline at end of file diff --git a/packages/cosmos/generated/types/cosmos/accesscontrol_x/query.ts b/packages/cosmos/generated/types/cosmos/accesscontrol_x/query.ts new file mode 100644 index 000000000..cec0fc08c --- /dev/null +++ b/packages/cosmos/generated/types/cosmos/accesscontrol_x/query.ts @@ -0,0 +1,38 @@ +import type { MessageDependencyMapping, WasmDependencyMapping } from "../accesscontrol/accesscontrol"; + +import type { Params } from "./genesis"; + +export type QueryParamsRequest = {}; + +export interface QueryParamsResponse { + /** params defines the parameters of the module. */ + params?: Params; +} + +export interface ResourceDependencyMappingFromMessageKeyRequest { + message_key: string; +} + +export interface ResourceDependencyMappingFromMessageKeyResponse { + message_dependency_mapping?: MessageDependencyMapping; +} + +export interface WasmDependencyMappingRequest { + contract_address: string; +} + +export interface WasmDependencyMappingResponse { + wasm_dependency_mapping?: WasmDependencyMapping; +} + +export type ListResourceDependencyMappingRequest = {}; + +export interface ListResourceDependencyMappingResponse { + message_dependency_mapping_list: MessageDependencyMapping[]; +} + +export type ListWasmDependencyMappingRequest = {}; + +export interface ListWasmDependencyMappingResponse { + wasm_dependency_mapping_list: WasmDependencyMapping[]; +} diff --git a/packages/cosmos/generated/types/cosmos/accesscontrol_x/tx.ts b/packages/cosmos/generated/types/cosmos/accesscontrol_x/tx.ts new file mode 100644 index 000000000..97f3a8cbc --- /dev/null +++ b/packages/cosmos/generated/types/cosmos/accesscontrol_x/tx.ts @@ -0,0 +1,12 @@ +import type { WasmDependencyMapping } from "../accesscontrol/accesscontrol"; + +export interface RegisterWasmDependencyJSONFile { + wasm_dependency_mapping?: WasmDependencyMapping; +} + +export interface MsgRegisterWasmDependency { + from_address: string; + wasm_dependency_mapping?: WasmDependencyMapping; +} + +export type MsgRegisterWasmDependencyResponse = {}; diff --git a/packages/cosmos/generated/types/cosmos/auth/v1beta1/auth.ts b/packages/cosmos/generated/types/cosmos/auth/v1beta1/auth.ts new file mode 100644 index 000000000..129810165 --- /dev/null +++ b/packages/cosmos/generated/types/cosmos/auth/v1beta1/auth.ts @@ -0,0 +1,23 @@ +import type { Any } from "../../../google/protobuf/any"; + +export interface BaseAccount { + address: string; + pub_key?: Any; + account_number: number; + sequence: number; +} + +export interface ModuleAccount { + base_account?: BaseAccount; + name: string; + permissions: string[]; +} + +export interface Params { + max_memo_characters: number; + tx_sig_limit: number; + tx_size_cost_per_byte: number; + sig_verify_cost_ed25519: number; + sig_verify_cost_secp256k1: number; + disable_seqno_check: boolean; +} diff --git a/packages/cosmos/generated/types/cosmos/auth/v1beta1/genesis.ts b/packages/cosmos/generated/types/cosmos/auth/v1beta1/genesis.ts new file mode 100644 index 000000000..4148a1be4 --- /dev/null +++ b/packages/cosmos/generated/types/cosmos/auth/v1beta1/genesis.ts @@ -0,0 +1,10 @@ +import type { Any } from "../../../google/protobuf/any"; + +import type { Params } from "./auth"; + +export interface GenesisState { + /** params defines all the paramaters of the module. */ + params?: Params; + /** accounts are the accounts present at genesis. */ + accounts: Any[]; +} diff --git a/packages/cosmos/generated/types/cosmos/auth/v1beta1/index.ts b/packages/cosmos/generated/types/cosmos/auth/v1beta1/index.ts new file mode 100644 index 000000000..975890188 --- /dev/null +++ b/packages/cosmos/generated/types/cosmos/auth/v1beta1/index.ts @@ -0,0 +1,5 @@ +// @ts-nocheck + +export * from './auth'; +export * from './genesis'; +export * from './query'; \ No newline at end of file diff --git a/packages/cosmos/generated/types/cosmos/auth/v1beta1/query.ts b/packages/cosmos/generated/types/cosmos/auth/v1beta1/query.ts new file mode 100644 index 000000000..6431f59ef --- /dev/null +++ b/packages/cosmos/generated/types/cosmos/auth/v1beta1/query.ts @@ -0,0 +1,41 @@ +import type { Any } from "../../../google/protobuf/any"; + +import type { PageRequest, PageResponse } from "../../base/query/v1beta1/pagination"; + +import type { Params } from "./auth"; + +export interface QueryAccountsRequest { + /** pagination defines an optional pagination for the request. */ + pagination?: PageRequest; +} + +export interface QueryAccountsResponse { + /** accounts are the existing accounts */ + accounts: Any[]; + /** pagination defines the pagination in the response. */ + pagination?: PageResponse; +} + +export interface QueryAccountRequest { + /** address defines the address to query for. */ + address: string; +} + +export interface QueryAccountResponse { + /** account defines the account of the corresponding address. */ + account?: Any; +} + +export type QueryParamsRequest = {}; + +export interface QueryParamsResponse { + /** params defines the parameters of the module. */ + params?: Params; +} + +export type QueryNextAccountNumberRequest = {}; + +export interface QueryNextAccountNumberResponse { + /** count defines the next account number. */ + count: number; +} diff --git a/packages/cosmos/generated/types/cosmos/authz/v1beta1/authz.ts b/packages/cosmos/generated/types/cosmos/authz/v1beta1/authz.ts new file mode 100644 index 000000000..5ee6d91cb --- /dev/null +++ b/packages/cosmos/generated/types/cosmos/authz/v1beta1/authz.ts @@ -0,0 +1,18 @@ +import type { Any } from "../../../google/protobuf/any"; + +export interface GenericAuthorization { + /** Msg, identified by it's type URL, to grant unrestricted permissions to execute */ + msg: string; +} + +export interface Grant { + authorization?: Any; + expiration?: Date; +} + +export interface GrantAuthorization { + granter: string; + grantee: string; + authorization?: Any; + expiration?: Date; +} diff --git a/packages/cosmos/generated/types/cosmos/authz/v1beta1/event.ts b/packages/cosmos/generated/types/cosmos/authz/v1beta1/event.ts new file mode 100644 index 000000000..bf460417c --- /dev/null +++ b/packages/cosmos/generated/types/cosmos/authz/v1beta1/event.ts @@ -0,0 +1,17 @@ +export interface EventGrant { + /** 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 EventRevoke { + /** Msg type URL for which an autorization is revoked */ + msg_type_url: string; + /** Granter account address */ + granter: string; + /** Grantee account address */ + grantee: string; +} diff --git a/packages/cosmos/generated/types/cosmos/authz/v1beta1/genesis.ts b/packages/cosmos/generated/types/cosmos/authz/v1beta1/genesis.ts new file mode 100644 index 000000000..762007141 --- /dev/null +++ b/packages/cosmos/generated/types/cosmos/authz/v1beta1/genesis.ts @@ -0,0 +1,5 @@ +import type { GrantAuthorization } from "./authz"; + +export interface GenesisState { + authorization: GrantAuthorization[]; +} diff --git a/packages/cosmos/generated/types/cosmos/authz/v1beta1/index.ts b/packages/cosmos/generated/types/cosmos/authz/v1beta1/index.ts new file mode 100644 index 000000000..4014c93a4 --- /dev/null +++ b/packages/cosmos/generated/types/cosmos/authz/v1beta1/index.ts @@ -0,0 +1,7 @@ +// @ts-nocheck + +export * from './authz'; +export * from './event'; +export * from './genesis'; +export * from './query'; +export * from './tx'; \ No newline at end of file diff --git a/packages/cosmos/generated/types/cosmos/authz/v1beta1/query.ts b/packages/cosmos/generated/types/cosmos/authz/v1beta1/query.ts new file mode 100644 index 000000000..341d14e8e --- /dev/null +++ b/packages/cosmos/generated/types/cosmos/authz/v1beta1/query.ts @@ -0,0 +1,45 @@ +import type { PageRequest, PageResponse } from "../../base/query/v1beta1/pagination"; + +import type { Grant, GrantAuthorization } from "./authz"; + +export interface QueryGrantsRequest { + 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?: PageRequest; +} + +export interface QueryGrantsResponse { + /** authorizations is a list of grants granted for grantee by granter. */ + grants: Grant[]; + /** pagination defines an pagination for the response. */ + pagination?: PageResponse; +} + +export interface QueryGranterGrantsRequest { + granter: string; + /** pagination defines an pagination for the request. */ + pagination?: PageRequest; +} + +export interface QueryGranterGrantsResponse { + /** grants is a list of grants granted by the granter. */ + grants: GrantAuthorization[]; + /** pagination defines an pagination for the response. */ + pagination?: PageResponse; +} + +export interface QueryGranteeGrantsRequest { + grantee: string; + /** pagination defines an pagination for the request. */ + pagination?: PageRequest; +} + +export interface QueryGranteeGrantsResponse { + /** grants is a list of grants granted to the grantee. */ + grants: GrantAuthorization[]; + /** pagination defines an pagination for the response. */ + pagination?: PageResponse; +} diff --git a/packages/cosmos/generated/types/cosmos/authz/v1beta1/tx.ts b/packages/cosmos/generated/types/cosmos/authz/v1beta1/tx.ts new file mode 100644 index 000000000..d311cfba7 --- /dev/null +++ b/packages/cosmos/generated/types/cosmos/authz/v1beta1/tx.ts @@ -0,0 +1,33 @@ +import type { Any } from "../../../google/protobuf/any"; + +import type { Grant } from "./authz"; + +export interface MsgGrant { + granter: string; + grantee: string; + grant?: Grant; +} + +export interface MsgExecResponse { + results: Uint8Array[]; +} + +export interface MsgExec { + grantee: string; + /** + * Authorization Msg requests to execute. Each msg must implement Authorization interface + * The x/authz will try to find a grant matching (msg.signers[0], grantee, MsgTypeURL(msg)) + * triple and validate it. + */ + msgs: Any[]; +} + +export type MsgGrantResponse = {}; + +export interface MsgRevoke { + granter: string; + grantee: string; + msg_type_url: string; +} + +export type MsgRevokeResponse = {}; diff --git a/packages/cosmos/generated/types/cosmos/bank/v1beta1/authz.ts b/packages/cosmos/generated/types/cosmos/bank/v1beta1/authz.ts new file mode 100644 index 000000000..0f52f6b5a --- /dev/null +++ b/packages/cosmos/generated/types/cosmos/bank/v1beta1/authz.ts @@ -0,0 +1,5 @@ +import type { Coin } from "../../base/v1beta1/coin"; + +export interface SendAuthorization { + spend_limit: Coin[]; +} diff --git a/packages/cosmos/generated/types/cosmos/bank/v1beta1/bank.ts b/packages/cosmos/generated/types/cosmos/bank/v1beta1/bank.ts new file mode 100644 index 000000000..7cdcc2a4e --- /dev/null +++ b/packages/cosmos/generated/types/cosmos/bank/v1beta1/bank.ts @@ -0,0 +1,71 @@ +import type { Coin } from "../../base/v1beta1/coin"; + +export interface Params { + send_enabled: SendEnabled[]; + default_send_enabled: boolean; +} + +export interface SendEnabled { + denom: string; + enabled: boolean; +} + +export interface Input { + address: string; + coins: Coin[]; +} + +export interface Output { + address: string; + coins: Coin[]; +} + +export interface Supply { + total: Coin[]; +} + +export interface DenomUnit { + /** denom represents the string name of the given denom unit (e.g uatom). */ + denom: string; + /** + * exponent represents power of 10 exponent that one must + * raise the base_denom to in order to equal the given DenomUnit's denom + * 1 denom = 1^exponent base_denom + * (e.g. with a base_denom of uatom, one can create a DenomUnit of 'atom' with + * exponent = 6, thus: 1 atom = 10^6 uatom). + */ + exponent: number; + /** aliases is a list of string aliases for the given denom */ + aliases: string[]; +} + +export interface Metadata { + description: string; + /** denom_units represents the list of DenomUnit's for a given coin */ + denom_units: DenomUnit[]; + /** base represents the base denom (should be the DenomUnit with exponent = 0). */ + base: string; + /** + * display indicates the suggested denom that should be + * displayed in clients. + */ + display: string; + /** + * name defines the name of the token (eg: Cosmos Atom) + * + * Since: cosmos-sdk 0.43 + */ + name: string; + /** + * symbol is the token symbol usually shown on exchanges (eg: ATOM). This can + * be the same as the display. + * + * Since: cosmos-sdk 0.43 + */ + symbol: string; +} + +export interface AllowList { + /** Can be empty for no admin, or a valid sei address */ + addresses: string[]; +} diff --git a/packages/cosmos/generated/types/cosmos/bank/v1beta1/genesis.ts b/packages/cosmos/generated/types/cosmos/bank/v1beta1/genesis.ts new file mode 100644 index 000000000..f7b447a28 --- /dev/null +++ b/packages/cosmos/generated/types/cosmos/bank/v1beta1/genesis.ts @@ -0,0 +1,33 @@ +import type { Coin } from "../../base/v1beta1/coin"; + +import type { Metadata, Params } from "./bank"; + +export interface GenesisState { + /** params defines all the paramaters of the module. */ + params?: Params; + /** balances is an array containing the balances of all the accounts. */ + balances: Balance[]; + /** + * supply represents the total supply. If it is left empty, then supply will be calculated based on the provided + * balances. Otherwise, it will be used to validate that the sum of the balances equals this amount. + */ + supply: Coin[]; + /** denom_metadata defines the metadata of the differents coins. */ + denom_metadata: Metadata[]; + /** wei balances */ + wei_balances: WeiBalance[]; +} + +export interface Balance { + /** address is the address of the balance holder. */ + address: string; + /** coins defines the different coins this balance holds. */ + coins: Coin[]; +} + +export interface WeiBalance { + /** address is the address of the balance holder. */ + address: string; + /** wei balance amount. */ + amount: string; +} diff --git a/packages/cosmos/generated/types/cosmos/bank/v1beta1/index.ts b/packages/cosmos/generated/types/cosmos/bank/v1beta1/index.ts new file mode 100644 index 000000000..8036441bb --- /dev/null +++ b/packages/cosmos/generated/types/cosmos/bank/v1beta1/index.ts @@ -0,0 +1,7 @@ +// @ts-nocheck + +export * from './authz'; +export * from './bank'; +export * from './genesis'; +export * from './query'; +export * from './tx'; \ No newline at end of file diff --git a/packages/cosmos/generated/types/cosmos/bank/v1beta1/query.ts b/packages/cosmos/generated/types/cosmos/bank/v1beta1/query.ts new file mode 100644 index 000000000..66416e79b --- /dev/null +++ b/packages/cosmos/generated/types/cosmos/bank/v1beta1/query.ts @@ -0,0 +1,103 @@ +import type { PageRequest, PageResponse } from "../../base/query/v1beta1/pagination"; + +import type { Coin } from "../../base/v1beta1/coin"; + +import type { Metadata, Params } from "./bank"; + +export interface QueryBalanceRequest { + /** address is the address to query balances for. */ + address: string; + /** denom is the coin denom to query balances for. */ + denom: string; +} + +export interface QueryBalanceResponse { + /** balance is the balance of the coin. */ + balance?: Coin; +} + +export interface QueryAllBalancesRequest { + /** address is the address to query balances for. */ + address: string; + /** pagination defines an optional pagination for the request. */ + pagination?: PageRequest; +} + +export interface QueryAllBalancesResponse { + /** balances is the balances of all the coins. */ + balances: Coin[]; + /** pagination defines the pagination in the response. */ + pagination?: PageResponse; +} + +export interface QuerySpendableBalancesRequest { + /** address is the address to query spendable balances for. */ + address: string; + /** pagination defines an optional pagination for the request. */ + pagination?: PageRequest; +} + +export interface QuerySpendableBalancesResponse { + /** balances is the spendable balances of all the coins. */ + balances: Coin[]; + /** pagination defines the pagination in the response. */ + pagination?: PageResponse; +} + +export interface QueryTotalSupplyRequest { + /** + * pagination defines an optional pagination for the request. + * + * Since: cosmos-sdk 0.43 + */ + pagination?: PageRequest; +} + +export interface QueryTotalSupplyResponse { + /** supply is the supply of the coins */ + supply: Coin[]; + /** + * pagination defines the pagination in the response. + * + * Since: cosmos-sdk 0.43 + */ + pagination?: PageResponse; +} + +export interface QuerySupplyOfRequest { + /** denom is the coin denom to query balances for. */ + denom: string; +} + +export interface QuerySupplyOfResponse { + /** amount is the supply of the coin. */ + amount?: Coin; +} + +export type QueryParamsRequest = {}; + +export interface QueryParamsResponse { + params?: Params; +} + +export interface QueryDenomsMetadataRequest { + /** pagination defines an optional pagination for the request. */ + pagination?: PageRequest; +} + +export interface QueryDenomsMetadataResponse { + /** metadata provides the client information for all the registered tokens. */ + metadatas: Metadata[]; + /** pagination defines the pagination in the response. */ + pagination?: PageResponse; +} + +export interface QueryDenomMetadataRequest { + /** denom is the coin denom to query the metadata for. */ + denom: string; +} + +export interface QueryDenomMetadataResponse { + /** metadata describes and provides all the client information for the requested token. */ + metadata?: Metadata; +} diff --git a/packages/cosmos/generated/types/cosmos/bank/v1beta1/tx.ts b/packages/cosmos/generated/types/cosmos/bank/v1beta1/tx.ts new file mode 100644 index 000000000..fa4514ce7 --- /dev/null +++ b/packages/cosmos/generated/types/cosmos/bank/v1beta1/tx.ts @@ -0,0 +1,18 @@ +import type { Coin } from "../../base/v1beta1/coin"; + +import type { Input, Output } from "./bank"; + +export interface MsgSend { + from_address: string; + to_address: string; + amount: Coin[]; +} + +export type MsgSendResponse = {}; + +export interface MsgMultiSend { + inputs: Input[]; + outputs: Output[]; +} + +export type MsgMultiSendResponse = {}; diff --git a/packages/cosmos/generated/types/cosmos/base/abci/v1beta1/abci.ts b/packages/cosmos/generated/types/cosmos/base/abci/v1beta1/abci.ts new file mode 100644 index 000000000..8fdbba53b --- /dev/null +++ b/packages/cosmos/generated/types/cosmos/base/abci/v1beta1/abci.ts @@ -0,0 +1,119 @@ +import type { Any } from "../../../../google/protobuf/any"; + +import type { Event } from "../../../../tendermint/abci/types"; + +export interface TxResponse { + /** The block height */ + height: number; + /** The transaction hash. */ + txhash: string; + /** Namespace for the Code */ + codespace: string; + /** Response code. */ + code: number; + /** Result bytes, if any. */ + data: string; + /** + * The output of the application's logger (raw string). May be + * non-deterministic. + */ + raw_log: string; + /** The output of the application's logger (typed). May be non-deterministic. */ + logs: ABCIMessageLog[]; + /** Additional information. May be non-deterministic. */ + info: string; + /** Amount of gas requested for transaction. */ + gas_wanted: number; + /** Amount of gas consumed by transaction. */ + gas_used: number; + /** The request transaction bytes. */ + tx?: Any; + /** + * Time of the previous block. For heights > 1, it's the weighted median of + * the timestamps of the valid votes in the block.LastCommit. For height == 1, + * it's genesis time. + */ + timestamp: string; + /** + * Events defines all the events emitted by processing a transaction. Note, + * these events include those emitted by processing all the messages and those + * emitted from the ante handler. Whereas Logs contains the events, with + * additional metadata, emitted only by processing the messages. + * + * Since: cosmos-sdk 0.42.11, 0.44.5, 0.45 + */ + events: Event[]; +} + +export interface ABCIMessageLog { + msg_index: number; + log: string; + /** + * Events contains a slice of Event objects that were emitted during some + * execution. + */ + events: StringEvent[]; +} + +export interface StringEvent { + type: string; + attributes: Attribute[]; +} + +export interface Attribute { + key: string; + value: string; +} + +export interface GasInfo { + /** GasWanted is the maximum units of work we allow this tx to perform. */ + gas_wanted: number; + /** GasUsed is the amount of gas actually consumed. */ + gas_used: number; +} + +export interface Result { + /** + * Data is any data returned from message or handler execution. It MUST be + * length prefixed in order to separate data from multiple message executions. + */ + data: Uint8Array; + /** Log contains the log information from message or handler execution. */ + log: string; + /** + * Events contains a slice of Event objects that were emitted during message + * or handler execution. + */ + events: Event[]; + /** EVM VM error during execution */ + evmError: string; +} + +export interface SimulationResponse { + gas_info?: GasInfo; + result?: Result; +} + +export interface MsgData { + msg_type: string; + data: Uint8Array; +} + +export interface TxMsgData { + data: MsgData[]; +} + +export interface SearchTxsResult { + /** Count of all txs */ + total_count: number; + /** Count of txs in current page */ + count: number; + /** Index of current page, start from 1 */ + page_number: number; + /** Count of total pages */ + page_total: number; + /** Max count txs per page */ + limit: number; + /** List of txs in current page */ + txs: TxResponse[]; +} diff --git a/packages/cosmos/generated/types/cosmos/base/abci/v1beta1/index.ts b/packages/cosmos/generated/types/cosmos/base/abci/v1beta1/index.ts new file mode 100644 index 000000000..1f0a750cf --- /dev/null +++ b/packages/cosmos/generated/types/cosmos/base/abci/v1beta1/index.ts @@ -0,0 +1,3 @@ +// @ts-nocheck + +export * from './abci'; \ No newline at end of file diff --git a/packages/cosmos/generated/types/cosmos/base/kv/v1beta1/index.ts b/packages/cosmos/generated/types/cosmos/base/kv/v1beta1/index.ts new file mode 100644 index 000000000..c55d060f5 --- /dev/null +++ b/packages/cosmos/generated/types/cosmos/base/kv/v1beta1/index.ts @@ -0,0 +1,3 @@ +// @ts-nocheck + +export * from './kv'; \ No newline at end of file diff --git a/packages/cosmos/generated/types/cosmos/base/kv/v1beta1/kv.ts b/packages/cosmos/generated/types/cosmos/base/kv/v1beta1/kv.ts new file mode 100644 index 000000000..a50cc0042 --- /dev/null +++ b/packages/cosmos/generated/types/cosmos/base/kv/v1beta1/kv.ts @@ -0,0 +1,8 @@ +export interface Pairs { + pairs: Pair[]; +} + +export interface Pair { + key: Uint8Array; + value: Uint8Array; +} diff --git a/packages/cosmos/generated/types/cosmos/base/query/v1beta1/index.ts b/packages/cosmos/generated/types/cosmos/base/query/v1beta1/index.ts new file mode 100644 index 000000000..2fb8b1947 --- /dev/null +++ b/packages/cosmos/generated/types/cosmos/base/query/v1beta1/index.ts @@ -0,0 +1,3 @@ +// @ts-nocheck + +export * from './pagination'; \ No newline at end of file diff --git a/packages/cosmos/generated/types/cosmos/base/query/v1beta1/pagination.ts b/packages/cosmos/generated/types/cosmos/base/query/v1beta1/pagination.ts new file mode 100644 index 000000000..aee8db537 --- /dev/null +++ b/packages/cosmos/generated/types/cosmos/base/query/v1beta1/pagination.ts @@ -0,0 +1,45 @@ +export interface PageRequest { + /** + * 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: number; + /** + * 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: number; + /** + * 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 PageResponse { + /** + * next_key is the key to be passed to PageRequest.key to + * query the next page most efficiently + */ + next_key: Uint8Array; + /** + * total is total number of results available if PageRequest.count_total + * was set, its value is undefined otherwise + */ + total: number; +} diff --git a/packages/cosmos/generated/types/cosmos/base/reflection/v1beta1/index.ts b/packages/cosmos/generated/types/cosmos/base/reflection/v1beta1/index.ts new file mode 100644 index 000000000..c8c4801a7 --- /dev/null +++ b/packages/cosmos/generated/types/cosmos/base/reflection/v1beta1/index.ts @@ -0,0 +1,3 @@ +// @ts-nocheck + +export * from './reflection'; \ No newline at end of file diff --git a/packages/cosmos/generated/types/cosmos/base/reflection/v1beta1/reflection.ts b/packages/cosmos/generated/types/cosmos/base/reflection/v1beta1/reflection.ts new file mode 100644 index 000000000..e677144d1 --- /dev/null +++ b/packages/cosmos/generated/types/cosmos/base/reflection/v1beta1/reflection.ts @@ -0,0 +1,15 @@ +export type ListAllInterfacesRequest = {}; + +export interface ListAllInterfacesResponse { + /** interface_names is an array of all the registered interfaces. */ + interface_names: string[]; +} + +export interface ListImplementationsRequest { + /** interface_name defines the interface to query the implementations for. */ + interface_name: string; +} + +export interface ListImplementationsResponse { + implementation_message_names: string[]; +} diff --git a/packages/cosmos/generated/types/cosmos/base/reflection/v2alpha1/index.ts b/packages/cosmos/generated/types/cosmos/base/reflection/v2alpha1/index.ts new file mode 100644 index 000000000..c8c4801a7 --- /dev/null +++ b/packages/cosmos/generated/types/cosmos/base/reflection/v2alpha1/index.ts @@ -0,0 +1,3 @@ +// @ts-nocheck + +export * from './reflection'; \ No newline at end of file diff --git a/packages/cosmos/generated/types/cosmos/base/reflection/v2alpha1/reflection.ts b/packages/cosmos/generated/types/cosmos/base/reflection/v2alpha1/reflection.ts new file mode 100644 index 000000000..b81d3c549 --- /dev/null +++ b/packages/cosmos/generated/types/cosmos/base/reflection/v2alpha1/reflection.ts @@ -0,0 +1,169 @@ +export interface AppDescriptor { + /** + * AuthnDescriptor provides information on how to authenticate transactions on the application + * NOTE: experimental and subject to change in future releases. + */ + authn?: AuthnDescriptor; + /** chain provides the chain descriptor */ + chain?: ChainDescriptor; + /** codec provides metadata information regarding codec related types */ + codec?: CodecDescriptor; + /** configuration provides metadata information regarding the sdk.Config type */ + configuration?: ConfigurationDescriptor; + /** query_services provides metadata information regarding the available queriable endpoints */ + query_services?: QueryServicesDescriptor; + /** tx provides metadata information regarding how to send transactions to the given application */ + tx?: TxDescriptor; +} + +export interface TxDescriptor { + /** + * fullname is the protobuf fullname of the raw transaction type (for instance the tx.Tx type) + * it is not meant to support polymorphism of transaction types, it is supposed to be used by + * reflection clients to understand if they can handle a specific transaction type in an application. + */ + fullname: string; + /** msgs lists the accepted application messages (sdk.Msg) */ + msgs: MsgDescriptor[]; +} + +export interface AuthnDescriptor { + /** sign_modes defines the supported signature algorithm */ + sign_modes: SigningModeDescriptor[]; +} + +export interface SigningModeDescriptor { + /** name defines the unique name of the signing mode */ + name: string; + /** number is the unique int32 identifier for the sign_mode enum */ + number: number; + /** + * authn_info_provider_method_fullname defines the fullname of the method to call to get + * the metadata required to authenticate using the provided sign_modes + */ + authn_info_provider_method_fullname: string; +} + +export interface ChainDescriptor { + /** id is the chain id */ + id: string; +} + +export interface CodecDescriptor { + /** interfaces is a list of the registerted interfaces descriptors */ + interfaces: InterfaceDescriptor[]; +} + +export interface InterfaceDescriptor { + /** fullname is the name of the interface */ + fullname: string; + /** + * interface_accepting_messages contains information regarding the proto messages which contain the interface as + * google.protobuf.Any field + */ + interface_accepting_messages: InterfaceAcceptingMessageDescriptor[]; + /** interface_implementers is a list of the descriptors of the interface implementers */ + interface_implementers: InterfaceImplementerDescriptor[]; +} + +export interface InterfaceImplementerDescriptor { + /** fullname is the protobuf queryable name of the interface implementer */ + fullname: string; + /** + * type_url defines the type URL used when marshalling the type as any + * this is required so we can provide type safe google.protobuf.Any marshalling and + * unmarshalling, making sure that we don't accept just 'any' type + * in our interface fields + */ + type_url: string; +} + +export interface InterfaceAcceptingMessageDescriptor { + /** fullname is the protobuf fullname of the type containing the interface */ + fullname: string; + /** + * field_descriptor_names is a list of the protobuf name (not fullname) of the field + * which contains the interface as google.protobuf.Any (the interface is the same, but + * it can be in multiple fields of the same proto message) + */ + field_descriptor_names: string[]; +} + +export interface ConfigurationDescriptor { + /** bech32_account_address_prefix is the account address prefix */ + bech32_account_address_prefix: string; +} + +export interface MsgDescriptor { + /** msg_type_url contains the TypeURL of a sdk.Msg. */ + msg_type_url: string; +} + +export type GetAuthnDescriptorRequest = {}; + +export interface GetAuthnDescriptorResponse { + /** authn describes how to authenticate to the application when sending transactions */ + authn?: AuthnDescriptor; +} + +export type GetChainDescriptorRequest = {}; + +export interface GetChainDescriptorResponse { + /** chain describes application chain information */ + chain?: ChainDescriptor; +} + +export type GetCodecDescriptorRequest = {}; + +export interface GetCodecDescriptorResponse { + /** codec describes the application codec such as registered interfaces and implementations */ + codec?: CodecDescriptor; +} + +export type GetConfigurationDescriptorRequest = {}; + +export interface GetConfigurationDescriptorResponse { + /** config describes the application's sdk.Config */ + config?: ConfigurationDescriptor; +} + +export type GetQueryServicesDescriptorRequest = {}; + +export interface GetQueryServicesDescriptorResponse { + /** queries provides information on the available queryable services */ + queries?: QueryServicesDescriptor; +} + +export type GetTxDescriptorRequest = {}; + +export interface GetTxDescriptorResponse { + /** + * tx provides information on msgs that can be forwarded to the application + * alongside the accepted transaction protobuf type + */ + tx?: TxDescriptor; +} + +export interface QueryServicesDescriptor { + /** query_services is a list of cosmos-sdk QueryServiceDescriptor */ + query_services: QueryServiceDescriptor[]; +} + +export interface QueryServiceDescriptor { + /** fullname is the protobuf fullname of the service descriptor */ + fullname: string; + /** is_module describes if this service is actually exposed by an application's module */ + is_module: boolean; + /** methods provides a list of query service methods */ + methods: QueryMethodDescriptor[]; +} + +export interface QueryMethodDescriptor { + /** name is the protobuf name (not fullname) of the method */ + name: string; + /** + * full_query_path is the path that can be used to query + * this method via tendermint abci.Query + */ + full_query_path: string; +} diff --git a/packages/cosmos/generated/types/cosmos/base/snapshots/v1beta1/index.ts b/packages/cosmos/generated/types/cosmos/base/snapshots/v1beta1/index.ts new file mode 100644 index 000000000..51d895881 --- /dev/null +++ b/packages/cosmos/generated/types/cosmos/base/snapshots/v1beta1/index.ts @@ -0,0 +1,3 @@ +// @ts-nocheck + +export * from './snapshot'; \ No newline at end of file diff --git a/packages/cosmos/generated/types/cosmos/base/snapshots/v1beta1/snapshot.ts b/packages/cosmos/generated/types/cosmos/base/snapshots/v1beta1/snapshot.ts new file mode 100644 index 000000000..8bf436767 --- /dev/null +++ b/packages/cosmos/generated/types/cosmos/base/snapshots/v1beta1/snapshot.ts @@ -0,0 +1,41 @@ +export interface Snapshot { + height: number; + format: number; + chunks: number; + hash: Uint8Array; + metadata?: Metadata; +} + +export interface Metadata { + /** SHA-256 chunk hashes */ + chunk_hashes: Uint8Array[]; +} + +export interface SnapshotItem { + store?: SnapshotStoreItem; + iavl?: SnapshotIAVLItem; + extension?: SnapshotExtensionMeta; + extension_payload?: SnapshotExtensionPayload; +} + +export interface SnapshotStoreItem { + name: string; +} + +export interface SnapshotIAVLItem { + key: Uint8Array; + value: Uint8Array; + /** version is block height */ + version: number; + /** height is depth of the tree. */ + height: number; +} + +export interface SnapshotExtensionMeta { + name: string; + format: number; +} + +export interface SnapshotExtensionPayload { + payload: Uint8Array; +} diff --git a/packages/cosmos/generated/types/cosmos/base/store/v1beta1/commit_info.ts b/packages/cosmos/generated/types/cosmos/base/store/v1beta1/commit_info.ts new file mode 100644 index 000000000..116fc73b7 --- /dev/null +++ b/packages/cosmos/generated/types/cosmos/base/store/v1beta1/commit_info.ts @@ -0,0 +1,14 @@ +export interface CommitInfo { + version: number; + store_infos: StoreInfo[]; +} + +export interface StoreInfo { + name: string; + commit_id?: CommitID; +} + +export interface CommitID { + version: number; + hash: Uint8Array; +} diff --git a/packages/cosmos/generated/types/cosmos/base/store/v1beta1/index.ts b/packages/cosmos/generated/types/cosmos/base/store/v1beta1/index.ts new file mode 100644 index 000000000..ea683009b --- /dev/null +++ b/packages/cosmos/generated/types/cosmos/base/store/v1beta1/index.ts @@ -0,0 +1,4 @@ +// @ts-nocheck + +export * from './commit_info'; +export * from './listening'; \ No newline at end of file diff --git a/packages/cosmos/generated/types/cosmos/base/store/v1beta1/listening.ts b/packages/cosmos/generated/types/cosmos/base/store/v1beta1/listening.ts new file mode 100644 index 000000000..1b9b15bfd --- /dev/null +++ b/packages/cosmos/generated/types/cosmos/base/store/v1beta1/listening.ts @@ -0,0 +1,8 @@ +export interface StoreKVPair { + /** the store key for the KVStore this pair originates from */ + store_key: string; + /** true indicates a delete operation, false indicates a set operation */ + delete: boolean; + key: Uint8Array; + value: Uint8Array; +} diff --git a/packages/cosmos/generated/types/cosmos/base/tendermint/v1beta1/index.ts b/packages/cosmos/generated/types/cosmos/base/tendermint/v1beta1/index.ts new file mode 100644 index 000000000..847fe8275 --- /dev/null +++ b/packages/cosmos/generated/types/cosmos/base/tendermint/v1beta1/index.ts @@ -0,0 +1,3 @@ +// @ts-nocheck + +export * from './query'; \ No newline at end of file diff --git a/packages/cosmos/generated/types/cosmos/base/tendermint/v1beta1/query.ts b/packages/cosmos/generated/types/cosmos/base/tendermint/v1beta1/query.ts new file mode 100644 index 000000000..99d34d0ac --- /dev/null +++ b/packages/cosmos/generated/types/cosmos/base/tendermint/v1beta1/query.ts @@ -0,0 +1,91 @@ +import type { Any } from "../../../../google/protobuf/any"; + +import type { NodeInfo } from "../../../../tendermint/p2p/types"; + +import type { Block } from "../../../../tendermint/types/block"; + +import type { BlockID } from "../../../../tendermint/types/types"; + +import type { PageRequest, PageResponse } from "../../query/v1beta1/pagination"; + +export interface GetValidatorSetByHeightRequest { + height: number; + /** pagination defines an pagination for the request. */ + pagination?: PageRequest; +} + +export interface GetValidatorSetByHeightResponse { + block_height: number; + validators: Validator[]; + /** pagination defines an pagination for the response. */ + pagination?: PageResponse; +} + +export interface GetLatestValidatorSetRequest { + /** pagination defines an pagination for the request. */ + pagination?: PageRequest; +} + +export interface GetLatestValidatorSetResponse { + block_height: number; + validators: Validator[]; + /** pagination defines an pagination for the response. */ + pagination?: PageResponse; +} + +export interface Validator { + address: string; + pub_key?: Any; + voting_power: number; + proposer_priority: number; +} + +export interface GetBlockByHeightRequest { + height: number; +} + +export interface GetBlockByHeightResponse { + block_id?: BlockID; + block?: Block; +} + +export type GetLatestBlockRequest = {}; + +export interface GetLatestBlockResponse { + block_id?: BlockID; + block?: Block; +} + +export type GetSyncingRequest = {}; + +export interface GetSyncingResponse { + syncing: boolean; +} + +export type GetNodeInfoRequest = {}; + +export interface GetNodeInfoResponse { + default_node_info?: NodeInfo; + application_version?: VersionInfo; +} + +export interface VersionInfo { + name: string; + app_name: string; + version: string; + git_commit: string; + build_tags: string; + go_version: string; + build_deps: Module[]; + /** Since: cosmos-sdk 0.43 */ + cosmos_sdk_version: string; +} + +export interface Module { + /** module path */ + path: string; + /** module version */ + version: string; + /** checksum */ + sum: string; +} diff --git a/packages/cosmos/generated/types/cosmos/base/v1beta1/coin.ts b/packages/cosmos/generated/types/cosmos/base/v1beta1/coin.ts new file mode 100644 index 000000000..7b67a03a9 --- /dev/null +++ b/packages/cosmos/generated/types/cosmos/base/v1beta1/coin.ts @@ -0,0 +1,17 @@ +export interface Coin { + denom: string; + amount: string; +} + +export interface DecCoin { + denom: string; + amount: string; +} + +export interface IntProto { + int: string; +} + +export interface DecProto { + dec: string; +} diff --git a/packages/cosmos/generated/types/cosmos/base/v1beta1/index.ts b/packages/cosmos/generated/types/cosmos/base/v1beta1/index.ts new file mode 100644 index 000000000..b81aacb46 --- /dev/null +++ b/packages/cosmos/generated/types/cosmos/base/v1beta1/index.ts @@ -0,0 +1,3 @@ +// @ts-nocheck + +export * from './coin'; \ No newline at end of file diff --git a/packages/cosmos/generated/types/cosmos/capability/v1beta1/capability.ts b/packages/cosmos/generated/types/cosmos/capability/v1beta1/capability.ts new file mode 100644 index 000000000..03c0223cf --- /dev/null +++ b/packages/cosmos/generated/types/cosmos/capability/v1beta1/capability.ts @@ -0,0 +1,12 @@ +export interface Capability { + index: number; +} + +export interface Owner { + module: string; + name: string; +} + +export interface CapabilityOwners { + owners: Owner[]; +} diff --git a/packages/cosmos/generated/types/cosmos/capability/v1beta1/genesis.ts b/packages/cosmos/generated/types/cosmos/capability/v1beta1/genesis.ts new file mode 100644 index 000000000..aff9f716e --- /dev/null +++ b/packages/cosmos/generated/types/cosmos/capability/v1beta1/genesis.ts @@ -0,0 +1,18 @@ +import type { CapabilityOwners } from "./capability"; + +export interface GenesisOwners { + /** index is the index of the capability owner. */ + index: number; + /** index_owners are the owners at the given index. */ + index_owners?: CapabilityOwners; +} + +export interface GenesisState { + /** index is the capability global index. */ + index: number; + /** + * owners represents a map from index to owners of the capability index + * index key is string to allow amino marshalling. + */ + owners: GenesisOwners[]; +} diff --git a/packages/cosmos/generated/types/cosmos/capability/v1beta1/index.ts b/packages/cosmos/generated/types/cosmos/capability/v1beta1/index.ts new file mode 100644 index 000000000..8a11e58ff --- /dev/null +++ b/packages/cosmos/generated/types/cosmos/capability/v1beta1/index.ts @@ -0,0 +1,4 @@ +// @ts-nocheck + +export * from './capability'; +export * from './genesis'; \ No newline at end of file diff --git a/packages/cosmos/generated/types/cosmos/crisis/v1beta1/genesis.ts b/packages/cosmos/generated/types/cosmos/crisis/v1beta1/genesis.ts new file mode 100644 index 000000000..04ce93b8d --- /dev/null +++ b/packages/cosmos/generated/types/cosmos/crisis/v1beta1/genesis.ts @@ -0,0 +1,9 @@ +import type { Coin } from "../../base/v1beta1/coin"; + +export interface GenesisState { + /** + * constant_fee is the fee used to verify the invariant in the crisis + * module. + */ + constant_fee?: Coin; +} diff --git a/packages/cosmos/generated/types/cosmos/crisis/v1beta1/index.ts b/packages/cosmos/generated/types/cosmos/crisis/v1beta1/index.ts new file mode 100644 index 000000000..afdc62858 --- /dev/null +++ b/packages/cosmos/generated/types/cosmos/crisis/v1beta1/index.ts @@ -0,0 +1,4 @@ +// @ts-nocheck + +export * from './genesis'; +export * from './tx'; \ No newline at end of file diff --git a/packages/cosmos/generated/types/cosmos/crisis/v1beta1/tx.ts b/packages/cosmos/generated/types/cosmos/crisis/v1beta1/tx.ts new file mode 100644 index 000000000..165e41183 --- /dev/null +++ b/packages/cosmos/generated/types/cosmos/crisis/v1beta1/tx.ts @@ -0,0 +1,7 @@ +export interface MsgVerifyInvariant { + sender: string; + invariant_module_name: string; + invariant_route: string; +} + +export type MsgVerifyInvariantResponse = {}; diff --git a/packages/cosmos/generated/types/cosmos/crypto/ed25519/index.ts b/packages/cosmos/generated/types/cosmos/crypto/ed25519/index.ts new file mode 100644 index 000000000..2d2828c1d --- /dev/null +++ b/packages/cosmos/generated/types/cosmos/crypto/ed25519/index.ts @@ -0,0 +1,3 @@ +// @ts-nocheck + +export * from './keys'; \ No newline at end of file diff --git a/packages/cosmos/generated/types/cosmos/crypto/ed25519/keys.ts b/packages/cosmos/generated/types/cosmos/crypto/ed25519/keys.ts new file mode 100644 index 000000000..ef25a887a --- /dev/null +++ b/packages/cosmos/generated/types/cosmos/crypto/ed25519/keys.ts @@ -0,0 +1,7 @@ +export interface PubKey { + key: Uint8Array; +} + +export interface PrivKey { + key: Uint8Array; +} diff --git a/packages/cosmos/generated/types/cosmos/crypto/multisig/index.ts b/packages/cosmos/generated/types/cosmos/crypto/multisig/index.ts new file mode 100644 index 000000000..2d2828c1d --- /dev/null +++ b/packages/cosmos/generated/types/cosmos/crypto/multisig/index.ts @@ -0,0 +1,3 @@ +// @ts-nocheck + +export * from './keys'; \ No newline at end of file diff --git a/packages/cosmos/generated/types/cosmos/crypto/multisig/keys.ts b/packages/cosmos/generated/types/cosmos/crypto/multisig/keys.ts new file mode 100644 index 000000000..5f1ed35cf --- /dev/null +++ b/packages/cosmos/generated/types/cosmos/crypto/multisig/keys.ts @@ -0,0 +1,6 @@ +import type { Any } from "../../../google/protobuf/any"; + +export interface LegacyAminoPubKey { + threshold: number; + public_keys: Any[]; +} diff --git a/packages/cosmos/generated/types/cosmos/crypto/multisig/v1beta1/index.ts b/packages/cosmos/generated/types/cosmos/crypto/multisig/v1beta1/index.ts new file mode 100644 index 000000000..77ccbe516 --- /dev/null +++ b/packages/cosmos/generated/types/cosmos/crypto/multisig/v1beta1/index.ts @@ -0,0 +1,3 @@ +// @ts-nocheck + +export * from './multisig'; \ No newline at end of file diff --git a/packages/cosmos/generated/types/cosmos/crypto/multisig/v1beta1/multisig.ts b/packages/cosmos/generated/types/cosmos/crypto/multisig/v1beta1/multisig.ts new file mode 100644 index 000000000..cfbf164d1 --- /dev/null +++ b/packages/cosmos/generated/types/cosmos/crypto/multisig/v1beta1/multisig.ts @@ -0,0 +1,8 @@ +export interface MultiSignature { + signatures: Uint8Array[]; +} + +export interface CompactBitArray { + extra_bits_stored: number; + elems: Uint8Array; +} diff --git a/packages/cosmos/generated/types/cosmos/crypto/secp256k1/index.ts b/packages/cosmos/generated/types/cosmos/crypto/secp256k1/index.ts new file mode 100644 index 000000000..2d2828c1d --- /dev/null +++ b/packages/cosmos/generated/types/cosmos/crypto/secp256k1/index.ts @@ -0,0 +1,3 @@ +// @ts-nocheck + +export * from './keys'; \ No newline at end of file diff --git a/packages/cosmos/generated/types/cosmos/crypto/secp256k1/keys.ts b/packages/cosmos/generated/types/cosmos/crypto/secp256k1/keys.ts new file mode 100644 index 000000000..ef25a887a --- /dev/null +++ b/packages/cosmos/generated/types/cosmos/crypto/secp256k1/keys.ts @@ -0,0 +1,7 @@ +export interface PubKey { + key: Uint8Array; +} + +export interface PrivKey { + key: Uint8Array; +} diff --git a/packages/cosmos/generated/types/cosmos/crypto/secp256r1/index.ts b/packages/cosmos/generated/types/cosmos/crypto/secp256r1/index.ts new file mode 100644 index 000000000..2d2828c1d --- /dev/null +++ b/packages/cosmos/generated/types/cosmos/crypto/secp256r1/index.ts @@ -0,0 +1,3 @@ +// @ts-nocheck + +export * from './keys'; \ No newline at end of file diff --git a/packages/cosmos/generated/types/cosmos/crypto/secp256r1/keys.ts b/packages/cosmos/generated/types/cosmos/crypto/secp256r1/keys.ts new file mode 100644 index 000000000..3de1a9150 --- /dev/null +++ b/packages/cosmos/generated/types/cosmos/crypto/secp256r1/keys.ts @@ -0,0 +1,12 @@ +export interface PubKey { + /** + * Point on secp256r1 curve in a compressed representation as specified in section + * 4.3.6 of ANSI X9.62: https://webstore.ansi.org/standards/ascx9/ansix9621998 + */ + key: Uint8Array; +} + +export interface PrivKey { + /** secret number serialized using big-endian encoding */ + secret: Uint8Array; +} diff --git a/packages/cosmos/generated/types/cosmos/crypto/sr25519/index.ts b/packages/cosmos/generated/types/cosmos/crypto/sr25519/index.ts new file mode 100644 index 000000000..2d2828c1d --- /dev/null +++ b/packages/cosmos/generated/types/cosmos/crypto/sr25519/index.ts @@ -0,0 +1,3 @@ +// @ts-nocheck + +export * from './keys'; \ No newline at end of file diff --git a/packages/cosmos/generated/types/cosmos/crypto/sr25519/keys.ts b/packages/cosmos/generated/types/cosmos/crypto/sr25519/keys.ts new file mode 100644 index 000000000..7e90df3db --- /dev/null +++ b/packages/cosmos/generated/types/cosmos/crypto/sr25519/keys.ts @@ -0,0 +1,3 @@ +export interface PubKey { + key: Uint8Array; +} diff --git a/packages/cosmos/generated/types/cosmos/distribution/v1beta1/distribution.ts b/packages/cosmos/generated/types/cosmos/distribution/v1beta1/distribution.ts new file mode 100644 index 000000000..b128d27d3 --- /dev/null +++ b/packages/cosmos/generated/types/cosmos/distribution/v1beta1/distribution.ts @@ -0,0 +1,65 @@ +import type { Coin, DecCoin } from "../../base/v1beta1/coin"; + +export interface Params { + community_tax: string; + base_proposer_reward: string; + bonus_proposer_reward: string; + withdraw_addr_enabled: boolean; +} + +export interface ValidatorHistoricalRewards { + cumulative_reward_ratio: DecCoin[]; + reference_count: number; +} + +export interface ValidatorCurrentRewards { + rewards: DecCoin[]; + period: number; +} + +export interface ValidatorAccumulatedCommission { + commission: DecCoin[]; +} + +export interface ValidatorOutstandingRewards { + rewards: DecCoin[]; +} + +export interface ValidatorSlashEvent { + validator_period: number; + fraction: string; +} + +export interface ValidatorSlashEvents { + validator_slash_events: ValidatorSlashEvent[]; +} + +export interface FeePool { + community_pool: DecCoin[]; +} + +export interface CommunityPoolSpendProposal { + title: string; + description: string; + recipient: string; + amount: Coin[]; +} + +export interface DelegatorStartingInfo { + previous_period: number; + stake: string; + height: number; +} + +export interface DelegationDelegatorReward { + validator_address: string; + reward: DecCoin[]; +} + +export interface CommunityPoolSpendProposalWithDeposit { + title: string; + description: string; + recipient: string; + amount: string; + deposit: string; +} diff --git a/packages/cosmos/generated/types/cosmos/distribution/v1beta1/genesis.ts b/packages/cosmos/generated/types/cosmos/distribution/v1beta1/genesis.ts new file mode 100644 index 000000000..befc8613f --- /dev/null +++ b/packages/cosmos/generated/types/cosmos/distribution/v1beta1/genesis.ts @@ -0,0 +1,91 @@ +import type { DecCoin } from "../../base/v1beta1/coin"; + +import type { + DelegatorStartingInfo, + FeePool, + Params, + ValidatorAccumulatedCommission, + ValidatorCurrentRewards, + ValidatorHistoricalRewards, + ValidatorSlashEvent, +} from "./distribution"; + +export interface DelegatorWithdrawInfo { + /** delegator_address is the address of the delegator. */ + delegator_address: string; + /** withdraw_address is the address to withdraw the delegation rewards to. */ + withdraw_address: string; +} + +export interface ValidatorOutstandingRewardsRecord { + /** validator_address is the address of the validator. */ + validator_address: string; + /** outstanding_rewards represents the oustanding rewards of a validator. */ + outstanding_rewards: DecCoin[]; +} + +export interface ValidatorAccumulatedCommissionRecord { + /** validator_address is the address of the validator. */ + validator_address: string; + /** accumulated is the accumulated commission of a validator. */ + accumulated?: ValidatorAccumulatedCommission; +} + +export interface ValidatorHistoricalRewardsRecord { + /** validator_address is the address of the validator. */ + validator_address: string; + /** period defines the period the historical rewards apply to. */ + period: number; + /** rewards defines the historical rewards of a validator. */ + rewards?: ValidatorHistoricalRewards; +} + +export interface ValidatorCurrentRewardsRecord { + /** validator_address is the address of the validator. */ + validator_address: string; + /** rewards defines the current rewards of a validator. */ + rewards?: ValidatorCurrentRewards; +} + +export interface DelegatorStartingInfoRecord { + /** delegator_address is the address of the delegator. */ + delegator_address: string; + /** validator_address is the address of the validator. */ + validator_address: string; + /** starting_info defines the starting info of a delegator. */ + starting_info?: DelegatorStartingInfo; +} + +export interface ValidatorSlashEventRecord { + /** validator_address is the address of the validator. */ + validator_address: string; + /** height defines the block height at which the slash event occured. */ + height: number; + /** period is the period of the slash event. */ + period: number; + /** validator_slash_event describes the slash event. */ + validator_slash_event?: ValidatorSlashEvent; +} + +export interface GenesisState { + /** params defines all the paramaters of the module. */ + params?: Params; + /** fee_pool defines the fee pool at genesis. */ + fee_pool?: FeePool; + /** fee_pool defines the delegator withdraw infos at genesis. */ + delegator_withdraw_infos: DelegatorWithdrawInfo[]; + /** fee_pool defines the previous proposer at genesis. */ + previous_proposer: string; + /** fee_pool defines the outstanding rewards of all validators at genesis. */ + outstanding_rewards: ValidatorOutstandingRewardsRecord[]; + /** fee_pool defines the accumulated commisions of all validators at genesis. */ + validator_accumulated_commissions: ValidatorAccumulatedCommissionRecord[]; + /** fee_pool defines the historical rewards of all validators at genesis. */ + validator_historical_rewards: ValidatorHistoricalRewardsRecord[]; + /** fee_pool defines the current rewards of all validators at genesis. */ + validator_current_rewards: ValidatorCurrentRewardsRecord[]; + /** fee_pool defines the delegator starting infos at genesis. */ + delegator_starting_infos: DelegatorStartingInfoRecord[]; + /** fee_pool defines the validator slash events at genesis. */ + validator_slash_events: ValidatorSlashEventRecord[]; +} diff --git a/packages/cosmos/generated/types/cosmos/distribution/v1beta1/index.ts b/packages/cosmos/generated/types/cosmos/distribution/v1beta1/index.ts new file mode 100644 index 000000000..9a5e3080e --- /dev/null +++ b/packages/cosmos/generated/types/cosmos/distribution/v1beta1/index.ts @@ -0,0 +1,6 @@ +// @ts-nocheck + +export * from './distribution'; +export * from './genesis'; +export * from './query'; +export * from './tx'; \ No newline at end of file diff --git a/packages/cosmos/generated/types/cosmos/distribution/v1beta1/query.ts b/packages/cosmos/generated/types/cosmos/distribution/v1beta1/query.ts new file mode 100644 index 000000000..eb7da61dd --- /dev/null +++ b/packages/cosmos/generated/types/cosmos/distribution/v1beta1/query.ts @@ -0,0 +1,100 @@ +import type { PageRequest, PageResponse } from "../../base/query/v1beta1/pagination"; + +import type { DecCoin } from "../../base/v1beta1/coin"; + +import type { DelegationDelegatorReward, Params, ValidatorAccumulatedCommission, ValidatorOutstandingRewards, ValidatorSlashEvent } from "./distribution"; + +export type QueryParamsRequest = {}; + +export interface QueryParamsResponse { + /** params defines the parameters of the module. */ + params?: Params; +} + +export interface QueryValidatorOutstandingRewardsRequest { + /** validator_address defines the validator address to query for. */ + validator_address: string; +} + +export interface QueryValidatorOutstandingRewardsResponse { + rewards?: ValidatorOutstandingRewards; +} + +export interface QueryValidatorCommissionRequest { + /** validator_address defines the validator address to query for. */ + validator_address: string; +} + +export interface QueryValidatorCommissionResponse { + /** commission defines the commision the validator received. */ + commission?: ValidatorAccumulatedCommission; +} + +export interface QueryValidatorSlashesRequest { + /** validator_address defines the validator address to query for. */ + validator_address: string; + /** starting_height defines the optional starting height to query the slashes. */ + starting_height: number; + /** starting_height defines the optional ending height to query the slashes. */ + ending_height: number; + /** pagination defines an optional pagination for the request. */ + pagination?: PageRequest; +} + +export interface QueryValidatorSlashesResponse { + /** slashes defines the slashes the validator received. */ + slashes: ValidatorSlashEvent[]; + /** pagination defines the pagination in the response. */ + pagination?: PageResponse; +} + +export interface QueryDelegationRewardsRequest { + /** delegator_address defines the delegator address to query for. */ + delegator_address: string; + /** validator_address defines the validator address to query for. */ + validator_address: string; +} + +export interface QueryDelegationRewardsResponse { + /** rewards defines the rewards accrued by a delegation. */ + rewards: DecCoin[]; +} + +export interface QueryDelegationTotalRewardsRequest { + /** delegator_address defines the delegator address to query for. */ + delegator_address: string; +} + +export interface QueryDelegationTotalRewardsResponse { + /** rewards defines all the rewards accrued by a delegator. */ + rewards: DelegationDelegatorReward[]; + /** total defines the sum of all the rewards. */ + total: DecCoin[]; +} + +export interface QueryDelegatorValidatorsRequest { + /** delegator_address defines the delegator address to query for. */ + delegator_address: string; +} + +export interface QueryDelegatorValidatorsResponse { + /** validators defines the validators a delegator is delegating for. */ + validators: string[]; +} + +export interface QueryDelegatorWithdrawAddressRequest { + /** delegator_address defines the delegator address to query for. */ + delegator_address: string; +} + +export interface QueryDelegatorWithdrawAddressResponse { + /** withdraw_address defines the delegator address to query for. */ + withdraw_address: string; +} + +export type QueryCommunityPoolRequest = {}; + +export interface QueryCommunityPoolResponse { + /** pool defines community pool's coins. */ + pool: DecCoin[]; +} diff --git a/packages/cosmos/generated/types/cosmos/distribution/v1beta1/tx.ts b/packages/cosmos/generated/types/cosmos/distribution/v1beta1/tx.ts new file mode 100644 index 000000000..9f87588e4 --- /dev/null +++ b/packages/cosmos/generated/types/cosmos/distribution/v1beta1/tx.ts @@ -0,0 +1,28 @@ +import type { Coin } from "../../base/v1beta1/coin"; + +export interface MsgSetWithdrawAddress { + delegator_address: string; + withdraw_address: string; +} + +export type MsgSetWithdrawAddressResponse = {}; + +export interface MsgWithdrawDelegatorReward { + delegator_address: string; + validator_address: string; +} + +export type MsgWithdrawDelegatorRewardResponse = {}; + +export interface MsgWithdrawValidatorCommission { + validator_address: string; +} + +export type MsgWithdrawValidatorCommissionResponse = {}; + +export interface MsgFundCommunityPool { + amount: Coin[]; + depositor: string; +} + +export type MsgFundCommunityPoolResponse = {}; diff --git a/packages/cosmos/generated/types/cosmos/evidence/v1beta1/evidence.ts b/packages/cosmos/generated/types/cosmos/evidence/v1beta1/evidence.ts new file mode 100644 index 000000000..0d01c8dba --- /dev/null +++ b/packages/cosmos/generated/types/cosmos/evidence/v1beta1/evidence.ts @@ -0,0 +1,6 @@ +export interface Equivocation { + height: number; + time?: Date; + power: number; + consensus_address: string; +} diff --git a/packages/cosmos/generated/types/cosmos/evidence/v1beta1/genesis.ts b/packages/cosmos/generated/types/cosmos/evidence/v1beta1/genesis.ts new file mode 100644 index 000000000..e64fb91a4 --- /dev/null +++ b/packages/cosmos/generated/types/cosmos/evidence/v1beta1/genesis.ts @@ -0,0 +1,6 @@ +import type { Any } from "../../../google/protobuf/any"; + +export interface GenesisState { + /** evidence defines all the evidence at genesis. */ + evidence: Any[]; +} diff --git a/packages/cosmos/generated/types/cosmos/evidence/v1beta1/index.ts b/packages/cosmos/generated/types/cosmos/evidence/v1beta1/index.ts new file mode 100644 index 000000000..9287c42ee --- /dev/null +++ b/packages/cosmos/generated/types/cosmos/evidence/v1beta1/index.ts @@ -0,0 +1,6 @@ +// @ts-nocheck + +export * from './evidence'; +export * from './genesis'; +export * from './query'; +export * from './tx'; \ No newline at end of file diff --git a/packages/cosmos/generated/types/cosmos/evidence/v1beta1/query.ts b/packages/cosmos/generated/types/cosmos/evidence/v1beta1/query.ts new file mode 100644 index 000000000..34bc48269 --- /dev/null +++ b/packages/cosmos/generated/types/cosmos/evidence/v1beta1/query.ts @@ -0,0 +1,25 @@ +import type { Any } from "../../../google/protobuf/any"; + +import type { PageRequest, PageResponse } from "../../base/query/v1beta1/pagination"; + +export interface QueryEvidenceRequest { + /** evidence_hash defines the hash of the requested evidence. */ + evidence_hash: Uint8Array; +} + +export interface QueryEvidenceResponse { + /** evidence returns the requested evidence. */ + evidence?: Any; +} + +export interface QueryAllEvidenceRequest { + /** pagination defines an optional pagination for the request. */ + pagination?: PageRequest; +} + +export interface QueryAllEvidenceResponse { + /** evidence returns all evidences. */ + evidence: Any[]; + /** pagination defines the pagination in the response. */ + pagination?: PageResponse; +} diff --git a/packages/cosmos/generated/types/cosmos/evidence/v1beta1/tx.ts b/packages/cosmos/generated/types/cosmos/evidence/v1beta1/tx.ts new file mode 100644 index 000000000..964e19852 --- /dev/null +++ b/packages/cosmos/generated/types/cosmos/evidence/v1beta1/tx.ts @@ -0,0 +1,11 @@ +import type { Any } from "../../../google/protobuf/any"; + +export interface MsgSubmitEvidence { + submitter: string; + evidence?: Any; +} + +export interface MsgSubmitEvidenceResponse { + /** hash defines the hash of the evidence. */ + hash: Uint8Array; +} diff --git a/packages/cosmos/generated/types/cosmos/feegrant/v1beta1/feegrant.ts b/packages/cosmos/generated/types/cosmos/feegrant/v1beta1/feegrant.ts new file mode 100644 index 000000000..d09ce4f81 --- /dev/null +++ b/packages/cosmos/generated/types/cosmos/feegrant/v1beta1/feegrant.ts @@ -0,0 +1,55 @@ +import type { Any } from "../../../google/protobuf/any"; + +import type { Duration } from "../../../google/protobuf/duration"; + +import type { Coin } from "../../base/v1beta1/coin"; + +export interface BasicAllowance { + /** + * spend_limit specifies the maximum amount of tokens that can be spent + * by this allowance and will be updated as tokens are spent. If it is + * empty, there is no spend limit and any amount of coins can be spent. + */ + spend_limit: Coin[]; + /** expiration specifies an optional time when this allowance expires */ + expiration?: Date; +} + +export interface PeriodicAllowance { + /** basic specifies a struct of `BasicAllowance` */ + basic?: BasicAllowance; + /** + * period specifies the time duration in which period_spend_limit coins can + * be spent before that allowance is reset + */ + period?: Duration; + /** + * period_spend_limit specifies the maximum number of coins that can be spent + * in the period + */ + period_spend_limit: Coin[]; + /** period_can_spend is the number of coins left to be spent before the period_reset time */ + period_can_spend: Coin[]; + /** + * period_reset is the time at which this period resets and a new one begins, + * it is calculated from the start time of the first transaction after the + * last period ended + */ + period_reset?: Date; +} + +export interface AllowedMsgAllowance { + /** allowance can be any of basic and filtered fee allowance. */ + allowance?: Any; + /** allowed_messages are the messages for which the grantee has the access. */ + allowed_messages: string[]; +} + +export interface Grant { + /** granter is the address of the user granting an allowance of their funds. */ + granter: string; + /** grantee is the address of the user being granted an allowance of another user's funds. */ + grantee: string; + /** allowance can be any of basic and filtered fee allowance. */ + allowance?: Any; +} diff --git a/packages/cosmos/generated/types/cosmos/feegrant/v1beta1/genesis.ts b/packages/cosmos/generated/types/cosmos/feegrant/v1beta1/genesis.ts new file mode 100644 index 000000000..1a65f1a88 --- /dev/null +++ b/packages/cosmos/generated/types/cosmos/feegrant/v1beta1/genesis.ts @@ -0,0 +1,5 @@ +import type { Grant } from "./feegrant"; + +export interface GenesisState { + allowances: Grant[]; +} diff --git a/packages/cosmos/generated/types/cosmos/feegrant/v1beta1/index.ts b/packages/cosmos/generated/types/cosmos/feegrant/v1beta1/index.ts new file mode 100644 index 000000000..2c26afaf4 --- /dev/null +++ b/packages/cosmos/generated/types/cosmos/feegrant/v1beta1/index.ts @@ -0,0 +1,6 @@ +// @ts-nocheck + +export * from './feegrant'; +export * from './genesis'; +export * from './query'; +export * from './tx'; \ No newline at end of file diff --git a/packages/cosmos/generated/types/cosmos/feegrant/v1beta1/query.ts b/packages/cosmos/generated/types/cosmos/feegrant/v1beta1/query.ts new file mode 100644 index 000000000..3eaba1e27 --- /dev/null +++ b/packages/cosmos/generated/types/cosmos/feegrant/v1beta1/query.ts @@ -0,0 +1,41 @@ +import type { PageRequest, PageResponse } from "../../base/query/v1beta1/pagination"; + +import type { Grant } from "./feegrant"; + +export interface QueryAllowanceRequest { + /** granter is the address of the user granting an allowance of their funds. */ + granter: string; + /** grantee is the address of the user being granted an allowance of another user's funds. */ + grantee: string; +} + +export interface QueryAllowanceResponse { + /** allowance is a allowance granted for grantee by granter. */ + allowance?: Grant; +} + +export interface QueryAllowancesRequest { + grantee: string; + /** pagination defines an pagination for the request. */ + pagination?: PageRequest; +} + +export interface QueryAllowancesResponse { + /** allowances are allowance's granted for grantee by granter. */ + allowances: Grant[]; + /** pagination defines an pagination for the response. */ + pagination?: PageResponse; +} + +export interface QueryAllowancesByGranterRequest { + granter: string; + /** pagination defines an pagination for the request. */ + pagination?: PageRequest; +} + +export interface QueryAllowancesByGranterResponse { + /** allowances that have been issued by the granter. */ + allowances: Grant[]; + /** pagination defines an pagination for the response. */ + pagination?: PageResponse; +} diff --git a/packages/cosmos/generated/types/cosmos/feegrant/v1beta1/tx.ts b/packages/cosmos/generated/types/cosmos/feegrant/v1beta1/tx.ts new file mode 100644 index 000000000..ce107957f --- /dev/null +++ b/packages/cosmos/generated/types/cosmos/feegrant/v1beta1/tx.ts @@ -0,0 +1,21 @@ +import type { Any } from "../../../google/protobuf/any"; + +export interface MsgGrantAllowance { + /** granter is the address of the user granting an allowance of their funds. */ + granter: string; + /** grantee is the address of the user being granted an allowance of another user's funds. */ + grantee: string; + /** allowance can be any of basic and filtered fee allowance. */ + allowance?: Any; +} + +export type MsgGrantAllowanceResponse = {}; + +export interface MsgRevokeAllowance { + /** granter is the address of the user granting an allowance of their funds. */ + granter: string; + /** grantee is the address of the user being granted an allowance of another user's funds. */ + grantee: string; +} + +export type MsgRevokeAllowanceResponse = {}; diff --git a/packages/cosmos/generated/types/cosmos/genutil/v1beta1/genesis.ts b/packages/cosmos/generated/types/cosmos/genutil/v1beta1/genesis.ts new file mode 100644 index 000000000..d9626834b --- /dev/null +++ b/packages/cosmos/generated/types/cosmos/genutil/v1beta1/genesis.ts @@ -0,0 +1,4 @@ +export interface GenesisState { + /** gen_txs defines the genesis transactions. */ + gen_txs: Uint8Array[]; +} diff --git a/packages/cosmos/generated/types/cosmos/genutil/v1beta1/index.ts b/packages/cosmos/generated/types/cosmos/genutil/v1beta1/index.ts new file mode 100644 index 000000000..1659c80ed --- /dev/null +++ b/packages/cosmos/generated/types/cosmos/genutil/v1beta1/index.ts @@ -0,0 +1,3 @@ +// @ts-nocheck + +export * from './genesis'; \ No newline at end of file diff --git a/packages/cosmos/generated/types/cosmos/gov/v1beta1/genesis.ts b/packages/cosmos/generated/types/cosmos/gov/v1beta1/genesis.ts new file mode 100644 index 000000000..39829c66a --- /dev/null +++ b/packages/cosmos/generated/types/cosmos/gov/v1beta1/genesis.ts @@ -0,0 +1,18 @@ +import type { Deposit, DepositParams, Proposal, TallyParams, Vote, VotingParams } from "./gov"; + +export interface GenesisState { + /** starting_proposal_id is the ID of the starting proposal. */ + starting_proposal_id: number; + /** 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 paramaters of related to deposit. */ + deposit_params?: DepositParams; + /** params defines all the paramaters of related to voting. */ + voting_params?: VotingParams; + /** params defines all the paramaters of related to tally. */ + tally_params?: TallyParams; +} diff --git a/packages/cosmos/generated/types/cosmos/gov/v1beta1/gov.ts b/packages/cosmos/generated/types/cosmos/gov/v1beta1/gov.ts new file mode 100644 index 000000000..fb2b4137d --- /dev/null +++ b/packages/cosmos/generated/types/cosmos/gov/v1beta1/gov.ts @@ -0,0 +1,140 @@ +import type { Any } from "../../../google/protobuf/any"; + +import type { Duration } from "../../../google/protobuf/duration"; + +import type { Coin } from "../../base/v1beta1/coin"; + +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 enum ProposalStatus { + /** PROPOSAL_STATUS_UNSPECIFIED - PROPOSAL_STATUS_UNSPECIFIED defines the default propopsal 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 interface WeightedVoteOption { + option: VoteOption; + weight: string; +} + +export interface TextProposal { + title: string; + description: string; + is_expedited: boolean; +} + +export interface Deposit { + proposal_id: number; + depositor: string; + amount: Coin[]; +} + +export interface Proposal { + proposal_id: number; + content?: Any; + status: ProposalStatus; + final_tally_result?: TallyResult; + submit_time?: Date; + deposit_end_time?: Date; + total_deposit: Coin[]; + voting_start_time?: Date; + voting_end_time?: Date; + is_expedited: boolean; +} + +export interface TallyResult { + yes: string; + abstain: string; + no: string; + no_with_veto: string; +} + +export interface Vote { + proposal_id: number; + 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; + /** Since: cosmos-sdk 0.43 */ + options: WeightedVoteOption[]; +} + +export interface DepositParams { + /** Minimum deposit for a proposal to enter voting period. */ + min_deposit: Coin[]; + /** + * Maximum period for Atom holders to deposit on a proposal. Initial value: 2 + * months. + */ + max_deposit_period?: Duration; + /** Minimum deposit for a expedited proposal to enter voting period. */ + min_expedited_deposit: Coin[]; +} + +export interface VotingParams { + /** Length of the voting period. */ + voting_period?: Duration; + /** Length of the expedited voting period. */ + expedited_voting_period?: Duration; +} + +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. + */ + veto_threshold: Uint8Array; + /** Minimum percentage of total stake needed to vote for expedited proposal to be valid */ + expedited_quorum: Uint8Array; + /** Minimum proportion of Yes votes for an expedited proposal to pass. Default value: 0.67. */ + expedited_threshold: Uint8Array; +} diff --git a/packages/cosmos/generated/types/cosmos/gov/v1beta1/index.ts b/packages/cosmos/generated/types/cosmos/gov/v1beta1/index.ts new file mode 100644 index 000000000..57dc0904c --- /dev/null +++ b/packages/cosmos/generated/types/cosmos/gov/v1beta1/index.ts @@ -0,0 +1,6 @@ +// @ts-nocheck + +export * from './genesis'; +export * from './gov'; +export * from './query'; +export * from './tx'; \ No newline at end of file diff --git a/packages/cosmos/generated/types/cosmos/gov/v1beta1/query.ts b/packages/cosmos/generated/types/cosmos/gov/v1beta1/query.ts new file mode 100644 index 000000000..f9949990c --- /dev/null +++ b/packages/cosmos/generated/types/cosmos/gov/v1beta1/query.ts @@ -0,0 +1,107 @@ +import type { PageRequest, PageResponse } from "../../base/query/v1beta1/pagination"; + +import type { Deposit, DepositParams, Proposal, ProposalStatus, TallyParams, TallyResult, Vote, VotingParams } from "./gov"; + +export interface QueryProposalRequest { + /** proposal_id defines the unique id of the proposal. */ + proposal_id: number; +} + +export interface QueryProposalResponse { + proposal?: Proposal; +} + +export interface QueryProposalsRequest { + /** 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?: PageRequest; +} + +export interface QueryProposalsResponse { + proposals: Proposal[]; + /** pagination defines the pagination in the response. */ + pagination?: PageResponse; +} + +export interface QueryVoteRequest { + /** proposal_id defines the unique id of the proposal. */ + proposal_id: number; + /** voter defines the oter address for the proposals. */ + voter: string; +} + +export interface QueryVoteResponse { + /** vote defined the queried vote. */ + vote?: Vote; +} + +export interface QueryVotesRequest { + /** proposal_id defines the unique id of the proposal. */ + proposal_id: number; + /** pagination defines an optional pagination for the request. */ + pagination?: PageRequest; +} + +export interface QueryVotesResponse { + /** votes defined the queried votes. */ + votes: Vote[]; + /** pagination defines the pagination in the response. */ + pagination?: PageResponse; +} + +export interface QueryParamsRequest { + /** + * params_type defines which parameters to query for, can be one of "voting", + * "tallying" or "deposit". + */ + params_type: string; +} + +export interface QueryParamsResponse { + /** voting_params defines the parameters related to voting. */ + voting_params?: VotingParams; + /** deposit_params defines the parameters related to deposit. */ + deposit_params?: DepositParams; + /** tally_params defines the parameters related to tally. */ + tally_params?: TallyParams; +} + +export interface QueryDepositRequest { + /** proposal_id defines the unique id of the proposal. */ + proposal_id: number; + /** depositor defines the deposit addresses from the proposals. */ + depositor: string; +} + +export interface QueryDepositResponse { + /** deposit defines the requested deposit. */ + deposit?: Deposit; +} + +export interface QueryDepositsRequest { + /** proposal_id defines the unique id of the proposal. */ + proposal_id: number; + /** pagination defines an optional pagination for the request. */ + pagination?: PageRequest; +} + +export interface QueryDepositsResponse { + deposits: Deposit[]; + /** pagination defines the pagination in the response. */ + pagination?: PageResponse; +} + +export interface QueryTallyResultRequest { + /** proposal_id defines the unique id of the proposal. */ + proposal_id: number; +} + +export interface QueryTallyResultResponse { + /** tally defines the requested tally. */ + tally?: TallyResult; +} diff --git a/packages/cosmos/generated/types/cosmos/gov/v1beta1/tx.ts b/packages/cosmos/generated/types/cosmos/gov/v1beta1/tx.ts new file mode 100644 index 000000000..1d2725196 --- /dev/null +++ b/packages/cosmos/generated/types/cosmos/gov/v1beta1/tx.ts @@ -0,0 +1,40 @@ +import type { Any } from "../../../google/protobuf/any"; + +import type { Coin } from "../../base/v1beta1/coin"; + +import type { VoteOption, WeightedVoteOption } from "./gov"; + +export interface MsgSubmitProposal { + content?: Any; + initial_deposit: Coin[]; + proposer: string; + is_expedited: boolean; +} + +export interface MsgSubmitProposalResponse { + proposal_id: number; +} + +export interface MsgVote { + proposal_id: number; + voter: string; + option: VoteOption; +} + +export type MsgVoteResponse = {}; + +export interface MsgVoteWeighted { + proposal_id: number; + voter: string; + options: WeightedVoteOption[]; +} + +export type MsgVoteWeightedResponse = {}; + +export interface MsgDeposit { + proposal_id: number; + depositor: string; + amount: Coin[]; +} + +export type MsgDepositResponse = {}; diff --git a/packages/cosmos/generated/types/cosmos/mint/v1beta1/genesis.ts b/packages/cosmos/generated/types/cosmos/mint/v1beta1/genesis.ts new file mode 100644 index 000000000..82ae8fd76 --- /dev/null +++ b/packages/cosmos/generated/types/cosmos/mint/v1beta1/genesis.ts @@ -0,0 +1,8 @@ +import type { Minter, Params } from "./mint"; + +export interface GenesisState { + /** minter is a space for holding current inflation information. */ + minter?: Minter; + /** params defines all the paramaters of the module. */ + params?: Params; +} diff --git a/packages/cosmos/generated/types/cosmos/mint/v1beta1/index.ts b/packages/cosmos/generated/types/cosmos/mint/v1beta1/index.ts new file mode 100644 index 000000000..3d9b6202b --- /dev/null +++ b/packages/cosmos/generated/types/cosmos/mint/v1beta1/index.ts @@ -0,0 +1,5 @@ +// @ts-nocheck + +export * from './genesis'; +export * from './mint'; +export * from './query'; \ No newline at end of file diff --git a/packages/cosmos/generated/types/cosmos/mint/v1beta1/mint.ts b/packages/cosmos/generated/types/cosmos/mint/v1beta1/mint.ts new file mode 100644 index 000000000..d81a2355d --- /dev/null +++ b/packages/cosmos/generated/types/cosmos/mint/v1beta1/mint.ts @@ -0,0 +1,21 @@ +export interface Minter { + /** current annual inflation rate */ + inflation: string; + /** current annual expected provisions */ + annual_provisions: string; +} + +export interface Params { + /** type of coin to mint */ + mint_denom: string; + /** maximum annual change in inflation rate */ + inflation_rate_change: string; + /** maximum inflation rate */ + inflation_max: string; + /** minimum inflation rate */ + inflation_min: string; + /** goal of percent bonded atoms */ + goal_bonded: string; + /** expected blocks per year */ + blocks_per_year: number; +} diff --git a/packages/cosmos/generated/types/cosmos/mint/v1beta1/query.ts b/packages/cosmos/generated/types/cosmos/mint/v1beta1/query.ts new file mode 100644 index 000000000..0b9257745 --- /dev/null +++ b/packages/cosmos/generated/types/cosmos/mint/v1beta1/query.ts @@ -0,0 +1,22 @@ +import type { Params } from "./mint"; + +export type QueryParamsRequest = {}; + +export interface QueryParamsResponse { + /** params defines the parameters of the module. */ + params?: Params; +} + +export type QueryInflationRequest = {}; + +export interface QueryInflationResponse { + /** inflation is the current minting inflation value. */ + inflation: Uint8Array; +} + +export type QueryAnnualProvisionsRequest = {}; + +export interface QueryAnnualProvisionsResponse { + /** annual_provisions is the current minting annual provisions value. */ + annual_provisions: Uint8Array; +} diff --git a/packages/cosmos/generated/types/cosmos/params/types/index.ts b/packages/cosmos/generated/types/cosmos/params/types/index.ts new file mode 100644 index 000000000..316cec4f0 --- /dev/null +++ b/packages/cosmos/generated/types/cosmos/params/types/index.ts @@ -0,0 +1,3 @@ +// @ts-nocheck + +export * from './types'; \ No newline at end of file diff --git a/packages/cosmos/generated/types/cosmos/params/types/types.ts b/packages/cosmos/generated/types/cosmos/params/types/types.ts new file mode 100644 index 000000000..27d3a7651 --- /dev/null +++ b/packages/cosmos/generated/types/cosmos/params/types/types.ts @@ -0,0 +1,15 @@ +import type { DecCoin } from "../../base/v1beta1/coin"; + +export interface FeesParams { + global_minimum_gas_prices: DecCoin[]; +} + +export interface CosmosGasParams { + cosmos_gas_multiplier_numerator: number; + cosmos_gas_multiplier_denominator: number; +} + +export interface GenesisState { + fees_params?: FeesParams; + cosmos_gas_params?: CosmosGasParams; +} diff --git a/packages/cosmos/generated/types/cosmos/params/v1beta1/index.ts b/packages/cosmos/generated/types/cosmos/params/v1beta1/index.ts new file mode 100644 index 000000000..7aaa19318 --- /dev/null +++ b/packages/cosmos/generated/types/cosmos/params/v1beta1/index.ts @@ -0,0 +1,4 @@ +// @ts-nocheck + +export * from './params'; +export * from './query'; \ No newline at end of file diff --git a/packages/cosmos/generated/types/cosmos/params/v1beta1/params.ts b/packages/cosmos/generated/types/cosmos/params/v1beta1/params.ts new file mode 100644 index 000000000..1c10cefa1 --- /dev/null +++ b/packages/cosmos/generated/types/cosmos/params/v1beta1/params.ts @@ -0,0 +1,12 @@ +export interface ParameterChangeProposal { + title: string; + description: string; + changes: ParamChange[]; + is_expedited: boolean; +} + +export interface ParamChange { + subspace: string; + key: string; + value: string; +} diff --git a/packages/cosmos/generated/types/cosmos/params/v1beta1/query.ts b/packages/cosmos/generated/types/cosmos/params/v1beta1/query.ts new file mode 100644 index 000000000..f82f72221 --- /dev/null +++ b/packages/cosmos/generated/types/cosmos/params/v1beta1/query.ts @@ -0,0 +1,13 @@ +import type { ParamChange } from "./params"; + +export interface QueryParamsRequest { + /** subspace defines the module to query the parameter for. */ + subspace: string; + /** key defines the key of the parameter in the subspace. */ + key: string; +} + +export interface QueryParamsResponse { + /** param defines the queried parameter. */ + param?: ParamChange; +} diff --git a/packages/cosmos/generated/types/cosmos/slashing/v1beta1/genesis.ts b/packages/cosmos/generated/types/cosmos/slashing/v1beta1/genesis.ts new file mode 100644 index 000000000..ab62c7f68 --- /dev/null +++ b/packages/cosmos/generated/types/cosmos/slashing/v1beta1/genesis.ts @@ -0,0 +1,80 @@ +import type { + Params, + ValidatorMissedBlockArray, + ValidatorMissedBlockArrayLegacyMissedHeights, + ValidatorSigningInfo, + ValidatorSigningInfoLegacyMissedHeights, +} from "./slashing"; + +export interface GenesisState { + /** params defines all the paramaters of related to slashing. */ + params?: Params; + /** + * signing_infos represents a map between validator addresses and their + * signing infos. + */ + signing_infos: SigningInfo[]; + /** + * missed_blocks represents a map between validator addresses and their + * missed blocks. + */ + missed_blocks: ValidatorMissedBlockArray[]; +} + +export interface GenesisStateLegacyMissingHeights { + /** params defines all the paramaters of related to slashing. */ + params?: Params; + /** + * signing_infos represents a map between validator addresses and their + * signing infos. + */ + signing_infos: SigningInfo[]; + /** + * missed_blocks represents a map between validator addresses and their + * missed blocks. + */ + missed_blocks: ValidatorMissedBlockArrayLegacyMissedHeights[]; +} + +export interface GenesisStateLegacyV43 { + /** params defines all the paramaters of related to slashing. */ + params?: Params; + /** + * signing_infos represents a map between validator addresses and their + * signing infos. + */ + signing_infos: SigningInfo[]; + /** + * missed_blocks represents a map between validator addresses and their + * missed blocks. + */ + missed_blocks: ValidatorMissedBlocks[]; +} + +export interface SigningInfo { + /** address is the validator address. */ + address: string; + /** validator_signing_info represents the signing info of this validator. */ + validator_signing_info?: ValidatorSigningInfo; +} + +export interface SigningInfoLegacyMissedHeights { + /** address is the validator address. */ + address: string; + /** validator_signing_info represents the signing info of this validator. */ + validator_signing_info?: ValidatorSigningInfoLegacyMissedHeights; +} + +export interface ValidatorMissedBlocks { + /** address is the validator address. */ + address: string; + /** missed_blocks is an array of missed blocks by the validator. */ + missed_blocks: MissedBlock[]; +} + +export interface MissedBlock { + /** index is the height at which the block was missed. */ + index: number; + /** missed is the missed status. */ + missed: boolean; +} diff --git a/packages/cosmos/generated/types/cosmos/slashing/v1beta1/index.ts b/packages/cosmos/generated/types/cosmos/slashing/v1beta1/index.ts new file mode 100644 index 000000000..811e58511 --- /dev/null +++ b/packages/cosmos/generated/types/cosmos/slashing/v1beta1/index.ts @@ -0,0 +1,6 @@ +// @ts-nocheck + +export * from './genesis'; +export * from './query'; +export * from './slashing'; +export * from './tx'; \ No newline at end of file diff --git a/packages/cosmos/generated/types/cosmos/slashing/v1beta1/query.ts b/packages/cosmos/generated/types/cosmos/slashing/v1beta1/query.ts new file mode 100644 index 000000000..e60985c24 --- /dev/null +++ b/packages/cosmos/generated/types/cosmos/slashing/v1beta1/query.ts @@ -0,0 +1,29 @@ +import type { PageRequest, PageResponse } from "../../base/query/v1beta1/pagination"; + +import type { Params, ValidatorSigningInfo } from "./slashing"; + +export type QueryParamsRequest = {}; + +export interface QueryParamsResponse { + params?: Params; +} + +export interface QuerySigningInfoRequest { + /** cons_address is the address to query signing info of */ + cons_address: string; +} + +export interface QuerySigningInfoResponse { + /** val_signing_info is the signing info of requested val cons address */ + val_signing_info?: ValidatorSigningInfo; +} + +export interface QuerySigningInfosRequest { + pagination?: PageRequest; +} + +export interface QuerySigningInfosResponse { + /** info is the signing info of all validators */ + info: ValidatorSigningInfo[]; + pagination?: PageResponse; +} diff --git a/packages/cosmos/generated/types/cosmos/slashing/v1beta1/slashing.ts b/packages/cosmos/generated/types/cosmos/slashing/v1beta1/slashing.ts new file mode 100644 index 000000000..a3a694ade --- /dev/null +++ b/packages/cosmos/generated/types/cosmos/slashing/v1beta1/slashing.ts @@ -0,0 +1,65 @@ +import type { Duration } from "../../../google/protobuf/duration"; + +export interface ValidatorSigningInfoLegacyMissedHeights { + address: string; + /** Height at which validator was first a candidate OR was unjailed */ + start_height: number; + /** Timestamp until which the validator is jailed due to liveness downtime. */ + jailed_until?: Date; + /** + * Whether or not a validator has been tombstoned (killed out of validator set). It is set + * once the validator commits an equivocation or for any other configured misbehiavor. + */ + tombstoned: boolean; + /** + * A counter kept to avoid unnecessary array reads. + * Note that `Sum(MissedBlocksBitArray)` always equals `MissedBlocksCounter`. + */ + missed_blocks_counter: number; +} + +export interface ValidatorSigningInfo { + address: string; + /** Height at which validator was first a candidate OR was unjailed */ + start_height: number; + /** + * Index which is incremented each time the validator was a bonded + * in a block and may have signed a precommit or not. This in conjunction with the + * `SignedBlocksWindow` param determines the index in the `MissedBlocksBitArray`. + */ + index_offset: number; + /** Timestamp until which the validator is jailed due to liveness downtime. */ + jailed_until?: Date; + /** + * Whether or not a validator has been tombstoned (killed out of validator set). It is set + * once the validator commits an equivocation or for any other configured misbehiavor. + */ + tombstoned: boolean; + /** + * A counter kept to avoid unnecessary array reads. + * Note that `Sum(MissedBlocksBitArray)` always equals `MissedBlocksCounter`. + */ + missed_blocks_counter: number; +} + +export interface ValidatorMissedBlockArrayLegacyMissedHeights { + address: string; + /** Array of contains the heights when the validator missed the block */ + missed_heights: number[]; +} + +export interface ValidatorMissedBlockArray { + address: string; + /** store this in case window size changes but doesn't affect number of bit groups */ + window_size: number; + /** Array of contains the missed block bits packed into uint64s */ + missed_blocks: number[]; +} + +export interface Params { + signed_blocks_window: number; + min_signed_per_window: Uint8Array; + downtime_jail_duration?: Duration; + slash_fraction_double_sign: Uint8Array; + slash_fraction_downtime: Uint8Array; +} diff --git a/packages/cosmos/generated/types/cosmos/slashing/v1beta1/tx.ts b/packages/cosmos/generated/types/cosmos/slashing/v1beta1/tx.ts new file mode 100644 index 000000000..9415fb8b6 --- /dev/null +++ b/packages/cosmos/generated/types/cosmos/slashing/v1beta1/tx.ts @@ -0,0 +1,5 @@ +export interface MsgUnjail { + validator_addr: string; +} + +export type MsgUnjailResponse = {}; diff --git a/packages/cosmos/generated/types/cosmos/staking/v1beta1/authz.ts b/packages/cosmos/generated/types/cosmos/staking/v1beta1/authz.ts new file mode 100644 index 000000000..28fb079fd --- /dev/null +++ b/packages/cosmos/generated/types/cosmos/staking/v1beta1/authz.ts @@ -0,0 +1,34 @@ +import type { Coin } from "../../base/v1beta1/coin"; + +export enum AuthorizationType { + /** AUTHORIZATION_TYPE_UNSPECIFIED - AUTHORIZATION_TYPE_UNSPECIFIED specifies an unknown authorization type */ + AUTHORIZATION_TYPE_UNSPECIFIED = 0, + /** AUTHORIZATION_TYPE_DELEGATE - AUTHORIZATION_TYPE_DELEGATE defines an authorization type for Msg/Delegate */ + AUTHORIZATION_TYPE_DELEGATE = 1, + /** AUTHORIZATION_TYPE_UNDELEGATE - AUTHORIZATION_TYPE_UNDELEGATE defines an authorization type for Msg/Undelegate */ + AUTHORIZATION_TYPE_UNDELEGATE = 2, + /** AUTHORIZATION_TYPE_REDELEGATE - AUTHORIZATION_TYPE_REDELEGATE defines an authorization type for Msg/BeginRedelegate */ + AUTHORIZATION_TYPE_REDELEGATE = 3, + UNRECOGNIZED = -1, +} + +export interface StakeAuthorization { + /** + * max_tokens specifies the maximum amount of tokens can be delegate to a validator. If it is + * empty, there is no spend limit and any amount of coins can be delegated. + */ + max_tokens?: Coin; + /** + * allow_list specifies list of validator addresses to whom grantee can delegate tokens on behalf of granter's + * account. + */ + allow_list?: StakeAuthorizationValidators; + /** deny_list specifies list of validator addresses to whom grantee can not delegate tokens. */ + deny_list?: StakeAuthorizationValidators; + /** authorization_type defines one of AuthorizationType. */ + authorization_type: AuthorizationType; +} + +export interface StakeAuthorizationValidators { + address: string[]; +} diff --git a/packages/cosmos/generated/types/cosmos/staking/v1beta1/genesis.ts b/packages/cosmos/generated/types/cosmos/staking/v1beta1/genesis.ts new file mode 100644 index 000000000..ae3d99486 --- /dev/null +++ b/packages/cosmos/generated/types/cosmos/staking/v1beta1/genesis.ts @@ -0,0 +1,32 @@ +import type { Delegation, Params, Redelegation, UnbondingDelegation, Validator } from "./staking"; + +export interface GenesisState { + /** params defines all the paramaters of related to deposit. */ + params?: Params; + /** + * last_total_power tracks the total amounts of bonded tokens recorded during + * the previous end block. + */ + last_total_power: Uint8Array; + /** + * last_validator_powers is a special index that provides a historical list + * of the last-block's bonded validators. + */ + last_validator_powers: LastValidatorPower[]; + /** delegations defines the validator set at genesis. */ + validators: Validator[]; + /** delegations defines the delegations active at genesis. */ + delegations: Delegation[]; + /** unbonding_delegations defines the unbonding delegations active at genesis. */ + unbonding_delegations: UnbondingDelegation[]; + /** redelegations defines the redelegations active at genesis. */ + redelegations: Redelegation[]; + exported: boolean; +} + +export interface LastValidatorPower { + /** address is the address of the validator. */ + address: string; + /** power defines the power of the validator. */ + power: number; +} diff --git a/packages/cosmos/generated/types/cosmos/staking/v1beta1/index.ts b/packages/cosmos/generated/types/cosmos/staking/v1beta1/index.ts new file mode 100644 index 000000000..d785a094d --- /dev/null +++ b/packages/cosmos/generated/types/cosmos/staking/v1beta1/index.ts @@ -0,0 +1,7 @@ +// @ts-nocheck + +export * from './authz'; +export * from './genesis'; +export * from './query'; +export * from './staking'; +export * from './tx'; \ No newline at end of file diff --git a/packages/cosmos/generated/types/cosmos/staking/v1beta1/query.ts b/packages/cosmos/generated/types/cosmos/staking/v1beta1/query.ts new file mode 100644 index 000000000..d10e15e30 --- /dev/null +++ b/packages/cosmos/generated/types/cosmos/staking/v1beta1/query.ts @@ -0,0 +1,171 @@ +import type { PageRequest, PageResponse } from "../../base/query/v1beta1/pagination"; + +import type { DelegationResponse, HistoricalInfo, Params, Pool, RedelegationResponse, UnbondingDelegation, Validator } from "./staking"; + +export interface QueryValidatorsRequest { + /** status enables to query for validators matching a given status. */ + status: string; + /** pagination defines an optional pagination for the request. */ + pagination?: PageRequest; +} + +export interface QueryValidatorsResponse { + /** validators contains all the queried validators. */ + validators: Validator[]; + /** pagination defines the pagination in the response. */ + pagination?: PageResponse; +} + +export interface QueryValidatorRequest { + /** validator_addr defines the validator address to query for. */ + validator_addr: string; +} + +export interface QueryValidatorResponse { + /** validator defines the the validator info. */ + validator?: Validator; +} + +export interface QueryValidatorDelegationsRequest { + /** validator_addr defines the validator address to query for. */ + validator_addr: string; + /** pagination defines an optional pagination for the request. */ + pagination?: PageRequest; +} + +export interface QueryValidatorDelegationsResponse { + delegation_responses: DelegationResponse[]; + /** pagination defines the pagination in the response. */ + pagination?: PageResponse; +} + +export interface QueryValidatorUnbondingDelegationsRequest { + /** validator_addr defines the validator address to query for. */ + validator_addr: string; + /** pagination defines an optional pagination for the request. */ + pagination?: PageRequest; +} + +export interface QueryValidatorUnbondingDelegationsResponse { + unbonding_responses: UnbondingDelegation[]; + /** pagination defines the pagination in the response. */ + pagination?: PageResponse; +} + +export interface QueryDelegationRequest { + /** delegator_addr defines the delegator address to query for. */ + delegator_addr: string; + /** validator_addr defines the validator address to query for. */ + validator_addr: string; +} + +export interface QueryDelegationResponse { + /** delegation_responses defines the delegation info of a delegation. */ + delegation_response?: DelegationResponse; +} + +export interface QueryUnbondingDelegationRequest { + /** delegator_addr defines the delegator address to query for. */ + delegator_addr: string; + /** validator_addr defines the validator address to query for. */ + validator_addr: string; +} + +export interface QueryUnbondingDelegationResponse { + /** unbond defines the unbonding information of a delegation. */ + unbond?: UnbondingDelegation; +} + +export interface QueryDelegatorDelegationsRequest { + /** delegator_addr defines the delegator address to query for. */ + delegator_addr: string; + /** pagination defines an optional pagination for the request. */ + pagination?: PageRequest; +} + +export interface QueryDelegatorDelegationsResponse { + /** delegation_responses defines all the delegations' info of a delegator. */ + delegation_responses: DelegationResponse[]; + /** pagination defines the pagination in the response. */ + pagination?: PageResponse; +} + +export interface QueryDelegatorUnbondingDelegationsRequest { + /** delegator_addr defines the delegator address to query for. */ + delegator_addr: string; + /** pagination defines an optional pagination for the request. */ + pagination?: PageRequest; +} + +export interface QueryDelegatorUnbondingDelegationsResponse { + unbonding_responses: UnbondingDelegation[]; + /** pagination defines the pagination in the response. */ + pagination?: PageResponse; +} + +export interface QueryRedelegationsRequest { + /** delegator_addr defines the delegator address to query for. */ + delegator_addr: string; + /** src_validator_addr defines the validator address to redelegate from. */ + src_validator_addr: string; + /** dst_validator_addr defines the validator address to redelegate to. */ + dst_validator_addr: string; + /** pagination defines an optional pagination for the request. */ + pagination?: PageRequest; +} + +export interface QueryRedelegationsResponse { + redelegation_responses: RedelegationResponse[]; + /** pagination defines the pagination in the response. */ + pagination?: PageResponse; +} + +export interface QueryDelegatorValidatorsRequest { + /** delegator_addr defines the delegator address to query for. */ + delegator_addr: string; + /** pagination defines an optional pagination for the request. */ + pagination?: PageRequest; +} + +export interface QueryDelegatorValidatorsResponse { + /** validators defines the the validators' info of a delegator. */ + validators: Validator[]; + /** pagination defines the pagination in the response. */ + pagination?: PageResponse; +} + +export interface QueryDelegatorValidatorRequest { + /** delegator_addr defines the delegator address to query for. */ + delegator_addr: string; + /** validator_addr defines the validator address to query for. */ + validator_addr: string; +} + +export interface QueryDelegatorValidatorResponse { + /** validator defines the the validator info. */ + validator?: Validator; +} + +export interface QueryHistoricalInfoRequest { + /** height defines at which height to query the historical info. */ + height: number; +} + +export interface QueryHistoricalInfoResponse { + /** hist defines the historical info at the given height. */ + hist?: HistoricalInfo; +} + +export type QueryPoolRequest = {}; + +export interface QueryPoolResponse { + /** pool defines the pool info. */ + pool?: Pool; +} + +export type QueryParamsRequest = {}; + +export interface QueryParamsResponse { + /** params holds all the parameters of this module. */ + params?: Params; +} diff --git a/packages/cosmos/generated/types/cosmos/staking/v1beta1/staking.ts b/packages/cosmos/generated/types/cosmos/staking/v1beta1/staking.ts new file mode 100644 index 000000000..32ef33972 --- /dev/null +++ b/packages/cosmos/generated/types/cosmos/staking/v1beta1/staking.ts @@ -0,0 +1,191 @@ +import type { Any } from "../../../google/protobuf/any"; + +import type { Duration } from "../../../google/protobuf/duration"; + +import type { Header } from "../../../tendermint/types/types"; + +import type { Coin } from "../../base/v1beta1/coin"; + +export enum BondStatus { + /** BOND_STATUS_UNSPECIFIED - UNSPECIFIED defines an invalid validator status. */ + BOND_STATUS_UNSPECIFIED = 0, + /** BOND_STATUS_UNBONDED - UNBONDED defines a validator that is not bonded. */ + BOND_STATUS_UNBONDED = 1, + /** BOND_STATUS_UNBONDING - UNBONDING defines a validator that is unbonding. */ + BOND_STATUS_UNBONDING = 2, + /** BOND_STATUS_BONDED - BONDED defines a validator that is bonded. */ + BOND_STATUS_BONDED = 3, + UNRECOGNIZED = -1, +} + +export interface HistoricalInfo { + header?: Header; + valset: Validator[]; +} + +export interface CommissionRates { + /** rate is the commission rate charged to delegators, as a fraction. */ + rate: string; + /** max_rate defines the maximum commission rate which validator can ever charge, as a fraction. */ + max_rate: string; + /** max_change_rate defines the maximum daily increase of the validator commission, as a fraction. */ + max_change_rate: string; +} + +export interface Commission { + /** commission_rates defines the initial commission rates to be used for creating a validator. */ + commission_rates?: CommissionRates; + /** update_time is the last time the commission rate was changed. */ + update_time?: Date; +} + +export interface Description { + /** moniker defines a human-readable name for the validator. */ + moniker: string; + /** identity defines an optional identity signature (ex. UPort or Keybase). */ + identity: string; + /** website defines an optional website link. */ + website: string; + /** security_contact defines an optional email for security contact. */ + security_contact: string; + /** details define other optional details. */ + details: string; +} + +export interface Validator { + /** operator_address defines the address of the validator's operator; bech encoded in JSON. */ + operator_address: string; + /** consensus_pubkey is the consensus public key of the validator, as a Protobuf Any. */ + consensus_pubkey?: Any; + /** jailed defined whether the validator has been jailed from bonded status or not. */ + jailed: boolean; + /** status is the validator status (bonded/unbonding/unbonded). */ + status: BondStatus; + /** tokens define the delegated tokens (incl. self-delegation). */ + tokens: string; + /** delegator_shares defines total shares issued to a validator's delegators. */ + delegator_shares: string; + /** description defines the description terms for the validator. */ + description?: Description; + /** unbonding_height defines, if unbonding, the height at which this validator has begun unbonding. */ + unbonding_height: number; + /** unbonding_time defines, if unbonding, the min time for the validator to complete unbonding. */ + unbonding_time?: Date; + /** commission defines the commission parameters. */ + commission?: Commission; + /** min_self_delegation is the validator's self declared minimum self delegation. */ + min_self_delegation: string; +} + +export interface ValAddresses { + addresses: string[]; +} + +export interface DVPair { + delegator_address: string; + validator_address: string; +} + +export interface DVPairs { + pairs: DVPair[]; +} + +export interface DVVTriplet { + delegator_address: string; + validator_src_address: string; + validator_dst_address: string; +} + +export interface DVVTriplets { + triplets: DVVTriplet[]; +} + +export interface Delegation { + /** delegator_address is the bech32-encoded address of the delegator. */ + delegator_address: string; + /** validator_address is the bech32-encoded address of the validator. */ + validator_address: string; + /** shares define the delegation shares received. */ + shares: string; +} + +export interface UnbondingDelegation { + /** delegator_address is the bech32-encoded address of the delegator. */ + delegator_address: string; + /** validator_address is the bech32-encoded address of the validator. */ + validator_address: string; + /** entries are the unbonding delegation entries. */ + entries: UnbondingDelegationEntry[]; +} + +export interface UnbondingDelegationEntry { + /** creation_height is the height which the unbonding took place. */ + creation_height: number; + /** completion_time is the unix time for unbonding completion. */ + completion_time?: Date; + /** initial_balance defines the tokens initially scheduled to receive at completion. */ + initial_balance: string; + /** balance defines the tokens to receive at completion. */ + balance: string; +} + +export interface RedelegationEntry { + /** creation_height defines the height which the redelegation took place. */ + creation_height: number; + /** completion_time defines the unix time for redelegation completion. */ + completion_time?: Date; + /** initial_balance defines the initial balance when redelegation started. */ + initial_balance: string; + /** shares_dst is the amount of destination-validator shares created by redelegation. */ + shares_dst: string; +} + +export interface Redelegation { + /** delegator_address is the bech32-encoded address of the delegator. */ + delegator_address: string; + /** validator_src_address is the validator redelegation source operator address. */ + validator_src_address: string; + /** validator_dst_address is the validator redelegation destination operator address. */ + validator_dst_address: string; + /** entries are the redelegation entries. */ + entries: RedelegationEntry[]; +} + +export interface Params { + /** unbonding_time is the time duration of unbonding. */ + unbonding_time?: Duration; + /** max_validators is the maximum number of validators. */ + max_validators: number; + /** max_entries is the max entries for either unbonding delegation or redelegation (per pair/trio). */ + max_entries: number; + /** historical_entries is the number of historical entries to persist. */ + historical_entries: number; + /** bond_denom defines the bondable coin denomination. */ + bond_denom: string; + /** min_commission_rate is the chain-wide minimum commission rate that a validator can charge their delegators */ + min_commission_rate: string; + /** max_voting_power_ratio defines the maximal allowable voting power ratio delegated to a validator. */ + max_voting_power_ratio: string; + /** max_voting_power_enforcement_threshold defines the minimal bonded voting power of the max voting power ratio enforcement */ + max_voting_power_enforcement_threshold: string; +} + +export interface DelegationResponse { + delegation?: Delegation; + balance?: Coin; +} + +export interface RedelegationEntryResponse { + redelegation_entry?: RedelegationEntry; + balance: string; +} + +export interface RedelegationResponse { + redelegation?: Redelegation; + entries: RedelegationEntryResponse[]; +} + +export interface Pool { + not_bonded_tokens: string; + bonded_tokens: string; +} diff --git a/packages/cosmos/generated/types/cosmos/staking/v1beta1/tx.ts b/packages/cosmos/generated/types/cosmos/staking/v1beta1/tx.ts new file mode 100644 index 000000000..6372fc7cd --- /dev/null +++ b/packages/cosmos/generated/types/cosmos/staking/v1beta1/tx.ts @@ -0,0 +1,61 @@ +import type { Any } from "../../../google/protobuf/any"; + +import type { Coin } from "../../base/v1beta1/coin"; + +import type { CommissionRates, Description } from "./staking"; + +export interface MsgCreateValidator { + description?: Description; + commission?: CommissionRates; + min_self_delegation: string; + delegator_address: string; + validator_address: string; + pubkey?: Any; + value?: Coin; +} + +export type MsgCreateValidatorResponse = {}; + +export interface MsgEditValidator { + description?: Description; + validator_address: string; + /** + * We pass a reference to the new commission rate and min self delegation as + * it's not mandatory to update. If not updated, the deserialized rate will be + * zero with no way to distinguish if an update was intended. + * REF: #2373 + */ + commission_rate: string; + min_self_delegation: string; +} + +export type MsgEditValidatorResponse = {}; + +export interface MsgDelegate { + delegator_address: string; + validator_address: string; + amount?: Coin; +} + +export type MsgDelegateResponse = {}; + +export interface MsgBeginRedelegate { + delegator_address: string; + validator_src_address: string; + validator_dst_address: string; + amount?: Coin; +} + +export interface MsgBeginRedelegateResponse { + completion_time?: Date; +} + +export interface MsgUndelegate { + delegator_address: string; + validator_address: string; + amount?: Coin; +} + +export interface MsgUndelegateResponse { + completion_time?: Date; +} diff --git a/packages/cosmos/generated/types/cosmos/tx/signing/v1beta1/index.ts b/packages/cosmos/generated/types/cosmos/tx/signing/v1beta1/index.ts new file mode 100644 index 000000000..3bdf902ad --- /dev/null +++ b/packages/cosmos/generated/types/cosmos/tx/signing/v1beta1/index.ts @@ -0,0 +1,3 @@ +// @ts-nocheck + +export * from './signing'; \ No newline at end of file diff --git a/packages/cosmos/generated/types/cosmos/tx/signing/v1beta1/signing.ts b/packages/cosmos/generated/types/cosmos/tx/signing/v1beta1/signing.ts new file mode 100644 index 000000000..52bac649b --- /dev/null +++ b/packages/cosmos/generated/types/cosmos/tx/signing/v1beta1/signing.ts @@ -0,0 +1,79 @@ +import type { Any } from "../../../../google/protobuf/any"; + +import type { CompactBitArray } from "../../../crypto/multisig/v1beta1/multisig"; + +export enum SignMode { + /** + * SIGN_MODE_UNSPECIFIED - SIGN_MODE_UNSPECIFIED specifies an unknown signing mode and will be + * rejected + */ + SIGN_MODE_UNSPECIFIED = 0, + /** + * SIGN_MODE_DIRECT - SIGN_MODE_DIRECT specifies a signing mode which uses SignDoc and is + * verified with raw bytes from Tx + */ + SIGN_MODE_DIRECT = 1, + /** + * SIGN_MODE_TEXTUAL - SIGN_MODE_TEXTUAL is a future signing mode that will verify some + * human-readable textual representation on top of the binary representation + * from SIGN_MODE_DIRECT + */ + SIGN_MODE_TEXTUAL = 2, + /** + * SIGN_MODE_LEGACY_AMINO_JSON - SIGN_MODE_LEGACY_AMINO_JSON is a backwards compatibility mode which uses + * 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 interface SignatureDescriptors { + /** signatures are the signature descriptors */ + signatures: SignatureDescriptor[]; +} + +export interface SignatureDescriptor { + /** public_key is the public key of the signer */ + public_key?: Any; + data?: SignatureDescriptorData; + /** + * 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: number; +} + +export interface SignatureDescriptorData { + /** single represents a single signer */ + single?: SignatureDescriptorDataSingle; + /** multi represents a multisig signer */ + multi?: SignatureDescriptorDataMulti; +} + +export interface SignatureDescriptorDataSingle { + /** mode is the signing mode of the single signer */ + mode: SignMode; + /** signature is the raw signature bytes */ + signature: Uint8Array; +} + +export interface SignatureDescriptorDataMulti { + /** bitarray specifies which keys within the multisig are signing */ + bitarray?: CompactBitArray; + /** signatures is the signatures of the multi-signature */ + signatures: SignatureDescriptorData[]; +} diff --git a/packages/cosmos/generated/types/cosmos/tx/v1beta1/index.ts b/packages/cosmos/generated/types/cosmos/tx/v1beta1/index.ts new file mode 100644 index 000000000..eca32bb6f --- /dev/null +++ b/packages/cosmos/generated/types/cosmos/tx/v1beta1/index.ts @@ -0,0 +1,4 @@ +// @ts-nocheck + +export * from './service'; +export * from './tx'; \ No newline at end of file diff --git a/packages/cosmos/generated/types/cosmos/tx/v1beta1/service.ts b/packages/cosmos/generated/types/cosmos/tx/v1beta1/service.ts new file mode 100644 index 000000000..3facc00ac --- /dev/null +++ b/packages/cosmos/generated/types/cosmos/tx/v1beta1/service.ts @@ -0,0 +1,119 @@ +import type { Block } from "../../../tendermint/types/block"; + +import type { BlockID } from "../../../tendermint/types/types"; + +import type { GasInfo, Result, TxResponse } from "../../base/abci/v1beta1/abci"; + +import type { PageRequest, PageResponse } from "../../base/query/v1beta1/pagination"; + +import type { Tx } from "./tx"; + +export enum OrderBy { + /** ORDER_BY_UNSPECIFIED - ORDER_BY_UNSPECIFIED specifies an unknown sorting order. OrderBy defaults to ASC in this case. */ + ORDER_BY_UNSPECIFIED = 0, + /** ORDER_BY_ASC - ORDER_BY_ASC defines ascending order */ + ORDER_BY_ASC = 1, + /** ORDER_BY_DESC - ORDER_BY_DESC defines descending order */ + ORDER_BY_DESC = 2, + UNRECOGNIZED = -1, +} + +export enum BroadcastMode { + /** BROADCAST_MODE_UNSPECIFIED - zero-value for mode ordering */ + BROADCAST_MODE_UNSPECIFIED = 0, + /** + * BROADCAST_MODE_BLOCK - BROADCAST_MODE_BLOCK defines a tx broadcasting mode where the client waits for + * the tx to be committed in a block. + */ + BROADCAST_MODE_BLOCK = 1, + /** + * BROADCAST_MODE_SYNC - BROADCAST_MODE_SYNC defines a tx broadcasting mode where the client waits for + * a CheckTx execution response only. + */ + BROADCAST_MODE_SYNC = 2, + /** + * BROADCAST_MODE_ASYNC - BROADCAST_MODE_ASYNC defines a tx broadcasting mode where the client returns + * immediately. + */ + BROADCAST_MODE_ASYNC = 3, + UNRECOGNIZED = -1, +} + +export interface GetTxsEventRequest { + /** events is the list of transaction event type. */ + events: string[]; + /** pagination defines a pagination for the request. */ + pagination?: PageRequest; + order_by: OrderBy; +} + +export interface GetTxsEventResponse { + /** txs is the list of queried transactions. */ + txs: Tx[]; + /** tx_responses is the list of queried TxResponses. */ + tx_responses: TxResponse[]; + /** pagination defines a pagination for the response. */ + pagination?: PageResponse; +} + +export interface BroadcastTxRequest { + /** tx_bytes is the raw transaction. */ + tx_bytes: Uint8Array; + mode: BroadcastMode; +} + +export interface BroadcastTxResponse { + /** tx_response is the queried TxResponses. */ + tx_response?: TxResponse; +} + +export interface SimulateRequest { + /** + * tx is the transaction to simulate. + * Deprecated. Send raw tx bytes instead. + * + * @deprecated + */ + tx?: Tx; + /** + * tx_bytes is the raw transaction. + * + * Since: cosmos-sdk 0.43 + */ + tx_bytes: Uint8Array; +} + +export interface SimulateResponse { + /** gas_info is the information about gas used in the simulation. */ + gas_info?: GasInfo; + /** result is the result of the simulation. */ + result?: Result; +} + +export interface GetTxRequest { + /** hash is the tx hash to query, encoded as a hex string. */ + hash: string; +} + +export interface GetTxResponse { + /** tx is the queried transaction. */ + tx?: Tx; + /** tx_response is the queried TxResponses. */ + tx_response?: TxResponse; +} + +export interface GetBlockWithTxsRequest { + /** height is the height of the block to query. */ + height: number; + /** pagination defines a pagination for the request. */ + pagination?: PageRequest; +} + +export interface GetBlockWithTxsResponse { + /** txs are the transactions in the block. */ + txs: Tx[]; + block_id?: BlockID; + block?: Block; + /** pagination defines a pagination for the response. */ + pagination?: PageResponse; +} diff --git a/packages/cosmos/generated/types/cosmos/tx/v1beta1/tx.ts b/packages/cosmos/generated/types/cosmos/tx/v1beta1/tx.ts new file mode 100644 index 000000000..3d54eb505 --- /dev/null +++ b/packages/cosmos/generated/types/cosmos/tx/v1beta1/tx.ts @@ -0,0 +1,180 @@ +import type { Any } from "../../../google/protobuf/any"; + +import type { Coin } from "../../base/v1beta1/coin"; + +import type { CompactBitArray } from "../../crypto/multisig/v1beta1/multisig"; + +import type { SignMode } from "../signing/v1beta1/signing"; + +export interface Tx { + /** body is the processable content of the transaction */ + body?: TxBody; + /** + * auth_info is the authorization related content of the transaction, + * specifically signers, signer modes and fee + */ + auth_info?: AuthInfo; + /** + * signatures is a list of signatures that matches the length and order of + * AuthInfo's signer_infos to allow connecting signature meta information like + * public key and signing mode by position. + */ + signatures: Uint8Array[]; +} + +export interface TxRaw { + /** + * body_bytes is a protobuf serialization of a TxBody that matches the + * representation in SignDoc. + */ + body_bytes: Uint8Array; + /** + * auth_info_bytes is a protobuf serialization of an AuthInfo that matches the + * representation in SignDoc. + */ + auth_info_bytes: Uint8Array; + /** + * signatures is a list of signatures that matches the length and order of + * AuthInfo's signer_infos to allow connecting signature meta information like + * public key and signing mode by position. + */ + signatures: Uint8Array[]; +} + +export interface SignDoc { + /** + * body_bytes is protobuf serialization of a TxBody that matches the + * representation in TxRaw. + */ + body_bytes: Uint8Array; + /** + * auth_info_bytes is a protobuf serialization of an AuthInfo that matches the + * representation in TxRaw. + */ + auth_info_bytes: Uint8Array; + /** + * chain_id is the unique identifier of the chain this transaction targets. + * It prevents signed transactions from being used on another chain by an + * attacker + */ + chain_id: string; + /** account_number is the account number of the account in state */ + account_number: number; +} + +export interface TxBody { + /** + * messages is a list of messages to be executed. The required signers of + * those messages define the number and order of elements in AuthInfo's + * signer_infos and Tx's signatures. Each required signer address is added to + * the list only the first time it occurs. + * By convention, the first required signer (usually from the first message) + * is referred to as the primary signer and pays the fee for the whole + * transaction. + */ + messages: Any[]; + /** + * memo is any arbitrary note/comment to be added to the transaction. + * WARNING: in clients, any publicly exposed text should not be called memo, + * but should be called `note` instead (see https://github.com/cosmos/cosmos-sdk/issues/9122). + */ + memo: string; + /** + * timeout is the block height after which this transaction will not + * be processed by the chain + */ + timeout_height: number; + /** + * extension_options are arbitrary options that can be added by chains + * when the default options are not sufficient. If any of these are present + * and can't be handled, the transaction will be rejected + */ + extension_options: Any[]; + /** + * extension_options are arbitrary options that can be added by chains + * when the default options are not sufficient. If any of these are present + * and can't be handled, they will be ignored + */ + non_critical_extension_options: Any[]; +} + +export interface AuthInfo { + /** + * signer_infos defines the signing modes for the required signers. The number + * and order of elements must match the required signers from TxBody's + * messages. The first element is the primary signer and the one which pays + * the fee. + */ + signer_infos: SignerInfo[]; + /** + * Fee is the fee and gas limit for the transaction. The first signer is the + * primary signer and the one which pays the fee. The fee can be calculated + * based on the cost of evaluating the body and doing signature verification + * of the signers. This can be estimated via simulation. + */ + fee?: Fee; +} + +export interface SignerInfo { + /** + * public_key is the public key of the signer. It is optional for accounts + * that already exist in state. If unset, the verifier can use the required \ + * signer address for this position and lookup the public key. + */ + public_key?: Any; + /** + * mode_info describes the signing mode of the signer and is a nested + * structure to support nested multisig pubkey's + */ + mode_info?: ModeInfo; + /** + * 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: number; +} + +export interface ModeInfo { + /** single represents a single signer */ + single?: ModeInfoSingle; + /** multi represents a nested multisig signer */ + multi?: ModeInfoMulti; +} + +export interface ModeInfoSingle { + /** mode is the signing mode of the single signer */ + mode: SignMode; +} + +export interface ModeInfoMulti { + /** bitarray specifies which keys within the multisig are signing */ + bitarray?: CompactBitArray; + /** + * mode_infos is the corresponding modes of the signers of the multisig + * which could include nested multisig public keys + */ + mode_infos: ModeInfo[]; +} + +export interface Fee { + /** amount is the amount of coins to be paid as a fee */ + amount: Coin[]; + /** + * gas_limit is the maximum gas that can be used in transaction processing + * before an out of gas error occurs + */ + gas_limit: number; + /** + * if unset, the first signer is responsible for paying the fees. If set, the specified account must pay the fees. + * the payer must be a tx signer (and thus have signed this field in AuthInfo). + * setting this field does *not* change the ordering of required signers for the transaction. + */ + payer: string; + /** + * if set, the fee payer (either the first signer or the value of the payer field) requests that a fee grant be used + * to pay fees instead of the fee payer's own balance. If an appropriate fee grant does not exist or the chain does + * not support fee grants, this will fail + */ + granter: string; +} diff --git a/packages/cosmos/generated/types/cosmos/upgrade/v1beta1/index.ts b/packages/cosmos/generated/types/cosmos/upgrade/v1beta1/index.ts new file mode 100644 index 000000000..5c6725ec2 --- /dev/null +++ b/packages/cosmos/generated/types/cosmos/upgrade/v1beta1/index.ts @@ -0,0 +1,4 @@ +// @ts-nocheck + +export * from './query'; +export * from './upgrade'; \ No newline at end of file diff --git a/packages/cosmos/generated/types/cosmos/upgrade/v1beta1/query.ts b/packages/cosmos/generated/types/cosmos/upgrade/v1beta1/query.ts new file mode 100644 index 000000000..1402ffb71 --- /dev/null +++ b/packages/cosmos/generated/types/cosmos/upgrade/v1beta1/query.ts @@ -0,0 +1,45 @@ +import type { ModuleVersion, Plan } from "./upgrade"; + +export type QueryCurrentPlanRequest = {}; + +export interface QueryCurrentPlanResponse { + /** plan is the current upgrade plan. */ + plan?: Plan; +} + +export interface QueryAppliedPlanRequest { + /** name is the name of the applied plan to query for. */ + name: string; +} + +export interface QueryAppliedPlanResponse { + /** height is the block height at which the plan was applied. */ + height: number; +} + +export interface QueryUpgradedConsensusStateRequest { + /** + * 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: number; +} + +export interface QueryUpgradedConsensusStateResponse { + /** Since: cosmos-sdk 0.43 */ + upgraded_consensus_state: Uint8Array; +} + +export interface QueryModuleVersionsRequest { + /** + * 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 QueryModuleVersionsResponse { + /** module_versions is a list of module names with their consensus versions. */ + module_versions: ModuleVersion[]; +} diff --git a/packages/cosmos/generated/types/cosmos/upgrade/v1beta1/upgrade.ts b/packages/cosmos/generated/types/cosmos/upgrade/v1beta1/upgrade.ts new file mode 100644 index 000000000..194f18602 --- /dev/null +++ b/packages/cosmos/generated/types/cosmos/upgrade/v1beta1/upgrade.ts @@ -0,0 +1,58 @@ +import type { Any } from "../../../google/protobuf/any"; + +export interface Plan { + /** + * 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?: Date; + /** + * The height at which the upgrade must be performed. + * Only used if Time is not set. + */ + height: number; + /** + * 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?: Any; +} + +export interface SoftwareUpgradeProposal { + title: string; + description: string; + plan?: Plan; +} + +export interface CancelSoftwareUpgradeProposal { + title: string; + description: string; +} + +export interface ModuleVersion { + /** name of the app module */ + name: string; + /** consensus version of the app module */ + version: number; +} diff --git a/packages/cosmos/generated/types/cosmos/vesting/v1beta1/index.ts b/packages/cosmos/generated/types/cosmos/vesting/v1beta1/index.ts new file mode 100644 index 000000000..9239ccfa1 --- /dev/null +++ b/packages/cosmos/generated/types/cosmos/vesting/v1beta1/index.ts @@ -0,0 +1,4 @@ +// @ts-nocheck + +export * from './tx'; +export * from './vesting'; \ No newline at end of file diff --git a/packages/cosmos/generated/types/cosmos/vesting/v1beta1/tx.ts b/packages/cosmos/generated/types/cosmos/vesting/v1beta1/tx.ts new file mode 100644 index 000000000..56355cb4a --- /dev/null +++ b/packages/cosmos/generated/types/cosmos/vesting/v1beta1/tx.ts @@ -0,0 +1,12 @@ +import type { Coin } from "../../base/v1beta1/coin"; + +export interface MsgCreateVestingAccount { + from_address: string; + to_address: string; + amount: Coin[]; + end_time: number; + delayed: boolean; + admin: string; +} + +export type MsgCreateVestingAccountResponse = {}; diff --git a/packages/cosmos/generated/types/cosmos/vesting/v1beta1/vesting.ts b/packages/cosmos/generated/types/cosmos/vesting/v1beta1/vesting.ts new file mode 100644 index 000000000..3bf55603b --- /dev/null +++ b/packages/cosmos/generated/types/cosmos/vesting/v1beta1/vesting.ts @@ -0,0 +1,39 @@ +import type { BaseAccount } from "../../auth/v1beta1/auth"; + +import type { Coin } from "../../base/v1beta1/coin"; + +export interface BaseVestingAccount { + base_account?: BaseAccount; + original_vesting: Coin[]; + delegated_free: Coin[]; + delegated_vesting: Coin[]; + end_time: number; + /** admin field (optional), an address who has oversight powers for the vesting account such as cancelling */ + admin: string; + /** this field (default nil) indicates whether the vesting for the account has been cancelled (and what time it was cancelled) */ + cancelled_time: number; +} + +export interface ContinuousVestingAccount { + base_vesting_account?: BaseVestingAccount; + start_time: number; +} + +export interface DelayedVestingAccount { + base_vesting_account?: BaseVestingAccount; +} + +export interface Period { + length: number; + amount: Coin[]; +} + +export interface PeriodicVestingAccount { + base_vesting_account?: BaseVestingAccount; + start_time: number; + vesting_periods: Period[]; +} + +export interface PermanentLockedAccount { + base_vesting_account?: BaseVestingAccount; +} diff --git a/packages/cosmos/generated/types/epoch/epoch.ts b/packages/cosmos/generated/types/epoch/epoch.ts new file mode 100644 index 000000000..1dc332f9a --- /dev/null +++ b/packages/cosmos/generated/types/epoch/epoch.ts @@ -0,0 +1,9 @@ +import type { Duration } from "../google/protobuf/duration"; + +export interface Epoch { + genesis_time?: Date; + epoch_duration?: Duration; + current_epoch: number; + current_epoch_start_time?: Date; + current_epoch_height: number; +} diff --git a/packages/cosmos/generated/types/epoch/genesis.ts b/packages/cosmos/generated/types/epoch/genesis.ts new file mode 100644 index 000000000..e41d93232 --- /dev/null +++ b/packages/cosmos/generated/types/epoch/genesis.ts @@ -0,0 +1,9 @@ +import type { Epoch } from "./epoch"; + +import type { Params } from "./params"; + +export interface GenesisState { + params?: Params; + /** this line is used by starport scaffolding # genesis/proto/state */ + epoch?: Epoch; +} diff --git a/packages/cosmos/generated/types/epoch/index.ts b/packages/cosmos/generated/types/epoch/index.ts new file mode 100644 index 000000000..9d682d321 --- /dev/null +++ b/packages/cosmos/generated/types/epoch/index.ts @@ -0,0 +1,6 @@ +// @ts-nocheck + +export * from './epoch'; +export * from './genesis'; +export * from './params'; +export * from './query'; \ No newline at end of file diff --git a/packages/cosmos/generated/types/epoch/params.ts b/packages/cosmos/generated/types/epoch/params.ts new file mode 100644 index 000000000..dbc17de45 --- /dev/null +++ b/packages/cosmos/generated/types/epoch/params.ts @@ -0,0 +1 @@ +export type Params = {}; diff --git a/packages/cosmos/generated/types/epoch/query.ts b/packages/cosmos/generated/types/epoch/query.ts new file mode 100644 index 000000000..269566c19 --- /dev/null +++ b/packages/cosmos/generated/types/epoch/query.ts @@ -0,0 +1,16 @@ +import type { Epoch } from "./epoch"; + +import type { Params } from "./params"; + +export type QueryParamsRequest = {}; + +export interface QueryParamsResponse { + /** params holds all the parameters of this module. */ + params?: Params; +} + +export type QueryEpochRequest = {}; + +export interface QueryEpochResponse { + epoch?: Epoch; +} diff --git a/packages/cosmos/generated/types/eth/index.ts b/packages/cosmos/generated/types/eth/index.ts new file mode 100644 index 000000000..a549f9f69 --- /dev/null +++ b/packages/cosmos/generated/types/eth/index.ts @@ -0,0 +1,3 @@ +// @ts-nocheck + +export * from './tx'; \ No newline at end of file diff --git a/packages/cosmos/generated/types/eth/tx.ts b/packages/cosmos/generated/types/eth/tx.ts new file mode 100644 index 000000000..0a16f005a --- /dev/null +++ b/packages/cosmos/generated/types/eth/tx.ts @@ -0,0 +1,83 @@ +export interface AccessTuple { + address: string; + storage_keys: string[]; +} + +export interface AssociateTx { + /** signature values */ + v: Uint8Array; + r: Uint8Array; + s: Uint8Array; + custom_message: string; +} + +export interface LegacyTx { + nonce: number; + gas_price: string; + gas_limit: number; + to: string; + value: string; + data: Uint8Array; + /** signature values */ + v: Uint8Array; + r: Uint8Array; + s: Uint8Array; +} + +export interface AccessListTx { + chain_id: string; + nonce: number; + gas_price: string; + gas_limit: number; + to: string; + value: string; + data: Uint8Array; + accesses: AccessTuple[]; + /** signature values */ + v: Uint8Array; + r: Uint8Array; + s: Uint8Array; +} + +export interface DynamicFeeTx { + chain_id: string; + nonce: number; + gas_tip_cap: string; + gas_fee_cap: string; + gas_limit: number; + to: string; + value: string; + data: Uint8Array; + accesses: AccessTuple[]; + /** signature values */ + v: Uint8Array; + r: Uint8Array; + s: Uint8Array; +} + +export interface BlobTx { + chain_id: string; + nonce: number; + gas_tip_cap: string; + gas_fee_cap: string; + gas_limit: number; + to: string; + value: string; + data: Uint8Array; + accesses: AccessTuple[]; + blob_fee_cap: string; + blob_hashes: Uint8Array[]; + sidecar?: BlobTxSidecar; + /** signature values */ + v: Uint8Array; + r: Uint8Array; + s: Uint8Array; +} + +export interface BlobTxSidecar { + blobs: Uint8Array[]; + commitments: Uint8Array[]; + proofs: Uint8Array[]; +} + +export type ExtensionOptionsEthereumTx = {}; diff --git a/packages/cosmos/generated/types/evm/config.ts b/packages/cosmos/generated/types/evm/config.ts new file mode 100644 index 000000000..016872ca0 --- /dev/null +++ b/packages/cosmos/generated/types/evm/config.ts @@ -0,0 +1,5 @@ +export interface ChainConfig { + cancun_time: number; + prague_time: number; + verkle_time: number; +} diff --git a/packages/cosmos/generated/types/evm/enums.ts b/packages/cosmos/generated/types/evm/enums.ts new file mode 100644 index 000000000..5a20f448f --- /dev/null +++ b/packages/cosmos/generated/types/evm/enums.ts @@ -0,0 +1,8 @@ +export enum PointerType { + ERC20 = 0, + ERC721 = 1, + NATIVE = 2, + CW20 = 3, + CW721 = 4, + UNRECOGNIZED = -1, +} diff --git a/packages/cosmos/generated/types/evm/genesis.ts b/packages/cosmos/generated/types/evm/genesis.ts new file mode 100644 index 000000000..7ddb83831 --- /dev/null +++ b/packages/cosmos/generated/types/evm/genesis.ts @@ -0,0 +1,42 @@ +import type { Params } from "./params"; + +export interface AddressAssociation { + /** Sei address */ + sei_address: string; + /** Ethereum address */ + eth_address: string; +} + +export interface Code { + address: string; + code: Uint8Array; +} + +export interface ContractState { + address: string; + key: Uint8Array; + value: Uint8Array; +} + +export interface Nonce { + address: string; + nonce: number; +} + +export interface Serialized { + prefix: Uint8Array; + key: Uint8Array; + value: Uint8Array; +} + +export interface GenesisState { + params?: Params; + /** List of address associations */ + address_associations: AddressAssociation[]; + /** List of stored code */ + codes: Code[]; + /** List of contract state */ + states: ContractState[]; + nonces: Nonce[]; + serialized: Serialized[]; +} diff --git a/packages/cosmos/generated/types/evm/gov.ts b/packages/cosmos/generated/types/evm/gov.ts new file mode 100644 index 000000000..a89220f5d --- /dev/null +++ b/packages/cosmos/generated/types/evm/gov.ts @@ -0,0 +1,48 @@ +export interface AddERCNativePointerProposal { + title: string; + description: string; + token: string; + pointer: string; + version: number; +} + +export interface AddERCCW20PointerProposal { + title: string; + description: string; + pointee: string; + pointer: string; + version: number; +} + +export interface AddERCCW721PointerProposal { + title: string; + description: string; + pointee: string; + pointer: string; + version: number; +} + +export interface AddCWERC20PointerProposal { + title: string; + description: string; + pointee: string; + pointer: string; + version: number; +} + +export interface AddCWERC721PointerProposal { + title: string; + description: string; + pointee: string; + pointer: string; + version: number; +} + +export interface AddERCNativePointerProposalV2 { + title: string; + description: string; + token: string; + name: string; + symbol: string; + decimals: number; +} diff --git a/packages/cosmos/generated/types/evm/index.ts b/packages/cosmos/generated/types/evm/index.ts new file mode 100644 index 000000000..5a8252b19 --- /dev/null +++ b/packages/cosmos/generated/types/evm/index.ts @@ -0,0 +1,11 @@ +// @ts-nocheck + +export * from './config'; +export * from './enums'; +export * from './genesis'; +export * from './gov'; +export * from './params'; +export * from './query'; +export * from './receipt'; +export * from './tx'; +export * from './types'; \ No newline at end of file diff --git a/packages/cosmos/generated/types/evm/params.ts b/packages/cosmos/generated/types/evm/params.ts new file mode 100644 index 000000000..6369579a7 --- /dev/null +++ b/packages/cosmos/generated/types/evm/params.ts @@ -0,0 +1,56 @@ +export interface Params { + /** + * string base_denom = 1 [ + * (gogoproto.moretags) = "yaml:\"base_denom\"", + * (gogoproto.jsontag) = "base_denom" + * ]; + */ + priority_normalizer: string; + base_fee_per_gas: string; + minimum_fee_per_gas: string; + /** + * ChainConfig chain_config = 5 [(gogoproto.moretags) = "yaml:\"chain_config\"", (gogoproto.nullable) = false]; + * string chain_id = 6 [ + * (gogoproto.moretags) = "yaml:\"chain_id\"", + * (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", + * (gogoproto.nullable) = false, + * (gogoproto.jsontag) = "chain_id" + * ]; + * repeated string whitelisted_codehashes_bank_send = 7 [ + * (gogoproto.moretags) = "yaml:\"whitelisted_codehashes_bank_send\"", + * (gogoproto.jsontag) = "whitelisted_codehashes_bank_send" + * ]; + */ + whitelisted_cw_code_hashes_for_delegate_call: Uint8Array[]; + deliver_tx_hook_wasm_gas_limit: number; + max_dynamic_base_fee_upward_adjustment: string; + max_dynamic_base_fee_downward_adjustment: string; + target_gas_used_per_block: number; + maximum_fee_per_gas: string; +} + +export interface ParamsPreV580 { + /** + * string base_denom = 1 [ + * (gogoproto.moretags) = "yaml:\"base_denom\"", + * (gogoproto.jsontag) = "base_denom" + * ]; + */ + priority_normalizer: string; + base_fee_per_gas: string; + minimum_fee_per_gas: string; + /** + * ChainConfig chain_config = 5 [(gogoproto.moretags) = "yaml:\"chain_config\"", (gogoproto.nullable) = false]; + * string chain_id = 6 [ + * (gogoproto.moretags) = "yaml:\"chain_id\"", + * (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", + * (gogoproto.nullable) = false, + * (gogoproto.jsontag) = "chain_id" + * ]; + * repeated string whitelisted_codehashes_bank_send = 7 [ + * (gogoproto.moretags) = "yaml:\"whitelisted_codehashes_bank_send\"", + * (gogoproto.jsontag) = "whitelisted_codehashes_bank_send" + * ]; + */ + whitelisted_cw_code_hashes_for_delegate_call: Uint8Array[]; +} diff --git a/packages/cosmos/generated/types/evm/query.ts b/packages/cosmos/generated/types/evm/query.ts new file mode 100644 index 000000000..6369a6fce --- /dev/null +++ b/packages/cosmos/generated/types/evm/query.ts @@ -0,0 +1,59 @@ +import type { PointerType } from "./enums"; + +export interface QuerySeiAddressByEVMAddressRequest { + evm_address: string; +} + +export interface QuerySeiAddressByEVMAddressResponse { + sei_address: string; + associated: boolean; +} + +export interface QueryEVMAddressBySeiAddressRequest { + sei_address: string; +} + +export interface QueryEVMAddressBySeiAddressResponse { + evm_address: string; + associated: boolean; +} + +export interface QueryStaticCallRequest { + data: Uint8Array; + to: string; +} + +export interface QueryStaticCallResponse { + data: Uint8Array; +} + +export interface QueryPointerRequest { + pointer_type: PointerType; + pointee: string; +} + +export interface QueryPointerResponse { + pointer: string; + version: number; + exists: boolean; +} + +export interface QueryPointerVersionRequest { + pointer_type: PointerType; +} + +export interface QueryPointerVersionResponse { + version: number; + cw_code_id: number; +} + +export interface QueryPointeeRequest { + pointer_type: PointerType; + pointer: string; +} + +export interface QueryPointeeResponse { + pointee: string; + version: number; + exists: boolean; +} diff --git a/packages/cosmos/generated/types/evm/receipt.ts b/packages/cosmos/generated/types/evm/receipt.ts new file mode 100644 index 000000000..a4ae94906 --- /dev/null +++ b/packages/cosmos/generated/types/evm/receipt.ts @@ -0,0 +1,24 @@ +export interface Log { + address: string; + topics: string[]; + data: Uint8Array; + index: number; + synthetic: boolean; +} + +export interface Receipt { + tx_type: number; + cumulative_gas_used: number; + contract_address: string; + tx_hash_hex: string; + gas_used: number; + effective_gas_price: number; + block_number: number; + transaction_index: number; + status: number; + from: string; + to: string; + vm_error: string; + logs: Log[]; + logsBloom: Uint8Array; +} diff --git a/packages/cosmos/generated/types/evm/tx.ts b/packages/cosmos/generated/types/evm/tx.ts new file mode 100644 index 000000000..04886b967 --- /dev/null +++ b/packages/cosmos/generated/types/evm/tx.ts @@ -0,0 +1,71 @@ +import type { Coin } from "../cosmos/base/v1beta1/coin"; + +import type { Any } from "../google/protobuf/any"; + +import type { PointerType } from "./enums"; + +import type { Log } from "./receipt"; + +export interface MsgEVMTransaction { + data?: Any; + derived: Uint8Array; +} + +export interface MsgEVMTransactionResponse { + gas_used: number; + vm_error: string; + return_data: Uint8Array; + hash: string; + logs: Log[]; +} + +export interface MsgInternalEVMCall { + sender: string; + value: string; + to: string; + data: Uint8Array; +} + +export type MsgInternalEVMCallResponse = {}; + +export interface MsgInternalEVMDelegateCall { + sender: string; + codeHash: Uint8Array; + to: string; + data: Uint8Array; + fromContract: string; +} + +export type MsgInternalEVMDelegateCallResponse = {}; + +export interface MsgSend { + from_address: string; + to_address: string; + amount: Coin[]; +} + +export type MsgSendResponse = {}; + +export interface MsgRegisterPointer { + sender: string; + pointer_type: PointerType; + erc_address: string; +} + +export interface MsgRegisterPointerResponse { + pointer_address: string; +} + +export interface MsgAssociateContractAddress { + sender: string; + address: string; +} + +export type MsgAssociateContractAddressResponse = {}; + +export interface MsgAssociate { + sender: string; + custom_message: string; +} + +export type MsgAssociateResponse = {}; diff --git a/packages/cosmos/generated/types/evm/types.ts b/packages/cosmos/generated/types/evm/types.ts new file mode 100644 index 000000000..214b3326b --- /dev/null +++ b/packages/cosmos/generated/types/evm/types.ts @@ -0,0 +1,11 @@ +export interface Whitelist { + hashes: string[]; +} + +export interface DeferredInfo { + tx_index: number; + tx_hash: Uint8Array; + tx_bloom: Uint8Array; + surplus: string; + error: string; +} diff --git a/packages/cosmos/generated/types/google/api/http.ts b/packages/cosmos/generated/types/google/api/http.ts new file mode 100644 index 000000000..36273de98 --- /dev/null +++ b/packages/cosmos/generated/types/google/api/http.ts @@ -0,0 +1,69 @@ +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 parmeters 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. + */ + fully_decode_reserved_expansion: boolean; +} + +export interface HttpRule { + /** + * Selects methods to which this rule applies. + * + * Refer to [selector][google.api.DocumentationRule.selector] for syntax details. + */ + selector: string; + /** Used for listing and getting information about resources. */ + get?: string; + /** Used for updating a resource. */ + put?: string; + /** Used for creating a resource. */ + post?: string; + /** Used for deleting a resource. */ + delete?: string; + /** 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 body, or + * `*` for mapping all fields not captured by the path pattern to the HTTP + * body. NOTE: the referred field must not be a repeated field and must be + * present at the top-level of request message type. + */ + body: string; + /** + * Optional. The name of the response field whose value is mapped to the HTTP + * body of response. Other response fields are ignored. When + * not set, the response message will be used as HTTP body of response. + */ + response_body: 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). + */ + additional_bindings: HttpRule[]; +} + +export interface CustomHttpPattern { + /** The name of this custom HTTP verb. */ + kind: string; + /** The path matched by this custom verb. */ + path: string; +} diff --git a/packages/cosmos/generated/types/google/api/httpbody.ts b/packages/cosmos/generated/types/google/api/httpbody.ts new file mode 100644 index 000000000..aee973051 --- /dev/null +++ b/packages/cosmos/generated/types/google/api/httpbody.ts @@ -0,0 +1,13 @@ +import type { Any } from "../protobuf/any"; + +export interface HttpBody { + /** The HTTP Content-Type header value specifying the content type of the body. */ + content_type: string; + /** The HTTP request/response body as raw binary. */ + data: Uint8Array; + /** + * Application specific response metadata. Must be set in the first response + * for streaming APIs. + */ + extensions: Any[]; +} diff --git a/packages/cosmos/generated/types/google/api/index.ts b/packages/cosmos/generated/types/google/api/index.ts new file mode 100644 index 000000000..96ed9c615 --- /dev/null +++ b/packages/cosmos/generated/types/google/api/index.ts @@ -0,0 +1,4 @@ +// @ts-nocheck + +export * from './http'; +export * from './httpbody'; \ No newline at end of file diff --git a/packages/cosmos/generated/types/google/protobuf/any.ts b/packages/cosmos/generated/types/google/protobuf/any.ts new file mode 100644 index 000000000..7023a2351 --- /dev/null +++ b/packages/cosmos/generated/types/google/protobuf/any.ts @@ -0,0 +1,34 @@ +export interface Any { + /** + * 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_url: string; + /** Must be a valid serialized protocol buffer of the above specified type. */ + value: Uint8Array; +} diff --git a/packages/cosmos/generated/types/google/protobuf/descriptor.ts b/packages/cosmos/generated/types/google/protobuf/descriptor.ts new file mode 100644 index 000000000..568701b7f --- /dev/null +++ b/packages/cosmos/generated/types/google/protobuf/descriptor.ts @@ -0,0 +1,1100 @@ +export enum Edition { + /** EDITION_UNKNOWN - A placeholder for an unknown edition value. */ + EDITION_UNKNOWN = 0, + /** + * EDITION_LEGACY - A placeholder edition for specifying default behaviors *before* a feature + * was first introduced. This is effectively an "infinite past". + */ + EDITION_LEGACY = 900, + /** + * EDITION_PROTO2 - Legacy syntax "editions". These pre-date editions, but behave much like + * distinct editions. These can't be used to specify the edition of proto + * files, but feature definitions must supply proto2/proto3 defaults for + * backwards compatibility. + */ + EDITION_PROTO2 = 998, + EDITION_PROTO3 = 999, + /** + * EDITION_2023 - Editions that have been released. The specific values are arbitrary and + * should not be depended on, but they will always be time-ordered for easy + * comparison. + */ + EDITION_2023 = 1000, + EDITION_2024 = 1001, + /** + * EDITION_1_TEST_ONLY - Placeholder editions for testing feature resolution. These should not be + * used or relyed on outside of tests. + */ + EDITION_1_TEST_ONLY = 1, + EDITION_2_TEST_ONLY = 2, + EDITION_99997_TEST_ONLY = 99997, + EDITION_99998_TEST_ONLY = 99998, + EDITION_99999_TEST_ONLY = 99999, + /** + * EDITION_MAX - Placeholder for specifying unbounded edition support. This should only + * ever be used by plugins that can expect to never require any changes to + * support a new edition. + */ + EDITION_MAX = 2147483647, + UNRECOGNIZED = -1, +} + +export interface FileDescriptorSet { + file: FileDescriptorProto[]; +} + +export interface FileDescriptorProto { + /** file name, relative to root of source tree */ + name?: string; + /** e.g. "foo", "foo.bar", etc. */ + 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: DescriptorProto[]; + enum_type: EnumDescriptorProto[]; + service: ServiceDescriptorProto[]; + extension: FieldDescriptorProto[]; + options?: FileOptions; + /** + * 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?: SourceCodeInfo; + /** + * The syntax of the proto file. + * The supported values are "proto2", "proto3", and "editions". + * + * If `edition` is present, this value must be "editions". + */ + syntax?: string; + /** The edition of the proto file. */ + edition?: Edition; +} + +export interface DescriptorProto { + name?: string; + field: FieldDescriptorProto[]; + extension: FieldDescriptorProto[]; + nested_type: DescriptorProto[]; + enum_type: EnumDescriptorProto[]; + extension_range: DescriptorProtoExtensionRange[]; + oneof_decl: OneofDescriptorProto[]; + options?: MessageOptions; + reserved_range: DescriptorProtoReservedRange[]; + /** + * 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 DescriptorProtoExtensionRange { + /** Inclusive. */ + start?: number; + /** Exclusive. */ + end?: number; + options?: ExtensionRangeOptions; +} + +export interface DescriptorProtoReservedRange { + /** Inclusive. */ + start?: number; + /** Exclusive. */ + end?: number; +} + +export interface ExtensionRangeOptions { + /** The parser stores options it doesn't recognize here. See above. */ + uninterpreted_option: UninterpretedOption[]; + /** + * For external users: DO NOT USE. We are in the process of open sourcing + * extension declaration and executing internal cleanups before it can be + * used externally. + */ + declaration: ExtensionRangeOptionsDeclaration[]; + /** Any features defined in the specific edition. */ + features?: FeatureSet; + /** + * The verification state of the range. + * TODO: flip the default to DECLARATION once all empty ranges + * are marked as UNVERIFIED. + */ + verification?: ExtensionRangeOptionsVerificationState; +} + +export enum ExtensionRangeOptionsVerificationState { + /** DECLARATION - All the extensions of the range must be declared. */ + DECLARATION = 0, + UNVERIFIED = 1, + UNRECOGNIZED = -1, +} + +export interface ExtensionRangeOptionsDeclaration { + /** The extension number declared within the extension range. */ + number?: number; + /** + * The fully-qualified name of the extension field. There must be a leading + * dot in front of the full name. + */ + full_name?: string; + /** + * The fully-qualified type name of the extension field. Unlike + * Metadata.type, Declaration.type must have a leading dot for messages + * and enums. + */ + type?: string; + /** + * If true, indicates that the number is reserved in the extension range, + * and any extension field with the number will fail to compile. Set this + * when a declared extension field is deleted. + */ + reserved?: boolean; + /** + * If true, indicates that the extension must be defined as repeated. + * Otherwise the extension must be defined as optional. + */ + repeated?: boolean; +} + +export interface FieldDescriptorProto { + name?: string; + number?: number; + label?: FieldDescriptorProtoLabel; + /** + * 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?: FieldDescriptorProtoType; + /** + * 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. + */ + 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?: FieldOptions; + /** + * If true, this is a proto3 "optional". When a proto3 field is optional, it + * tracks presence regardless of field type. + * + * When proto3_optional is true, this field must belong to a oneof to signal + * to old proto3 clients that presence is tracked for this field. This oneof + * is known as a "synthetic" oneof, and this field must be its sole member + * (each proto3 optional field gets its own synthetic oneof). Synthetic oneofs + * exist in the descriptor only, and do not generate any API. Synthetic oneofs + * must be ordered after all "real" oneofs. + * + * For message fields, proto3_optional doesn't create any semantic change, + * since non-repeated message fields always track presence. However it still + * indicates the semantic detail of whether the user wrote "optional" or not. + * This can be useful for round-tripping the .proto file. For consistency we + * give message fields a synthetic oneof also, even though it is not required + * to track presence. This is especially important because the parser can't + * tell if a field is a message or an enum, so it must always create a + * synthetic oneof. + * + * Proto2 optional fields do not set this flag, because they already indicate + * optional with `LABEL_OPTIONAL`. + */ + proto3_optional?: boolean; +} + +export enum FieldDescriptorProtoType { + /** + * TYPE_DOUBLE - 0 is reserved for errors. + * Order is weird for historical reasons. + */ + TYPE_DOUBLE = 1, + TYPE_FLOAT = 2, + /** + * TYPE_INT64 - Not ZigZag encoded. Negative numbers take 10 bytes. Use TYPE_SINT64 if + * negative values are likely. + */ + TYPE_INT64 = 3, + TYPE_UINT64 = 4, + /** + * TYPE_INT32 - Not ZigZag encoded. Negative numbers take 10 bytes. Use TYPE_SINT32 if + * negative values are likely. + */ + TYPE_INT32 = 5, + TYPE_FIXED64 = 6, + TYPE_FIXED32 = 7, + TYPE_BOOL = 8, + TYPE_STRING = 9, + /** + * TYPE_GROUP - Tag-delimited aggregate. + * Group type is deprecated and not supported after google.protobuf. However, Proto3 + * implementations should still be able to parse the group wire format and + * treat group fields as unknown fields. In Editions, the group wire format + * can be enabled via the `message_encoding` feature. + */ + TYPE_GROUP = 10, + /** TYPE_MESSAGE - Length-delimited aggregate. */ + TYPE_MESSAGE = 11, + /** TYPE_BYTES - New in version 2. */ + TYPE_BYTES = 12, + TYPE_UINT32 = 13, + TYPE_ENUM = 14, + TYPE_SFIXED32 = 15, + TYPE_SFIXED64 = 16, + /** TYPE_SINT32 - Uses ZigZag encoding. */ + TYPE_SINT32 = 17, + /** TYPE_SINT64 - Uses ZigZag encoding. */ + TYPE_SINT64 = 18, + UNRECOGNIZED = -1, +} + +export enum FieldDescriptorProtoLabel { + /** LABEL_OPTIONAL - 0 is reserved for errors */ + LABEL_OPTIONAL = 1, + LABEL_REPEATED = 3, + /** + * LABEL_REQUIRED - The required label is only allowed in google.protobuf. In proto3 and Editions + * it's explicitly prohibited. In Editions, the `field_presence` feature + * can be used to get this behavior. + */ + LABEL_REQUIRED = 2, + UNRECOGNIZED = -1, +} + +export interface OneofDescriptorProto { + name?: string; + options?: OneofOptions; +} + +export interface EnumDescriptorProto { + name?: string; + value: EnumValueDescriptorProto[]; + options?: EnumOptions; + /** + * 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: EnumDescriptorProtoEnumReservedRange[]; + /** + * Reserved enum value names, which may not be reused. A given name may only + * be reserved once. + */ + reserved_name: string[]; +} + +export interface EnumDescriptorProtoEnumReservedRange { + /** Inclusive. */ + start?: number; + /** Inclusive. */ + end?: number; +} + +export interface EnumValueDescriptorProto { + name?: string; + number?: number; + options?: EnumValueOptions; +} + +export interface ServiceDescriptorProto { + name?: string; + method: MethodDescriptorProto[]; + options?: ServiceOptions; +} + +export interface MethodDescriptorProto { + 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?: MethodOptions; + /** Identifies if client streams multiple client messages */ + client_streaming?: boolean; + /** Identifies if server streams multiple server messages */ + server_streaming?: boolean; +} + +export interface FileOptions { + /** + * 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; + /** + * Controls the name of the wrapper Java class generated for the .proto file. + * That class will always contain the .proto file's getDescriptor() method as + * well as any top-level extensions defined in the .proto file. + * If java_multiple_files is disabled, then all the other classes from the + * .proto file will be nested inside the single wrapper outer class. + */ + java_outer_classname?: string; + /** + * If enabled, 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 wrapper class + * named by java_outer_classname. However, the wrapper 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; + /** + * A proto2 file can set this to true to opt in to UTF-8 checking for Java, + * which will throw an exception if invalid UTF-8 is parsed from the wire or + * assigned to a string field. + * + * TODO: clarify exactly what kinds of field types this option + * applies to, and update these docs accordingly. + * + * Proto3 files already perform these checks. Setting the option explicitly to + * false has no effect: it cannot be used to opt proto3 files out of UTF-8 + * checks. + */ + java_string_check_utf8?: boolean; + optimize_for?: FileOptionsOptimizeMode; + /** + * 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; + /** + * 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; + /** Any features defined in the specific edition. */ + features?: FeatureSet; + /** + * The parser stores options it doesn't recognize here. + * See the documentation for the "Options" section above. + */ + uninterpreted_option: UninterpretedOption[]; +} + +export enum FileOptionsOptimizeMode { + /** SPEED - Generate complete code for parsing, serialization, */ + SPEED = 1, + /** CODE_SIZE - etc. */ + CODE_SIZE = 2, + /** LITE_RUNTIME - Generate code using MessageLite and the lite runtime. */ + LITE_RUNTIME = 3, + UNRECOGNIZED = -1, +} + +export interface MessageOptions { + /** + * 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; + /** + * Enable the legacy handling of JSON field name conflicts. This lowercases + * and strips underscored from the fields before comparison in proto3 only. + * The new behavior takes `json_name` into account and applies to proto2 as + * well. + * + * This should only be used as a temporary measure against broken builds due + * to the change in behavior for JSON field name conflicts. + * + * TODO This is legacy behavior we plan to remove once downstream + * teams have had time to migrate. + * + * @deprecated + */ + deprecated_legacy_json_field_conflicts?: boolean; + /** Any features defined in the specific edition. */ + features?: FeatureSet; + /** The parser stores options it doesn't recognize here. See above. */ + uninterpreted_option: UninterpretedOption[]; +} + +export interface FieldOptions { + /** + * 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 only implemented to support use of + * [ctype=CORD] and [ctype=STRING] (the default) on non-repeated fields of + * type "bytes" in the open source release -- sorry, we'll try to include + * other types in a future version! + */ + ctype?: FieldOptionsCType; + /** + * 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. This option is prohibited in + * Editions, but the `repeated_field_encoding` feature can be used to control + * the behavior. + */ + 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?: FieldOptionsJSType; + /** + * 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 lazy message fields are still eagerly verified to check + * ill-formed wireformat or missing required fields. Calling IsInitialized() + * on the outer message would fail if the inner message has missing required + * fields. Failed verification would result in parsing failure (except when + * uninitialized messages are acceptable). + */ + lazy?: boolean; + /** + * unverified_lazy does no correctness checks on the byte stream. This should + * only be used where lazy with verification is prohibitive for performance + * reasons. + */ + unverified_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; + /** + * Indicate that the field value should not be printed out when using debug + * formats, e.g. when the field contains sensitive credentials. + */ + debug_redact?: boolean; + retention?: FieldOptionsOptionRetention; + targets: FieldOptionsOptionTargetType[]; + edition_defaults: FieldOptionsEditionDefault[]; + /** Any features defined in the specific edition. */ + features?: FeatureSet; + feature_support?: FieldOptionsFeatureSupport; + /** The parser stores options it doesn't recognize here. See above. */ + uninterpreted_option: UninterpretedOption[]; +} + +export enum FieldOptionsCType { + /** STRING - Default mode. */ + STRING = 0, + /** + * CORD - The option [ctype=CORD] may be applied to a non-repeated field of type + * "bytes". It indicates that in C++, the data should be stored in a Cord + * instead of a string. For very large strings, this may reduce memory + * fragmentation. It may also allow better performance when parsing from a + * Cord, or when parsing with aliasing enabled, as the parsed Cord may then + * alias the original buffer. + */ + CORD = 1, + STRING_PIECE = 2, + UNRECOGNIZED = -1, +} + +export enum FieldOptionsJSType { + /** JS_NORMAL - Use the default type. */ + JS_NORMAL = 0, + /** JS_STRING - Use JavaScript strings. */ + JS_STRING = 1, + /** JS_NUMBER - Use JavaScript numbers. */ + JS_NUMBER = 2, + UNRECOGNIZED = -1, +} + +export enum FieldOptionsOptionRetention { + RETENTION_UNKNOWN = 0, + RETENTION_RUNTIME = 1, + RETENTION_SOURCE = 2, + UNRECOGNIZED = -1, +} + +export enum FieldOptionsOptionTargetType { + TARGET_TYPE_UNKNOWN = 0, + TARGET_TYPE_FILE = 1, + TARGET_TYPE_EXTENSION_RANGE = 2, + TARGET_TYPE_MESSAGE = 3, + TARGET_TYPE_FIELD = 4, + TARGET_TYPE_ONEOF = 5, + TARGET_TYPE_ENUM = 6, + TARGET_TYPE_ENUM_ENTRY = 7, + TARGET_TYPE_SERVICE = 8, + TARGET_TYPE_METHOD = 9, + UNRECOGNIZED = -1, +} + +export interface FieldOptionsEditionDefault { + edition?: Edition; + /** Textproto value. */ + value?: string; +} + +export interface FieldOptionsFeatureSupport { + /** + * The edition that this feature was first available in. In editions + * earlier than this one, the default assigned to EDITION_LEGACY will be + * used, and proto files will not be able to override it. + */ + edition_introduced?: Edition; + /** + * The edition this feature becomes deprecated in. Using this after this + * edition may trigger warnings. + */ + edition_deprecated?: Edition; + /** + * The deprecation warning text if this feature is used after the edition it + * was marked deprecated in. + */ + deprecation_warning?: string; + /** + * The edition this feature is no longer available in. In editions after + * this one, the last default assigned will be used, and proto files will + * not be able to override it. + */ + edition_removed?: Edition; +} + +export interface OneofOptions { + /** Any features defined in the specific edition. */ + features?: FeatureSet; + /** The parser stores options it doesn't recognize here. See above. */ + uninterpreted_option: UninterpretedOption[]; +} + +export interface EnumOptions { + /** + * 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; + /** + * Enable the legacy handling of JSON field name conflicts. This lowercases + * and strips underscored from the fields before comparison in proto3 only. + * The new behavior takes `json_name` into account and applies to proto2 as + * well. + * TODO Remove this legacy behavior once downstream teams have + * had time to migrate. + * + * @deprecated + */ + deprecated_legacy_json_field_conflicts?: boolean; + /** Any features defined in the specific edition. */ + features?: FeatureSet; + /** The parser stores options it doesn't recognize here. See above. */ + uninterpreted_option: UninterpretedOption[]; +} + +export interface EnumValueOptions { + /** + * 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; + /** Any features defined in the specific edition. */ + features?: FeatureSet; + /** + * Indicate that fields annotated with this enum value should not be printed + * out when using debug formats, e.g. when the field contains sensitive + * credentials. + */ + debug_redact?: boolean; + /** Information about the support window of a feature value. */ + feature_support?: FieldOptionsFeatureSupport; + /** The parser stores options it doesn't recognize here. See above. */ + uninterpreted_option: UninterpretedOption[]; +} + +export interface ServiceOptions { + /** Any features defined in the specific edition. */ + features?: FeatureSet; + /** + * 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: UninterpretedOption[]; +} + +export interface MethodOptions { + /** + * 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?: MethodOptionsIdempotencyLevel; + /** Any features defined in the specific edition. */ + features?: FeatureSet; + /** The parser stores options it doesn't recognize here. See above. */ + uninterpreted_option: UninterpretedOption[]; +} + +export enum MethodOptionsIdempotencyLevel { + IDEMPOTENCY_UNKNOWN = 0, + /** NO_SIDE_EFFECTS - implies idempotent */ + NO_SIDE_EFFECTS = 1, + /** IDEMPOTENT - idempotent, but may have side effects */ + IDEMPOTENT = 2, + UNRECOGNIZED = -1, +} + +export interface UninterpretedOption { + name: UninterpretedOptionNamePart[]; + /** + * 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?: number; + negative_int_value?: number; + double_value?: number; + string_value?: Uint8Array; + aggregate_value?: string; +} + +export interface UninterpretedOptionNamePart { + name_part: string; + is_extension: boolean; +} + +export interface FeatureSet { + field_presence?: FeatureSetFieldPresence; + enum_type?: FeatureSetEnumType; + repeated_field_encoding?: FeatureSetRepeatedFieldEncoding; + utf8_validation?: FeatureSetUtf8Validation; + message_encoding?: FeatureSetMessageEncoding; + json_format?: FeatureSetJsonFormat; +} + +export enum FeatureSetFieldPresence { + FIELD_PRESENCE_UNKNOWN = 0, + EXPLICIT = 1, + IMPLICIT = 2, + LEGACY_REQUIRED = 3, + UNRECOGNIZED = -1, +} + +export enum FeatureSetEnumType { + ENUM_TYPE_UNKNOWN = 0, + OPEN = 1, + CLOSED = 2, + UNRECOGNIZED = -1, +} + +export enum FeatureSetRepeatedFieldEncoding { + REPEATED_FIELD_ENCODING_UNKNOWN = 0, + PACKED = 1, + EXPANDED = 2, + UNRECOGNIZED = -1, +} + +export enum FeatureSetUtf8Validation { + UTF8_VALIDATION_UNKNOWN = 0, + VERIFY = 2, + NONE = 3, + UNRECOGNIZED = -1, +} + +export enum FeatureSetMessageEncoding { + MESSAGE_ENCODING_UNKNOWN = 0, + LENGTH_PREFIXED = 1, + DELIMITED = 2, + UNRECOGNIZED = -1, +} + +export enum FeatureSetJsonFormat { + JSON_FORMAT_UNKNOWN = 0, + ALLOW = 1, + LEGACY_BEST_EFFORT = 2, + UNRECOGNIZED = -1, +} + +export interface FeatureSetDefaults { + defaults: FeatureSetDefaultsFeatureSetEditionDefault[]; + /** + * The minimum supported edition (inclusive) when this was constructed. + * Editions before this will not have defaults. + */ + minimum_edition?: Edition; + /** + * The maximum known edition (inclusive) when this was constructed. Editions + * after this will not have reliable defaults. + */ + maximum_edition?: Edition; +} + +export interface FeatureSetDefaultsFeatureSetEditionDefault { + edition?: Edition; + /** Defaults of features that can be overridden in this edition. */ + overridable_features?: FeatureSet; + /** Defaults of features that can't be overridden in this edition. */ + fixed_features?: FeatureSet; +} + +export interface SourceCodeInfo { + /** + * 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: SourceCodeInfoLocation[]; +} + +export interface SourceCodeInfoLocation { + /** + * 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 appears. + * 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 moo. + * // + * // Another line attached to moo. + * optional double moo = 4; + * + * // Detached comment for corge. This is not leading or trailing comments + * // to moo 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 GeneratedCodeInfo { + /** + * An Annotation connects some span of text in generated code to an element + * of its generating .proto file. + */ + annotation: GeneratedCodeInfoAnnotation[]; +} + +export interface GeneratedCodeInfoAnnotation { + /** + * 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 object. The end offset should be one past + * the last relevant byte (so the length of the text = end - begin). + */ + end?: number; + semantic?: GeneratedCodeInfoAnnotationSemantic; +} + +export enum GeneratedCodeInfoAnnotationSemantic { + /** NONE - There is no effect or the effect is indescribable. */ + NONE = 0, + /** SET - The element is set or otherwise mutated. */ + SET = 1, + /** ALIAS - An alias to the element is returned. */ + ALIAS = 2, + UNRECOGNIZED = -1, +} diff --git a/packages/cosmos/generated/types/google/protobuf/duration.ts b/packages/cosmos/generated/types/google/protobuf/duration.ts new file mode 100644 index 000000000..a5e759fc4 --- /dev/null +++ b/packages/cosmos/generated/types/google/protobuf/duration.ts @@ -0,0 +1,17 @@ +export interface Duration { + /** + * Signed seconds of the span of time. Must be from -315,576,000,000 + * to +315,576,000,000 inclusive. Note: these bounds are computed from: + * 60 sec/min * 60 min/hr * 24 hr/day * 365.25 days/year * 10000 years + */ + seconds: number; + /** + * Signed fractions of a second at nanosecond resolution of the span + * of time. Durations less than one second are represented with a 0 + * `seconds` field and a positive or negative `nanos` field. For durations + * of one second or more, a non-zero value for the `nanos` field must be + * of the same sign as the `seconds` field. Must be from -999,999,999 + * to +999,999,999 inclusive. + */ + nanos: number; +} diff --git a/packages/cosmos/generated/types/google/protobuf/index.ts b/packages/cosmos/generated/types/google/protobuf/index.ts new file mode 100644 index 000000000..30a5203d9 --- /dev/null +++ b/packages/cosmos/generated/types/google/protobuf/index.ts @@ -0,0 +1,6 @@ +// @ts-nocheck + +export * from './any'; +export * from './descriptor'; +export * from './duration'; +export * from './timestamp'; \ No newline at end of file diff --git a/packages/cosmos/generated/types/google/protobuf/timestamp.ts b/packages/cosmos/generated/types/google/protobuf/timestamp.ts new file mode 100644 index 000000000..af51568cc --- /dev/null +++ b/packages/cosmos/generated/types/google/protobuf/timestamp.ts @@ -0,0 +1,15 @@ +export interface Timestamp { + /** + * Represents seconds of UTC time since Unix epoch + * 1970-01-01T00:00:00Z. Must be from 0001-01-01T00:00:00Z to + * 9999-12-31T23:59:59Z inclusive. + */ + seconds: number; + /** + * Non-negative fractions of a second at nanosecond resolution. Negative + * second values with fractions must still have non-negative nanos values + * that count forward in time. Must be from 0 to 999,999,999 + * inclusive. + */ + nanos: number; +} diff --git a/packages/cosmos/generated/types/mint/v1beta1/genesis.ts b/packages/cosmos/generated/types/mint/v1beta1/genesis.ts new file mode 100644 index 000000000..82ae8fd76 --- /dev/null +++ b/packages/cosmos/generated/types/mint/v1beta1/genesis.ts @@ -0,0 +1,8 @@ +import type { Minter, Params } from "./mint"; + +export interface GenesisState { + /** minter is a space for holding current inflation information. */ + minter?: Minter; + /** params defines all the paramaters of the module. */ + params?: Params; +} diff --git a/packages/cosmos/generated/types/mint/v1beta1/gov.ts b/packages/cosmos/generated/types/mint/v1beta1/gov.ts new file mode 100644 index 000000000..d70ed4382 --- /dev/null +++ b/packages/cosmos/generated/types/mint/v1beta1/gov.ts @@ -0,0 +1,7 @@ +import type { Minter } from "./mint"; + +export interface UpdateMinterProposal { + title: string; + description: string; + minter?: Minter; +} diff --git a/packages/cosmos/generated/types/mint/v1beta1/index.ts b/packages/cosmos/generated/types/mint/v1beta1/index.ts new file mode 100644 index 000000000..81aaf2edc --- /dev/null +++ b/packages/cosmos/generated/types/mint/v1beta1/index.ts @@ -0,0 +1,6 @@ +// @ts-nocheck + +export * from './genesis'; +export * from './gov'; +export * from './mint'; +export * from './query'; \ No newline at end of file diff --git a/packages/cosmos/generated/types/mint/v1beta1/mint.ts b/packages/cosmos/generated/types/mint/v1beta1/mint.ts new file mode 100644 index 000000000..93388169a --- /dev/null +++ b/packages/cosmos/generated/types/mint/v1beta1/mint.ts @@ -0,0 +1,48 @@ +export interface Minter { + /** yyyy-mm-dd */ + start_date: string; + /** yyyy-mm-dd */ + end_date: string; + denom: string; + total_mint_amount: number; + remaining_mint_amount: number; + last_mint_amount: number; + last_mint_date: string; + /** yyyy-mm-dd */ + last_mint_height: number; +} + +export interface ScheduledTokenRelease { + /** yyyy-mm-dd */ + start_date: string; + /** yyyy-mm-dd */ + end_date: string; + token_release_amount: number; +} + +export interface Params { + /** type of coin to mint */ + mint_denom: string; + /** List of token release schedules */ + token_release_schedule: ScheduledTokenRelease[]; +} + +export interface Version2Minter { + last_mint_amount: string; + last_mint_date: string; + last_mint_height: number; + denom: string; +} + +export interface Version2ScheduledTokenRelease { + /** yyyy-mm-dd */ + date: string; + token_release_amount: number; +} + +export interface Version2Params { + /** type of coin to mint */ + mint_denom: string; + /** List of token release schedules */ + token_release_schedule: Version2ScheduledTokenRelease[]; +} diff --git a/packages/cosmos/generated/types/mint/v1beta1/query.ts b/packages/cosmos/generated/types/mint/v1beta1/query.ts new file mode 100644 index 000000000..534ce4f4d --- /dev/null +++ b/packages/cosmos/generated/types/mint/v1beta1/query.ts @@ -0,0 +1,21 @@ +import type { Params } from "./mint"; + +export type QueryParamsRequest = {}; + +export interface QueryParamsResponse { + /** params defines the parameters of the module. */ + params?: Params; +} + +export type QueryMinterRequest = {}; + +export interface QueryMinterResponse { + start_date: string; + end_date: string; + denom: string; + total_mint_amount: number; + remaining_mint_amount: number; + last_mint_amount: number; + last_mint_date: string; + last_mint_height: number; +} diff --git a/packages/cosmos/generated/types/oracle/genesis.ts b/packages/cosmos/generated/types/oracle/genesis.ts new file mode 100644 index 000000000..d8fdb8061 --- /dev/null +++ b/packages/cosmos/generated/types/oracle/genesis.ts @@ -0,0 +1,20 @@ +import type { AggregateExchangeRateVote, ExchangeRateTuple, Params, PriceSnapshot, VotePenaltyCounter } from "./oracle"; + +export interface GenesisState { + params?: Params; + feeder_delegations: FeederDelegation[]; + exchange_rates: ExchangeRateTuple[]; + penalty_counters: PenaltyCounter[]; + aggregate_exchange_rate_votes: AggregateExchangeRateVote[]; + price_snapshots: PriceSnapshot[]; +} + +export interface FeederDelegation { + feeder_address: string; + validator_address: string; +} + +export interface PenaltyCounter { + validator_address: string; + vote_penalty_counter?: VotePenaltyCounter; +} diff --git a/packages/cosmos/generated/types/oracle/index.ts b/packages/cosmos/generated/types/oracle/index.ts new file mode 100644 index 000000000..bd05e78b7 --- /dev/null +++ b/packages/cosmos/generated/types/oracle/index.ts @@ -0,0 +1,6 @@ +// @ts-nocheck + +export * from './genesis'; +export * from './oracle'; +export * from './query'; +export * from './tx'; \ No newline at end of file diff --git a/packages/cosmos/generated/types/oracle/oracle.ts b/packages/cosmos/generated/types/oracle/oracle.ts new file mode 100644 index 000000000..4925d98dc --- /dev/null +++ b/packages/cosmos/generated/types/oracle/oracle.ts @@ -0,0 +1,55 @@ +export interface Params { + /** The number of blocks per voting window, at the end of the vote period, the oracle votes are assessed and exchange rates are calculated. If the vote period is 1 this is equivalent to having oracle votes assessed and exchange rates calculated in each block. */ + vote_period: number; + vote_threshold: string; + reward_band: string; + whitelist: Denom[]; + slash_fraction: string; + /** The interval in blocks at which the oracle module will assess validator penalty counters, and penalize validators with too poor performance. */ + slash_window: number; + /** The minimum percentage of voting windows for which a validator must have `success`es in order to not be penalized at the end of the slash window. */ + min_valid_per_window: string; + lookback_duration: number; +} + +export interface Denom { + name: string; +} + +export interface AggregateExchangeRateVote { + exchange_rate_tuples: ExchangeRateTuple[]; + voter: string; +} + +export interface ExchangeRateTuple { + denom: string; + exchange_rate: string; +} + +export interface OracleExchangeRate { + exchange_rate: string; + last_update: string; + last_update_timestamp: number; +} + +export interface PriceSnapshotItem { + denom: string; + oracle_exchange_rate?: OracleExchangeRate; +} + +export interface PriceSnapshot { + snapshot_timestamp: number; + price_snapshot_items: PriceSnapshotItem[]; +} + +export interface OracleTwap { + denom: string; + twap: string; + lookback_seconds: number; +} + +export interface VotePenaltyCounter { + miss_count: number; + abstain_count: number; + success_count: number; +} diff --git a/packages/cosmos/generated/types/oracle/query.ts b/packages/cosmos/generated/types/oracle/query.ts new file mode 100644 index 000000000..ba69416ea --- /dev/null +++ b/packages/cosmos/generated/types/oracle/query.ts @@ -0,0 +1,90 @@ +import type { OracleExchangeRate, OracleTwap, Params, PriceSnapshot, VotePenaltyCounter } from "./oracle"; + +export interface QueryExchangeRateRequest { + /** denom defines the denomination to query for. */ + denom: string; +} + +export interface QueryExchangeRateResponse { + /** exchange_rate defines the exchange rate of Sei denominated in various Sei */ + oracle_exchange_rate?: OracleExchangeRate; +} + +export type QueryExchangeRatesRequest = {}; + +export interface DenomOracleExchangeRatePair { + denom: string; + oracle_exchange_rate?: OracleExchangeRate; +} + +export interface QueryExchangeRatesResponse { + /** exchange_rates defines a list of the exchange rate for all whitelisted denoms. */ + denom_oracle_exchange_rate_pairs: DenomOracleExchangeRatePair[]; +} + +export type QueryActivesRequest = {}; + +export interface QueryActivesResponse { + /** actives defines a list of the denomination which oracle prices aggreed upon. */ + actives: string[]; +} + +export type QueryVoteTargetsRequest = {}; + +export interface QueryVoteTargetsResponse { + /** + * vote_targets defines a list of the denomination in which everyone + * should vote in the current vote period. + */ + vote_targets: string[]; +} + +export type QueryPriceSnapshotHistoryRequest = {}; + +export interface QueryPriceSnapshotHistoryResponse { + price_snapshots: PriceSnapshot[]; +} + +export interface QueryTwapsRequest { + lookback_seconds: number; +} + +export interface QueryTwapsResponse { + oracle_twaps: OracleTwap[]; +} + +export interface QueryFeederDelegationRequest { + /** validator defines the validator address to query for. */ + validator_addr: string; +} + +export interface QueryFeederDelegationResponse { + /** feeder_addr defines the feeder delegation of a validator */ + feeder_addr: string; +} + +export interface QueryVotePenaltyCounterRequest { + /** validator defines the validator address to query for. */ + validator_addr: string; +} + +export interface QueryVotePenaltyCounterResponse { + vote_penalty_counter?: VotePenaltyCounter; +} + +export type QuerySlashWindowRequest = {}; + +export interface QuerySlashWindowResponse { + /** + * window_progress defines the number of voting periods + * since the last slashing event would have taken place. + */ + window_progress: number; +} + +export type QueryParamsRequest = {}; + +export interface QueryParamsResponse { + /** params defines the parameters of the module. */ + params?: Params; +} diff --git a/packages/cosmos/generated/types/oracle/tx.ts b/packages/cosmos/generated/types/oracle/tx.ts new file mode 100644 index 000000000..4b8f57385 --- /dev/null +++ b/packages/cosmos/generated/types/oracle/tx.ts @@ -0,0 +1,15 @@ +export interface MsgAggregateExchangeRateVote { + /** 1 reserved from old field `salt` */ + exchange_rates: string; + feeder: string; + validator: string; +} + +export type MsgAggregateExchangeRateVoteResponse = {}; + +export interface MsgDelegateFeedConsent { + operator: string; + delegate: string; +} + +export type MsgDelegateFeedConsentResponse = {}; diff --git a/packages/cosmos/generated/types/tendermint/abci/index.ts b/packages/cosmos/generated/types/tendermint/abci/index.ts new file mode 100644 index 000000000..316cec4f0 --- /dev/null +++ b/packages/cosmos/generated/types/tendermint/abci/index.ts @@ -0,0 +1,3 @@ +// @ts-nocheck + +export * from './types'; \ No newline at end of file diff --git a/packages/cosmos/generated/types/tendermint/abci/types.ts b/packages/cosmos/generated/types/tendermint/abci/types.ts new file mode 100644 index 000000000..fd0be1713 --- /dev/null +++ b/packages/cosmos/generated/types/tendermint/abci/types.ts @@ -0,0 +1,454 @@ +import type { PublicKey } from "../crypto/keys"; + +import type { ProofOps } from "../crypto/proof"; + +import type { ConsensusParams } from "../types/params"; + +export enum CheckTxType { + NEW = 0, + RECHECK = 1, + UNRECOGNIZED = -1, +} + +export enum MisbehaviorType { + UNKNOWN = 0, + DUPLICATE_VOTE = 1, + LIGHT_CLIENT_ATTACK = 2, + UNRECOGNIZED = -1, +} + +export interface Request { + echo?: RequestEcho; + flush?: RequestFlush; + info?: RequestInfo; + init_chain?: RequestInitChain; + query?: RequestQuery; + check_tx?: RequestCheckTx; + commit?: RequestCommit; + list_snapshots?: RequestListSnapshots; + offer_snapshot?: RequestOfferSnapshot; + load_snapshot_chunk?: RequestLoadSnapshotChunk; + apply_snapshot_chunk?: RequestApplySnapshotChunk; + prepare_proposal?: RequestPrepareProposal; + process_proposal?: RequestProcessProposal; + extend_vote?: RequestExtendVote; + verify_vote_extension?: RequestVerifyVoteExtension; + finalize_block?: RequestFinalizeBlock; +} + +export interface RequestEcho { + message: string; +} + +export type RequestFlush = {}; + +export interface RequestInfo { + version: string; + block_version: number; + p2p_version: number; + abci_version: string; +} + +export interface RequestInitChain { + time?: Date; + chain_id: string; + consensus_params?: ConsensusParams; + validators: ValidatorUpdate[]; + app_state_bytes: Uint8Array; + initial_height: number; +} + +export interface RequestQuery { + data: Uint8Array; + path: string; + height: number; + prove: boolean; +} + +export interface RequestCheckTx { + tx: Uint8Array; + type: CheckTxType; +} + +export type RequestCommit = {}; + +export type RequestListSnapshots = {}; + +export interface RequestOfferSnapshot { + /** snapshot offered by peers */ + snapshot?: Snapshot; + /** light client-verified app hash for snapshot height */ + app_hash: Uint8Array; +} + +export interface RequestLoadSnapshotChunk { + height: number; + format: number; + chunk: number; +} + +export interface RequestApplySnapshotChunk { + index: number; + chunk: Uint8Array; + sender: string; +} + +export interface RequestPrepareProposal { + /** the modified transactions cannot exceed this size. */ + max_tx_bytes: number; + /** + * 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?: ExtendedCommitInfo; + byzantine_validators: Misbehavior[]; + height: number; + time?: Date; + next_validators_hash: Uint8Array; + /** address of the public key of the validator proposing the block. */ + proposer_address: Uint8Array; +} + +export interface RequestProcessProposal { + txs: Uint8Array[]; + proposed_last_commit?: CommitInfo; + byzantine_validators: Misbehavior[]; + /** hash is the merkle root hash of the fields of the proposed block. */ + hash: Uint8Array; + height: number; + time?: Date; + next_validators_hash: Uint8Array; + /** address of the public key of the original proposer of the block. */ + proposer_address: Uint8Array; +} + +export interface RequestExtendVote { + hash: Uint8Array; + height: number; +} + +export interface RequestVerifyVoteExtension { + hash: Uint8Array; + validator_address: Uint8Array; + height: number; + vote_extension: Uint8Array; +} + +export interface RequestFinalizeBlock { + txs: Uint8Array[]; + decided_last_commit?: CommitInfo; + byzantine_validators: Misbehavior[]; + /** hash is the merkle root hash of the fields of the proposed block. */ + hash: Uint8Array; + height: number; + time?: Date; + next_validators_hash: Uint8Array; + /** proposer_address is the address of the public key of the original proposer of the block. */ + proposer_address: Uint8Array; +} + +export interface Response { + exception?: ResponseException; + echo?: ResponseEcho; + flush?: ResponseFlush; + info?: ResponseInfo; + init_chain?: ResponseInitChain; + query?: ResponseQuery; + check_tx?: ResponseCheckTx; + commit?: ResponseCommit; + list_snapshots?: ResponseListSnapshots; + offer_snapshot?: ResponseOfferSnapshot; + load_snapshot_chunk?: ResponseLoadSnapshotChunk; + apply_snapshot_chunk?: ResponseApplySnapshotChunk; + prepare_proposal?: ResponsePrepareProposal; + process_proposal?: ResponseProcessProposal; + extend_vote?: ResponseExtendVote; + verify_vote_extension?: ResponseVerifyVoteExtension; + finalize_block?: ResponseFinalizeBlock; +} + +export interface ResponseException { + error: string; +} + +export interface ResponseEcho { + message: string; +} + +export type ResponseFlush = {}; + +export interface ResponseInfo { + data: string; + /** this is the software version of the application. TODO: remove? */ + version: string; + app_version: number; + last_block_height: number; + last_block_app_hash: Uint8Array; +} + +export interface ResponseInitChain { + consensus_params?: ConsensusParams; + validators: ValidatorUpdate[]; + app_hash: Uint8Array; +} + +export interface ResponseQuery { + code: number; + /** bytes data = 2; // use "value" instead. */ + log: string; + /** nondeterministic */ + info: string; + index: number; + key: Uint8Array; + value: Uint8Array; + proof_ops?: ProofOps; + height: number; + codespace: string; +} + +export interface ResponseCheckTx { + code: number; + data: Uint8Array; + gas_wanted: number; + codespace: string; + sender: string; + priority: number; +} + +export interface ResponseDeliverTx { + code: number; + data: Uint8Array; + /** nondeterministic */ + log: string; + /** nondeterministic */ + info: string; + gas_wanted: number; + gas_used: number; + /** nondeterministic */ + events: Event[]; + codespace: string; +} + +export interface ResponseCommit { + /** reserve 1 */ + retain_height: number; +} + +export interface ResponseListSnapshots { + snapshots: Snapshot[]; +} + +export interface ResponseOfferSnapshot { + result: ResponseOfferSnapshotResult; +} + +export enum ResponseOfferSnapshotResult { + /** UNKNOWN - Unknown result, abort all snapshot restoration */ + UNKNOWN = 0, + /** ACCEPT - Snapshot accepted, apply chunks */ + ACCEPT = 1, + /** ABORT - Abort all snapshot restoration */ + ABORT = 2, + /** REJECT - Reject this specific snapshot, try others */ + REJECT = 3, + /** REJECT_FORMAT - Reject all snapshots of this format, try others */ + REJECT_FORMAT = 4, + /** REJECT_SENDER - Reject all snapshots from the sender(s), try others */ + REJECT_SENDER = 5, + UNRECOGNIZED = -1, +} + +export interface ResponseLoadSnapshotChunk { + chunk: Uint8Array; +} + +export interface ResponseApplySnapshotChunk { + result: ResponseApplySnapshotChunkResult; + /** Chunks to refetch and reapply */ + refetch_chunks: number[]; + /** Chunk senders to reject and ban */ + reject_senders: string[]; +} + +export enum ResponseApplySnapshotChunkResult { + /** UNKNOWN - Unknown result, abort all snapshot restoration */ + UNKNOWN = 0, + /** ACCEPT - Chunk successfully accepted */ + ACCEPT = 1, + /** ABORT - Abort all snapshot restoration */ + ABORT = 2, + /** RETRY - Retry chunk (combine with refetch and reject) */ + RETRY = 3, + /** RETRY_SNAPSHOT - Retry snapshot (combine with refetch and reject) */ + RETRY_SNAPSHOT = 4, + /** REJECT_SNAPSHOT - Reject this snapshot, try others */ + REJECT_SNAPSHOT = 5, + UNRECOGNIZED = -1, +} + +export interface ResponsePrepareProposal { + tx_records: TxRecord[]; + app_hash: Uint8Array; + tx_results: ExecTxResult[]; + validator_updates: ValidatorUpdate[]; + consensus_param_updates?: ConsensusParams; +} + +export interface ResponseProcessProposal { + status: ResponseProcessProposalProposalStatus; + app_hash: Uint8Array; + tx_results: ExecTxResult[]; + validator_updates: ValidatorUpdate[]; + consensus_param_updates?: ConsensusParams; +} + +export enum ResponseProcessProposalProposalStatus { + UNKNOWN = 0, + ACCEPT = 1, + REJECT = 2, + UNRECOGNIZED = -1, +} + +export interface ResponseExtendVote { + vote_extension: Uint8Array; +} + +export interface ResponseVerifyVoteExtension { + status: ResponseVerifyVoteExtensionVerifyStatus; +} + +export enum ResponseVerifyVoteExtensionVerifyStatus { + UNKNOWN = 0, + ACCEPT = 1, + REJECT = 2, + UNRECOGNIZED = -1, +} + +export interface ResponseFinalizeBlock { + events: Event[]; + tx_results: ExecTxResult[]; + validator_updates: ValidatorUpdate[]; + consensus_param_updates?: ConsensusParams; + app_hash: Uint8Array; +} + +export interface CommitInfo { + round: number; + votes: VoteInfo[]; +} + +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 Event { + type: string; + attributes: EventAttribute[]; +} + +export interface EventAttribute { + key: string; + value: string; + /** nondeterministic */ + index: boolean; +} + +export interface ExecTxResult { + code: number; + data: Uint8Array; + /** nondeterministic */ + log: string; + /** nondeterministic */ + info: string; + gas_wanted: number; + gas_used: number; + /** nondeterministic */ + events: Event[]; + codespace: string; +} + +export interface TxResult { + height: number; + index: number; + tx: Uint8Array; + result?: ExecTxResult; +} + +export interface TxRecord { + action: TxRecordTxAction; + tx: Uint8Array; +} + +export enum TxRecordTxAction { + /** UNKNOWN - Unknown action */ + UNKNOWN = 0, + /** UNMODIFIED - The Application did not modify this transaction. */ + UNMODIFIED = 1, + /** ADDED - The Application added this transaction. */ + ADDED = 2, + /** REMOVED - The Application wants this transaction removed from the proposal and the mempool. */ + REMOVED = 3, + UNRECOGNIZED = -1, +} + +export interface Validator { + /** The first 20 bytes of SHA256(public key) */ + address: Uint8Array; + /** PubKey pub_key = 2 [(gogoproto.nullable)=false]; */ + power: number; +} + +export interface ValidatorUpdate { + pub_key?: PublicKey; + power: number; +} + +export interface VoteInfo { + validator?: Validator; + signed_last_block: boolean; +} + +export interface ExtendedVoteInfo { + /** The validator that sent the vote. */ + validator?: Validator; + /** Indicates whether the validator signed the last block, allowing for rewards based on validator availability. */ + signed_last_block: boolean; + /** Non-deterministic extension provided by the sending validator's application. */ + vote_extension: Uint8Array; +} + +export interface Misbehavior { + type: MisbehaviorType; + /** The offending validator */ + validator?: Validator; + /** The height when the offense occurred */ + height: number; + /** The corresponding time where the offense occurred */ + time?: Date; + /** + * 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: number; +} + +export interface Snapshot { + /** The height at which the snapshot was taken */ + height: number; + /** 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; +} diff --git a/packages/cosmos/generated/types/tendermint/crypto/index.ts b/packages/cosmos/generated/types/tendermint/crypto/index.ts new file mode 100644 index 000000000..8a292eb60 --- /dev/null +++ b/packages/cosmos/generated/types/tendermint/crypto/index.ts @@ -0,0 +1,4 @@ +// @ts-nocheck + +export * from './keys'; +export * from './proof'; \ No newline at end of file diff --git a/packages/cosmos/generated/types/tendermint/crypto/keys.ts b/packages/cosmos/generated/types/tendermint/crypto/keys.ts new file mode 100644 index 000000000..2855cef7c --- /dev/null +++ b/packages/cosmos/generated/types/tendermint/crypto/keys.ts @@ -0,0 +1,5 @@ +export interface PublicKey { + ed25519?: Uint8Array; + secp256k1?: Uint8Array; + sr25519?: Uint8Array; +} diff --git a/packages/cosmos/generated/types/tendermint/crypto/proof.ts b/packages/cosmos/generated/types/tendermint/crypto/proof.ts new file mode 100644 index 000000000..9fc4db469 --- /dev/null +++ b/packages/cosmos/generated/types/tendermint/crypto/proof.ts @@ -0,0 +1,29 @@ +export interface Proof { + total: number; + index: number; + leaf_hash: Uint8Array; + aunts: Uint8Array[]; +} + +export interface ValueOp { + /** Encoded in ProofOp.Key. */ + key: Uint8Array; + /** To encode in ProofOp.Data */ + proof?: Proof; +} + +export interface DominoOp { + key: string; + input: string; + output: string; +} + +export interface ProofOp { + type: string; + key: Uint8Array; + data: Uint8Array; +} + +export interface ProofOps { + ops: ProofOp[]; +} diff --git a/packages/cosmos/generated/types/tendermint/libs/bits/index.ts b/packages/cosmos/generated/types/tendermint/libs/bits/index.ts new file mode 100644 index 000000000..316cec4f0 --- /dev/null +++ b/packages/cosmos/generated/types/tendermint/libs/bits/index.ts @@ -0,0 +1,3 @@ +// @ts-nocheck + +export * from './types'; \ No newline at end of file diff --git a/packages/cosmos/generated/types/tendermint/libs/bits/types.ts b/packages/cosmos/generated/types/tendermint/libs/bits/types.ts new file mode 100644 index 000000000..623f2e5aa --- /dev/null +++ b/packages/cosmos/generated/types/tendermint/libs/bits/types.ts @@ -0,0 +1,4 @@ +export interface BitArray { + bits: number; + elems: number[]; +} diff --git a/packages/cosmos/generated/types/tendermint/p2p/index.ts b/packages/cosmos/generated/types/tendermint/p2p/index.ts new file mode 100644 index 000000000..316cec4f0 --- /dev/null +++ b/packages/cosmos/generated/types/tendermint/p2p/index.ts @@ -0,0 +1,3 @@ +// @ts-nocheck + +export * from './types'; \ No newline at end of file diff --git a/packages/cosmos/generated/types/tendermint/p2p/types.ts b/packages/cosmos/generated/types/tendermint/p2p/types.ts new file mode 100644 index 000000000..cf93dee62 --- /dev/null +++ b/packages/cosmos/generated/types/tendermint/p2p/types.ts @@ -0,0 +1,34 @@ +export interface ProtocolVersion { + p2p: number; + block: number; + app: number; +} + +export interface NodeInfo { + protocol_version?: ProtocolVersion; + node_id: string; + listen_addr: string; + network: string; + version: string; + channels: Uint8Array; + moniker: string; + other?: NodeInfoOther; +} + +export interface NodeInfoOther { + tx_index: string; + rpc_address: string; +} + +export interface PeerInfo { + id: string; + address_info: PeerAddressInfo[]; + last_connected?: Date; +} + +export interface PeerAddressInfo { + address: string; + last_dial_success?: Date; + last_dial_failure?: Date; + dial_failures: number; +} diff --git a/packages/cosmos/generated/types/tendermint/types/block.ts b/packages/cosmos/generated/types/tendermint/types/block.ts new file mode 100644 index 000000000..5fa3da518 --- /dev/null +++ b/packages/cosmos/generated/types/tendermint/types/block.ts @@ -0,0 +1,10 @@ +import type { EvidenceList } from "./evidence"; + +import type { Commit, Data, Header } from "./types"; + +export interface Block { + header?: Header; + data?: Data; + evidence?: EvidenceList; + last_commit?: Commit; +} diff --git a/packages/cosmos/generated/types/tendermint/types/evidence.ts b/packages/cosmos/generated/types/tendermint/types/evidence.ts new file mode 100644 index 000000000..9a6e0606c --- /dev/null +++ b/packages/cosmos/generated/types/tendermint/types/evidence.ts @@ -0,0 +1,28 @@ +import type { LightBlock, Vote } from "./types"; + +import type { Validator } from "./validator"; + +export interface Evidence { + duplicate_vote_evidence?: DuplicateVoteEvidence; + light_client_attack_evidence?: LightClientAttackEvidence; +} + +export interface DuplicateVoteEvidence { + vote_a?: Vote; + vote_b?: Vote; + total_voting_power: number; + validator_power: number; + timestamp?: Date; +} + +export interface LightClientAttackEvidence { + conflicting_block?: LightBlock; + common_height: number; + byzantine_validators: Validator[]; + total_voting_power: number; + timestamp?: Date; +} + +export interface EvidenceList { + evidence: Evidence[]; +} diff --git a/packages/cosmos/generated/types/tendermint/types/index.ts b/packages/cosmos/generated/types/tendermint/types/index.ts new file mode 100644 index 000000000..8485741a4 --- /dev/null +++ b/packages/cosmos/generated/types/tendermint/types/index.ts @@ -0,0 +1,7 @@ +// @ts-nocheck + +export * from './block'; +export * from './evidence'; +export * from './params'; +export * from './types'; +export * from './validator'; \ No newline at end of file diff --git a/packages/cosmos/generated/types/tendermint/types/params.ts b/packages/cosmos/generated/types/tendermint/types/params.ts new file mode 100644 index 000000000..1f2c84fb2 --- /dev/null +++ b/packages/cosmos/generated/types/tendermint/types/params.ts @@ -0,0 +1,143 @@ +import type { Duration } from "../../google/protobuf/duration"; + +export interface ConsensusParams { + block?: BlockParams; + evidence?: EvidenceParams; + validator?: ValidatorParams; + version?: VersionParams; + synchrony?: SynchronyParams; + timeout?: TimeoutParams; + abci?: ABCIParams; +} + +export interface BlockParams { + /** + * Max block size, in bytes. + * Note: must be greater than 0 + */ + max_bytes: number; + /** + * Max gas per block. + * Note: must be greater or equal to -1 + */ + max_gas: number; +} + +export interface EvidenceParams { + /** + * Max age of evidence, in blocks. + * + * The basic formula for calculating this is: MaxAgeDuration / {average block + * time}. + */ + max_age_num_blocks: number; + /** + * 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?: Duration; + /** + * 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: number; +} + +export interface ValidatorParams { + pub_key_types: string[]; +} + +export interface VersionParams { + app_version: number; +} + +export interface HashedParams { + block_max_bytes: number; + block_max_gas: number; +} + +export interface SynchronyParams { + /** + * message_delay bounds how long a proposal message may take to reach all validators on a network + * and still be considered valid. + */ + message_delay?: Duration; + /** + * precision bounds how skewed a proposer's clock may be from any validator + * on the network while still producing valid proposals. + */ + precision?: Duration; +} + +export interface TimeoutParams { + /** + * These fields configure the timeouts for the propose step of the Tendermint + * consensus algorithm: propose is the initial timeout and propose_delta + * determines how much the timeout grows in subsequent rounds. + * For the first round, this propose timeout is used and for every subsequent + * round, the timeout grows by propose_delta. + * + * For example: + * With propose = 10ms, propose_delta = 5ms, the first round's propose phase + * timeout would be 10ms, the second round's would be 15ms, the third 20ms and so on. + * + * If a node waiting for a proposal message does not receive one matching its + * current height and round before this timeout, the node will issue a + * nil prevote for the round and advance to the next step. + */ + propose?: Duration; + propose_delta?: Duration; + /** + * vote along with vote_delta configure the timeout for both of the prevote and + * precommit steps of the Tendermint consensus algorithm. + * + * These parameters influence the vote step timeouts in the the same way that + * the propose and propose_delta parameters do to the proposal step. + * + * The vote timeout does not begin until a quorum of votes has been received. Once + * a quorum of votes has been seen and this timeout elapses, Tendermint will + * procced to the next step of the consensus algorithm. If Tendermint receives + * all of the remaining votes before the end of the timeout, it will proceed + * to the next step immediately. + */ + vote?: Duration; + vote_delta?: Duration; + /** + * commit configures how long Tendermint will wait after receiving a quorum of + * precommits before beginning consensus for the next height. This can be + * used to allow slow precommits to arrive for inclusion in the next height before progressing. + */ + commit?: Duration; + /** + * bypass_commit_timeout configures the node to proceed immediately to + * the next height once the node has received all precommits for a block, forgoing + * the remaining commit timeout. + * Setting bypass_commit_timeout false (the default) causes Tendermint to wait + * for the full commit timeout. + */ + bypass_commit_timeout: boolean; +} + +export interface ABCIParams { + /** + * vote_extensions_enable_height configures the first height during which + * vote extensions will be enabled. During this specified height, and for all + * subsequent heights, precommit messages that do not contain valid extension data + * will be considered invalid. Prior to this height, vote extensions will not + * be used or accepted by validators on the network. + * + * Once enabled, vote extensions will be created by the application in ExtendVote, + * passed to the application for validation in VerifyVoteExtension and given + * to the application to use when proposing a block during PrepareProposal. + */ + vote_extensions_enable_height: number; + /** + * Indicates if CheckTx should be called on all the transactions + * remaining in the mempool after a block is executed. + */ + recheck_tx: boolean; +} diff --git a/packages/cosmos/generated/types/tendermint/types/types.ts b/packages/cosmos/generated/types/tendermint/types/types.ts new file mode 100644 index 000000000..cb9e5ea22 --- /dev/null +++ b/packages/cosmos/generated/types/tendermint/types/types.ts @@ -0,0 +1,167 @@ +import type { Proof } from "../crypto/proof"; + +import type { Consensus } from "../version/types"; + +import type { ValidatorSet } from "./validator"; + +export enum BlockIDFlag { + BLOCK_ID_FLAG_UNKNOWN = 0, + BLOCK_ID_FLAG_ABSENT = 1, + BLOCK_ID_FLAG_COMMIT = 2, + BLOCK_ID_FLAG_NIL = 3, + UNRECOGNIZED = -1, +} + +export enum SignedMsgType { + SIGNED_MSG_TYPE_UNKNOWN = 0, + /** SIGNED_MSG_TYPE_PREVOTE - Votes */ + SIGNED_MSG_TYPE_PREVOTE = 1, + SIGNED_MSG_TYPE_PRECOMMIT = 2, + /** SIGNED_MSG_TYPE_PROPOSAL - Proposals */ + SIGNED_MSG_TYPE_PROPOSAL = 32, + UNRECOGNIZED = -1, +} + +export interface PartSetHeader { + total: number; + hash: Uint8Array; +} + +export interface Part { + index: number; + bytes: Uint8Array; + proof?: Proof; +} + +export interface BlockID { + hash: Uint8Array; + part_set_header?: PartSetHeader; +} + +export interface Header { + /** basic block info */ + version?: Consensus; + chain_id: string; + height: number; + time?: Date; + /** prev block info */ + last_block_id?: BlockID; + /** hashes of block data */ + last_commit_hash: Uint8Array; + /** transactions */ + 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; + /** root hash of all results from the txs from the previous block */ + last_results_hash: Uint8Array; + /** consensus info */ + evidence_hash: Uint8Array; + /** original proposer of the block */ + proposer_address: Uint8Array; +} + +export interface Data { + /** + * 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 Vote { + type: SignedMsgType; + height: number; + round: number; + /** zero if vote is nil. */ + block_id?: BlockID; + timestamp?: Date; + validator_address: Uint8Array; + validator_index: number; + /** + * Vote signature by the validator if they participated in consensus for the + * associated block. + */ + signature: Uint8Array; + /** + * Vote extension provided by the application. Only valid for precommit + * messages. + */ + extension: Uint8Array; + /** + * Vote extension signature by the validator if they participated in + * consensus for the associated block. Only valid for precommit messages. + */ + extension_signature: Uint8Array; +} + +export interface Commit { + height: number; + round: number; + block_id?: BlockID; + signatures: CommitSig[]; +} + +export interface CommitSig { + block_id_flag: BlockIDFlag; + validator_address: Uint8Array; + timestamp?: Date; + signature: Uint8Array; +} + +export interface ExtendedCommit { + height: number; + round: number; + block_id?: BlockID; + extended_signatures: ExtendedCommitSig[]; +} + +export interface ExtendedCommitSig { + block_id_flag: BlockIDFlag; + validator_address: Uint8Array; + timestamp?: Date; + signature: Uint8Array; + /** Vote extension data */ + extension: Uint8Array; + /** Vote extension signature */ + extension_signature: Uint8Array; +} + +export interface Proposal { + type: SignedMsgType; + height: number; + round: number; + pol_round: number; + block_id?: BlockID; + timestamp?: Date; + signature: Uint8Array; +} + +export interface SignedHeader { + header?: Header; + commit?: Commit; +} + +export interface LightBlock { + signed_header?: SignedHeader; + validator_set?: ValidatorSet; +} + +export interface BlockMeta { + block_id?: BlockID; + block_size: number; + header?: Header; + num_txs: number; +} + +export interface TxProof { + root_hash: Uint8Array; + data: Uint8Array; + proof?: Proof; +} diff --git a/packages/cosmos/generated/types/tendermint/types/validator.ts b/packages/cosmos/generated/types/tendermint/types/validator.ts new file mode 100644 index 000000000..454343da8 --- /dev/null +++ b/packages/cosmos/generated/types/tendermint/types/validator.ts @@ -0,0 +1,19 @@ +import type { PublicKey } from "../crypto/keys"; + +export interface ValidatorSet { + validators: Validator[]; + proposer?: Validator; + total_voting_power: number; +} + +export interface Validator { + address: Uint8Array; + pub_key?: PublicKey; + voting_power: number; + proposer_priority: number; +} + +export interface SimpleValidator { + pub_key?: PublicKey; + voting_power: number; +} diff --git a/packages/cosmos/generated/types/tendermint/version/index.ts b/packages/cosmos/generated/types/tendermint/version/index.ts new file mode 100644 index 000000000..316cec4f0 --- /dev/null +++ b/packages/cosmos/generated/types/tendermint/version/index.ts @@ -0,0 +1,3 @@ +// @ts-nocheck + +export * from './types'; \ No newline at end of file diff --git a/packages/cosmos/generated/types/tendermint/version/types.ts b/packages/cosmos/generated/types/tendermint/version/types.ts new file mode 100644 index 000000000..d0b8424bf --- /dev/null +++ b/packages/cosmos/generated/types/tendermint/version/types.ts @@ -0,0 +1,9 @@ +export interface App { + protocol: number; + software: string; +} + +export interface Consensus { + block: number; + app: number; +} diff --git a/packages/cosmos/generated/types/tokenfactory/authorityMetadata.ts b/packages/cosmos/generated/types/tokenfactory/authorityMetadata.ts new file mode 100644 index 000000000..ba5ef0692 --- /dev/null +++ b/packages/cosmos/generated/types/tokenfactory/authorityMetadata.ts @@ -0,0 +1,4 @@ +export interface DenomAuthorityMetadata { + /** Can be empty for no admin, or a valid sei address */ + admin: string; +} diff --git a/packages/cosmos/generated/types/tokenfactory/genesis.ts b/packages/cosmos/generated/types/tokenfactory/genesis.ts new file mode 100644 index 000000000..4a85e0e49 --- /dev/null +++ b/packages/cosmos/generated/types/tokenfactory/genesis.ts @@ -0,0 +1,14 @@ +import type { DenomAuthorityMetadata } from "./authorityMetadata"; + +import type { Params } from "./params"; + +export interface GenesisState { + /** params defines the paramaters of the module. */ + params?: Params; + factory_denoms: GenesisDenom[]; +} + +export interface GenesisDenom { + denom: string; + authority_metadata?: DenomAuthorityMetadata; +} diff --git a/packages/cosmos/generated/types/tokenfactory/index.ts b/packages/cosmos/generated/types/tokenfactory/index.ts new file mode 100644 index 000000000..8b1f142e2 --- /dev/null +++ b/packages/cosmos/generated/types/tokenfactory/index.ts @@ -0,0 +1,7 @@ +// @ts-nocheck + +export * from './authorityMetadata'; +export * from './genesis'; +export * from './params'; +export * from './query'; +export * from './tx'; \ No newline at end of file diff --git a/packages/cosmos/generated/types/tokenfactory/params.ts b/packages/cosmos/generated/types/tokenfactory/params.ts new file mode 100644 index 000000000..dbc17de45 --- /dev/null +++ b/packages/cosmos/generated/types/tokenfactory/params.ts @@ -0,0 +1 @@ +export type Params = {}; diff --git a/packages/cosmos/generated/types/tokenfactory/query.ts b/packages/cosmos/generated/types/tokenfactory/query.ts new file mode 100644 index 000000000..44096e08f --- /dev/null +++ b/packages/cosmos/generated/types/tokenfactory/query.ts @@ -0,0 +1,48 @@ +import type { AllowList, Metadata } from "../cosmos/bank/v1beta1/bank"; + +import type { DenomAuthorityMetadata } from "./authorityMetadata"; + +import type { Params } from "./params"; + +export type QueryParamsRequest = {}; + +export interface QueryParamsResponse { + /** params defines the parameters of the module. */ + params?: Params; +} + +export interface QueryDenomAuthorityMetadataRequest { + denom: string; +} + +export interface QueryDenomAuthorityMetadataResponse { + authority_metadata?: DenomAuthorityMetadata; +} + +export interface QueryDenomsFromCreatorRequest { + creator: string; +} + +export interface QueryDenomsFromCreatorResponse { + denoms: string[]; +} + +export interface QueryDenomMetadataRequest { + /** denom is the coin denom to query the metadata for. */ + denom: string; +} + +export interface QueryDenomMetadataResponse { + /** metadata describes and provides all the client information for the requested token. */ + metadata?: Metadata; +} + +export interface QueryDenomAllowListRequest { + /** denom is the coin denom to query the allowlist for. */ + denom: string; +} + +export interface QueryDenomAllowListResponse { + /** allow_list provides addresses allowed for the requested token. */ + allow_list?: AllowList; +} diff --git a/packages/cosmos/generated/types/tokenfactory/tx.ts b/packages/cosmos/generated/types/tokenfactory/tx.ts new file mode 100644 index 000000000..fd28c0fb3 --- /dev/null +++ b/packages/cosmos/generated/types/tokenfactory/tx.ts @@ -0,0 +1,51 @@ +import type { AllowList, Metadata } from "../cosmos/bank/v1beta1/bank"; + +import type { Coin } from "../cosmos/base/v1beta1/coin"; + +export interface MsgCreateDenom { + sender: string; + /** subdenom can be up to 44 "alphanumeric" characters long. */ + subdenom: string; + allow_list?: AllowList; +} + +export interface MsgCreateDenomResponse { + new_token_denom: string; +} + +export interface MsgMint { + sender: string; + amount?: Coin; +} + +export type MsgMintResponse = {}; + +export interface MsgBurn { + sender: string; + amount?: Coin; +} + +export type MsgBurnResponse = {}; + +export interface MsgChangeAdmin { + sender: string; + denom: string; + new_admin: string; +} + +export type MsgChangeAdminResponse = {}; + +export interface MsgSetDenomMetadata { + sender: string; + metadata?: Metadata; +} + +export type MsgSetDenomMetadataResponse = {}; + +export interface MsgUpdateDenom { + sender: string; + denom: string; + allow_list?: AllowList; +} + +export type MsgUpdateDenomResponse = {}; diff --git a/packages/cosmos/package.json b/packages/cosmos/package.json new file mode 100644 index 000000000..835b871c9 --- /dev/null +++ b/packages/cosmos/package.json @@ -0,0 +1,62 @@ +{ + "name": "@sei-js/cosmos", + "version": "0.1.0", + "description": "A Typescript library for building on Sei generated using the official Sei proto files on buf.build.", + "sideEffects": false, + "files": ["dist"], + "scripts": { + "precompile": "rimraf dist", + "compile": "yarn compile:cjs && yarn compile:esm && yarn compile:declarations", + "prebuild": "rimraf generated && rimraf gen", + "build": "yarn generate:all && yarn extract-libraries && yarn compile", + "postbuild": "rimraf gen", + "compile:cjs": "tsc --outDir dist/cjs --module commonjs --project ./tsconfig.json", + "compile:esm": "tsc --outDir dist/esm --module esnext --project ./tsconfig.json", + "compile:declarations": "tsc --project ./tsconfig.declaration.json", + "extract-libraries": "tsx scripts/index.ts", + "generate:all": "yarn generate-sei-cosmos && yarn generate-sei-chain && yarn generate-third-party", + "generate-sei-cosmos": "buf generate buf.build/sei-protocol/cosmos-sdk", + "generate-sei-chain": "buf generate buf.build/sei-protocol/sei-chain", + "generate-third-party": "buf generate buf.build/sei-protocol/third-party", + "lint": "echo 'No linting configured for this package'" + }, + "homepage": "https://github.com/sei-protocol/sei-js#readme", + "keywords": ["sei", "typescript", "types", "enums", "interfaces"], + "repository": "git@github.com:sei-protocol/sei-js.git", + "license": "MIT", + "private": false, + "publishConfig": { + "access": "public" + }, + "peerDependencies": {}, + "dependencies": { + "@bufbuild/protobuf": "^2.1.0", + "@cosmjs/proto-signing": "^0.32.4", + "@cosmjs/stargate": "^0.32.4" + }, + "devDependencies": { + "tsx": "^4.19.1" + }, + "exports": { + "./types/*": { + "import": "./dist/types/types/*/index.js", + "require": "./dist/types/types/*/index.js", + "types": "./dist/types/types/*/index.js" + }, + "./rest": { + "import": "./dist/esm/rest/index.js", + "require": "./dist/cjs/rest/index.js", + "types": "./dist/types/rest/index.d.ts" + }, + "./encoding": { + "import": "./dist/esm/encoding/index.js", + "require": "./dist/cjs/encoding/index.js", + "types": "./dist/types/encoding/index.d.ts" + }, + "./encoding/stargate": { + "import": "./dist/esm/encoding/stargate.js", + "require": "./dist/cjs/encoding/stargate.js", + "types": "./dist/types/encoding/stargate.d.ts" + } + } +} diff --git a/packages/cosmos/public/encoding/common.ts b/packages/cosmos/public/encoding/common.ts new file mode 100644 index 000000000..fd8b78a35 --- /dev/null +++ b/packages/cosmos/public/encoding/common.ts @@ -0,0 +1,27 @@ +import type { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; + +export type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; + +export type DeepPartial = T extends Builtin + ? T + : T extends globalThis.Array + ? globalThis.Array> + : T extends ReadonlyArray + ? ReadonlyArray> + : T extends {} + ? { [K in keyof T]?: DeepPartial } + : Partial; + +export type KeysOfUnion = T extends T ? keyof T : never; + +export type Exact = P extends Builtin ? P : P & { [K in keyof P]: Exact } & { [K in Exclude>]: never }; + +export interface MessageFns { + readonly $type: V; + encode(message: T, writer?: BinaryWriter): BinaryWriter; + decode(input: BinaryReader | Uint8Array, length?: number): T; + fromJSON(object: any): T; + toJSON(message: T): unknown; + create, I>>(base?: I): T; + fromPartial, I>>(object: I): T; +} diff --git a/packages/cosmos/public/encoding/stargate.ts b/packages/cosmos/public/encoding/stargate.ts new file mode 100644 index 000000000..793a49554 --- /dev/null +++ b/packages/cosmos/public/encoding/stargate.ts @@ -0,0 +1,2 @@ +export * from "./amino"; +export * from "./proto"; diff --git a/packages/cosmos/public/rest/fetch.ts b/packages/cosmos/public/rest/fetch.ts new file mode 100644 index 000000000..08d74d196 --- /dev/null +++ b/packages/cosmos/public/rest/fetch.ts @@ -0,0 +1,82 @@ +export interface InitReq extends RequestInit { + pathPrefix?: string; +} + +export function fetchReq<_I, O>(path: string, init?: InitReq): Promise { + const { pathPrefix, ...req } = init || {}; + + const url = pathPrefix ? `${pathPrefix}${path}` : path; + + return fetch(url, req).then((r) => + r.json().then((body: O) => { + if (!r.ok) { + throw body; + } + return body; + }), + ) as Promise; +} + +type Primitive = string | boolean | number; +type RequestPayload = Record; +type FlattenedRequestPayload = Record>; + +function isPlainObject(value: unknown): boolean { + const isObject = Object.prototype.toString.call(value).slice(8, -1) === "Object"; + const isObjLike = value !== null && isObject; + + if (!isObjLike || !isObject) { + return false; + } + + const proto = Object.getPrototypeOf(value); + + return typeof proto === "object" && proto.constructor === Object.prototype.constructor; +} + +function isPrimitive(value: unknown): boolean { + return typeof value === "string" || typeof value === "number" || typeof value === "boolean"; +} + +function isZeroValuePrimitive(value: Primitive): boolean { + return value === false || value === 0 || value === ""; +} + +function flattenRequestPayload(requestPayload: T, path = ""): FlattenedRequestPayload { + return Object.keys(requestPayload).reduce((acc: FlattenedRequestPayload, key: string): FlattenedRequestPayload => { + const value = requestPayload[key]; + const newPath = path ? [path, key].join(".") : key; + + const isNonEmptyPrimitiveArray = Array.isArray(value) && value.every((v) => isPrimitive(v)) && value.length > 0; + const isNonZeroValuePrimitive = isPrimitive(value) && !isZeroValuePrimitive(value as Primitive); + + if (isPlainObject(value)) { + // Recursively flatten objects + const nested = flattenRequestPayload(value as RequestPayload, newPath); + Object.assign(acc, nested); // Merge nested results into accumulator + } else if (isNonZeroValuePrimitive || isNonEmptyPrimitiveArray) { + // Add non-zero primitives or non-empty primitive arrays + acc[newPath] = value as Primitive | Primitive[]; + } + + return acc; + }, {} as FlattenedRequestPayload); +} +export function renderURLSearchParams(requestPayload: any, urlPathParams: string[] = []): string { + const flattenedRequestPayload = flattenRequestPayload(requestPayload); + + const urlSearchParams = Object.keys(flattenedRequestPayload).reduce((acc: string[][], key: string): string[][] => { + // key should not be present in the url path as a parameter + const value = flattenedRequestPayload[key]; + if (!urlPathParams.includes(key)) { + if (Array.isArray(value)) { + value.forEach((m) => acc.push([key, m.toString()])); + } else { + acc.push([key, value.toString()]); + } + } + return acc; + }, [] as string[][]); + + return new URLSearchParams(urlSearchParams).toString(); +} diff --git a/packages/cosmos/scripts/common/create-indexes.ts b/packages/cosmos/scripts/common/create-indexes.ts new file mode 100644 index 000000000..064d23bb2 --- /dev/null +++ b/packages/cosmos/scripts/common/create-indexes.ts @@ -0,0 +1,38 @@ +import { promises } from "node:fs"; +import path from "node:path"; + +const createIndexFile = async (dirPath: string): Promise => { + try { + const files = await promises.readdir(dirPath); + const tsFiles = files.filter((file) => file.endsWith(".ts") && file !== "index.ts"); + + if (tsFiles.length === 0) return; + + // Generate export statements for each file in the directory + const exports = tsFiles.map((file) => { + const fileNameWithoutExt = path.basename(file, ".ts"); + return `export * from './${fileNameWithoutExt}';`; + }); + + const indexFilePath = path.join(dirPath, "index.ts"); + await promises.writeFile(indexFilePath, `// @ts-nocheck\n\n${exports.join("\n")}`, "utf-8"); + } catch (error) { + console.error(`Error processing directory ${dirPath}:`, error); + } +}; + +export const createIndexesForDirectory = async (rootDir: string): Promise => { + try { + const items = await promises.readdir(rootDir, { withFileTypes: true }); + for (const item of items) { + const itemPath = path.join(rootDir, item.name); + if (item.isDirectory()) { + // Recursively check subdirectories + await createIndexesForDirectory(itemPath); + await createIndexFile(itemPath); + } + } + } catch (error) { + console.error(`Error iterating through ${rootDir}:`, error); + } +}; diff --git a/packages/cosmos/scripts/common/utils.ts b/packages/cosmos/scripts/common/utils.ts new file mode 100644 index 000000000..7abf578d8 --- /dev/null +++ b/packages/cosmos/scripts/common/utils.ts @@ -0,0 +1,88 @@ +import { exec } from "node:child_process"; +import { promises as fs, existsSync } from "node:fs"; +import { basename } from "node:path"; +import path from "node:path"; +import util from "node:util"; +import ts from "typescript"; + +const execAsync = util.promisify(exec); + +// Run biome fix on a file to remove unused imports and clean up the code +export const runBiomeFix = async (filePath: string) => { + try { + if (!existsSync(filePath)) return; + + await execAsync(`biome check ${filePath} --write`); + } catch (error) { + // @biome-ignore + console.log(error); + } +}; + +// Read a file and return a TypeScript source file +export const readSourceFile = async (sourceFilePath: string): Promise => { + try { + const fileContent = await fs.readFile(sourceFilePath, "utf-8"); + return ts.createSourceFile(basename(sourceFilePath), fileContent, ts.ScriptTarget.ESNext, true); + } catch (error) { + console.error(`Failed to read the file at ${sourceFilePath}:`, error); + throw error; + } +}; + +// Recursively traverse all nodes in a TypeScript source file +export const traverseNodes = (sourceFile: ts.SourceFile, visitCallback: (node: ts.Node) => void) => { + const visit = (node: ts.SourceFile) => { + visitCallback(node); + ts.forEachChild(node, visitCallback); // Recursively visit child nodes + }; + visit(sourceFile); +}; + +// Write the extracted result to a file +export const writeToFile = async (destinationFilePath: string, result: string) => { + try { + if (!result) return; + + await fs.writeFile(destinationFilePath, result, "utf-8"); + } catch (error) { + console.error(`Failed to write to the file at ${destinationFilePath}:`, error); + throw error; + } +}; + +// Recursively iterate through a directory and return all `.ts` file paths. +export const getAllTsFiles = async (dir: string): Promise => { + let tsFiles: string[] = []; + const files = await fs.readdir(dir, { withFileTypes: true }); + + for (const file of files) { + const fullPath = path.join(dir, file.name); + + if (file.isDirectory()) { + tsFiles = tsFiles.concat(await getAllTsFiles(fullPath)); + } else if (file.isFile() && file.name.endsWith(".ts")) { + tsFiles.push(fullPath); + } + } + + return tsFiles; +}; + +// Find if a specific variable (registry or amino converters) exists in a file +export const findExportInFile = (sourceFile: ts.SourceFile, variableName: string) => { + let found = false; + + const visitor = (node: ts.Node) => { + if ( + ts.isVariableStatement(node) && + node.declarationList.declarations.some((declaration) => ts.isIdentifier(declaration.name) && declaration.name.text === variableName) + ) { + found = true; + } + ts.forEachChild(node, visitor); + }; + + ts.forEachChild(sourceFile, visitor); + return found; +}; diff --git a/packages/cosmos/scripts/encoding/create-encoder.ts b/packages/cosmos/scripts/encoding/create-encoder.ts new file mode 100644 index 000000000..66bc55724 --- /dev/null +++ b/packages/cosmos/scripts/encoding/create-encoder.ts @@ -0,0 +1,75 @@ +import fs from "node:fs"; +import path from "node:path"; +import { runBiomeFix, writeToFile } from "../common/utils"; + +// Recursive function to collect all Query exports in subdirectories and construct Querier object +const collectQueriesRecursively = async ( + dir: string, + rootDir: string, + importStatements: string[], + parentNamespace: Record, + currentKey: string, +) => { + const items = await fs.promises.readdir(dir, { withFileTypes: true }); + + const hasQueryFile = items.some((item) => item.isFile() && item.name === "index.ts"); + + if (hasQueryFile) { + // If 'index.ts' exists, import it and assign the alias directly to the parent namespace + const relativePath = path.relative(rootDir, path.join(dir, "index")).replace(/\\/g, "/"); + + // Replace non-alphanumeric characters (like slashes) with underscores + const alias = path.relative(rootDir, dir).replace(/[^a-zA-Z0-9]/g, "_"); + + // Add import statements from the 'index.ts' file + importStatements.push(`import * as ${alias} from "./${relativePath}";`); + + // Assign the alias directly to the parent namespace + parentNamespace[currentKey] = alias; + } else { + // Otherwise, create a new namespace and recurse into subdirectories + const currentNamespace: Record = {}; + parentNamespace[currentKey] = currentNamespace; + + for (const item of items) { + if (item.isDirectory()) { + const itemPath = path.join(dir, item.name); + // Recursively process subdirectories + await collectQueriesRecursively(itemPath, rootDir, importStatements, currentNamespace, item.name); + } + } + } +}; + +// Function to generate an index file with a Querier object +export const generateEncoderIndexFile = async (rootDir: string): Promise => { + try { + const querierObject: Record = {}; + const importStatements: string[] = []; + + // Start recursively collecting queries from the root directory + await collectQueriesRecursively(rootDir, rootDir, importStatements, querierObject, "Encoder"); + + // Extract the constructed Querier object + const constructedQuerier = querierObject["Encoder"]; + + // Helper function to format Querier object for export + const formatQuerierObject = (obj: any, level = 0): string => { + if (typeof obj === "string") { + return obj; + } + return `{${Object.entries(obj) + .map(([key, value]) => `${key}: ${formatQuerierObject(value, level + 1)}`) + .join(",")}}`; + }; + + // Create the content of the index.ts file + const indexContent = `${importStatements.join("\n")}\n\nexport const Encoder = ${formatQuerierObject(constructedQuerier)};`; + const outputFilePath = path.join(rootDir, "index.ts"); + await writeToFile(outputFilePath, indexContent); + await runBiomeFix(outputFilePath); + console.log(`Generated index file at ${outputFilePath}`); + } catch (error) { + console.error("Error generating index file:", error); + } +}; diff --git a/packages/cosmos/scripts/encoding/extract-encoding.ts b/packages/cosmos/scripts/encoding/extract-encoding.ts new file mode 100644 index 000000000..24f95f62b --- /dev/null +++ b/packages/cosmos/scripts/encoding/extract-encoding.ts @@ -0,0 +1,173 @@ +import { promises as fs } from 'node:fs'; +import path from 'node:path'; +import ts from 'typescript'; +import { readSourceFile, runBiomeFix, traverseNodes, writeToFile } from '../common/utils'; + +// List of specific types that we always want to import from "common.ts" +const COMMON_TYPES = new Set(['Builtin', 'DeepPartial', 'Exact', 'KeysOfUnion', 'MessageFns']); + +const parseRegistryAndAmino = (node: ts.Node, registryEntries: string[], aminoConverters: string[], processedEntries: Set) => { + const nodeText = node.getText().trim(); + const messageMatch = nodeText.match(/MessageFns<(\w+), "(.*?)">/); + if (messageMatch) { + const [_, messageName, typeUrl] = messageMatch; + + // Check if this typeUrl has already been processed to avoid duplicates + if (processedEntries.has(typeUrl)) { + return; // Skip if this typeUrl has already been added + } + processedEntries.add(typeUrl); + + // Generate registry entry + registryEntries.push(`["/${typeUrl}", ${messageName} as never]`); + + // Calculate aminoType + let aminoType = typeUrl; + if (typeUrl.startsWith('cosmos')) { + const msgType = typeUrl.split('.').pop(); + aminoType = `cosmos-sdk/${msgType}`; + } else if (typeUrl.startsWith('seiprotocol')) { + const split = typeUrl.split('.'); + const msgType = split.pop(); + const module = split.pop(); + + console.log(module, msgType); + aminoType = `${module}/${msgType}`; + } + + // Generate Amino converters + aminoConverters.push(` + "/${typeUrl}": { + aminoType: "${aminoType}", + toAmino: (message: ${messageName}) => ({ ...message }), + fromAmino: (object: ${messageName}) => ({ ...object }), + }`); + } +}; + +export const extractEncoding = async (sourceFilePath: string, destinationFilePath: string, relativePath: string): Promise => { + try { + const sourceFile = await readSourceFile(sourceFilePath); + + const importsToCopy: string[] = ['import type { GeneratedType } from "@cosmjs/proto-signing";']; + const enumsToCopy: string[] = []; + const typesToCopy: Set = new Set(); + const typesToImport: Set = new Set(); + const processedEntries: Set = new Set(); + const functionsToCopy: string[] = []; + const constantsToCopy: string[] = []; + + // Used in @cosmjs/stargate clients + const registryEntries: string[] = []; + const aminoConverters: string[] = []; + + // Redefine an interface for imported types to fix a TypeScript error + const interfaceDeclarations: string[] = []; + + traverseNodes(sourceFile, (node) => { + // Extract constants from the source file + if (ts.isVariableStatement(node) && node.declarationList.flags & ts.NodeFlags.Const) { + const variableDeclarations = node.declarationList.declarations; + + for (const declaration of variableDeclarations) { + if (ts.isIdentifier(declaration.name)) { + const varName = declaration.name.text; + + if (varName === 'protobufPackage') return; // Skip this constant + + const nodeText = node.getText(sourceFile).trim(); + parseRegistryAndAmino(node, registryEntries, aminoConverters, processedEntries); + constantsToCopy.push(`${nodeText}\n`); + } + } + } else if (ts.isFunctionDeclaration(node)) { + const nodeText = node.getText(sourceFile).trim(); + functionsToCopy.push(`${nodeText}\n`); + } else if (ts.isImportDeclaration(node)) { + const importText = node.getText(sourceFile).trim(); + importsToCopy.push(importText); + } else if (ts.isEnumDeclaration(node)) { + enumsToCopy.push(node.name.text); + } else if (ts.isTypeAliasDeclaration(node) || ts.isInterfaceDeclaration(node)) { + const typeName = node.name.text; + if (COMMON_TYPES.has(typeName)) { + // Store that this common value is used for import later + typesToImport.add(typeName); + } else { + // collect typename for imports and interface declarations + typesToCopy.add(typeName); + } + } + }); + + // Create the custom import statement for the collected types from "@sei-js/types" + if (typesToCopy.size > 0) { + const splitPath = relativePath.split('/'); + const path = splitPath.slice(0, splitPath.length - 1).join('/'); + + const relativePathToTypes = `${getRelativePathToEncodingRoot(relativePath)}..`; + + const importStatement = `import type { ${Array.from(typesToCopy) + .map((type) => `${type} as ${type}_type`) + .join(', ')} } from "${relativePathToTypes}/types/${path}";`; + importsToCopy.push(importStatement); + + // Create the interface declarations for each type. This is necessary to fix a TypeScript error. + interfaceDeclarations.push( + Array.from(typesToCopy) + .map((type) => `export interface ${type} extends ${type}_type {}`) + .join('\n') + ); + } + + if (enumsToCopy.length > 0) { + const splitPath = relativePath.split('/'); + const path = splitPath.slice(0, splitPath.length - 1).join('/'); + const relativePathToTypes = `${getRelativePathToEncodingRoot(relativePath)}..`; + + const importStatement = `import { ${enumsToCopy.join(', ')} } from "${relativePathToTypes}/types/${path}";`; + importsToCopy.push(importStatement); + } + + // Add the import from "common.ts" for the common types if any are found + if (typesToImport.size > 0) { + const relativePathToCommon = `${getRelativePathToEncodingRoot(relativePath)}common`; + + const commonImportStatement = `import { ${Array.from(typesToImport).join(', ')} } from "${relativePathToCommon}";`; + importsToCopy.push(commonImportStatement); + } + + // Build the result text + let result = [...importsToCopy, ...interfaceDeclarations, ...constantsToCopy, ...functionsToCopy].join('\n\n'); + + // Add the registry entry at the end of the file + if (registryEntries.length > 0) { + const registryDeclaration = `export const registry: Array<[string, GeneratedType]> = [\n ${registryEntries.join(',\n ')}\n];`; + result += registryDeclaration; + } + + // Add the amino converters at the end of the file + if (aminoConverters.length > 0) { + const aminoDeclaration = `export const aminoConverters = {\n ${aminoConverters.join(',\n ')}\n};`; + result += aminoDeclaration; + } + + if (result.trim() !== '' && importsToCopy.length > 1) { + // Ensure output directory exists + await fs.mkdir(path.dirname(destinationFilePath), { recursive: true }); + + await writeToFile(destinationFilePath, result); + await runBiomeFix(destinationFilePath); + } + } catch (error) { + console.error('Error extracting const and function declarations:', error); + } +}; + +const getRelativePathToEncodingRoot = (relativePath: string): string => { + // Count the number of directories in the relative path + const depth = relativePath.split('/').length - 1; + + // Build the string with the appropriate number of '../' + return '../'.repeat(depth); +}; diff --git a/packages/cosmos/scripts/encoding/stargate.ts b/packages/cosmos/scripts/encoding/stargate.ts new file mode 100644 index 000000000..656b2c1b7 --- /dev/null +++ b/packages/cosmos/scripts/encoding/stargate.ts @@ -0,0 +1,103 @@ +import fs from "node:fs"; +import path from "node:path"; +import ts from "typescript"; +import { findExportInFile, runBiomeFix, writeToFile } from "../common/utils"; + +// Configurations +const REGISTRY_CONFIG = { + fileName: "proto.ts", + varName: "registry", + exportName: "seiProtoRegistry", + suffix: "_registry", +}; + +const AMINO_CONFIG = { + fileName: "amino.ts", + varName: "aminoConverters", + exportName: "aminoConverters: AminoConverters", + suffix: "_amino", +}; + +// Helper function to create a unique and descriptive alias +const createAliasFromFilePath = (filePath: string, rootDir: string): string => + path + .relative(rootDir, filePath) + .replace(/\\/g, "/") + .replace(/\.ts$/, "") + .replace(/[^a-zA-Z0-9]/g, "_"); + +// Process TypeScript file to detect if it contains a specific export +const processTsFile = async (filePath: string, varName: string, foundFiles: string[]): Promise => { + try { + const fileContent = await fs.promises.readFile(filePath, "utf-8"); + const sourceFile = ts.createSourceFile(filePath, fileContent, ts.ScriptTarget.Latest, true); + + if (findExportInFile(sourceFile, varName)) { + foundFiles.push(filePath); + } + } catch (error) { + console.error(`Error processing file ${filePath}:`, error); + } +}; + +// Recursively iterate directories to find registry or amino converters +const iterateDirectoriesAndFindExports = async (dirPath: string, varName: string, foundFiles: string[]): Promise => { + const items = await fs.promises.readdir(dirPath, { withFileTypes: true }); + await Promise.all( + items.map(async (item) => { + const itemPath = path.join(dirPath, item.name); + if (item.isDirectory()) { + await iterateDirectoriesAndFindExports(itemPath, varName, foundFiles); + } else if (item.isFile() && item.name.endsWith(".ts")) { + await processTsFile(itemPath, varName, foundFiles); + } + }), + ); +}; + +// Generalized function to create registry or amino converter file +const createFile = async ( + rootDir: string, + foundFiles: string[], + config: { fileName: string; varName: string; exportName: string; suffix: string }, +): Promise => { + try { + if (foundFiles.length === 0) return; + + const imports: string[] = config.varName === "aminoConverters" ? ["import { AminoConverters } from '@cosmjs/stargate';"] : []; + const arrayEntries: string[] = []; + + foundFiles.forEach((filePath) => { + const importPath = path.relative(rootDir, filePath).replace(/\\/g, "/").replace(/\.ts$/, ""); + const alias = createAliasFromFilePath(filePath, rootDir) + config.suffix; + imports.push(`import { ${config.varName} as ${alias} } from './${importPath}';`); + arrayEntries.push(`...${alias}`); + }); + + let fileContent = `${imports.join("\n")}\n\nexport const ${config.exportName} = [${arrayEntries.join(",")}];`; + if (config.varName === "aminoConverters") { + fileContent = `${imports.join("\n")}\n\nexport const ${config.exportName} = {${arrayEntries.join(",")}};`; + } + const outputFilePath = path.join(rootDir, config.fileName); + await writeToFile(outputFilePath, fileContent.trim()); + await runBiomeFix(outputFilePath); + console.log(`Generated ${config.exportName} file in ${outputFilePath}`); + } catch (error) { + console.error(`Error creating ${config.exportName} file:`, error); + } +}; + +// Main function to orchestrate registry and amino converters generation +export const buildCombinedProtoRegistryAndAminoConverters = async (): Promise => { + console.log("Building combined proto registry and amino converters..."); + + const rootDir = "./generated/encoding"; + const registries: string[] = []; + const aminoConverters: string[] = []; + + await iterateDirectoriesAndFindExports(rootDir, REGISTRY_CONFIG.varName, registries); + await iterateDirectoriesAndFindExports(rootDir, AMINO_CONFIG.varName, aminoConverters); + + await createFile(rootDir, registries, REGISTRY_CONFIG); + await createFile(rootDir, aminoConverters, AMINO_CONFIG); +}; diff --git a/packages/cosmos/scripts/index.ts b/packages/cosmos/scripts/index.ts new file mode 100644 index 000000000..448fc3400 --- /dev/null +++ b/packages/cosmos/scripts/index.ts @@ -0,0 +1,78 @@ +import { promises as fs } from "node:fs"; +import path from "node:path"; +import { createIndexesForDirectory } from "./common/create-indexes"; +import { getAllTsFiles } from "./common/utils"; +import { generateEncoderIndexFile } from "./encoding/create-encoder"; +import { extractEncoding } from "./encoding/extract-encoding"; +import { buildCombinedProtoRegistryAndAminoConverters } from "./encoding/stargate"; +import { generateQueryIndexFile } from "./rest/create-querier"; +import { extractRESTClient } from "./rest/extract-rest"; +import { extractTypes } from "./types/extract-types"; + +// Define paths as constants for reuse and easy updates +const GRPC_TS_DIR = "./gen/grpc-gateway"; +const TS_PROTO_DIR = "./gen/ts-proto"; +const TYPES_OUTPUT_DIR = "./generated/types"; +const REST_OUTPUT_DIR = "./generated/rest"; +const ENCODING_OUTPUT_DIR = "./generated/encoding"; +const FETCH_FILE = "./public/rest/fetch.ts"; +const ENCODING_FILES = ["./public/encoding/common.ts", "./public/encoding/stargate.ts"]; + +// Extracts only types from the proto generated TypeScript files in the input directory +async function processGrpcGatewayFiles(): Promise { + try { + const grpcTsFiles = await getAllTsFiles(GRPC_TS_DIR); + + for (const tsFile of grpcTsFiles) { + const relativePath = path.relative(GRPC_TS_DIR, tsFile).replace(".pb.ts", ".ts"); + + const restDestination = path.join(REST_OUTPUT_DIR, relativePath); + await extractRESTClient(tsFile, restDestination, relativePath); + } + await fs.copyFile(FETCH_FILE, `${REST_OUTPUT_DIR}/fetch.ts`); + await generateQueryIndexFile(REST_OUTPUT_DIR); + } catch (error) { + console.error("Error processing gRPC gateway files:", error); + } +} + +// Process proto encoding files and generate the necessary outputs +async function processEncodingFiles(): Promise { + try { + const tsFiles = await getAllTsFiles(TS_PROTO_DIR); + + for (const tsFile of tsFiles) { + const relativePath = path.relative(TS_PROTO_DIR, tsFile).replace(".pb.ts", ".ts"); + const encodingDestination = path.join(ENCODING_OUTPUT_DIR, relativePath); + await extractEncoding(tsFile, encodingDestination, relativePath.replace(".ts", "")); + + const typesDestination = path.join(TYPES_OUTPUT_DIR, relativePath); + await extractTypes(tsFile, typesDestination); + } + + await createIndexesForDirectory(TYPES_OUTPUT_DIR); + + // Copy static encoding files (common.ts, stargate.ts) + await Promise.all(ENCODING_FILES.map((file) => fs.copyFile(file, path.join(ENCODING_OUTPUT_DIR, path.basename(file))))); + + await buildCombinedProtoRegistryAndAminoConverters(); + await createIndexesForDirectory(ENCODING_OUTPUT_DIR); + await generateEncoderIndexFile(ENCODING_OUTPUT_DIR); + } catch (error) { + console.error("Error processing encoding files:", error); + } +} + +// Main function orchestrating the extraction process +async function extractLibrariesFromProto(): Promise { + try { + // Run the GRPC Gateway and Encoding processes in parallel (since they're independent) + await Promise.all([processGrpcGatewayFiles(), processEncodingFiles()]); + + console.log("Generated library successfully."); + } catch (error) { + console.error("Error generating library:", error); + } +} + +extractLibrariesFromProto(); diff --git a/packages/cosmos/scripts/rest/create-querier.ts b/packages/cosmos/scripts/rest/create-querier.ts new file mode 100644 index 000000000..6e4eda1dc --- /dev/null +++ b/packages/cosmos/scripts/rest/create-querier.ts @@ -0,0 +1,75 @@ +import fs from "node:fs"; +import path from "node:path"; +import { runBiomeFix, writeToFile } from "../common/utils"; + +// Recursive function to collect all Query exports in subdirectories and construct Querier object +const collectQueriesRecursively = async ( + dir: string, + rootDir: string, + importStatements: string[], + parentNamespace: Record, + currentKey: string, +) => { + const items = await fs.promises.readdir(dir, { withFileTypes: true }); + + const hasQueryFile = items.some((item) => item.isFile() && item.name === "query.ts"); + + if (hasQueryFile) { + // If 'query.ts' exists, import it and assign the alias directly to the parent namespace + const relativePath = path.relative(rootDir, path.join(dir, "query")).replace(/\\/g, "/"); + + // Replace non-alphanumeric characters (like slashes) with underscores + const alias = path.relative(rootDir, dir).replace(/[^a-zA-Z0-9]/g, "_"); + + // Add import statement for the Query from the 'query.ts' file + importStatements.push(`import { Query as ${alias} } from "./${relativePath}";`); + + // Assign the alias directly to the parent namespace + parentNamespace[currentKey] = alias; + } else { + // Otherwise, create a new namespace and recurse into subdirectories + const currentNamespace: Record = {}; + parentNamespace[currentKey] = currentNamespace; + + for (const item of items) { + if (item.isDirectory()) { + const itemPath = path.join(dir, item.name); + // Recursively process subdirectories + await collectQueriesRecursively(itemPath, rootDir, importStatements, currentNamespace, item.name); + } + } + } +}; + +// Function to generate an index file with a Querier object +export const generateQueryIndexFile = async (rootDir: string): Promise => { + try { + const querierObject: Record = {}; + const importStatements: string[] = []; + + // Start recursively collecting queries from the root directory + await collectQueriesRecursively(rootDir, rootDir, importStatements, querierObject, "Querier"); + + // Extract the constructed Querier object + const constructedQuerier = querierObject["Querier"]; + + // Helper function to format Querier object for export + const formatQuerierObject = (obj: any, level = 0): string => { + if (typeof obj === "string") { + return obj; + } + return `{${Object.entries(obj) + .map(([key, value]) => `${key}: ${formatQuerierObject(value, level + 1)}`) + .join(",")}}`; + }; + + // Create the content of the index.ts file + const indexContent = `${importStatements.join("\n")}\n\nexport const Querier = ${formatQuerierObject(constructedQuerier)};`; + const outputFilePath = path.join(rootDir, "index.ts"); + await writeToFile(outputFilePath, indexContent); + await runBiomeFix(outputFilePath); + console.log(`Generated index file at ${outputFilePath}`); + } catch (error) { + console.error("Error generating index file:", error); + } +}; diff --git a/packages/cosmos/scripts/rest/extract-rest.ts b/packages/cosmos/scripts/rest/extract-rest.ts new file mode 100644 index 000000000..4ef2f4dcb --- /dev/null +++ b/packages/cosmos/scripts/rest/extract-rest.ts @@ -0,0 +1,49 @@ +import { promises as fs } from "node:fs"; +import path from "node:path"; +import ts from "typescript"; +import { readSourceFile, runBiomeFix, traverseNodes, writeToFile } from "../common/utils"; + +export const extractRESTClient = async (sourceFilePath: string, destinationFilePath: string, relativePath: string): Promise => { + try { + const sourceFile = await readSourceFile(sourceFilePath); + + const extractedDeclarations: Set = new Set(); + const extractedImports: Set = new Set(); + const typeNames: Set = new Set(); + + traverseNodes(sourceFile, (node) => { + if (ts.isClassDeclaration(node)) { + if (node.name?.text !== "Query") return; // Only grab Query Msg classes + const nodeText = node.getText(sourceFile).trim(); + extractedDeclarations.add(nodeText); + } else if (ts.isImportDeclaration(node)) { + const importText = node.getText(sourceFile).trim().replace(/\.pb/g, ""); // Remove ".pb" from import paths + extractedImports.add(importText); + } else if (ts.isTypeAliasDeclaration(node) || ts.isInterfaceDeclaration(node) || ts.isEnumDeclaration(node)) { + typeNames.add(node.name.text); + } + }); + + // Instead of importing all types from the proto-generated file, we import from the generated types directory + if (typeNames.size > 0) { + const restImportPath = path.relative(path.dirname(destinationFilePath), path.join("generated/types", relativePath)); + const importStatement = `import { ${Array.from(typeNames).join(", ")} } from "${restImportPath}";`; + extractedImports.add(importStatement); + } + + // Build the file with the extracted content + const result = [...Array.from(extractedImports), ...Array.from(extractedDeclarations)].join("\n\n"); + + // Write the extracted content to the destination file if it's not empty and there are declarations (not only imports) + if (result.trim() !== "" && extractedDeclarations.size > 0) { + // Ensure output directory exists + await fs.mkdir(path.dirname(destinationFilePath), { recursive: true }); + + // Save the file then run biome fix to remove unused imports and clean up the code + await writeToFile(destinationFilePath, result); + await runBiomeFix(destinationFilePath); + } + } catch (error) { + console.error("Error extracting REST library from proto-generated files.", error); + } +}; diff --git a/packages/cosmos/scripts/types/extract-types.ts b/packages/cosmos/scripts/types/extract-types.ts new file mode 100644 index 000000000..1b8d7a426 --- /dev/null +++ b/packages/cosmos/scripts/types/extract-types.ts @@ -0,0 +1,60 @@ +import { promises as fs } from "node:fs"; +import path from "node:path"; +import ts from "typescript"; +import { readSourceFile, runBiomeFix, traverseNodes, writeToFile } from "../common/utils"; + +// These get included in the proto registry for other functions, but are not necessary +const EXCLUDED_TYPES = new Set([ + "Builtin", + "DeepPartial", + "Exact", + "KeysOfUnion", + "MessageFns", + "InitReq", + "NotifyStreamEntityArrival", + "JSONStringStreamController", + "Primitive", + "RequestPayload", + "FlattenedRequestPayload", +]); + +export const extractTypes = async (sourceFilePath: string, destinationFilePath: string): Promise => { + try { + const sourceFile = await readSourceFile(sourceFilePath); + + const extractedDeclarations: string[] = []; + const extractedImports: string[] = []; + + traverseNodes(sourceFile, (node: ts.Node) => { + if (ts.isImportDeclaration(node)) { + // ts-proto uses pb imports, we remove the .pb extension + const importText = node.getText(sourceFile).trim().replace(".pb", ""); + extractedImports.push(importText); + } + // Grab all type aliases, interfaces, and enums from the source file + else if (ts.isTypeAliasDeclaration(node) || ts.isInterfaceDeclaration(node) || ts.isEnumDeclaration(node)) { + // We exclude some types that are not needed because those functions are only used in the @sei-js/encoding package + if (!EXCLUDED_TYPES.has(node.name.text)) { + const nodeText = node.getText(sourceFile).trim(); + // ts-proto adds `| undefined` to optional fields, this removes it as it's redundant + const noOrUndefinedText = nodeText.replace(/ \| undefined/g, ""); + extractedDeclarations.push(noOrUndefinedText); + } + } + }); + + // Rebuild the file with the extracted types and imports if any were found + if (extractedImports.length > 0 || extractedDeclarations.length > 0) { + const result = [...extractedImports, ...extractedDeclarations].join("\n\n"); + + // Ensure output directory exists + await fs.mkdir(path.dirname(destinationFilePath), { recursive: true }); + + // Save the file then run biome fix to remove unused imports and clean up the code + await writeToFile(destinationFilePath, result); + await runBiomeFix(destinationFilePath); + } + } catch (error) { + console.error("Error extracting types from proto generated files:", error); + } +}; diff --git a/packages/cosmos/tsconfig.declaration.json b/packages/cosmos/tsconfig.declaration.json new file mode 100644 index 000000000..6e3c44cca --- /dev/null +++ b/packages/cosmos/tsconfig.declaration.json @@ -0,0 +1,9 @@ +{ + "extends": "./tsconfig.json", + "compilerOptions": { + "outDir": "./dist/types", + "declaration": true, + "emitDeclarationOnly": true, + "isolatedModules": false + } +} diff --git a/packages/cosmos/tsconfig.json b/packages/cosmos/tsconfig.json new file mode 100644 index 000000000..491eae1cc --- /dev/null +++ b/packages/cosmos/tsconfig.json @@ -0,0 +1,8 @@ +{ + "extends": "../../tsconfig.base.json", + "include": ["./generated/encoding", "./generated/rest"], + "exclude": ["./generated/types"], + "compilerOptions": { + "outDir": "./dist" + } +} diff --git a/packages/ledger/package.json b/packages/ledger/package.json index ea0015a47..b83742b0f 100644 --- a/packages/ledger/package.json +++ b/packages/ledger/package.json @@ -34,9 +34,10 @@ "access": "public" }, "dependencies": { + "@cosmjs/crypto": "^0.32.4", "@cosmjs/stargate": "^0.32.4", "@ledgerhq/hw-transport-node-hid": "^6.29.3", - "@zondax/ledger-sei": "^1.0.0" + "@zondax/ledger-sei": "1.0.1" }, "peerDependencies": {}, "devDependencies": {}, diff --git a/packages/ledger/src/cosmos/seiLedgerOfflineAminoSigner.ts b/packages/ledger/src/cosmos/seiLedgerOfflineAminoSigner.ts index 368144b27..7c38616b5 100644 --- a/packages/ledger/src/cosmos/seiLedgerOfflineAminoSigner.ts +++ b/packages/ledger/src/cosmos/seiLedgerOfflineAminoSigner.ts @@ -1,11 +1,5 @@ -import { - AminoSignResponse, - encodeSecp256k1Signature, - OfflineAminoSigner, - serializeSignDoc, - StdSignDoc -} from '@cosmjs/amino'; -import {fromHex } from '@cosmjs/encoding'; +import { AminoSignResponse, encodeSecp256k1Signature, OfflineAminoSigner, serializeSignDoc, StdSignDoc } from '@cosmjs/amino'; +import { fromHex } from '@cosmjs/encoding'; import { AccountData } from '@cosmjs/proto-signing'; import { Secp256k1Signature } from '@cosmjs/crypto'; import { SeiApp } from '@zondax/ledger-sei'; @@ -14,37 +8,51 @@ import { SeiApp } from '@zondax/ledger-sei'; * A signer implementation that uses a Ledger device to sign transactions */ export class SeiLedgerOfflineAminoSigner implements OfflineAminoSigner { - private readonly path: string; - private readonly app: SeiApp; + private readonly path: string; + private readonly app: SeiApp; - /** - * Creates a new SeiLedgerOfflineAminoSigner - * @param app Ledger Sei app instance - * @param path hd derivation path (e.g. "m/44'/60'/0'/0/0") - */ - constructor(app: SeiApp, path: string) { - this.path = path; - this.app = app; - } + /** + * Creates a new SeiLedgerOfflineAminoSigner + * @param app Ledger Sei app instance + * @param path hd derivation path (e.g. "m/44'/60'/0'/0/0") + */ + constructor(app: SeiApp, path: string) { + this.path = path; + this.app = app; + } - public async getAccounts(): Promise { - const nativeAddress = await this.app.getCosmosAddress(this.path); - return [ - { - address: nativeAddress.address, - algo: "secp256k1", - pubkey: fromHex(nativeAddress.pubKey) - }, - ]; - } + public async getAccounts(): Promise { + const nativeAddress = await this.app.getCosmosAddress(this.path); + return [ + { + address: nativeAddress.address, + algo: 'secp256k1', + pubkey: fromHex(nativeAddress.pubKey) + } + ]; + } - public async signAmino(signerAddress: string, signDoc: StdSignDoc): Promise { - const signature = await this.app.signCosmos(this.path, Buffer.from(serializeSignDoc(signDoc))); - const sig = new Secp256k1Signature(signature.r, signature.s).toFixedLength(); - const nativeAddress = await this.app.getCosmosAddress(this.path); - return { - signed: signDoc, - signature: encodeSecp256k1Signature(fromHex(nativeAddress.pubKey), sig), - }; - } + public async signAmino(_signerAddress: string, signDoc: StdSignDoc): Promise { + const signature = await this.app.signCosmos(this.path, Buffer.from(serializeSignDoc(signDoc))); + const sig = new Secp256k1Signature(removeLeadingZeros(signature.r), removeLeadingZeros(signature.s)).toFixedLength(); + const nativeAddress = await this.app.getCosmosAddress(this.path); + return { + signed: signDoc, + signature: encodeSecp256k1Signature(fromHex(nativeAddress.pubKey), sig) + }; + } } + +/** + * Remove leading zeros from a Uint8Array and return a new Uint8Array + * This is required for the Secp256k1Signature constructor in @cosmjs/crypto + * @param uint8Array + */ +const removeLeadingZeros = (uint8Array: Uint8Array): Uint8Array => { + let i = 0; + while (i < uint8Array.length && uint8Array[i] === 0) { + i++; + } + + return new Uint8Array(uint8Array.slice(i)); +}; diff --git a/packages/proto/__tests__/.gitkeep b/packages/proto/__tests__/.gitkeep deleted file mode 100644 index e69de29bb..000000000 diff --git a/tsconfig.base.json b/tsconfig.base.json index 663a83db1..10ac00787 100644 --- a/tsconfig.base.json +++ b/tsconfig.base.json @@ -15,7 +15,7 @@ "baseUrl": "./", "paths": { - "@sei-js/proto/*": ["packages/proto/dist/esm/codegen/*", "packages/proto/dist/cjs/codegen/*"], + "@sei-js/cosmos/*": ["packages/cosmos/dist/esm/*", "packages/cosmos/dist/cjs/*"], "@sei-js/cosmjs/*": ["packages/cosmjs/dist/esm/*", "packages/cosmjs/dist/cjs/*"], "@sei-js/evm/*": ["packages/evm/dist/esm/*", "packages/evm/dist/cjs/*"], "@sei-js/registry/*": ["packages/registry/dist/esm/*", "packages/registry/dist/cjs/*"] diff --git a/yarn.lock b/yarn.lock index 129c63e85..84e1145bb 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1388,6 +1388,65 @@ resolved "https://registry.yarnpkg.com/@bcoe/v8-coverage/-/v8-coverage-0.2.3.tgz#75a2e8b51cb758a7553d6804a5932d7aace75c39" integrity sha512-0hYQ8SB4Db5zvZB4axdMHGwEaQjkZzFjQiN9LVYvIFB2nSUHW9tYpxWriPrWDASIxiaXax83REcLxuSdnGPZtw== +"@biomejs/biome@^1.9.2": + version "1.9.2" + resolved "https://registry.yarnpkg.com/@biomejs/biome/-/biome-1.9.2.tgz#297a6a0172e46124b9b6058ec3875091d352a0be" + integrity sha512-4j2Gfwft8Jqp1X0qLYvK4TEy4xhTo4o6rlvJPsjPeEame8gsmbGQfOPBkw7ur+7/Z/f0HZmCZKqbMvR7vTXQYQ== + optionalDependencies: + "@biomejs/cli-darwin-arm64" "1.9.2" + "@biomejs/cli-darwin-x64" "1.9.2" + "@biomejs/cli-linux-arm64" "1.9.2" + "@biomejs/cli-linux-arm64-musl" "1.9.2" + "@biomejs/cli-linux-x64" "1.9.2" + "@biomejs/cli-linux-x64-musl" "1.9.2" + "@biomejs/cli-win32-arm64" "1.9.2" + "@biomejs/cli-win32-x64" "1.9.2" + +"@biomejs/cli-darwin-arm64@1.9.2": + version "1.9.2" + resolved "https://registry.yarnpkg.com/@biomejs/cli-darwin-arm64/-/cli-darwin-arm64-1.9.2.tgz#9303e426156189b2ab469154f7cd94ecfbf8bd5e" + integrity sha512-rbs9uJHFmhqB3Td0Ro+1wmeZOHhAPTL3WHr8NtaVczUmDhXkRDWScaxicG9+vhSLj1iLrW47itiK6xiIJy6vaA== + +"@biomejs/cli-darwin-x64@1.9.2": + version "1.9.2" + resolved "https://registry.yarnpkg.com/@biomejs/cli-darwin-x64/-/cli-darwin-x64-1.9.2.tgz#a674e61c04b5aeca31b5b1e7f7b678937a6e90ac" + integrity sha512-BlfULKijNaMigQ9GH9fqJVt+3JTDOSiZeWOQtG/1S1sa8Lp046JHG3wRJVOvekTPL9q/CNFW1NVG8J0JN+L1OA== + +"@biomejs/cli-linux-arm64-musl@1.9.2": + version "1.9.2" + resolved "https://registry.yarnpkg.com/@biomejs/cli-linux-arm64-musl/-/cli-linux-arm64-musl-1.9.2.tgz#b126b0093a7b7632c01a948bf7a0feaf5040ea76" + integrity sha512-ZATvbUWhNxegSALUnCKWqetTZqrK72r2RsFD19OK5jXDj/7o1hzI1KzDNG78LloZxftrwr3uI9SqCLh06shSZw== + +"@biomejs/cli-linux-arm64@1.9.2": + version "1.9.2" + resolved "https://registry.yarnpkg.com/@biomejs/cli-linux-arm64/-/cli-linux-arm64-1.9.2.tgz#c71b4aa374fcd32d3f1a9e7c8a6ce3090e9b6be4" + integrity sha512-T8TJuSxuBDeQCQzxZu2o3OU4eyLumTofhCxxFd3+aH2AEWVMnH7Z/c3QP1lHI5RRMBP9xIJeMORqDQ5j+gVZzw== + +"@biomejs/cli-linux-x64-musl@1.9.2": + version "1.9.2" + resolved "https://registry.yarnpkg.com/@biomejs/cli-linux-x64-musl/-/cli-linux-x64-musl-1.9.2.tgz#5fce02295b435362aa75044ddc388547fbbbbb19" + integrity sha512-CjPM6jT1miV5pry9C7qv8YJk0FIZvZd86QRD3atvDgfgeh9WQU0k2Aoo0xUcPdTnoz0WNwRtDicHxwik63MmSg== + +"@biomejs/cli-linux-x64@1.9.2": + version "1.9.2" + resolved "https://registry.yarnpkg.com/@biomejs/cli-linux-x64/-/cli-linux-x64-1.9.2.tgz#17d7bac0b6ebb20b9fb18812d4ef390f5855858f" + integrity sha512-T0cPk3C3Jr2pVlsuQVTBqk2qPjTm8cYcTD9p/wmR9MeVqui1C/xTVfOIwd3miRODFMrJaVQ8MYSXnVIhV9jTjg== + +"@biomejs/cli-win32-arm64@1.9.2": + version "1.9.2" + resolved "https://registry.yarnpkg.com/@biomejs/cli-win32-arm64/-/cli-win32-arm64-1.9.2.tgz#725734c4dc35cdcad3ef5cbcd85c6ff1238afa46" + integrity sha512-2x7gSty75bNIeD23ZRPXyox6Z/V0M71ObeJtvQBhi1fgrvPdtkEuw7/0wEHg6buNCubzOFuN9WYJm6FKoUHfhg== + +"@biomejs/cli-win32-x64@1.9.2": + version "1.9.2" + resolved "https://registry.yarnpkg.com/@biomejs/cli-win32-x64/-/cli-win32-x64-1.9.2.tgz#6f506d604d3349c1ba674d46cb96540c00a2ba83" + integrity sha512-JC3XvdYcjmu1FmAehVwVV0SebLpeNTnO2ZaMdGCSOdS7f8O9Fq14T2P1gTG1Q29Q8Dt1S03hh0IdVpIZykOL8g== + +"@bufbuild/protobuf@^2.1.0": + version "2.1.0" + resolved "https://registry.yarnpkg.com/@bufbuild/protobuf/-/protobuf-2.1.0.tgz#6925f30c25789b4f74d7c505e731c96f79fb48a7" + integrity sha512-+2Mx67Y3skJ4NCD/qNSdBJNWtu6x6Qr53jeNg+QcwiL6mt0wK+3jwHH2x1p7xaYH6Ve2JKOVn0OxU35WsmqI9A== + "@changesets/apply-release-plan@^7.0.0": version "7.0.0" resolved "https://registry.yarnpkg.com/@changesets/apply-release-plan/-/apply-release-plan-7.0.0.tgz#ce3c3dfc5720550a5d592b54ad2f411f816ec5ff" @@ -2170,116 +2229,236 @@ resolved "https://registry.yarnpkg.com/@esbuild/aix-ppc64/-/aix-ppc64-0.19.12.tgz#d1bc06aedb6936b3b6d313bf809a5a40387d2b7f" integrity sha512-bmoCYyWdEL3wDQIVbcyzRyeKLgk2WtWLTWz1ZIAZF/EGbNOwSA6ew3PftJ1PqMiOOGu0OyFMzG53L0zqIpPeNA== +"@esbuild/aix-ppc64@0.23.1": + version "0.23.1" + resolved "https://registry.yarnpkg.com/@esbuild/aix-ppc64/-/aix-ppc64-0.23.1.tgz#51299374de171dbd80bb7d838e1cfce9af36f353" + integrity sha512-6VhYk1diRqrhBAqpJEdjASR/+WVRtfjpqKuNw11cLiaWpAT/Uu+nokB+UJnevzy/P9C/ty6AOe0dwueMrGh/iQ== + "@esbuild/android-arm64@0.19.12": version "0.19.12" resolved "https://registry.yarnpkg.com/@esbuild/android-arm64/-/android-arm64-0.19.12.tgz#7ad65a36cfdb7e0d429c353e00f680d737c2aed4" integrity sha512-P0UVNGIienjZv3f5zq0DP3Nt2IE/3plFzuaS96vihvD0Hd6H/q4WXUGpCxD/E8YrSXfNyRPbpTq+T8ZQioSuPA== +"@esbuild/android-arm64@0.23.1": + version "0.23.1" + resolved "https://registry.yarnpkg.com/@esbuild/android-arm64/-/android-arm64-0.23.1.tgz#58565291a1fe548638adb9c584237449e5e14018" + integrity sha512-xw50ipykXcLstLeWH7WRdQuysJqejuAGPd30vd1i5zSyKK3WE+ijzHmLKxdiCMtH1pHz78rOg0BKSYOSB/2Khw== + "@esbuild/android-arm@0.19.12": version "0.19.12" resolved "https://registry.yarnpkg.com/@esbuild/android-arm/-/android-arm-0.19.12.tgz#b0c26536f37776162ca8bde25e42040c203f2824" integrity sha512-qg/Lj1mu3CdQlDEEiWrlC4eaPZ1KztwGJ9B6J+/6G+/4ewxJg7gqj8eVYWvao1bXrqGiW2rsBZFSX3q2lcW05w== +"@esbuild/android-arm@0.23.1": + version "0.23.1" + resolved "https://registry.yarnpkg.com/@esbuild/android-arm/-/android-arm-0.23.1.tgz#5eb8c652d4c82a2421e3395b808e6d9c42c862ee" + integrity sha512-uz6/tEy2IFm9RYOyvKl88zdzZfwEfKZmnX9Cj1BHjeSGNuGLuMD1kR8y5bteYmwqKm1tj8m4cb/aKEorr6fHWQ== + "@esbuild/android-x64@0.19.12": version "0.19.12" resolved "https://registry.yarnpkg.com/@esbuild/android-x64/-/android-x64-0.19.12.tgz#cb13e2211282012194d89bf3bfe7721273473b3d" integrity sha512-3k7ZoUW6Q6YqhdhIaq/WZ7HwBpnFBlW905Fa4s4qWJyiNOgT1dOqDiVAQFwBH7gBRZr17gLrlFCRzF6jFh7Kew== +"@esbuild/android-x64@0.23.1": + version "0.23.1" + resolved "https://registry.yarnpkg.com/@esbuild/android-x64/-/android-x64-0.23.1.tgz#ae19d665d2f06f0f48a6ac9a224b3f672e65d517" + integrity sha512-nlN9B69St9BwUoB+jkyU090bru8L0NA3yFvAd7k8dNsVH8bi9a8cUAUSEcEEgTp2z3dbEDGJGfP6VUnkQnlReg== + "@esbuild/darwin-arm64@0.19.12": version "0.19.12" resolved "https://registry.yarnpkg.com/@esbuild/darwin-arm64/-/darwin-arm64-0.19.12.tgz#cbee41e988020d4b516e9d9e44dd29200996275e" integrity sha512-B6IeSgZgtEzGC42jsI+YYu9Z3HKRxp8ZT3cqhvliEHovq8HSX2YX8lNocDn79gCKJXOSaEot9MVYky7AKjCs8g== +"@esbuild/darwin-arm64@0.23.1": + version "0.23.1" + resolved "https://registry.yarnpkg.com/@esbuild/darwin-arm64/-/darwin-arm64-0.23.1.tgz#05b17f91a87e557b468a9c75e9d85ab10c121b16" + integrity sha512-YsS2e3Wtgnw7Wq53XXBLcV6JhRsEq8hkfg91ESVadIrzr9wO6jJDMZnCQbHm1Guc5t/CdDiFSSfWP58FNuvT3Q== + "@esbuild/darwin-x64@0.19.12": version "0.19.12" resolved "https://registry.yarnpkg.com/@esbuild/darwin-x64/-/darwin-x64-0.19.12.tgz#e37d9633246d52aecf491ee916ece709f9d5f4cd" integrity sha512-hKoVkKzFiToTgn+41qGhsUJXFlIjxI/jSYeZf3ugemDYZldIXIxhvwN6erJGlX4t5h417iFuheZ7l+YVn05N3A== +"@esbuild/darwin-x64@0.23.1": + version "0.23.1" + resolved "https://registry.yarnpkg.com/@esbuild/darwin-x64/-/darwin-x64-0.23.1.tgz#c58353b982f4e04f0d022284b8ba2733f5ff0931" + integrity sha512-aClqdgTDVPSEGgoCS8QDG37Gu8yc9lTHNAQlsztQ6ENetKEO//b8y31MMu2ZaPbn4kVsIABzVLXYLhCGekGDqw== + "@esbuild/freebsd-arm64@0.19.12": version "0.19.12" resolved "https://registry.yarnpkg.com/@esbuild/freebsd-arm64/-/freebsd-arm64-0.19.12.tgz#1ee4d8b682ed363b08af74d1ea2b2b4dbba76487" integrity sha512-4aRvFIXmwAcDBw9AueDQ2YnGmz5L6obe5kmPT8Vd+/+x/JMVKCgdcRwH6APrbpNXsPz+K653Qg8HB/oXvXVukA== +"@esbuild/freebsd-arm64@0.23.1": + version "0.23.1" + resolved "https://registry.yarnpkg.com/@esbuild/freebsd-arm64/-/freebsd-arm64-0.23.1.tgz#f9220dc65f80f03635e1ef96cfad5da1f446f3bc" + integrity sha512-h1k6yS8/pN/NHlMl5+v4XPfikhJulk4G+tKGFIOwURBSFzE8bixw1ebjluLOjfwtLqY0kewfjLSrO6tN2MgIhA== + "@esbuild/freebsd-x64@0.19.12": version "0.19.12" resolved "https://registry.yarnpkg.com/@esbuild/freebsd-x64/-/freebsd-x64-0.19.12.tgz#37a693553d42ff77cd7126764b535fb6cc28a11c" integrity sha512-EYoXZ4d8xtBoVN7CEwWY2IN4ho76xjYXqSXMNccFSx2lgqOG/1TBPW0yPx1bJZk94qu3tX0fycJeeQsKovA8gg== +"@esbuild/freebsd-x64@0.23.1": + version "0.23.1" + resolved "https://registry.yarnpkg.com/@esbuild/freebsd-x64/-/freebsd-x64-0.23.1.tgz#69bd8511fa013b59f0226d1609ac43f7ce489730" + integrity sha512-lK1eJeyk1ZX8UklqFd/3A60UuZ/6UVfGT2LuGo3Wp4/z7eRTRYY+0xOu2kpClP+vMTi9wKOfXi2vjUpO1Ro76g== + "@esbuild/linux-arm64@0.19.12": version "0.19.12" resolved "https://registry.yarnpkg.com/@esbuild/linux-arm64/-/linux-arm64-0.19.12.tgz#be9b145985ec6c57470e0e051d887b09dddb2d4b" integrity sha512-EoTjyYyLuVPfdPLsGVVVC8a0p1BFFvtpQDB/YLEhaXyf/5bczaGeN15QkR+O4S5LeJ92Tqotve7i1jn35qwvdA== +"@esbuild/linux-arm64@0.23.1": + version "0.23.1" + resolved "https://registry.yarnpkg.com/@esbuild/linux-arm64/-/linux-arm64-0.23.1.tgz#8050af6d51ddb388c75653ef9871f5ccd8f12383" + integrity sha512-/93bf2yxencYDnItMYV/v116zff6UyTjo4EtEQjUBeGiVpMmffDNUyD9UN2zV+V3LRV3/on4xdZ26NKzn6754g== + "@esbuild/linux-arm@0.19.12": version "0.19.12" resolved "https://registry.yarnpkg.com/@esbuild/linux-arm/-/linux-arm-0.19.12.tgz#207ecd982a8db95f7b5279207d0ff2331acf5eef" integrity sha512-J5jPms//KhSNv+LO1S1TX1UWp1ucM6N6XuL6ITdKWElCu8wXP72l9MM0zDTzzeikVyqFE6U8YAV9/tFyj0ti+w== +"@esbuild/linux-arm@0.23.1": + version "0.23.1" + resolved "https://registry.yarnpkg.com/@esbuild/linux-arm/-/linux-arm-0.23.1.tgz#ecaabd1c23b701070484990db9a82f382f99e771" + integrity sha512-CXXkzgn+dXAPs3WBwE+Kvnrf4WECwBdfjfeYHpMeVxWE0EceB6vhWGShs6wi0IYEqMSIzdOF1XjQ/Mkm5d7ZdQ== + "@esbuild/linux-ia32@0.19.12": version "0.19.12" resolved "https://registry.yarnpkg.com/@esbuild/linux-ia32/-/linux-ia32-0.19.12.tgz#d0d86b5ca1562523dc284a6723293a52d5860601" integrity sha512-Thsa42rrP1+UIGaWz47uydHSBOgTUnwBwNq59khgIwktK6x60Hivfbux9iNR0eHCHzOLjLMLfUMLCypBkZXMHA== +"@esbuild/linux-ia32@0.23.1": + version "0.23.1" + resolved "https://registry.yarnpkg.com/@esbuild/linux-ia32/-/linux-ia32-0.23.1.tgz#3ed2273214178109741c09bd0687098a0243b333" + integrity sha512-VTN4EuOHwXEkXzX5nTvVY4s7E/Krz7COC8xkftbbKRYAl96vPiUssGkeMELQMOnLOJ8k3BY1+ZY52tttZnHcXQ== + "@esbuild/linux-loong64@0.19.12": version "0.19.12" resolved "https://registry.yarnpkg.com/@esbuild/linux-loong64/-/linux-loong64-0.19.12.tgz#9a37f87fec4b8408e682b528391fa22afd952299" integrity sha512-LiXdXA0s3IqRRjm6rV6XaWATScKAXjI4R4LoDlvO7+yQqFdlr1Bax62sRwkVvRIrwXxvtYEHHI4dm50jAXkuAA== +"@esbuild/linux-loong64@0.23.1": + version "0.23.1" + resolved "https://registry.yarnpkg.com/@esbuild/linux-loong64/-/linux-loong64-0.23.1.tgz#a0fdf440b5485c81b0fbb316b08933d217f5d3ac" + integrity sha512-Vx09LzEoBa5zDnieH8LSMRToj7ir/Jeq0Gu6qJ/1GcBq9GkfoEAoXvLiW1U9J1qE/Y/Oyaq33w5p2ZWrNNHNEw== + "@esbuild/linux-mips64el@0.19.12": version "0.19.12" resolved "https://registry.yarnpkg.com/@esbuild/linux-mips64el/-/linux-mips64el-0.19.12.tgz#4ddebd4e6eeba20b509d8e74c8e30d8ace0b89ec" integrity sha512-fEnAuj5VGTanfJ07ff0gOA6IPsvrVHLVb6Lyd1g2/ed67oU1eFzL0r9WL7ZzscD+/N6i3dWumGE1Un4f7Amf+w== +"@esbuild/linux-mips64el@0.23.1": + version "0.23.1" + resolved "https://registry.yarnpkg.com/@esbuild/linux-mips64el/-/linux-mips64el-0.23.1.tgz#e11a2806346db8375b18f5e104c5a9d4e81807f6" + integrity sha512-nrFzzMQ7W4WRLNUOU5dlWAqa6yVeI0P78WKGUo7lg2HShq/yx+UYkeNSE0SSfSure0SqgnsxPvmAUu/vu0E+3Q== + "@esbuild/linux-ppc64@0.19.12": version "0.19.12" resolved "https://registry.yarnpkg.com/@esbuild/linux-ppc64/-/linux-ppc64-0.19.12.tgz#adb67dadb73656849f63cd522f5ecb351dd8dee8" integrity sha512-nYJA2/QPimDQOh1rKWedNOe3Gfc8PabU7HT3iXWtNUbRzXS9+vgB0Fjaqr//XNbd82mCxHzik2qotuI89cfixg== +"@esbuild/linux-ppc64@0.23.1": + version "0.23.1" + resolved "https://registry.yarnpkg.com/@esbuild/linux-ppc64/-/linux-ppc64-0.23.1.tgz#06a2744c5eaf562b1a90937855b4d6cf7c75ec96" + integrity sha512-dKN8fgVqd0vUIjxuJI6P/9SSSe/mB9rvA98CSH2sJnlZ/OCZWO1DJvxj8jvKTfYUdGfcq2dDxoKaC6bHuTlgcw== + "@esbuild/linux-riscv64@0.19.12": version "0.19.12" resolved "https://registry.yarnpkg.com/@esbuild/linux-riscv64/-/linux-riscv64-0.19.12.tgz#11bc0698bf0a2abf8727f1c7ace2112612c15adf" integrity sha512-2MueBrlPQCw5dVJJpQdUYgeqIzDQgw3QtiAHUC4RBz9FXPrskyyU3VI1hw7C0BSKB9OduwSJ79FTCqtGMWqJHg== +"@esbuild/linux-riscv64@0.23.1": + version "0.23.1" + resolved "https://registry.yarnpkg.com/@esbuild/linux-riscv64/-/linux-riscv64-0.23.1.tgz#65b46a2892fc0d1af4ba342af3fe0fa4a8fe08e7" + integrity sha512-5AV4Pzp80fhHL83JM6LoA6pTQVWgB1HovMBsLQ9OZWLDqVY8MVobBXNSmAJi//Csh6tcY7e7Lny2Hg1tElMjIA== + "@esbuild/linux-s390x@0.19.12": version "0.19.12" resolved "https://registry.yarnpkg.com/@esbuild/linux-s390x/-/linux-s390x-0.19.12.tgz#e86fb8ffba7c5c92ba91fc3b27ed5a70196c3cc8" integrity sha512-+Pil1Nv3Umes4m3AZKqA2anfhJiVmNCYkPchwFJNEJN5QxmTs1uzyy4TvmDrCRNT2ApwSari7ZIgrPeUx4UZDg== +"@esbuild/linux-s390x@0.23.1": + version "0.23.1" + resolved "https://registry.yarnpkg.com/@esbuild/linux-s390x/-/linux-s390x-0.23.1.tgz#e71ea18c70c3f604e241d16e4e5ab193a9785d6f" + integrity sha512-9ygs73tuFCe6f6m/Tb+9LtYxWR4c9yg7zjt2cYkjDbDpV/xVn+68cQxMXCjUpYwEkze2RcU/rMnfIXNRFmSoDw== + "@esbuild/linux-x64@0.19.12": version "0.19.12" resolved "https://registry.yarnpkg.com/@esbuild/linux-x64/-/linux-x64-0.19.12.tgz#5f37cfdc705aea687dfe5dfbec086a05acfe9c78" integrity sha512-B71g1QpxfwBvNrfyJdVDexenDIt1CiDN1TIXLbhOw0KhJzE78KIFGX6OJ9MrtC0oOqMWf+0xop4qEU8JrJTwCg== +"@esbuild/linux-x64@0.23.1": + version "0.23.1" + resolved "https://registry.yarnpkg.com/@esbuild/linux-x64/-/linux-x64-0.23.1.tgz#d47f97391e80690d4dfe811a2e7d6927ad9eed24" + integrity sha512-EV6+ovTsEXCPAp58g2dD68LxoP/wK5pRvgy0J/HxPGB009omFPv3Yet0HiaqvrIrgPTBuC6wCH1LTOY91EO5hQ== + "@esbuild/netbsd-x64@0.19.12": version "0.19.12" resolved "https://registry.yarnpkg.com/@esbuild/netbsd-x64/-/netbsd-x64-0.19.12.tgz#29da566a75324e0d0dd7e47519ba2f7ef168657b" integrity sha512-3ltjQ7n1owJgFbuC61Oj++XhtzmymoCihNFgT84UAmJnxJfm4sYCiSLTXZtE00VWYpPMYc+ZQmB6xbSdVh0JWA== +"@esbuild/netbsd-x64@0.23.1": + version "0.23.1" + resolved "https://registry.yarnpkg.com/@esbuild/netbsd-x64/-/netbsd-x64-0.23.1.tgz#44e743c9778d57a8ace4b72f3c6b839a3b74a653" + integrity sha512-aevEkCNu7KlPRpYLjwmdcuNz6bDFiE7Z8XC4CPqExjTvrHugh28QzUXVOZtiYghciKUacNktqxdpymplil1beA== + +"@esbuild/openbsd-arm64@0.23.1": + version "0.23.1" + resolved "https://registry.yarnpkg.com/@esbuild/openbsd-arm64/-/openbsd-arm64-0.23.1.tgz#05c5a1faf67b9881834758c69f3e51b7dee015d7" + integrity sha512-3x37szhLexNA4bXhLrCC/LImN/YtWis6WXr1VESlfVtVeoFJBRINPJ3f0a/6LV8zpikqoUg4hyXw0sFBt5Cr+Q== + "@esbuild/openbsd-x64@0.19.12": version "0.19.12" resolved "https://registry.yarnpkg.com/@esbuild/openbsd-x64/-/openbsd-x64-0.19.12.tgz#306c0acbdb5a99c95be98bdd1d47c916e7dc3ff0" integrity sha512-RbrfTB9SWsr0kWmb9srfF+L933uMDdu9BIzdA7os2t0TXhCRjrQyCeOt6wVxr79CKD4c+p+YhCj31HBkYcXebw== +"@esbuild/openbsd-x64@0.23.1": + version "0.23.1" + resolved "https://registry.yarnpkg.com/@esbuild/openbsd-x64/-/openbsd-x64-0.23.1.tgz#2e58ae511bacf67d19f9f2dcd9e8c5a93f00c273" + integrity sha512-aY2gMmKmPhxfU+0EdnN+XNtGbjfQgwZj43k8G3fyrDM/UdZww6xrWxmDkuz2eCZchqVeABjV5BpildOrUbBTqA== + "@esbuild/sunos-x64@0.19.12": version "0.19.12" resolved "https://registry.yarnpkg.com/@esbuild/sunos-x64/-/sunos-x64-0.19.12.tgz#0933eaab9af8b9b2c930236f62aae3fc593faf30" integrity sha512-HKjJwRrW8uWtCQnQOz9qcU3mUZhTUQvi56Q8DPTLLB+DawoiQdjsYq+j+D3s9I8VFtDr+F9CjgXKKC4ss89IeA== +"@esbuild/sunos-x64@0.23.1": + version "0.23.1" + resolved "https://registry.yarnpkg.com/@esbuild/sunos-x64/-/sunos-x64-0.23.1.tgz#adb022b959d18d3389ac70769cef5a03d3abd403" + integrity sha512-RBRT2gqEl0IKQABT4XTj78tpk9v7ehp+mazn2HbUeZl1YMdaGAQqhapjGTCe7uw7y0frDi4gS0uHzhvpFuI1sA== + "@esbuild/win32-arm64@0.19.12": version "0.19.12" resolved "https://registry.yarnpkg.com/@esbuild/win32-arm64/-/win32-arm64-0.19.12.tgz#773bdbaa1971b36db2f6560088639ccd1e6773ae" integrity sha512-URgtR1dJnmGvX864pn1B2YUYNzjmXkuJOIqG2HdU62MVS4EHpU2946OZoTMnRUHklGtJdJZ33QfzdjGACXhn1A== +"@esbuild/win32-arm64@0.23.1": + version "0.23.1" + resolved "https://registry.yarnpkg.com/@esbuild/win32-arm64/-/win32-arm64-0.23.1.tgz#84906f50c212b72ec360f48461d43202f4c8b9a2" + integrity sha512-4O+gPR5rEBe2FpKOVyiJ7wNDPA8nGzDuJ6gN4okSA1gEOYZ67N8JPk58tkWtdtPeLz7lBnY6I5L3jdsr3S+A6A== + "@esbuild/win32-ia32@0.19.12": version "0.19.12" resolved "https://registry.yarnpkg.com/@esbuild/win32-ia32/-/win32-ia32-0.19.12.tgz#000516cad06354cc84a73f0943a4aa690ef6fd67" integrity sha512-+ZOE6pUkMOJfmxmBZElNOx72NKpIa/HFOMGzu8fqzQJ5kgf6aTGrcJaFsNiVMH4JKpMipyK+7k0n2UXN7a8YKQ== +"@esbuild/win32-ia32@0.23.1": + version "0.23.1" + resolved "https://registry.yarnpkg.com/@esbuild/win32-ia32/-/win32-ia32-0.23.1.tgz#5e3eacc515820ff729e90d0cb463183128e82fac" + integrity sha512-BcaL0Vn6QwCwre3Y717nVHZbAa4UBEigzFm6VdsVdT/MbZ38xoj1X9HPkZhbmaBGUD1W8vxAfffbDe8bA6AKnQ== + "@esbuild/win32-x64@0.19.12": version "0.19.12" resolved "https://registry.yarnpkg.com/@esbuild/win32-x64/-/win32-x64-0.19.12.tgz#c57c8afbb4054a3ab8317591a0b7320360b444ae" integrity sha512-T1QyPSDCyMXaO3pzBkF96E8xMkiRYbUEZADd29SyPGabqxMViNoii+NcK7eWJAEoU6RZyEm5lVSIjTmcdoB9HA== +"@esbuild/win32-x64@0.23.1": + version "0.23.1" + resolved "https://registry.yarnpkg.com/@esbuild/win32-x64/-/win32-x64-0.23.1.tgz#81fd50d11e2c32b2d6241470e3185b70c7b30699" + integrity sha512-BHpFFeslkWrXWyUPnbKm+xYYVYruCinGcftSBaa8zoF9hZO4BcSCFUvHVTtzpIY6YzUnYtuEhZ+C9iEXjxnasg== + "@eslint-community/eslint-utils@^4.2.0", "@eslint-community/eslint-utils@^4.4.0": version "4.4.0" resolved "https://registry.yarnpkg.com/@eslint-community/eslint-utils/-/eslint-utils-4.4.0.tgz#a23514e8fb9af1269d5f7788aa556798d61c6b59" @@ -4308,10 +4487,10 @@ dependencies: "@ledgerhq/hw-transport" "6.30.6" -"@zondax/ledger-sei@^1.0.0": - version "1.0.0" - resolved "https://registry.yarnpkg.com/@zondax/ledger-sei/-/ledger-sei-1.0.0.tgz#0036c7d43d46b75c3060810950b0e07f8abb1c86" - integrity sha512-PZswU9EIGjJVJijp/n3U9ZVTZU/BBdavEpERETClxyAF8zLxpC1vukTQ86lPk9vK18s6vvnSpl7W+fSPLxPOZg== +"@zondax/ledger-sei@1.0.1": + version "1.0.1" + resolved "https://registry.yarnpkg.com/@zondax/ledger-sei/-/ledger-sei-1.0.1.tgz#dc9777a756c0dd6b260d875d4d0b7b9bc914b4a4" + integrity sha512-N8Y8xc5DvR9BpEtjuVzCb3XYkOoEW30t3bB4glIPy//c2R2pfzT8+eUzecZcnpLbOdkmQ/6THGR0GKb9o5bQ/Q== dependencies: "@ledgerhq/hw-app-eth" "^6.37.3" "@zondax/ledger-js" "^0.10.0" @@ -5940,6 +6119,36 @@ esbuild@^0.19.2: "@esbuild/win32-ia32" "0.19.12" "@esbuild/win32-x64" "0.19.12" +esbuild@~0.23.0: + version "0.23.1" + resolved "https://registry.yarnpkg.com/esbuild/-/esbuild-0.23.1.tgz#40fdc3f9265ec0beae6f59824ade1bd3d3d2dab8" + integrity sha512-VVNz/9Sa0bs5SELtn3f7qhJCDPCF5oMEl5cO9/SSinpE9hbPVvxbd572HH5AKiP7WD8INO53GgfDDhRjkylHEg== + optionalDependencies: + "@esbuild/aix-ppc64" "0.23.1" + "@esbuild/android-arm" "0.23.1" + "@esbuild/android-arm64" "0.23.1" + "@esbuild/android-x64" "0.23.1" + "@esbuild/darwin-arm64" "0.23.1" + "@esbuild/darwin-x64" "0.23.1" + "@esbuild/freebsd-arm64" "0.23.1" + "@esbuild/freebsd-x64" "0.23.1" + "@esbuild/linux-arm" "0.23.1" + "@esbuild/linux-arm64" "0.23.1" + "@esbuild/linux-ia32" "0.23.1" + "@esbuild/linux-loong64" "0.23.1" + "@esbuild/linux-mips64el" "0.23.1" + "@esbuild/linux-ppc64" "0.23.1" + "@esbuild/linux-riscv64" "0.23.1" + "@esbuild/linux-s390x" "0.23.1" + "@esbuild/linux-x64" "0.23.1" + "@esbuild/netbsd-x64" "0.23.1" + "@esbuild/openbsd-arm64" "0.23.1" + "@esbuild/openbsd-x64" "0.23.1" + "@esbuild/sunos-x64" "0.23.1" + "@esbuild/win32-arm64" "0.23.1" + "@esbuild/win32-ia32" "0.23.1" + "@esbuild/win32-x64" "0.23.1" + escalade@^3.1.1: version "3.1.2" resolved "https://registry.yarnpkg.com/escalade/-/escalade-3.1.2.tgz#54076e9ab29ea5bf3d8f1ed62acffbb88272df27" @@ -6494,7 +6703,7 @@ fs.realpath@^1.0.0: resolved "https://registry.yarnpkg.com/fs.realpath/-/fs.realpath-1.0.0.tgz#1504ad2523158caa40db4a2787cb01411994ea4f" integrity sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw== -fsevents@^2.3.2, fsevents@~2.3.2: +fsevents@^2.3.2, fsevents@~2.3.2, fsevents@~2.3.3: version "2.3.3" resolved "https://registry.yarnpkg.com/fsevents/-/fsevents-2.3.3.tgz#cac6407785d03675a2a5e1a5305c697b347d90d6" integrity sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw== @@ -6569,6 +6778,13 @@ get-symbol-description@^1.0.2: es-errors "^1.3.0" get-intrinsic "^1.2.4" +get-tsconfig@^4.7.5: + version "4.8.1" + resolved "https://registry.yarnpkg.com/get-tsconfig/-/get-tsconfig-4.8.1.tgz#8995eb391ae6e1638d251118c7b56de7eb425471" + integrity sha512-k9PN+cFBmaLWtVz29SkUoqU5O0slLuHJXt/2P+tMVFT+phsSGXGkp9t3rQIqdz0e+06EHNGs3oM6ZX1s2zHxRg== + dependencies: + resolve-pkg-maps "^1.0.0" + github-from-package@0.0.0: version "0.0.0" resolved "https://registry.yarnpkg.com/github-from-package/-/github-from-package-0.0.0.tgz#97fb5d96bfde8973313f20e8288ef9a167fa64ce" @@ -8889,11 +9105,16 @@ prettier@^2.6.2, prettier@^2.7.1: resolved "https://registry.yarnpkg.com/prettier/-/prettier-2.8.8.tgz#e8c5d7e98a4305ffe3de2e1fc4aca1a71c28b1da" integrity sha512-tdN8qQGvNjw4CHbY+XXk0JgCXn9QiF21a55rBe5LJAU+kDyC4WQn4+awm2Xfk2lQMk5fKup9XgzTZtGkjBdP9Q== -prettier@^3.0.3, prettier@^3.2.5: +prettier@^3.0.3: version "3.2.5" resolved "https://registry.yarnpkg.com/prettier/-/prettier-3.2.5.tgz#e52bc3090586e824964a8813b09aba6233b28368" integrity sha512-3/GWa9aOC0YeD7LUfvOG2NiDyhOWRvt1k+rcKhOuYnMY24iiCphgneUfJDyFXd6rZCAnuLBv6UeAULtrhT/F4A== +prettier@^3.2.5: + version "3.3.3" + resolved "https://registry.yarnpkg.com/prettier/-/prettier-3.3.3.tgz#30c54fe0be0d8d12e6ae61dbb10109ea00d53105" + integrity sha512-i2tDNA0O5IrMO757lfrdQZCc2jPNDVntV0m/+4whiDfWaTKfMNgR7Qz0NAeGz/nRqF4m5/6CLzbP4/liHt12Ew== + pretty-format@^28.1.3: version "28.1.3" resolved "https://registry.yarnpkg.com/pretty-format/-/pretty-format-28.1.3.tgz#c9fba8cedf99ce50963a11b27d982a9ae90970d5" @@ -9241,6 +9462,11 @@ resolve-from@^5.0.0: resolved "https://registry.yarnpkg.com/resolve-from/-/resolve-from-5.0.0.tgz#c35225843df8f776df21c57557bc087e9dfdfc69" integrity sha512-qYg9KP24dD5qka9J47d0aVky0N+b4fTU89LN9iDnjB5waksiC49rvMB0PrUJQGoTmH50XPiqOvAjDfaijGxYZw== +resolve-pkg-maps@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/resolve-pkg-maps/-/resolve-pkg-maps-1.0.0.tgz#616b3dc2c57056b5588c31cdf4b3d64db133720f" + integrity sha512-seS2Tj26TBVOC2NIc2rOe2y2ZO7efxITtLZcGSOnHHNOQ7CkiUBfw0Iw2ck6xkIhPwLhKNLS8BO+hEpngQlqzw== + resolve.exports@1.1.0: version "1.1.0" resolved "https://registry.yarnpkg.com/resolve.exports/-/resolve.exports-1.1.0.tgz#5ce842b94b05146c0e03076985d1d0e7e48c90c9" @@ -10148,6 +10374,16 @@ tslib@^2.3.0, tslib@^2.4.0, tslib@^2.6.2: resolved "https://registry.yarnpkg.com/tslib/-/tslib-2.6.2.tgz#703ac29425e7b37cd6fd456e92404d46d1f3e4ae" integrity sha512-AEYxH93jGFPn/a2iVAwW87VuUIkR1FVUKB77NwMF7nBTDkDrrT/Hpt/IrCJ0QXhW27jTBDcf5ZY7w6RiqTMw2Q== +tsx@^4.19.1: + version "4.19.1" + resolved "https://registry.yarnpkg.com/tsx/-/tsx-4.19.1.tgz#b7bffdf4b565813e4dea14b90872af279cd0090b" + integrity sha512-0flMz1lh74BR4wOvBjuh9olbnwqCPc35OOlfyzHba0Dc+QNUeWX/Gq2YTbnwcWPO3BMd8fkzRVrHcsR+a7z7rA== + dependencies: + esbuild "~0.23.0" + get-tsconfig "^4.7.5" + optionalDependencies: + fsevents "~2.3.3" + tty-table@^4.1.5: version "4.2.3" resolved "https://registry.yarnpkg.com/tty-table/-/tty-table-4.2.3.tgz#e33eb4007a0a9c976c97c37fa13ba66329a5c515"