diff --git a/.github/workflows/run-tests.yml b/.github/workflows/run-tests.yml
deleted file mode 100644
index 22e6b7bc6..000000000
--- a/.github/workflows/run-tests.yml
+++ /dev/null
@@ -1,29 +0,0 @@
-name: Run Tests
-
-on:
- workflow_dispatch:
- #push:
-
- pull_request:
- types: [opened, reopened]
-
- workflow_dispatch:
-
-jobs:
- run-tests:
- runs-on: ubuntu-latest
- steps:
- - name: checkout 🛎️
- uses: actions/checkout@v2.3.1
- - name: node
- uses: actions/setup-node@v3
- with:
- node-version: 16.14.0
- - name: deps
- run: yarn
- - name: bootstrap
- run: yarn bootstrap
- - name: build
- run: yarn build
- - name: react
- run: cd ./packages/react && yarn test
\ No newline at end of file
diff --git a/.prettierrc.yaml b/.prettierrc.yaml
new file mode 100644
index 000000000..125ae1cb2
--- /dev/null
+++ b/.prettierrc.yaml
@@ -0,0 +1,2 @@
+# .prettierrc or .prettierrc.yaml
+singleQuote: true
diff --git a/README.md b/README.md
index 802b05358..75282bde1 100644
--- a/README.md
+++ b/README.md
@@ -1 +1,195 @@
-# create-cosmos-app
\ No newline at end of file
+# create-cosmos-app
+
+
+
+
+
+
+
+
+
+
+
+Set up a modern Cosmos app by running one command ⚛️
+
+## Demo
+
+https://user-images.githubusercontent.com/545047/192061992-f0e1106d-f4b2-4879-ab0a-896f22ee4f49.mp4
+
+## Overview
+
+```
+# install
+npm install -g create-cosmos-app
+
+# run one command
+create-cosmos-app
+
+> name: my-app
+cd my-app
+yarn && yarn dev
+
+# now your app is running on localhost:3000!
+```
+
+### Get Started Immediately
+
+You don’t need to install or configure cosmjs, keplr, nextjs, webpack or Babel.
+
+Everything is preconfigured, ready-to-go, so you can focus on your code!
+
+* ⚡️ Connect easily to keplr + keplr mobile via wallet connect
+* ⚛️ Sign and broadcast with [cosmjs](https://github.com/cosmos/cosmjs) stargate + cosmwasm signers
+* 🛠 Render pages with [next.js](https://nextjs.org/) hybrid static & server rendering
+* 🎨 Build awesome UI with [Cosmos Kit](https://github.com/cosmology-tech/cosmos-kit) and [Chakra UI](https://chakra-ui.com/docs/components)
+* 📝 Leverage [chain-registry](https://github.com/cosmology-tech/chain-registry) for Chain and Asset info for all Cosmos chains
+## Education & Resources
+
+🎥 [Checkout our videos](https://cosmology.tech/learn) to learn to learn more about `create-cosmos-app` and tooling for building frontends in the Cosmos!
+
+Checkout [cosmos-kit](https://github.com/cosmology-tech/cosmos-kit) for more docs as well as [cosmos-kit/react](https://github.com/cosmology-tech/cosmos-kit/tree/main/packages/react#signing-clients) for getting cosmjs stargate and cosmjs signers.
+
+## Creating an App
+
+To create a new app, you may choose one of the following methods:
+
+### global install
+
+```sh
+npm install -g create-cosmos-app
+```
+
+Then run the command:
+
+```sh
+create-cosmos-app
+```
+
+we also made an alias `cca` if you don't want to type `create-cosmos-app`:
+
+```sh
+cca
+```
+
+### npx
+
+```sh
+npx create-cosmos-app
+```
+### npm
+
+```sh
+npm init cosmos-app
+```
+### Yarn
+
+```sh
+yarn create cosmos-app
+```
+## Examples
+
+Explore examples!
+
+```
+cca --example
+```
+
+### Send Tokens
+
+
+
+
+
+```
+cca --name cca-sendtokens --example --template send-tokens
+```
+
+### Osmosis
+
+
+
+
+
+uses [osmojs](https://github.com/osmosis-labs/osmojs)
+
+```
+cca --name myosmoapp --example --template osmosis
+```
+
+or the cosmwasm example:
+
+```
+cca --name osmowasm --example --template osmosis-cosmwasm
+```
+
+### Juno
+
+
+
+
+
+uses [juno-network](https://github.com/CosmosContracts/typescript)
+
+
+```
+cca --name myjunoapp --example --template juno
+```
+
+### Stargaze
+
+
+
+
+
+uses [stargazejs](https://github.com/cosmology-tech/stargazejs)
+
+```
+cca --name mystarsapp --example --template stargaze
+```
+
+### CosmWasm
+
+
+
+
+
+
+
+```
+cca --name mywasmapp --example --template cosmwasm
+```
+
+### Tailwind
+
+```
+cca --name cca-tailwind --example --template tailwindcss
+```
+
+## Development
+
+Because the nature of how template boilerplates are generated, we generate `yarn.lock` files inside of nested packages so we can fix versions to avoid non-deterministic installations.
+
+When adding packages, yarn workspaces will use the root `yarn.lock`. It could be ideal to remove it while adding packages, and when publishing or pushing new changes, generating the nested lock files.
+
+In the root, to remove all nested lock files:
+
+```
+yarn locks:remove
+```
+
+When you need to remove/generate locks for all nested packages, simply run `yarn locks` in the root:
+
+```
+yarn locks
+```
+
+## Credits
+
+🛠 Built by Cosmology — if you like our tools, please consider delegating to [our validator ⚛️](https://cosmology.tech/validator)
+
+Code built with the help of these related projects:
+
+* [@cosmwasm/ts-codegen](https://github.com/CosmWasm/ts-codegen) for generated CosmWasm contract Typescript classes
+* [@osmonauts/telescope](https://github.com/osmosis-labs/telescope) a "babel for the Cosmos", Telescope is a TypeScript Transpiler for Cosmos Protobufs.
+* [chain-registry](https://github.com/cosmology-tech/chain-registry) Cosmos chain registry and chain info.
+* [cosmos-kit](https://github.com/cosmology-tech/cosmos-kit) A wallet connector for the Cosmos.
diff --git a/templates/connect-multi-chain/.eslintrc copy.json b/examples/contracts/.eslintrc.json
similarity index 100%
rename from templates/connect-multi-chain/.eslintrc copy.json
rename to examples/contracts/.eslintrc.json
diff --git a/examples/contracts/.gitignore b/examples/contracts/.gitignore
new file mode 100644
index 000000000..c87c9b392
--- /dev/null
+++ b/examples/contracts/.gitignore
@@ -0,0 +1,36 @@
+# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
+
+# dependencies
+/node_modules
+/.pnp
+.pnp.js
+
+# testing
+/coverage
+
+# next.js
+/.next/
+/out/
+
+# production
+/build
+
+# misc
+.DS_Store
+*.pem
+
+# debug
+npm-debug.log*
+yarn-debug.log*
+yarn-error.log*
+.pnpm-debug.log*
+
+# local env files
+.env*.local
+
+# vercel
+.vercel
+
+# typescript
+*.tsbuildinfo
+next-env.d.ts
diff --git a/examples/contracts/CHANGELOG.md b/examples/contracts/CHANGELOG.md
new file mode 100644
index 000000000..5ac60aec4
--- /dev/null
+++ b/examples/contracts/CHANGELOG.md
@@ -0,0 +1,240 @@
+# Change Log
+
+All notable changes to this project will be documented in this file.
+See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
+
+## [1.5.3](https://github.com/cosmology-tech/create-cosmos-app/compare/@cosmology/connect-chain-with-telescope-and-contracts@1.5.2...@cosmology/connect-chain-with-telescope-and-contracts@1.5.3) (2022-11-25)
+
+**Note:** Version bump only for package @cosmology/connect-chain-with-telescope-and-contracts
+
+
+
+
+
+## [1.5.2](https://github.com/cosmology-tech/create-cosmos-app/compare/@cosmology/connect-chain-with-telescope-and-contracts@1.5.1...@cosmology/connect-chain-with-telescope-and-contracts@1.5.2) (2022-11-21)
+
+**Note:** Version bump only for package @cosmology/connect-chain-with-telescope-and-contracts
+
+
+
+
+
+## [1.5.1](https://github.com/cosmology-tech/create-cosmos-app/compare/@cosmology/connect-chain-with-telescope-and-contracts@1.5.0...@cosmology/connect-chain-with-telescope-and-contracts@1.5.1) (2022-11-17)
+
+**Note:** Version bump only for package @cosmology/connect-chain-with-telescope-and-contracts
+
+
+
+
+
+# [1.5.0](https://github.com/cosmology-tech/create-cosmos-app/compare/@cosmology/connect-chain-with-telescope-and-contracts@1.4.0...@cosmology/connect-chain-with-telescope-and-contracts@1.5.0) (2022-11-15)
+
+**Note:** Version bump only for package @cosmology/connect-chain-with-telescope-and-contracts
+
+
+
+
+
+# [1.4.0](https://github.com/cosmology-tech/create-cosmos-app/compare/@cosmology/connect-chain-with-telescope-and-contracts@1.3.0...@cosmology/connect-chain-with-telescope-and-contracts@1.4.0) (2022-11-14)
+
+**Note:** Version bump only for package @cosmology/connect-chain-with-telescope-and-contracts
+
+
+
+
+
+# [1.3.0](https://github.com/cosmology-tech/create-cosmos-app/compare/@cosmology/connect-chain-with-telescope-and-contracts@1.2.0...@cosmology/connect-chain-with-telescope-and-contracts@1.3.0) (2022-11-10)
+
+**Note:** Version bump only for package @cosmology/connect-chain-with-telescope-and-contracts
+
+
+
+
+
+# [1.2.0](https://github.com/cosmology-tech/create-cosmos-app/compare/@cosmology/connect-chain-with-telescope-and-contracts@1.1.0...@cosmology/connect-chain-with-telescope-and-contracts@1.2.0) (2022-11-09)
+
+**Note:** Version bump only for package @cosmology/connect-chain-with-telescope-and-contracts
+
+
+
+
+
+# [1.1.0](https://github.com/cosmology-tech/create-cosmos-app/compare/@cosmology/connect-chain-with-telescope-and-contracts@1.0.7...@cosmology/connect-chain-with-telescope-and-contracts@1.1.0) (2022-11-08)
+
+**Note:** Version bump only for package @cosmology/connect-chain-with-telescope-and-contracts
+
+
+
+
+
+## [1.0.7](https://github.com/cosmology-tech/create-cosmos-app/compare/@cosmology/connect-chain-with-telescope-and-contracts@1.0.6...@cosmology/connect-chain-with-telescope-and-contracts@1.0.7) (2022-11-05)
+
+**Note:** Version bump only for package @cosmology/connect-chain-with-telescope-and-contracts
+
+
+
+
+
+## [1.0.6](https://github.com/cosmology-tech/create-cosmos-app/compare/@cosmology/connect-chain-with-telescope-and-contracts@1.0.5...@cosmology/connect-chain-with-telescope-and-contracts@1.0.6) (2022-11-05)
+
+**Note:** Version bump only for package @cosmology/connect-chain-with-telescope-and-contracts
+
+
+
+
+
+## [1.0.5](https://github.com/cosmology-tech/create-cosmos-app/compare/@cosmology/connect-chain-with-telescope-and-contracts@1.0.4...@cosmology/connect-chain-with-telescope-and-contracts@1.0.5) (2022-11-05)
+
+**Note:** Version bump only for package @cosmology/connect-chain-with-telescope-and-contracts
+
+
+
+
+
+## 1.0.4 (2022-11-01)
+
+**Note:** Version bump only for package @cosmology/connect-chain-with-telescope-and-contracts
+
+
+
+
+
+## [1.0.3](https://github.com/cosmology-tech/create-cosmos-app/compare/@cosmonauts/connect-chain-with-telescope-and-contracts@1.0.2...@cosmonauts/connect-chain-with-telescope-and-contracts@1.0.3) (2022-10-24)
+
+**Note:** Version bump only for package @cosmonauts/connect-chain-with-telescope-and-contracts
+
+
+
+
+
+## [1.0.2](https://github.com/cosmology-tech/create-cosmos-app/compare/@cosmonauts/connect-chain-with-telescope-and-contracts@1.0.1...@cosmonauts/connect-chain-with-telescope-and-contracts@1.0.2) (2022-10-15)
+
+**Note:** Version bump only for package @cosmonauts/connect-chain-with-telescope-and-contracts
+
+
+
+
+
+## [1.0.1](https://github.com/cosmology-tech/create-cosmos-app/compare/@cosmonauts/connect-chain-with-telescope-and-contracts@1.0.0...@cosmonauts/connect-chain-with-telescope-and-contracts@1.0.1) (2022-10-03)
+
+**Note:** Version bump only for package @cosmonauts/connect-chain-with-telescope-and-contracts
+
+
+
+
+
+# [1.0.0](https://github.com/cosmology-tech/create-cosmos-app/compare/@cosmonauts/connect-chain-with-telescope-and-contracts@0.6.0...@cosmonauts/connect-chain-with-telescope-and-contracts@1.0.0) (2022-10-01)
+
+**Note:** Version bump only for package @cosmonauts/connect-chain-with-telescope-and-contracts
+
+
+
+
+
+# [0.6.0](https://github.com/cosmology-tech/create-cosmos-app/compare/@cosmonauts/connect-chain-with-telescope-and-contracts@0.5.1...@cosmonauts/connect-chain-with-telescope-and-contracts@0.6.0) (2022-09-30)
+
+**Note:** Version bump only for package @cosmonauts/connect-chain-with-telescope-and-contracts
+
+
+
+
+
+## [0.5.1](https://github.com/cosmology-tech/create-cosmos-app/compare/@cosmonauts/connect-chain-with-telescope-and-contracts@0.5.0...@cosmonauts/connect-chain-with-telescope-and-contracts@0.5.1) (2022-09-25)
+
+**Note:** Version bump only for package @cosmonauts/connect-chain-with-telescope-and-contracts
+
+
+
+
+
+# [0.5.0](https://github.com/cosmology-tech/create-cosmos-app/compare/@cosmonauts/connect-chain-with-telescope-and-contracts@0.4.0...@cosmonauts/connect-chain-with-telescope-and-contracts@0.5.0) (2022-09-25)
+
+**Note:** Version bump only for package @cosmonauts/connect-chain-with-telescope-and-contracts
+
+
+
+
+
+# [0.4.0](https://github.com/cosmology-tech/create-cosmos-app/compare/@cosmonauts/connect-chain-with-telescope-and-contracts@0.3.0...@cosmonauts/connect-chain-with-telescope-and-contracts@0.4.0) (2022-09-23)
+
+**Note:** Version bump only for package @cosmonauts/connect-chain-with-telescope-and-contracts
+
+
+
+
+
+# [0.3.0](https://github.com/cosmology-tech/create-cosmos-app/compare/@cosmonauts/connect-chain-with-telescope-and-contracts@0.2.0...@cosmonauts/connect-chain-with-telescope-and-contracts@0.3.0) (2022-09-22)
+
+**Note:** Version bump only for package @cosmonauts/connect-chain-with-telescope-and-contracts
+
+
+
+
+
+# [0.2.0](https://github.com/cosmology-tech/create-cosmos-app/compare/@cosmonauts/connect-chain-with-telescope-and-contracts@0.1.9...@cosmonauts/connect-chain-with-telescope-and-contracts@0.2.0) (2022-09-22)
+
+**Note:** Version bump only for package @cosmonauts/connect-chain-with-telescope-and-contracts
+
+
+
+
+
+## [0.1.9](https://github.com/cosmology-tech/create-cosmos-app/compare/@cosmonauts/connect-chain-with-telescope-and-contracts@0.1.8...@cosmonauts/connect-chain-with-telescope-and-contracts@0.1.9) (2022-09-11)
+
+**Note:** Version bump only for package @cosmonauts/connect-chain-with-telescope-and-contracts
+
+
+
+
+
+## [0.1.8](https://github.com/cosmology-tech/create-cosmos-app/compare/@cosmonauts/connect-chain-with-telescope-and-contracts@0.1.7...@cosmonauts/connect-chain-with-telescope-and-contracts@0.1.8) (2022-09-08)
+
+**Note:** Version bump only for package @cosmonauts/connect-chain-with-telescope-and-contracts
+
+
+
+
+
+## [0.1.7](https://github.com/cosmology-tech/create-cosmos-app/compare/@cosmonauts/connect-chain-with-telescope-and-contracts@0.1.6...@cosmonauts/connect-chain-with-telescope-and-contracts@0.1.7) (2022-08-30)
+
+**Note:** Version bump only for package @cosmonauts/connect-chain-with-telescope-and-contracts
+
+
+
+
+
+## [0.1.6](https://github.com/cosmology-tech/create-cosmos-app/compare/@cosmonauts/connect-chain-with-telescope-and-contracts@0.1.5...@cosmonauts/connect-chain-with-telescope-and-contracts@0.1.6) (2022-08-27)
+
+**Note:** Version bump only for package @cosmonauts/connect-chain-with-telescope-and-contracts
+
+
+
+
+
+## [0.1.5](https://github.com/cosmology-tech/create-cosmos-app/compare/@cosmonauts/connect-chain-with-telescope-and-contracts@0.1.4...@cosmonauts/connect-chain-with-telescope-and-contracts@0.1.5) (2022-08-27)
+
+**Note:** Version bump only for package @cosmonauts/connect-chain-with-telescope-and-contracts
+
+
+
+
+
+## [0.1.4](https://github.com/cosmology-tech/create-cosmos-app/compare/@cosmonauts/connect-chain-with-telescope-and-contracts@0.1.3...@cosmonauts/connect-chain-with-telescope-and-contracts@0.1.4) (2022-08-27)
+
+**Note:** Version bump only for package @cosmonauts/connect-chain-with-telescope-and-contracts
+
+
+
+
+
+## [0.1.3](https://github.com/cosmology-tech/create-cosmos-app/compare/@cosmonauts/connect-chain-with-telescope-and-contracts@0.1.2...@cosmonauts/connect-chain-with-telescope-and-contracts@0.1.3) (2022-08-25)
+
+**Note:** Version bump only for package @cosmonauts/connect-chain-with-telescope-and-contracts
+
+
+
+
+
+## 0.1.2 (2022-08-25)
+
+**Note:** Version bump only for package @cosmonauts/connect-chain-with-telescope-and-contracts
diff --git a/examples/contracts/README.md b/examples/contracts/README.md
new file mode 100644
index 000000000..340852813
--- /dev/null
+++ b/examples/contracts/README.md
@@ -0,0 +1,76 @@
+This is a Cosmos App project bootstrapped with [`create-cosmos-app`](https://github.com/cosmology-tech/create-cosmos-app).
+
+## Getting Started
+
+First, install the packages and run the development server:
+
+```bash
+yarn && yarn dev
+```
+
+Open [http://localhost:3000](http://localhost:3000) with your browser to see the result.
+
+You can start editing the page by modifying `pages/index.tsx`. The page auto-updates as you edit the file.
+
+## Learn More
+
+### Chain Registry
+
+The npm package for the Official Cosmos chain registry. Get chain and token data for you application.
+
+* https://github.com/cosmology-tech/chain-registry
+
+### Cosmology Videos
+
+Checkout more videos for how to use various frontend tooling in the Cosmos!
+
+* https://cosmology.tech/learn
+
+### Cosmos Kit
+
+A wallet connector for the Cosmos ⚛️
+
+* https://github.com/cosmology-tech/cosmos-kit
+
+### Telescope
+
+A "babel for the Cosmos", Telescope is a TypeScript Transpiler for Cosmos Protobufs. Telescope is used to generate libraries for Cosmos blockchains. Simply point to your protobuffer files and create developer-friendly Typescript libraries for teams to build on your blockchain.
+
+* https://github.com/osmosis-labs/telescope
+
+🎥 [Checkout the Telescope video playlist](https://www.youtube.com/watch?v=n82MsLe82mk&list=PL-lMkVv7GZwyQaK6bp6kMdOS5mzosxytC) to learn how to use `telescope`!
+
+### CosmWasm TS Codegen
+
+The quickest and easiest way to interact with CosmWasm Contracts. @cosmwasm/ts-codegen converts your CosmWasm smart contracts into dev-friendly TypeScript classes so you can focus on shipping code.
+
+* https://github.com/CosmWasm/ts-codegen
+
+🎥 [Checkout the CosmWasm/ts-codegne video playlist](https://www.youtube.com/watch?v=D_A5V2PfNLA&list=PL-lMkVv7GZwz1KO3jANwr5W4MoziruXwK) to learn how to use `ts-codegen`!
+
+
+## Learn More about Next.js
+
+To learn more about Next.js, take a look at the following resources:
+
+- [Next.js Documentation](https://nextjs.org/docs) - learn about Next.js features and API.
+- [Learn Next.js](https://nextjs.org/learn) - an interactive Next.js tutorial.
+
+You can check out [the Next.js GitHub repository](https://github.com/vercel/next.js/) - your feedback and contributions are welcome!
+
+## Deploy on Vercel
+
+The easiest way to deploy your Next.js app is to use the [Vercel Platform](https://vercel.com/new?utm_medium=default-template&filter=next.js&utm_source=create-next-app&utm_campaign=create-next-app-readme) from the creators of Next.js.
+
+Check out our [Next.js deployment documentation](https://nextjs.org/docs/deployment) for more details.
+
+## Credits
+
+🛠 Built by Cosmology — if you like our tools, please consider delegating to [our validator ⚛️](https://cosmology.tech/validator)
+
+Code built with the help of these related projects:
+
+* [@cosmwasm/ts-codegen](https://github.com/CosmWasm/ts-codegen) for generated CosmWasm contract Typescript classes
+* [@osmonauts/telescope](https://github.com/osmosis-labs/telescope) a "babel for the Cosmos", Telescope is a TypeScript Transpiler for Cosmos Protobufs.
+* [chain-registry](https://github.com/cosmology-tech/chain-registry) Cosmos chain registry and chain info.
+* [cosmos-kit](https://github.com/cosmology-tech/cosmos-kit) A wallet connector for the Cosmos.
diff --git a/examples/contracts/codegen/JunoSwap.client.ts b/examples/contracts/codegen/JunoSwap.client.ts
new file mode 100644
index 000000000..92b0f8ef2
--- /dev/null
+++ b/examples/contracts/codegen/JunoSwap.client.ts
@@ -0,0 +1,294 @@
+/**
+* This file was automatically generated by @cosmwasm/ts-codegen@0.17.0.
+* DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file,
+* and run the @cosmwasm/ts-codegen generate command to regenerate this file.
+*/
+
+import { CosmWasmClient, SigningCosmWasmClient, ExecuteResult } from "@cosmjs/cosmwasm-stargate";
+import { Coin, StdFee } from "@cosmjs/amino";
+import { Uint128, BalanceResponse, ExecuteMsg, Expiration, Timestamp, Uint64, TokenSelect, Addr, InfoResponse, InstantiateMsg, QueryMsg, Token, Token1ForToken2PriceResponse, Token2ForToken1PriceResponse } from "./JunoSwap.types";
+export interface JunoSwapReadOnlyInterface {
+ contractAddress: string;
+ balance: ({
+ address
+ }: {
+ address: string;
+ }) => Promise;
+ info: () => Promise;
+ token1ForToken2Price: ({
+ token1Amount
+ }: {
+ token1Amount: Uint128;
+ }) => Promise;
+ token2ForToken1Price: ({
+ token2Amount
+ }: {
+ token2Amount: Uint128;
+ }) => Promise;
+}
+export class JunoSwapQueryClient implements JunoSwapReadOnlyInterface {
+ client: CosmWasmClient;
+ contractAddress: string;
+
+ constructor(client: CosmWasmClient, contractAddress: string) {
+ this.client = client;
+ this.contractAddress = contractAddress;
+ this.balance = this.balance.bind(this);
+ this.info = this.info.bind(this);
+ this.token1ForToken2Price = this.token1ForToken2Price.bind(this);
+ this.token2ForToken1Price = this.token2ForToken1Price.bind(this);
+ }
+
+ balance = async ({
+ address
+ }: {
+ address: string;
+ }): Promise => {
+ return this.client.queryContractSmart(this.contractAddress, {
+ balance: {
+ address
+ }
+ });
+ };
+ info = async (): Promise => {
+ return this.client.queryContractSmart(this.contractAddress, {
+ info: {}
+ });
+ };
+ token1ForToken2Price = async ({
+ token1Amount
+ }: {
+ token1Amount: Uint128;
+ }): Promise => {
+ return this.client.queryContractSmart(this.contractAddress, {
+ token1_for_token2_price: {
+ token1_amount: token1Amount
+ }
+ });
+ };
+ token2ForToken1Price = async ({
+ token2Amount
+ }: {
+ token2Amount: Uint128;
+ }): Promise => {
+ return this.client.queryContractSmart(this.contractAddress, {
+ token2_for_token1_price: {
+ token2_amount: token2Amount
+ }
+ });
+ };
+}
+export interface JunoSwapInterface extends JunoSwapReadOnlyInterface {
+ contractAddress: string;
+ sender: string;
+ addLiquidity: ({
+ expiration,
+ maxToken2,
+ minLiquidity,
+ token1Amount
+ }: {
+ expiration?: Expiration;
+ maxToken2: Uint128;
+ minLiquidity: Uint128;
+ token1Amount: Uint128;
+ }, fee?: number | StdFee | "auto", memo?: string, funds?: Coin[]) => Promise;
+ removeLiquidity: ({
+ amount,
+ expiration,
+ minToken1,
+ minToken2
+ }: {
+ amount: Uint128;
+ expiration?: Expiration;
+ minToken1: Uint128;
+ minToken2: Uint128;
+ }, fee?: number | StdFee | "auto", memo?: string, funds?: Coin[]) => Promise;
+ swapToken1ForToken2: ({
+ expiration,
+ minToken2,
+ token1Amount
+ }: {
+ expiration?: Expiration;
+ minToken2: Uint128;
+ token1Amount: Uint128;
+ }, fee?: number | StdFee | "auto", memo?: string, funds?: Coin[]) => Promise;
+ swapToken2ForToken1: ({
+ expiration,
+ minToken1,
+ token2Amount
+ }: {
+ expiration?: Expiration;
+ minToken1: Uint128;
+ token2Amount: Uint128;
+ }, fee?: number | StdFee | "auto", memo?: string, funds?: Coin[]) => Promise;
+ multiContractSwap: ({
+ expiration,
+ inputToken,
+ inputTokenAmount,
+ outputAmmAddress,
+ outputMinToken,
+ outputToken
+ }: {
+ expiration?: Expiration;
+ inputToken: TokenSelect;
+ inputTokenAmount: Uint128;
+ outputAmmAddress: Addr;
+ outputMinToken: Uint128;
+ outputToken: TokenSelect;
+ }, fee?: number | StdFee | "auto", memo?: string, funds?: Coin[]) => Promise;
+ swapTo: ({
+ expiration,
+ inputAmount,
+ inputToken,
+ minToken,
+ recipient
+ }: {
+ expiration?: Expiration;
+ inputAmount: Uint128;
+ inputToken: TokenSelect;
+ minToken: Uint128;
+ recipient: Addr;
+ }, fee?: number | StdFee | "auto", memo?: string, funds?: Coin[]) => Promise;
+}
+export class JunoSwapClient extends JunoSwapQueryClient implements JunoSwapInterface {
+ client: SigningCosmWasmClient;
+ sender: string;
+ contractAddress: string;
+
+ constructor(client: SigningCosmWasmClient, sender: string, contractAddress: string) {
+ super(client, contractAddress);
+ this.client = client;
+ this.sender = sender;
+ this.contractAddress = contractAddress;
+ this.addLiquidity = this.addLiquidity.bind(this);
+ this.removeLiquidity = this.removeLiquidity.bind(this);
+ this.swapToken1ForToken2 = this.swapToken1ForToken2.bind(this);
+ this.swapToken2ForToken1 = this.swapToken2ForToken1.bind(this);
+ this.multiContractSwap = this.multiContractSwap.bind(this);
+ this.swapTo = this.swapTo.bind(this);
+ }
+
+ addLiquidity = async ({
+ expiration,
+ maxToken2,
+ minLiquidity,
+ token1Amount
+ }: {
+ expiration?: Expiration;
+ maxToken2: Uint128;
+ minLiquidity: Uint128;
+ token1Amount: Uint128;
+ }, fee: number | StdFee | "auto" = "auto", memo?: string, funds?: Coin[]): Promise => {
+ return await this.client.execute(this.sender, this.contractAddress, {
+ add_liquidity: {
+ expiration,
+ max_token2: maxToken2,
+ min_liquidity: minLiquidity,
+ token1_amount: token1Amount
+ }
+ }, fee, memo, funds);
+ };
+ removeLiquidity = async ({
+ amount,
+ expiration,
+ minToken1,
+ minToken2
+ }: {
+ amount: Uint128;
+ expiration?: Expiration;
+ minToken1: Uint128;
+ minToken2: Uint128;
+ }, fee: number | StdFee | "auto" = "auto", memo?: string, funds?: Coin[]): Promise => {
+ return await this.client.execute(this.sender, this.contractAddress, {
+ remove_liquidity: {
+ amount,
+ expiration,
+ min_token1: minToken1,
+ min_token2: minToken2
+ }
+ }, fee, memo, funds);
+ };
+ swapToken1ForToken2 = async ({
+ expiration,
+ minToken2,
+ token1Amount
+ }: {
+ expiration?: Expiration;
+ minToken2: Uint128;
+ token1Amount: Uint128;
+ }, fee: number | StdFee | "auto" = "auto", memo?: string, funds?: Coin[]): Promise => {
+ return await this.client.execute(this.sender, this.contractAddress, {
+ swap_token1_for_token2: {
+ expiration,
+ min_token2: minToken2,
+ token1_amount: token1Amount
+ }
+ }, fee, memo, funds);
+ };
+ swapToken2ForToken1 = async ({
+ expiration,
+ minToken1,
+ token2Amount
+ }: {
+ expiration?: Expiration;
+ minToken1: Uint128;
+ token2Amount: Uint128;
+ }, fee: number | StdFee | "auto" = "auto", memo?: string, funds?: Coin[]): Promise => {
+ return await this.client.execute(this.sender, this.contractAddress, {
+ swap_token2_for_token1: {
+ expiration,
+ min_token1: minToken1,
+ token2_amount: token2Amount
+ }
+ }, fee, memo, funds);
+ };
+ multiContractSwap = async ({
+ expiration,
+ inputToken,
+ inputTokenAmount,
+ outputAmmAddress,
+ outputMinToken,
+ outputToken
+ }: {
+ expiration?: Expiration;
+ inputToken: TokenSelect;
+ inputTokenAmount: Uint128;
+ outputAmmAddress: Addr;
+ outputMinToken: Uint128;
+ outputToken: TokenSelect;
+ }, fee: number | StdFee | "auto" = "auto", memo?: string, funds?: Coin[]): Promise => {
+ return await this.client.execute(this.sender, this.contractAddress, {
+ multi_contract_swap: {
+ expiration,
+ input_token: inputToken,
+ input_token_amount: inputTokenAmount,
+ output_amm_address: outputAmmAddress,
+ output_min_token: outputMinToken,
+ output_token: outputToken
+ }
+ }, fee, memo, funds);
+ };
+ swapTo = async ({
+ expiration,
+ inputAmount,
+ inputToken,
+ minToken,
+ recipient
+ }: {
+ expiration?: Expiration;
+ inputAmount: Uint128;
+ inputToken: TokenSelect;
+ minToken: Uint128;
+ recipient: Addr;
+ }, fee: number | StdFee | "auto" = "auto", memo?: string, funds?: Coin[]): Promise => {
+ return await this.client.execute(this.sender, this.contractAddress, {
+ swap_to: {
+ expiration,
+ input_amount: inputAmount,
+ input_token: inputToken,
+ min_token: minToken,
+ recipient
+ }
+ }, fee, memo, funds);
+ };
+}
\ No newline at end of file
diff --git a/examples/contracts/codegen/JunoSwap.types.ts b/examples/contracts/codegen/JunoSwap.types.ts
new file mode 100644
index 000000000..0c0998e32
--- /dev/null
+++ b/examples/contracts/codegen/JunoSwap.types.ts
@@ -0,0 +1,125 @@
+/**
+* This file was automatically generated by @cosmwasm/ts-codegen@0.17.0.
+* DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file,
+* and run the @cosmwasm/ts-codegen generate command to regenerate this file.
+*/
+
+export type Uint128 = string;
+export interface BalanceResponse {
+ balance: Uint128;
+ [k: string]: unknown;
+}
+export type ExecuteMsg = {
+ add_liquidity: {
+ expiration?: Expiration | null;
+ max_token2: Uint128;
+ min_liquidity: Uint128;
+ token1_amount: Uint128;
+ [k: string]: unknown;
+ };
+} | {
+ remove_liquidity: {
+ amount: Uint128;
+ expiration?: Expiration | null;
+ min_token1: Uint128;
+ min_token2: Uint128;
+ [k: string]: unknown;
+ };
+} | {
+ swap_token1_for_token2: {
+ expiration?: Expiration | null;
+ min_token2: Uint128;
+ token1_amount: Uint128;
+ [k: string]: unknown;
+ };
+} | {
+ swap_token2_for_token1: {
+ expiration?: Expiration | null;
+ min_token1: Uint128;
+ token2_amount: Uint128;
+ [k: string]: unknown;
+ };
+} | {
+ multi_contract_swap: {
+ expiration?: Expiration | null;
+ input_token: TokenSelect;
+ input_token_amount: Uint128;
+ output_amm_address: Addr;
+ output_min_token: Uint128;
+ output_token: TokenSelect;
+ [k: string]: unknown;
+ };
+} | {
+ swap_to: {
+ expiration?: Expiration | null;
+ input_amount: Uint128;
+ input_token: TokenSelect;
+ min_token: Uint128;
+ recipient: Addr;
+ [k: string]: unknown;
+ };
+};
+export type Expiration = {
+ at_height: number;
+} | {
+ at_time: Timestamp;
+} | {
+ never: {
+ [k: string]: unknown;
+ };
+};
+export type Timestamp = Uint64;
+export type Uint64 = string;
+export type TokenSelect = "Token1" | "Token2";
+export type Addr = string;
+export interface InfoResponse {
+ lp_token_supply: Uint128;
+ token1_address?: string | null;
+ token1_denom: string;
+ token1_reserve: Uint128;
+ token2_address?: string | null;
+ token2_denom: string;
+ token2_reserve: Uint128;
+ [k: string]: unknown;
+}
+export interface InstantiateMsg {
+ token1_address?: Addr | null;
+ token1_denom: string;
+ token2_address?: Addr | null;
+ token2_denom: string;
+ [k: string]: unknown;
+}
+export type QueryMsg = {
+ balance: {
+ address: string;
+ [k: string]: unknown;
+ };
+} | {
+ info: {
+ [k: string]: unknown;
+ };
+} | {
+ token1_for_token2_price: {
+ token1_amount: Uint128;
+ [k: string]: unknown;
+ };
+} | {
+ token2_for_token1_price: {
+ token2_amount: Uint128;
+ [k: string]: unknown;
+ };
+};
+export interface Token {
+ address?: Addr | null;
+ denom: string;
+ reserve: Uint128;
+ [k: string]: unknown;
+}
+export interface Token1ForToken2PriceResponse {
+ token2_amount: Uint128;
+ [k: string]: unknown;
+}
+export interface Token2ForToken1PriceResponse {
+ token1_amount: Uint128;
+ [k: string]: unknown;
+}
\ No newline at end of file
diff --git a/examples/contracts/codegen/confio/proofs.ts b/examples/contracts/codegen/confio/proofs.ts
new file mode 100644
index 000000000..354db9699
--- /dev/null
+++ b/examples/contracts/codegen/confio/proofs.ts
@@ -0,0 +1,1522 @@
+import * as _m0 from "protobufjs/minimal";
+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 HashOpSDKType {
+ /** 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 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";
+ }
+}
+/**
+ * LengthOp defines how to process the key and value of the LeafOp
+ * to include length information. After encoding the length with the given
+ * algorithm, the length will be prepended to the key and value bytes.
+ * (Each one with it's own encoded length)
+ */
+
+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,
+}
+/**
+ * LengthOp defines how to process the key and value of the LeafOp
+ * to include length information. After encoding the length with the given
+ * algorithm, the length will be prepended to the key and value bytes.
+ * (Each one with it's own encoded length)
+ */
+
+export enum LengthOpSDKType {
+ /** 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 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";
+ }
+}
+/**
+ * ExistenceProof takes a key and a value and a set of steps to perform on it.
+ * The result of peforming all these steps will provide a "root hash", which can
+ * be compared to the value in a header.
+ *
+ * Since it is computationally infeasible to produce a hash collission for any of the used
+ * cryptographic hash functions, if someone can provide a series of operations to transform
+ * a given key and value into a root hash that matches some trusted root, these key and values
+ * must be in the referenced merkle tree.
+ *
+ * The only possible issue is maliablity in LeafOp, such as providing extra prefix data,
+ * which should be controlled by a spec. Eg. with lengthOp as NONE,
+ * prefix = FOO, key = BAR, value = CHOICE
+ * and
+ * prefix = F, key = OOBAR, value = CHOICE
+ * would produce the same value.
+ *
+ * With LengthOp this is tricker but not impossible. Which is why the "leafPrefixEqual" field
+ * in the ProofSpec is valuable to prevent this mutability. And why all trees should
+ * length-prefix the data before hashing it.
+ */
+
+export interface ExistenceProof {
+ key: Uint8Array;
+ value: Uint8Array;
+ leaf?: LeafOp | undefined;
+ path: InnerOp[];
+}
+/**
+ * ExistenceProof takes a key and a value and a set of steps to perform on it.
+ * The result of peforming all these steps will provide a "root hash", which can
+ * be compared to the value in a header.
+ *
+ * Since it is computationally infeasible to produce a hash collission for any of the used
+ * cryptographic hash functions, if someone can provide a series of operations to transform
+ * a given key and value into a root hash that matches some trusted root, these key and values
+ * must be in the referenced merkle tree.
+ *
+ * The only possible issue is maliablity in LeafOp, such as providing extra prefix data,
+ * which should be controlled by a spec. Eg. with lengthOp as NONE,
+ * prefix = FOO, key = BAR, value = CHOICE
+ * and
+ * prefix = F, key = OOBAR, value = CHOICE
+ * would produce the same value.
+ *
+ * With LengthOp this is tricker but not impossible. Which is why the "leafPrefixEqual" field
+ * in the ProofSpec is valuable to prevent this mutability. And why all trees should
+ * length-prefix the data before hashing it.
+ */
+
+export interface ExistenceProofSDKType {
+ key: Uint8Array;
+ value: Uint8Array;
+ leaf?: LeafOpSDKType | undefined;
+ path: InnerOpSDKType[];
+}
+/**
+ * NonExistenceProof takes a proof of two neighbors, one left of the desired key,
+ * one right of the desired key. If both proofs are valid AND they are neighbors,
+ * then there is no valid proof for the given key.
+ */
+
+export interface NonExistenceProof {
+ /** TODO: remove this as unnecessary??? we prove a range */
+ key: Uint8Array;
+ left?: ExistenceProof | undefined;
+ right?: ExistenceProof | undefined;
+}
+/**
+ * NonExistenceProof takes a proof of two neighbors, one left of the desired key,
+ * one right of the desired key. If both proofs are valid AND they are neighbors,
+ * then there is no valid proof for the given key.
+ */
+
+export interface NonExistenceProofSDKType {
+ /** TODO: remove this as unnecessary??? we prove a range */
+ key: Uint8Array;
+ left?: ExistenceProofSDKType | undefined;
+ right?: ExistenceProofSDKType | undefined;
+}
+/** CommitmentProof is either an ExistenceProof or a NonExistenceProof, or a Batch of such messages */
+
+export interface CommitmentProof {
+ exist?: ExistenceProof | undefined;
+ nonexist?: NonExistenceProof | undefined;
+ batch?: BatchProof | undefined;
+ compressed?: CompressedBatchProof | undefined;
+}
+/** CommitmentProof is either an ExistenceProof or a NonExistenceProof, or a Batch of such messages */
+
+export interface CommitmentProofSDKType {
+ exist?: ExistenceProofSDKType | undefined;
+ nonexist?: NonExistenceProofSDKType | undefined;
+ batch?: BatchProofSDKType | undefined;
+ compressed?: CompressedBatchProofSDKType | undefined;
+}
+/**
+ * LeafOp represents the raw key-value data we wish to prove, and
+ * must be flexible to represent the internal transformation from
+ * the original key-value pairs into the basis hash, for many existing
+ * merkle trees.
+ *
+ * key and value are passed in. So that the signature of this operation is:
+ * leafOp(key, value) -> output
+ *
+ * To process this, first prehash the keys and values if needed (ANY means no hash in this case):
+ * hkey = prehashKey(key)
+ * hvalue = prehashValue(value)
+ *
+ * Then combine the bytes, and hash it
+ * output = hash(prefix || length(hkey) || hkey || length(hvalue) || hvalue)
+ */
+
+export interface LeafOp {
+ hash: HashOp;
+ prehashKey: HashOp;
+ prehashValue: 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;
+}
+/**
+ * LeafOp represents the raw key-value data we wish to prove, and
+ * must be flexible to represent the internal transformation from
+ * the original key-value pairs into the basis hash, for many existing
+ * merkle trees.
+ *
+ * key and value are passed in. So that the signature of this operation is:
+ * leafOp(key, value) -> output
+ *
+ * To process this, first prehash the keys and values if needed (ANY means no hash in this case):
+ * hkey = prehashKey(key)
+ * hvalue = prehashValue(value)
+ *
+ * Then combine the bytes, and hash it
+ * output = hash(prefix || length(hkey) || hkey || length(hvalue) || hvalue)
+ */
+
+export interface LeafOpSDKType {
+ hash: HashOpSDKType;
+ prehash_key: HashOpSDKType;
+ prehash_value: HashOpSDKType;
+ length: LengthOpSDKType;
+ /**
+ * prefix is a fixed bytes that may optionally be included at the beginning to differentiate
+ * a leaf node from an inner node.
+ */
+
+ prefix: Uint8Array;
+}
+/**
+ * InnerOp represents a merkle-proof step that is not a leaf.
+ * It represents concatenating two children and hashing them to provide the next result.
+ *
+ * The result of the previous step is passed in, so the signature of this op is:
+ * innerOp(child) -> output
+ *
+ * The result of applying InnerOp should be:
+ * output = op.hash(op.prefix || child || op.suffix)
+ *
+ * where the || operator is concatenation of binary data,
+ * and child is the result of hashing all the tree below this step.
+ *
+ * Any special data, like prepending child with the length, or prepending the entire operation with
+ * some value to differentiate from leaf nodes, should be included in prefix and suffix.
+ * If either of prefix or suffix is empty, we just treat it as an empty string
+ */
+
+export interface InnerOp {
+ hash: HashOp;
+ prefix: Uint8Array;
+ suffix: Uint8Array;
+}
+/**
+ * InnerOp represents a merkle-proof step that is not a leaf.
+ * It represents concatenating two children and hashing them to provide the next result.
+ *
+ * The result of the previous step is passed in, so the signature of this op is:
+ * innerOp(child) -> output
+ *
+ * The result of applying InnerOp should be:
+ * output = op.hash(op.prefix || child || op.suffix)
+ *
+ * where the || operator is concatenation of binary data,
+ * and child is the result of hashing all the tree below this step.
+ *
+ * Any special data, like prepending child with the length, or prepending the entire operation with
+ * some value to differentiate from leaf nodes, should be included in prefix and suffix.
+ * If either of prefix or suffix is empty, we just treat it as an empty string
+ */
+
+export interface InnerOpSDKType {
+ hash: HashOpSDKType;
+ prefix: Uint8Array;
+ suffix: Uint8Array;
+}
+/**
+ * ProofSpec defines what the expected parameters are for a given proof type.
+ * This can be stored in the client and used to validate any incoming proofs.
+ *
+ * verify(ProofSpec, Proof) -> Proof | Error
+ *
+ * As demonstrated in tests, if we don't fix the algorithm used to calculate the
+ * LeafHash for a given tree, there are many possible key-value pairs that can
+ * generate a given hash (by interpretting the preimage differently).
+ * We need this for proper security, requires client knows a priori what
+ * tree format server uses. But not in code, rather a configuration object.
+ */
+
+export interface 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)
+ */
+ leafSpec?: LeafOp | undefined;
+ innerSpec?: InnerSpec | undefined;
+ /** max_depth (if > 0) is the maximum number of InnerOps allowed (mainly for fixed-depth tries) */
+
+ maxDepth: number;
+ /** min_depth (if > 0) is the minimum number of InnerOps allowed (mainly for fixed-depth tries) */
+
+ minDepth: number;
+}
+/**
+ * ProofSpec defines what the expected parameters are for a given proof type.
+ * This can be stored in the client and used to validate any incoming proofs.
+ *
+ * verify(ProofSpec, Proof) -> Proof | Error
+ *
+ * As demonstrated in tests, if we don't fix the algorithm used to calculate the
+ * LeafHash for a given tree, there are many possible key-value pairs that can
+ * generate a given hash (by interpretting the preimage differently).
+ * We need this for proper security, requires client knows a priori what
+ * tree format server uses. But not in code, rather a configuration object.
+ */
+
+export interface ProofSpecSDKType {
+ /**
+ * 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?: LeafOpSDKType | undefined;
+ inner_spec?: InnerSpecSDKType | undefined;
+ /** 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;
+}
+/**
+ * InnerSpec contains all store-specific structure info to determine if two proofs from a
+ * given store are neighbors.
+ *
+ * This enables:
+ *
+ * isLeftMost(spec: InnerSpec, op: InnerOp)
+ * isRightMost(spec: InnerSpec, op: InnerOp)
+ * isLeftNeighbor(spec: InnerSpec, left: InnerOp, right: InnerOp)
+ */
+
+export interface 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)
+ */
+ childOrder: number[];
+ childSize: number;
+ minPrefixLength: number;
+ maxPrefixLength: number;
+ /** empty child is the prehash image that is used when one child is nil (eg. 20 bytes of 0) */
+
+ emptyChild: Uint8Array;
+ /** hash is the algorithm that must be used for each InnerOp */
+
+ hash: HashOp;
+}
+/**
+ * InnerSpec contains all store-specific structure info to determine if two proofs from a
+ * given store are neighbors.
+ *
+ * This enables:
+ *
+ * isLeftMost(spec: InnerSpec, op: InnerOp)
+ * isRightMost(spec: InnerSpec, op: InnerOp)
+ * isLeftNeighbor(spec: InnerSpec, left: InnerOp, right: InnerOp)
+ */
+
+export interface InnerSpecSDKType {
+ /**
+ * 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: HashOpSDKType;
+}
+/** BatchProof is a group of multiple proof types than can be compressed */
+
+export interface BatchProof {
+ entries: BatchEntry[];
+}
+/** BatchProof is a group of multiple proof types than can be compressed */
+
+export interface BatchProofSDKType {
+ entries: BatchEntrySDKType[];
+}
+/** Use BatchEntry not CommitmentProof, to avoid recursion */
+
+export interface BatchEntry {
+ exist?: ExistenceProof | undefined;
+ nonexist?: NonExistenceProof | undefined;
+}
+/** Use BatchEntry not CommitmentProof, to avoid recursion */
+
+export interface BatchEntrySDKType {
+ exist?: ExistenceProofSDKType | undefined;
+ nonexist?: NonExistenceProofSDKType | undefined;
+}
+export interface CompressedBatchProof {
+ entries: CompressedBatchEntry[];
+ lookupInners: InnerOp[];
+}
+export interface CompressedBatchProofSDKType {
+ entries: CompressedBatchEntrySDKType[];
+ lookup_inners: InnerOpSDKType[];
+}
+/** Use BatchEntry not CommitmentProof, to avoid recursion */
+
+export interface CompressedBatchEntry {
+ exist?: CompressedExistenceProof | undefined;
+ nonexist?: CompressedNonExistenceProof | undefined;
+}
+/** Use BatchEntry not CommitmentProof, to avoid recursion */
+
+export interface CompressedBatchEntrySDKType {
+ exist?: CompressedExistenceProofSDKType | undefined;
+ nonexist?: CompressedNonExistenceProofSDKType | undefined;
+}
+export interface CompressedExistenceProof {
+ key: Uint8Array;
+ value: Uint8Array;
+ leaf?: LeafOp | undefined;
+ /** these are indexes into the lookup_inners table in CompressedBatchProof */
+
+ path: number[];
+}
+export interface CompressedExistenceProofSDKType {
+ key: Uint8Array;
+ value: Uint8Array;
+ leaf?: LeafOpSDKType | undefined;
+ /** 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 | undefined;
+ right?: CompressedExistenceProof | undefined;
+}
+export interface CompressedNonExistenceProofSDKType {
+ /** TODO: remove this as unnecessary??? we prove a range */
+ key: Uint8Array;
+ left?: CompressedExistenceProofSDKType | undefined;
+ right?: CompressedExistenceProofSDKType | undefined;
+}
+
+function createBaseExistenceProof(): ExistenceProof {
+ return {
+ key: new Uint8Array(),
+ value: new Uint8Array(),
+ leaf: undefined,
+ path: []
+ };
+}
+
+export const ExistenceProof = {
+ encode(message: ExistenceProof, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
+ 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()).ldelim();
+ }
+
+ for (const v of message.path) {
+ InnerOp.encode(v!, writer.uint32(34).fork()).ldelim();
+ }
+
+ return writer;
+ },
+
+ decode(input: _m0.Reader | Uint8Array, length?: number): ExistenceProof {
+ const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
+ let end = length === undefined ? reader.len : reader.pos + length;
+ const message = createBaseExistenceProof();
+
+ while (reader.pos < end) {
+ const tag = reader.uint32();
+
+ switch (tag >>> 3) {
+ case 1:
+ message.key = reader.bytes();
+ break;
+
+ case 2:
+ message.value = reader.bytes();
+ break;
+
+ case 3:
+ message.leaf = LeafOp.decode(reader, reader.uint32());
+ break;
+
+ case 4:
+ message.path.push(InnerOp.decode(reader, reader.uint32()));
+ break;
+
+ default:
+ reader.skipType(tag & 7);
+ break;
+ }
+ }
+
+ return message;
+ },
+
+ fromPartial(object: Partial): ExistenceProof {
+ const message = createBaseExistenceProof();
+ message.key = object.key ?? new Uint8Array();
+ message.value = object.value ?? new Uint8Array();
+ message.leaf = object.leaf !== undefined && object.leaf !== null ? LeafOp.fromPartial(object.leaf) : undefined;
+ message.path = object.path?.map(e => InnerOp.fromPartial(e)) || [];
+ return message;
+ }
+
+};
+
+function createBaseNonExistenceProof(): NonExistenceProof {
+ return {
+ key: new Uint8Array(),
+ left: undefined,
+ right: undefined
+ };
+}
+
+export const NonExistenceProof = {
+ encode(message: NonExistenceProof, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
+ if (message.key.length !== 0) {
+ writer.uint32(10).bytes(message.key);
+ }
+
+ if (message.left !== undefined) {
+ ExistenceProof.encode(message.left, writer.uint32(18).fork()).ldelim();
+ }
+
+ if (message.right !== undefined) {
+ ExistenceProof.encode(message.right, writer.uint32(26).fork()).ldelim();
+ }
+
+ return writer;
+ },
+
+ decode(input: _m0.Reader | Uint8Array, length?: number): NonExistenceProof {
+ const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
+ let end = length === undefined ? reader.len : reader.pos + length;
+ const message = createBaseNonExistenceProof();
+
+ while (reader.pos < end) {
+ const tag = reader.uint32();
+
+ switch (tag >>> 3) {
+ case 1:
+ message.key = reader.bytes();
+ break;
+
+ case 2:
+ message.left = ExistenceProof.decode(reader, reader.uint32());
+ break;
+
+ case 3:
+ message.right = ExistenceProof.decode(reader, reader.uint32());
+ break;
+
+ default:
+ reader.skipType(tag & 7);
+ break;
+ }
+ }
+
+ return message;
+ },
+
+ fromPartial(object: Partial): NonExistenceProof {
+ const message = createBaseNonExistenceProof();
+ message.key = object.key ?? new Uint8Array();
+ 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;
+ }
+
+};
+
+function createBaseCommitmentProof(): CommitmentProof {
+ return {
+ exist: undefined,
+ nonexist: undefined,
+ batch: undefined,
+ compressed: undefined
+ };
+}
+
+export const CommitmentProof = {
+ encode(message: CommitmentProof, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
+ if (message.exist !== undefined) {
+ ExistenceProof.encode(message.exist, writer.uint32(10).fork()).ldelim();
+ }
+
+ if (message.nonexist !== undefined) {
+ NonExistenceProof.encode(message.nonexist, writer.uint32(18).fork()).ldelim();
+ }
+
+ if (message.batch !== undefined) {
+ BatchProof.encode(message.batch, writer.uint32(26).fork()).ldelim();
+ }
+
+ if (message.compressed !== undefined) {
+ CompressedBatchProof.encode(message.compressed, writer.uint32(34).fork()).ldelim();
+ }
+
+ return writer;
+ },
+
+ decode(input: _m0.Reader | Uint8Array, length?: number): CommitmentProof {
+ const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
+ let end = length === undefined ? reader.len : reader.pos + length;
+ const message = createBaseCommitmentProof();
+
+ while (reader.pos < end) {
+ const tag = reader.uint32();
+
+ switch (tag >>> 3) {
+ case 1:
+ message.exist = ExistenceProof.decode(reader, reader.uint32());
+ break;
+
+ case 2:
+ message.nonexist = NonExistenceProof.decode(reader, reader.uint32());
+ break;
+
+ case 3:
+ message.batch = BatchProof.decode(reader, reader.uint32());
+ break;
+
+ case 4:
+ message.compressed = CompressedBatchProof.decode(reader, reader.uint32());
+ break;
+
+ default:
+ reader.skipType(tag & 7);
+ break;
+ }
+ }
+
+ return message;
+ },
+
+ fromPartial(object: Partial): 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;
+ }
+
+};
+
+function createBaseLeafOp(): LeafOp {
+ return {
+ hash: 0,
+ prehashKey: 0,
+ prehashValue: 0,
+ length: 0,
+ prefix: new Uint8Array()
+ };
+}
+
+export const LeafOp = {
+ encode(message: LeafOp, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
+ if (message.hash !== 0) {
+ writer.uint32(8).int32(message.hash);
+ }
+
+ if (message.prehashKey !== 0) {
+ writer.uint32(16).int32(message.prehashKey);
+ }
+
+ if (message.prehashValue !== 0) {
+ writer.uint32(24).int32(message.prehashValue);
+ }
+
+ 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: _m0.Reader | Uint8Array, length?: number): LeafOp {
+ const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
+ let end = length === undefined ? reader.len : reader.pos + length;
+ const message = createBaseLeafOp();
+
+ while (reader.pos < end) {
+ const tag = reader.uint32();
+
+ switch (tag >>> 3) {
+ case 1:
+ message.hash = (reader.int32() as any);
+ break;
+
+ case 2:
+ message.prehashKey = (reader.int32() as any);
+ break;
+
+ case 3:
+ message.prehashValue = (reader.int32() as any);
+ break;
+
+ case 4:
+ message.length = (reader.int32() as any);
+ break;
+
+ case 5:
+ message.prefix = reader.bytes();
+ break;
+
+ default:
+ reader.skipType(tag & 7);
+ break;
+ }
+ }
+
+ return message;
+ },
+
+ fromPartial(object: Partial): LeafOp {
+ const message = createBaseLeafOp();
+ message.hash = object.hash ?? 0;
+ message.prehashKey = object.prehashKey ?? 0;
+ message.prehashValue = object.prehashValue ?? 0;
+ message.length = object.length ?? 0;
+ message.prefix = object.prefix ?? new Uint8Array();
+ return message;
+ }
+
+};
+
+function createBaseInnerOp(): InnerOp {
+ return {
+ hash: 0,
+ prefix: new Uint8Array(),
+ suffix: new Uint8Array()
+ };
+}
+
+export const InnerOp = {
+ encode(message: InnerOp, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
+ 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: _m0.Reader | Uint8Array, length?: number): InnerOp {
+ const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
+ let end = length === undefined ? reader.len : reader.pos + length;
+ const message = createBaseInnerOp();
+
+ while (reader.pos < end) {
+ const tag = reader.uint32();
+
+ switch (tag >>> 3) {
+ case 1:
+ message.hash = (reader.int32() as any);
+ break;
+
+ case 2:
+ message.prefix = reader.bytes();
+ break;
+
+ case 3:
+ message.suffix = reader.bytes();
+ break;
+
+ default:
+ reader.skipType(tag & 7);
+ break;
+ }
+ }
+
+ return message;
+ },
+
+ fromPartial(object: Partial): InnerOp {
+ const message = createBaseInnerOp();
+ message.hash = object.hash ?? 0;
+ message.prefix = object.prefix ?? new Uint8Array();
+ message.suffix = object.suffix ?? new Uint8Array();
+ return message;
+ }
+
+};
+
+function createBaseProofSpec(): ProofSpec {
+ return {
+ leafSpec: undefined,
+ innerSpec: undefined,
+ maxDepth: 0,
+ minDepth: 0
+ };
+}
+
+export const ProofSpec = {
+ encode(message: ProofSpec, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
+ if (message.leafSpec !== undefined) {
+ LeafOp.encode(message.leafSpec, writer.uint32(10).fork()).ldelim();
+ }
+
+ if (message.innerSpec !== undefined) {
+ InnerSpec.encode(message.innerSpec, writer.uint32(18).fork()).ldelim();
+ }
+
+ if (message.maxDepth !== 0) {
+ writer.uint32(24).int32(message.maxDepth);
+ }
+
+ if (message.minDepth !== 0) {
+ writer.uint32(32).int32(message.minDepth);
+ }
+
+ return writer;
+ },
+
+ decode(input: _m0.Reader | Uint8Array, length?: number): ProofSpec {
+ const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
+ let end = length === undefined ? reader.len : reader.pos + length;
+ const message = createBaseProofSpec();
+
+ while (reader.pos < end) {
+ const tag = reader.uint32();
+
+ switch (tag >>> 3) {
+ case 1:
+ message.leafSpec = LeafOp.decode(reader, reader.uint32());
+ break;
+
+ case 2:
+ message.innerSpec = InnerSpec.decode(reader, reader.uint32());
+ break;
+
+ case 3:
+ message.maxDepth = reader.int32();
+ break;
+
+ case 4:
+ message.minDepth = reader.int32();
+ break;
+
+ default:
+ reader.skipType(tag & 7);
+ break;
+ }
+ }
+
+ return message;
+ },
+
+ fromPartial(object: Partial): ProofSpec {
+ const message = createBaseProofSpec();
+ message.leafSpec = object.leafSpec !== undefined && object.leafSpec !== null ? LeafOp.fromPartial(object.leafSpec) : undefined;
+ message.innerSpec = object.innerSpec !== undefined && object.innerSpec !== null ? InnerSpec.fromPartial(object.innerSpec) : undefined;
+ message.maxDepth = object.maxDepth ?? 0;
+ message.minDepth = object.minDepth ?? 0;
+ return message;
+ }
+
+};
+
+function createBaseInnerSpec(): InnerSpec {
+ return {
+ childOrder: [],
+ childSize: 0,
+ minPrefixLength: 0,
+ maxPrefixLength: 0,
+ emptyChild: new Uint8Array(),
+ hash: 0
+ };
+}
+
+export const InnerSpec = {
+ encode(message: InnerSpec, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
+ writer.uint32(10).fork();
+
+ for (const v of message.childOrder) {
+ writer.int32(v);
+ }
+
+ writer.ldelim();
+
+ if (message.childSize !== 0) {
+ writer.uint32(16).int32(message.childSize);
+ }
+
+ if (message.minPrefixLength !== 0) {
+ writer.uint32(24).int32(message.minPrefixLength);
+ }
+
+ if (message.maxPrefixLength !== 0) {
+ writer.uint32(32).int32(message.maxPrefixLength);
+ }
+
+ if (message.emptyChild.length !== 0) {
+ writer.uint32(42).bytes(message.emptyChild);
+ }
+
+ if (message.hash !== 0) {
+ writer.uint32(48).int32(message.hash);
+ }
+
+ return writer;
+ },
+
+ decode(input: _m0.Reader | Uint8Array, length?: number): InnerSpec {
+ const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
+ let 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 & 7) === 2) {
+ const end2 = reader.uint32() + reader.pos;
+
+ while (reader.pos < end2) {
+ message.childOrder.push(reader.int32());
+ }
+ } else {
+ message.childOrder.push(reader.int32());
+ }
+
+ break;
+
+ case 2:
+ message.childSize = reader.int32();
+ break;
+
+ case 3:
+ message.minPrefixLength = reader.int32();
+ break;
+
+ case 4:
+ message.maxPrefixLength = reader.int32();
+ break;
+
+ case 5:
+ message.emptyChild = reader.bytes();
+ break;
+
+ case 6:
+ message.hash = (reader.int32() as any);
+ break;
+
+ default:
+ reader.skipType(tag & 7);
+ break;
+ }
+ }
+
+ return message;
+ },
+
+ fromPartial(object: Partial): InnerSpec {
+ const message = createBaseInnerSpec();
+ message.childOrder = object.childOrder?.map(e => e) || [];
+ message.childSize = object.childSize ?? 0;
+ message.minPrefixLength = object.minPrefixLength ?? 0;
+ message.maxPrefixLength = object.maxPrefixLength ?? 0;
+ message.emptyChild = object.emptyChild ?? new Uint8Array();
+ message.hash = object.hash ?? 0;
+ return message;
+ }
+
+};
+
+function createBaseBatchProof(): BatchProof {
+ return {
+ entries: []
+ };
+}
+
+export const BatchProof = {
+ encode(message: BatchProof, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
+ for (const v of message.entries) {
+ BatchEntry.encode(v!, writer.uint32(10).fork()).ldelim();
+ }
+
+ return writer;
+ },
+
+ decode(input: _m0.Reader | Uint8Array, length?: number): BatchProof {
+ const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
+ let end = length === undefined ? reader.len : reader.pos + length;
+ const message = createBaseBatchProof();
+
+ while (reader.pos < end) {
+ const tag = reader.uint32();
+
+ switch (tag >>> 3) {
+ case 1:
+ message.entries.push(BatchEntry.decode(reader, reader.uint32()));
+ break;
+
+ default:
+ reader.skipType(tag & 7);
+ break;
+ }
+ }
+
+ return message;
+ },
+
+ fromPartial(object: Partial): BatchProof {
+ const message = createBaseBatchProof();
+ message.entries = object.entries?.map(e => BatchEntry.fromPartial(e)) || [];
+ return message;
+ }
+
+};
+
+function createBaseBatchEntry(): BatchEntry {
+ return {
+ exist: undefined,
+ nonexist: undefined
+ };
+}
+
+export const BatchEntry = {
+ encode(message: BatchEntry, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
+ if (message.exist !== undefined) {
+ ExistenceProof.encode(message.exist, writer.uint32(10).fork()).ldelim();
+ }
+
+ if (message.nonexist !== undefined) {
+ NonExistenceProof.encode(message.nonexist, writer.uint32(18).fork()).ldelim();
+ }
+
+ return writer;
+ },
+
+ decode(input: _m0.Reader | Uint8Array, length?: number): BatchEntry {
+ const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
+ let end = length === undefined ? reader.len : reader.pos + length;
+ const message = createBaseBatchEntry();
+
+ while (reader.pos < end) {
+ const tag = reader.uint32();
+
+ switch (tag >>> 3) {
+ case 1:
+ message.exist = ExistenceProof.decode(reader, reader.uint32());
+ break;
+
+ case 2:
+ message.nonexist = NonExistenceProof.decode(reader, reader.uint32());
+ break;
+
+ default:
+ reader.skipType(tag & 7);
+ break;
+ }
+ }
+
+ return message;
+ },
+
+ fromPartial(object: Partial): 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;
+ }
+
+};
+
+function createBaseCompressedBatchProof(): CompressedBatchProof {
+ return {
+ entries: [],
+ lookupInners: []
+ };
+}
+
+export const CompressedBatchProof = {
+ encode(message: CompressedBatchProof, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
+ for (const v of message.entries) {
+ CompressedBatchEntry.encode(v!, writer.uint32(10).fork()).ldelim();
+ }
+
+ for (const v of message.lookupInners) {
+ InnerOp.encode(v!, writer.uint32(18).fork()).ldelim();
+ }
+
+ return writer;
+ },
+
+ decode(input: _m0.Reader | Uint8Array, length?: number): CompressedBatchProof {
+ const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
+ let end = length === undefined ? reader.len : reader.pos + length;
+ const message = createBaseCompressedBatchProof();
+
+ while (reader.pos < end) {
+ const tag = reader.uint32();
+
+ switch (tag >>> 3) {
+ case 1:
+ message.entries.push(CompressedBatchEntry.decode(reader, reader.uint32()));
+ break;
+
+ case 2:
+ message.lookupInners.push(InnerOp.decode(reader, reader.uint32()));
+ break;
+
+ default:
+ reader.skipType(tag & 7);
+ break;
+ }
+ }
+
+ return message;
+ },
+
+ fromPartial(object: Partial): CompressedBatchProof {
+ const message = createBaseCompressedBatchProof();
+ message.entries = object.entries?.map(e => CompressedBatchEntry.fromPartial(e)) || [];
+ message.lookupInners = object.lookupInners?.map(e => InnerOp.fromPartial(e)) || [];
+ return message;
+ }
+
+};
+
+function createBaseCompressedBatchEntry(): CompressedBatchEntry {
+ return {
+ exist: undefined,
+ nonexist: undefined
+ };
+}
+
+export const CompressedBatchEntry = {
+ encode(message: CompressedBatchEntry, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
+ if (message.exist !== undefined) {
+ CompressedExistenceProof.encode(message.exist, writer.uint32(10).fork()).ldelim();
+ }
+
+ if (message.nonexist !== undefined) {
+ CompressedNonExistenceProof.encode(message.nonexist, writer.uint32(18).fork()).ldelim();
+ }
+
+ return writer;
+ },
+
+ decode(input: _m0.Reader | Uint8Array, length?: number): CompressedBatchEntry {
+ const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
+ let end = length === undefined ? reader.len : reader.pos + length;
+ const message = createBaseCompressedBatchEntry();
+
+ while (reader.pos < end) {
+ const tag = reader.uint32();
+
+ switch (tag >>> 3) {
+ case 1:
+ message.exist = CompressedExistenceProof.decode(reader, reader.uint32());
+ break;
+
+ case 2:
+ message.nonexist = CompressedNonExistenceProof.decode(reader, reader.uint32());
+ break;
+
+ default:
+ reader.skipType(tag & 7);
+ break;
+ }
+ }
+
+ return message;
+ },
+
+ fromPartial(object: Partial): 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;
+ }
+
+};
+
+function createBaseCompressedExistenceProof(): CompressedExistenceProof {
+ return {
+ key: new Uint8Array(),
+ value: new Uint8Array(),
+ leaf: undefined,
+ path: []
+ };
+}
+
+export const CompressedExistenceProof = {
+ encode(message: CompressedExistenceProof, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
+ 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()).ldelim();
+ }
+
+ writer.uint32(34).fork();
+
+ for (const v of message.path) {
+ writer.int32(v);
+ }
+
+ writer.ldelim();
+ return writer;
+ },
+
+ decode(input: _m0.Reader | Uint8Array, length?: number): CompressedExistenceProof {
+ const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
+ let end = length === undefined ? reader.len : reader.pos + length;
+ const message = createBaseCompressedExistenceProof();
+
+ while (reader.pos < end) {
+ const tag = reader.uint32();
+
+ switch (tag >>> 3) {
+ case 1:
+ message.key = reader.bytes();
+ break;
+
+ case 2:
+ message.value = reader.bytes();
+ break;
+
+ case 3:
+ message.leaf = LeafOp.decode(reader, reader.uint32());
+ break;
+
+ case 4:
+ if ((tag & 7) === 2) {
+ const end2 = reader.uint32() + reader.pos;
+
+ while (reader.pos < end2) {
+ message.path.push(reader.int32());
+ }
+ } else {
+ message.path.push(reader.int32());
+ }
+
+ break;
+
+ default:
+ reader.skipType(tag & 7);
+ break;
+ }
+ }
+
+ return message;
+ },
+
+ fromPartial(object: Partial): CompressedExistenceProof {
+ const message = createBaseCompressedExistenceProof();
+ message.key = object.key ?? new Uint8Array();
+ message.value = object.value ?? new Uint8Array();
+ message.leaf = object.leaf !== undefined && object.leaf !== null ? LeafOp.fromPartial(object.leaf) : undefined;
+ message.path = object.path?.map(e => e) || [];
+ return message;
+ }
+
+};
+
+function createBaseCompressedNonExistenceProof(): CompressedNonExistenceProof {
+ return {
+ key: new Uint8Array(),
+ left: undefined,
+ right: undefined
+ };
+}
+
+export const CompressedNonExistenceProof = {
+ encode(message: CompressedNonExistenceProof, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
+ if (message.key.length !== 0) {
+ writer.uint32(10).bytes(message.key);
+ }
+
+ if (message.left !== undefined) {
+ CompressedExistenceProof.encode(message.left, writer.uint32(18).fork()).ldelim();
+ }
+
+ if (message.right !== undefined) {
+ CompressedExistenceProof.encode(message.right, writer.uint32(26).fork()).ldelim();
+ }
+
+ return writer;
+ },
+
+ decode(input: _m0.Reader | Uint8Array, length?: number): CompressedNonExistenceProof {
+ const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
+ let end = length === undefined ? reader.len : reader.pos + length;
+ const message = createBaseCompressedNonExistenceProof();
+
+ while (reader.pos < end) {
+ const tag = reader.uint32();
+
+ switch (tag >>> 3) {
+ case 1:
+ message.key = reader.bytes();
+ break;
+
+ case 2:
+ message.left = CompressedExistenceProof.decode(reader, reader.uint32());
+ break;
+
+ case 3:
+ message.right = CompressedExistenceProof.decode(reader, reader.uint32());
+ break;
+
+ default:
+ reader.skipType(tag & 7);
+ break;
+ }
+ }
+
+ return message;
+ },
+
+ fromPartial(object: Partial): CompressedNonExistenceProof {
+ const message = createBaseCompressedNonExistenceProof();
+ message.key = object.key ?? new Uint8Array();
+ 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;
+ }
+
+};
\ No newline at end of file
diff --git a/examples/contracts/codegen/contracts.ts b/examples/contracts/codegen/contracts.ts
new file mode 100644
index 000000000..f89602121
--- /dev/null
+++ b/examples/contracts/codegen/contracts.ts
@@ -0,0 +1,13 @@
+/**
+* This file was automatically generated by @cosmwasm/ts-codegen@0.17.0.
+* DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file,
+* and run the @cosmwasm/ts-codegen generate command to regenerate this file.
+*/
+
+import * as _0 from "./JunoSwap.types";
+import * as _1 from "./JunoSwap.client";
+export namespace contracts {
+ export const JunoSwap = { ..._0,
+ ..._1
+ };
+}
\ No newline at end of file
diff --git a/examples/contracts/codegen/cosmos/app/v1alpha1/config.ts b/examples/contracts/codegen/cosmos/app/v1alpha1/config.ts
new file mode 100644
index 000000000..a67d60bde
--- /dev/null
+++ b/examples/contracts/codegen/cosmos/app/v1alpha1/config.ts
@@ -0,0 +1,176 @@
+import { Any, AnySDKType } from "../../../google/protobuf/any";
+import * as _m0 from "protobufjs/minimal";
+/**
+ * Config represents the configuration for a Cosmos SDK ABCI app.
+ * It is intended that all state machine logic including the version of
+ * baseapp and tx handlers (and possibly even Tendermint) that an app needs
+ * can be described in a config object. For compatibility, the framework should
+ * allow a mixture of declarative and imperative app wiring, however, apps
+ * that strive for the maximum ease of maintainability should be able to describe
+ * their state machine with a config object alone.
+ */
+
+export interface Config {
+ /** modules are the module configurations for the app. */
+ modules: ModuleConfig[];
+}
+/**
+ * Config represents the configuration for a Cosmos SDK ABCI app.
+ * It is intended that all state machine logic including the version of
+ * baseapp and tx handlers (and possibly even Tendermint) that an app needs
+ * can be described in a config object. For compatibility, the framework should
+ * allow a mixture of declarative and imperative app wiring, however, apps
+ * that strive for the maximum ease of maintainability should be able to describe
+ * their state machine with a config object alone.
+ */
+
+export interface ConfigSDKType {
+ /** modules are the module configurations for the app. */
+ modules: ModuleConfigSDKType[];
+}
+/** ModuleConfig is a module configuration for an app. */
+
+export interface ModuleConfig {
+ /**
+ * name is the unique name of the module within the app. It should be a name
+ * that persists between different versions of a module so that modules
+ * can be smoothly upgraded to new versions.
+ *
+ * For example, for the module cosmos.bank.module.v1.Module, we may chose
+ * to simply name the module "bank" in the app. When we upgrade to
+ * cosmos.bank.module.v2.Module, the app-specific name "bank" stays the same
+ * and the framework knows that the v2 module should receive all the same state
+ * that the v1 module had. Note: modules should provide info on which versions
+ * they can migrate from in the ModuleDescriptor.can_migration_from field.
+ */
+ name: string;
+ /**
+ * config is the config object for the module. Module config messages should
+ * define a ModuleDescriptor using the cosmos.app.v1alpha1.is_module extension.
+ */
+
+ config?: Any | undefined;
+}
+/** ModuleConfig is a module configuration for an app. */
+
+export interface ModuleConfigSDKType {
+ /**
+ * name is the unique name of the module within the app. It should be a name
+ * that persists between different versions of a module so that modules
+ * can be smoothly upgraded to new versions.
+ *
+ * For example, for the module cosmos.bank.module.v1.Module, we may chose
+ * to simply name the module "bank" in the app. When we upgrade to
+ * cosmos.bank.module.v2.Module, the app-specific name "bank" stays the same
+ * and the framework knows that the v2 module should receive all the same state
+ * that the v1 module had. Note: modules should provide info on which versions
+ * they can migrate from in the ModuleDescriptor.can_migration_from field.
+ */
+ name: string;
+ /**
+ * config is the config object for the module. Module config messages should
+ * define a ModuleDescriptor using the cosmos.app.v1alpha1.is_module extension.
+ */
+
+ config?: AnySDKType | undefined;
+}
+
+function createBaseConfig(): Config {
+ return {
+ modules: []
+ };
+}
+
+export const Config = {
+ encode(message: Config, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
+ for (const v of message.modules) {
+ ModuleConfig.encode(v!, writer.uint32(10).fork()).ldelim();
+ }
+
+ return writer;
+ },
+
+ decode(input: _m0.Reader | Uint8Array, length?: number): Config {
+ const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
+ let end = length === undefined ? reader.len : reader.pos + length;
+ const message = createBaseConfig();
+
+ while (reader.pos < end) {
+ const tag = reader.uint32();
+
+ switch (tag >>> 3) {
+ case 1:
+ message.modules.push(ModuleConfig.decode(reader, reader.uint32()));
+ break;
+
+ default:
+ reader.skipType(tag & 7);
+ break;
+ }
+ }
+
+ return message;
+ },
+
+ fromPartial(object: Partial): Config {
+ const message = createBaseConfig();
+ message.modules = object.modules?.map(e => ModuleConfig.fromPartial(e)) || [];
+ return message;
+ }
+
+};
+
+function createBaseModuleConfig(): ModuleConfig {
+ return {
+ name: "",
+ config: undefined
+ };
+}
+
+export const ModuleConfig = {
+ encode(message: ModuleConfig, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
+ if (message.name !== "") {
+ writer.uint32(10).string(message.name);
+ }
+
+ if (message.config !== undefined) {
+ Any.encode(message.config, writer.uint32(18).fork()).ldelim();
+ }
+
+ return writer;
+ },
+
+ decode(input: _m0.Reader | Uint8Array, length?: number): ModuleConfig {
+ const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
+ let end = length === undefined ? reader.len : reader.pos + length;
+ const message = createBaseModuleConfig();
+
+ while (reader.pos < end) {
+ const tag = reader.uint32();
+
+ switch (tag >>> 3) {
+ case 1:
+ message.name = reader.string();
+ break;
+
+ case 2:
+ message.config = Any.decode(reader, reader.uint32());
+ break;
+
+ default:
+ reader.skipType(tag & 7);
+ break;
+ }
+ }
+
+ return message;
+ },
+
+ fromPartial(object: Partial): ModuleConfig {
+ const message = createBaseModuleConfig();
+ message.name = object.name ?? "";
+ message.config = object.config !== undefined && object.config !== null ? Any.fromPartial(object.config) : undefined;
+ return message;
+ }
+
+};
\ No newline at end of file
diff --git a/examples/contracts/codegen/cosmos/app/v1alpha1/module.ts b/examples/contracts/codegen/cosmos/app/v1alpha1/module.ts
new file mode 100644
index 000000000..2041ee6c0
--- /dev/null
+++ b/examples/contracts/codegen/cosmos/app/v1alpha1/module.ts
@@ -0,0 +1,342 @@
+import * as _m0 from "protobufjs/minimal";
+/** ModuleDescriptor describes an app module. */
+
+export interface ModuleDescriptor {
+ /**
+ * go_import names the package that should be imported by an app to load the
+ * module in the runtime module registry. Either go_import must be defined here
+ * or the go_package option must be defined at the file level to indicate
+ * to users where to location the module implementation. go_import takes
+ * precedence over go_package when both are defined.
+ */
+ goImport: string;
+ /**
+ * use_package refers to a protobuf package that this module
+ * uses and exposes to the world. In an app, only one module should "use"
+ * or own a single protobuf package. It is assumed that the module uses
+ * all of the .proto files in a single package.
+ */
+
+ usePackage: PackageReference[];
+ /**
+ * can_migrate_from defines which module versions this module can migrate
+ * state from. The framework will check that one module version is able to
+ * migrate from a previous module version before attempting to update its
+ * config. It is assumed that modules can transitively migrate from earlier
+ * versions. For instance if v3 declares it can migrate from v2, and v2
+ * declares it can migrate from v1, the framework knows how to migrate
+ * from v1 to v3, assuming all 3 module versions are registered at runtime.
+ */
+
+ canMigrateFrom: MigrateFromInfo[];
+}
+/** ModuleDescriptor describes an app module. */
+
+export interface ModuleDescriptorSDKType {
+ /**
+ * go_import names the package that should be imported by an app to load the
+ * module in the runtime module registry. Either go_import must be defined here
+ * or the go_package option must be defined at the file level to indicate
+ * to users where to location the module implementation. go_import takes
+ * precedence over go_package when both are defined.
+ */
+ go_import: string;
+ /**
+ * use_package refers to a protobuf package that this module
+ * uses and exposes to the world. In an app, only one module should "use"
+ * or own a single protobuf package. It is assumed that the module uses
+ * all of the .proto files in a single package.
+ */
+
+ use_package: PackageReferenceSDKType[];
+ /**
+ * can_migrate_from defines which module versions this module can migrate
+ * state from. The framework will check that one module version is able to
+ * migrate from a previous module version before attempting to update its
+ * config. It is assumed that modules can transitively migrate from earlier
+ * versions. For instance if v3 declares it can migrate from v2, and v2
+ * declares it can migrate from v1, the framework knows how to migrate
+ * from v1 to v3, assuming all 3 module versions are registered at runtime.
+ */
+
+ can_migrate_from: MigrateFromInfoSDKType[];
+}
+/** PackageReference is a reference to a protobuf package used by a module. */
+
+export interface PackageReference {
+ /** name is the fully-qualified name of the package. */
+ name: string;
+ /**
+ * revision is the optional revision of the package that is being used.
+ * Protobuf packages used in Cosmos should generally have a major version
+ * as the last part of the package name, ex. foo.bar.baz.v1.
+ * The revision of a package can be thought of as the minor version of a
+ * package which has additional backwards compatible definitions that weren't
+ * present in a previous version.
+ *
+ * A package should indicate its revision with a source code comment
+ * above the package declaration in one of its fields containing the
+ * test "Revision N" where N is an integer revision. All packages start
+ * at revision 0 the first time they are released in a module.
+ *
+ * When a new version of a module is released and items are added to existing
+ * .proto files, these definitions should contain comments of the form
+ * "Since Revision N" where N is an integer revision.
+ *
+ * When the module runtime starts up, it will check the pinned proto
+ * image and panic if there are runtime protobuf definitions that are not
+ * in the pinned descriptor which do not have
+ * a "Since Revision N" comment or have a "Since Revision N" comment where
+ * N is <= to the revision specified here. This indicates that the protobuf
+ * files have been updated, but the pinned file descriptor hasn't.
+ *
+ * If there are items in the pinned file descriptor with a revision
+ * greater than the value indicated here, this will also cause a panic
+ * as it may mean that the pinned descriptor for a legacy module has been
+ * improperly updated or that there is some other versioning discrepancy.
+ * Runtime protobuf definitions will also be checked for compatibility
+ * with pinned file descriptors to make sure there are no incompatible changes.
+ *
+ * This behavior ensures that:
+ * * pinned proto images are up-to-date
+ * * protobuf files are carefully annotated with revision comments which
+ * are important good client UX
+ * * protobuf files are changed in backwards and forwards compatible ways
+ */
+
+ revision: number;
+}
+/** PackageReference is a reference to a protobuf package used by a module. */
+
+export interface PackageReferenceSDKType {
+ /** name is the fully-qualified name of the package. */
+ name: string;
+ /**
+ * revision is the optional revision of the package that is being used.
+ * Protobuf packages used in Cosmos should generally have a major version
+ * as the last part of the package name, ex. foo.bar.baz.v1.
+ * The revision of a package can be thought of as the minor version of a
+ * package which has additional backwards compatible definitions that weren't
+ * present in a previous version.
+ *
+ * A package should indicate its revision with a source code comment
+ * above the package declaration in one of its fields containing the
+ * test "Revision N" where N is an integer revision. All packages start
+ * at revision 0 the first time they are released in a module.
+ *
+ * When a new version of a module is released and items are added to existing
+ * .proto files, these definitions should contain comments of the form
+ * "Since Revision N" where N is an integer revision.
+ *
+ * When the module runtime starts up, it will check the pinned proto
+ * image and panic if there are runtime protobuf definitions that are not
+ * in the pinned descriptor which do not have
+ * a "Since Revision N" comment or have a "Since Revision N" comment where
+ * N is <= to the revision specified here. This indicates that the protobuf
+ * files have been updated, but the pinned file descriptor hasn't.
+ *
+ * If there are items in the pinned file descriptor with a revision
+ * greater than the value indicated here, this will also cause a panic
+ * as it may mean that the pinned descriptor for a legacy module has been
+ * improperly updated or that there is some other versioning discrepancy.
+ * Runtime protobuf definitions will also be checked for compatibility
+ * with pinned file descriptors to make sure there are no incompatible changes.
+ *
+ * This behavior ensures that:
+ * * pinned proto images are up-to-date
+ * * protobuf files are carefully annotated with revision comments which
+ * are important good client UX
+ * * protobuf files are changed in backwards and forwards compatible ways
+ */
+
+ revision: number;
+}
+/**
+ * MigrateFromInfo is information on a module version that a newer module
+ * can migrate from.
+ */
+
+export interface MigrateFromInfo {
+ /**
+ * module is the fully-qualified protobuf name of the module config object
+ * for the previous module version, ex: "cosmos.group.module.v1.Module".
+ */
+ module: string;
+}
+/**
+ * MigrateFromInfo is information on a module version that a newer module
+ * can migrate from.
+ */
+
+export interface MigrateFromInfoSDKType {
+ /**
+ * module is the fully-qualified protobuf name of the module config object
+ * for the previous module version, ex: "cosmos.group.module.v1.Module".
+ */
+ module: string;
+}
+
+function createBaseModuleDescriptor(): ModuleDescriptor {
+ return {
+ goImport: "",
+ usePackage: [],
+ canMigrateFrom: []
+ };
+}
+
+export const ModuleDescriptor = {
+ encode(message: ModuleDescriptor, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
+ if (message.goImport !== "") {
+ writer.uint32(10).string(message.goImport);
+ }
+
+ for (const v of message.usePackage) {
+ PackageReference.encode(v!, writer.uint32(18).fork()).ldelim();
+ }
+
+ for (const v of message.canMigrateFrom) {
+ MigrateFromInfo.encode(v!, writer.uint32(26).fork()).ldelim();
+ }
+
+ return writer;
+ },
+
+ decode(input: _m0.Reader | Uint8Array, length?: number): ModuleDescriptor {
+ const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
+ let end = length === undefined ? reader.len : reader.pos + length;
+ const message = createBaseModuleDescriptor();
+
+ while (reader.pos < end) {
+ const tag = reader.uint32();
+
+ switch (tag >>> 3) {
+ case 1:
+ message.goImport = reader.string();
+ break;
+
+ case 2:
+ message.usePackage.push(PackageReference.decode(reader, reader.uint32()));
+ break;
+
+ case 3:
+ message.canMigrateFrom.push(MigrateFromInfo.decode(reader, reader.uint32()));
+ break;
+
+ default:
+ reader.skipType(tag & 7);
+ break;
+ }
+ }
+
+ return message;
+ },
+
+ fromPartial(object: Partial): ModuleDescriptor {
+ const message = createBaseModuleDescriptor();
+ message.goImport = object.goImport ?? "";
+ message.usePackage = object.usePackage?.map(e => PackageReference.fromPartial(e)) || [];
+ message.canMigrateFrom = object.canMigrateFrom?.map(e => MigrateFromInfo.fromPartial(e)) || [];
+ return message;
+ }
+
+};
+
+function createBasePackageReference(): PackageReference {
+ return {
+ name: "",
+ revision: 0
+ };
+}
+
+export const PackageReference = {
+ encode(message: PackageReference, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
+ if (message.name !== "") {
+ writer.uint32(10).string(message.name);
+ }
+
+ if (message.revision !== 0) {
+ writer.uint32(16).uint32(message.revision);
+ }
+
+ return writer;
+ },
+
+ decode(input: _m0.Reader | Uint8Array, length?: number): PackageReference {
+ const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
+ let end = length === undefined ? reader.len : reader.pos + length;
+ const message = createBasePackageReference();
+
+ while (reader.pos < end) {
+ const tag = reader.uint32();
+
+ switch (tag >>> 3) {
+ case 1:
+ message.name = reader.string();
+ break;
+
+ case 2:
+ message.revision = reader.uint32();
+ break;
+
+ default:
+ reader.skipType(tag & 7);
+ break;
+ }
+ }
+
+ return message;
+ },
+
+ fromPartial(object: Partial): PackageReference {
+ const message = createBasePackageReference();
+ message.name = object.name ?? "";
+ message.revision = object.revision ?? 0;
+ return message;
+ }
+
+};
+
+function createBaseMigrateFromInfo(): MigrateFromInfo {
+ return {
+ module: ""
+ };
+}
+
+export const MigrateFromInfo = {
+ encode(message: MigrateFromInfo, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
+ if (message.module !== "") {
+ writer.uint32(10).string(message.module);
+ }
+
+ return writer;
+ },
+
+ decode(input: _m0.Reader | Uint8Array, length?: number): MigrateFromInfo {
+ const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
+ let end = length === undefined ? reader.len : reader.pos + length;
+ const message = createBaseMigrateFromInfo();
+
+ while (reader.pos < end) {
+ const tag = reader.uint32();
+
+ switch (tag >>> 3) {
+ case 1:
+ message.module = reader.string();
+ break;
+
+ default:
+ reader.skipType(tag & 7);
+ break;
+ }
+ }
+
+ return message;
+ },
+
+ fromPartial(object: Partial): MigrateFromInfo {
+ const message = createBaseMigrateFromInfo();
+ message.module = object.module ?? "";
+ return message;
+ }
+
+};
\ No newline at end of file
diff --git a/examples/contracts/codegen/cosmos/app/v1alpha1/query.rpc.query.ts b/examples/contracts/codegen/cosmos/app/v1alpha1/query.rpc.query.ts
new file mode 100644
index 000000000..9ae7ca7f3
--- /dev/null
+++ b/examples/contracts/codegen/cosmos/app/v1alpha1/query.rpc.query.ts
@@ -0,0 +1,35 @@
+import { Rpc } from "../../../helpers";
+import * as _m0 from "protobufjs/minimal";
+import { QueryClient, createProtobufRpcClient } from "@cosmjs/stargate";
+import { QueryConfigRequest, QueryConfigResponse } from "./query";
+/** Query is the app module query service. */
+
+export interface Query {
+ /** Config returns the current app config. */
+ config(request?: QueryConfigRequest): Promise;
+}
+export class QueryClientImpl implements Query {
+ private readonly rpc: Rpc;
+
+ constructor(rpc: Rpc) {
+ this.rpc = rpc;
+ this.config = this.config.bind(this);
+ }
+
+ config(request: QueryConfigRequest = {}): Promise {
+ const data = QueryConfigRequest.encode(request).finish();
+ const promise = this.rpc.request("cosmos.app.v1alpha1.Query", "Config", data);
+ return promise.then(data => QueryConfigResponse.decode(new _m0.Reader(data)));
+ }
+
+}
+export const createRpcQueryExtension = (base: QueryClient) => {
+ const rpc = createProtobufRpcClient(base);
+ const queryService = new QueryClientImpl(rpc);
+ return {
+ config(request?: QueryConfigRequest): Promise {
+ return queryService.config(request);
+ }
+
+ };
+};
\ No newline at end of file
diff --git a/examples/contracts/codegen/cosmos/app/v1alpha1/query.ts b/examples/contracts/codegen/cosmos/app/v1alpha1/query.ts
new file mode 100644
index 000000000..005f0d648
--- /dev/null
+++ b/examples/contracts/codegen/cosmos/app/v1alpha1/query.ts
@@ -0,0 +1,99 @@
+import { Config, ConfigSDKType } from "./config";
+import * as _m0 from "protobufjs/minimal";
+/** QueryConfigRequest is the Query/Config request type. */
+
+export interface QueryConfigRequest {}
+/** QueryConfigRequest is the Query/Config request type. */
+
+export interface QueryConfigRequestSDKType {}
+/** QueryConfigRequest is the Query/Config response type. */
+
+export interface QueryConfigResponse {
+ /** config is the current app config. */
+ config?: Config | undefined;
+}
+/** QueryConfigRequest is the Query/Config response type. */
+
+export interface QueryConfigResponseSDKType {
+ /** config is the current app config. */
+ config?: ConfigSDKType | undefined;
+}
+
+function createBaseQueryConfigRequest(): QueryConfigRequest {
+ return {};
+}
+
+export const QueryConfigRequest = {
+ encode(_: QueryConfigRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
+ return writer;
+ },
+
+ decode(input: _m0.Reader | Uint8Array, length?: number): QueryConfigRequest {
+ const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
+ let end = length === undefined ? reader.len : reader.pos + length;
+ const message = createBaseQueryConfigRequest();
+
+ while (reader.pos < end) {
+ const tag = reader.uint32();
+
+ switch (tag >>> 3) {
+ default:
+ reader.skipType(tag & 7);
+ break;
+ }
+ }
+
+ return message;
+ },
+
+ fromPartial(_: Partial): QueryConfigRequest {
+ const message = createBaseQueryConfigRequest();
+ return message;
+ }
+
+};
+
+function createBaseQueryConfigResponse(): QueryConfigResponse {
+ return {
+ config: undefined
+ };
+}
+
+export const QueryConfigResponse = {
+ encode(message: QueryConfigResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
+ if (message.config !== undefined) {
+ Config.encode(message.config, writer.uint32(10).fork()).ldelim();
+ }
+
+ return writer;
+ },
+
+ decode(input: _m0.Reader | Uint8Array, length?: number): QueryConfigResponse {
+ const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
+ let end = length === undefined ? reader.len : reader.pos + length;
+ const message = createBaseQueryConfigResponse();
+
+ while (reader.pos < end) {
+ const tag = reader.uint32();
+
+ switch (tag >>> 3) {
+ case 1:
+ message.config = Config.decode(reader, reader.uint32());
+ break;
+
+ default:
+ reader.skipType(tag & 7);
+ break;
+ }
+ }
+
+ return message;
+ },
+
+ fromPartial(object: Partial): QueryConfigResponse {
+ const message = createBaseQueryConfigResponse();
+ message.config = object.config !== undefined && object.config !== null ? Config.fromPartial(object.config) : undefined;
+ return message;
+ }
+
+};
\ No newline at end of file
diff --git a/examples/contracts/codegen/cosmos/auth/v1beta1/auth.ts b/examples/contracts/codegen/cosmos/auth/v1beta1/auth.ts
new file mode 100644
index 000000000..61a7013dd
--- /dev/null
+++ b/examples/contracts/codegen/cosmos/auth/v1beta1/auth.ts
@@ -0,0 +1,284 @@
+import { Any, AnySDKType } from "../../../google/protobuf/any";
+import * as _m0 from "protobufjs/minimal";
+import { Long } from "../../../helpers";
+/**
+ * BaseAccount defines a base account type. It contains all the necessary fields
+ * for basic account functionality. Any custom account type should extend this
+ * type for additional functionality (e.g. vesting).
+ */
+
+export interface BaseAccount {
+ address: string;
+ pubKey?: Any | undefined;
+ accountNumber: Long;
+ sequence: Long;
+}
+/**
+ * BaseAccount defines a base account type. It contains all the necessary fields
+ * for basic account functionality. Any custom account type should extend this
+ * type for additional functionality (e.g. vesting).
+ */
+
+export interface BaseAccountSDKType {
+ address: string;
+ pub_key?: AnySDKType | undefined;
+ account_number: Long;
+ sequence: Long;
+}
+/** ModuleAccount defines an account for modules that holds coins on a pool. */
+
+export interface ModuleAccount {
+ baseAccount?: BaseAccount | undefined;
+ name: string;
+ permissions: string[];
+}
+/** ModuleAccount defines an account for modules that holds coins on a pool. */
+
+export interface ModuleAccountSDKType {
+ base_account?: BaseAccountSDKType | undefined;
+ name: string;
+ permissions: string[];
+}
+/** Params defines the parameters for the auth module. */
+
+export interface Params {
+ maxMemoCharacters: Long;
+ txSigLimit: Long;
+ txSizeCostPerByte: Long;
+ sigVerifyCostEd25519: Long;
+ sigVerifyCostSecp256k1: Long;
+}
+/** Params defines the parameters for the auth module. */
+
+export interface ParamsSDKType {
+ max_memo_characters: Long;
+ tx_sig_limit: Long;
+ tx_size_cost_per_byte: Long;
+ sig_verify_cost_ed25519: Long;
+ sig_verify_cost_secp256k1: Long;
+}
+
+function createBaseBaseAccount(): BaseAccount {
+ return {
+ address: "",
+ pubKey: undefined,
+ accountNumber: Long.UZERO,
+ sequence: Long.UZERO
+ };
+}
+
+export const BaseAccount = {
+ encode(message: BaseAccount, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
+ if (message.address !== "") {
+ writer.uint32(10).string(message.address);
+ }
+
+ if (message.pubKey !== undefined) {
+ Any.encode(message.pubKey, writer.uint32(18).fork()).ldelim();
+ }
+
+ if (!message.accountNumber.isZero()) {
+ writer.uint32(24).uint64(message.accountNumber);
+ }
+
+ if (!message.sequence.isZero()) {
+ writer.uint32(32).uint64(message.sequence);
+ }
+
+ return writer;
+ },
+
+ decode(input: _m0.Reader | Uint8Array, length?: number): BaseAccount {
+ const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
+ let end = length === undefined ? reader.len : reader.pos + length;
+ const message = createBaseBaseAccount();
+
+ while (reader.pos < end) {
+ const tag = reader.uint32();
+
+ switch (tag >>> 3) {
+ case 1:
+ message.address = reader.string();
+ break;
+
+ case 2:
+ message.pubKey = Any.decode(reader, reader.uint32());
+ break;
+
+ case 3:
+ message.accountNumber = (reader.uint64() as Long);
+ break;
+
+ case 4:
+ message.sequence = (reader.uint64() as Long);
+ break;
+
+ default:
+ reader.skipType(tag & 7);
+ break;
+ }
+ }
+
+ return message;
+ },
+
+ fromPartial(object: Partial): BaseAccount {
+ const message = createBaseBaseAccount();
+ message.address = object.address ?? "";
+ message.pubKey = object.pubKey !== undefined && object.pubKey !== null ? Any.fromPartial(object.pubKey) : undefined;
+ message.accountNumber = object.accountNumber !== undefined && object.accountNumber !== null ? Long.fromValue(object.accountNumber) : Long.UZERO;
+ message.sequence = object.sequence !== undefined && object.sequence !== null ? Long.fromValue(object.sequence) : Long.UZERO;
+ return message;
+ }
+
+};
+
+function createBaseModuleAccount(): ModuleAccount {
+ return {
+ baseAccount: undefined,
+ name: "",
+ permissions: []
+ };
+}
+
+export const ModuleAccount = {
+ encode(message: ModuleAccount, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
+ if (message.baseAccount !== undefined) {
+ BaseAccount.encode(message.baseAccount, writer.uint32(10).fork()).ldelim();
+ }
+
+ if (message.name !== "") {
+ writer.uint32(18).string(message.name);
+ }
+
+ for (const v of message.permissions) {
+ writer.uint32(26).string(v!);
+ }
+
+ return writer;
+ },
+
+ decode(input: _m0.Reader | Uint8Array, length?: number): ModuleAccount {
+ const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
+ let end = length === undefined ? reader.len : reader.pos + length;
+ const message = createBaseModuleAccount();
+
+ while (reader.pos < end) {
+ const tag = reader.uint32();
+
+ switch (tag >>> 3) {
+ case 1:
+ message.baseAccount = BaseAccount.decode(reader, reader.uint32());
+ break;
+
+ case 2:
+ message.name = reader.string();
+ break;
+
+ case 3:
+ message.permissions.push(reader.string());
+ break;
+
+ default:
+ reader.skipType(tag & 7);
+ break;
+ }
+ }
+
+ return message;
+ },
+
+ fromPartial(object: Partial): ModuleAccount {
+ const message = createBaseModuleAccount();
+ message.baseAccount = object.baseAccount !== undefined && object.baseAccount !== null ? BaseAccount.fromPartial(object.baseAccount) : undefined;
+ message.name = object.name ?? "";
+ message.permissions = object.permissions?.map(e => e) || [];
+ return message;
+ }
+
+};
+
+function createBaseParams(): Params {
+ return {
+ maxMemoCharacters: Long.UZERO,
+ txSigLimit: Long.UZERO,
+ txSizeCostPerByte: Long.UZERO,
+ sigVerifyCostEd25519: Long.UZERO,
+ sigVerifyCostSecp256k1: Long.UZERO
+ };
+}
+
+export const Params = {
+ encode(message: Params, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
+ if (!message.maxMemoCharacters.isZero()) {
+ writer.uint32(8).uint64(message.maxMemoCharacters);
+ }
+
+ if (!message.txSigLimit.isZero()) {
+ writer.uint32(16).uint64(message.txSigLimit);
+ }
+
+ if (!message.txSizeCostPerByte.isZero()) {
+ writer.uint32(24).uint64(message.txSizeCostPerByte);
+ }
+
+ if (!message.sigVerifyCostEd25519.isZero()) {
+ writer.uint32(32).uint64(message.sigVerifyCostEd25519);
+ }
+
+ if (!message.sigVerifyCostSecp256k1.isZero()) {
+ writer.uint32(40).uint64(message.sigVerifyCostSecp256k1);
+ }
+
+ return writer;
+ },
+
+ decode(input: _m0.Reader | Uint8Array, length?: number): Params {
+ const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
+ let end = length === undefined ? reader.len : reader.pos + length;
+ const message = createBaseParams();
+
+ while (reader.pos < end) {
+ const tag = reader.uint32();
+
+ switch (tag >>> 3) {
+ case 1:
+ message.maxMemoCharacters = (reader.uint64() as Long);
+ break;
+
+ case 2:
+ message.txSigLimit = (reader.uint64() as Long);
+ break;
+
+ case 3:
+ message.txSizeCostPerByte = (reader.uint64() as Long);
+ break;
+
+ case 4:
+ message.sigVerifyCostEd25519 = (reader.uint64() as Long);
+ break;
+
+ case 5:
+ message.sigVerifyCostSecp256k1 = (reader.uint64() as Long);
+ break;
+
+ default:
+ reader.skipType(tag & 7);
+ break;
+ }
+ }
+
+ return message;
+ },
+
+ fromPartial(object: Partial): Params {
+ const message = createBaseParams();
+ message.maxMemoCharacters = object.maxMemoCharacters !== undefined && object.maxMemoCharacters !== null ? Long.fromValue(object.maxMemoCharacters) : Long.UZERO;
+ message.txSigLimit = object.txSigLimit !== undefined && object.txSigLimit !== null ? Long.fromValue(object.txSigLimit) : Long.UZERO;
+ message.txSizeCostPerByte = object.txSizeCostPerByte !== undefined && object.txSizeCostPerByte !== null ? Long.fromValue(object.txSizeCostPerByte) : Long.UZERO;
+ message.sigVerifyCostEd25519 = object.sigVerifyCostEd25519 !== undefined && object.sigVerifyCostEd25519 !== null ? Long.fromValue(object.sigVerifyCostEd25519) : Long.UZERO;
+ message.sigVerifyCostSecp256k1 = object.sigVerifyCostSecp256k1 !== undefined && object.sigVerifyCostSecp256k1 !== null ? Long.fromValue(object.sigVerifyCostSecp256k1) : Long.UZERO;
+ return message;
+ }
+
+};
\ No newline at end of file
diff --git a/examples/contracts/codegen/cosmos/auth/v1beta1/genesis.ts b/examples/contracts/codegen/cosmos/auth/v1beta1/genesis.ts
new file mode 100644
index 000000000..af6abc863
--- /dev/null
+++ b/examples/contracts/codegen/cosmos/auth/v1beta1/genesis.ts
@@ -0,0 +1,76 @@
+import { Params, ParamsSDKType } from "./auth";
+import { Any, AnySDKType } from "../../../google/protobuf/any";
+import * as _m0 from "protobufjs/minimal";
+/** GenesisState defines the auth module's genesis state. */
+
+export interface GenesisState {
+ /** params defines all the paramaters of the module. */
+ params?: Params | undefined;
+ /** accounts are the accounts present at genesis. */
+
+ accounts: Any[];
+}
+/** GenesisState defines the auth module's genesis state. */
+
+export interface GenesisStateSDKType {
+ /** params defines all the paramaters of the module. */
+ params?: ParamsSDKType | undefined;
+ /** accounts are the accounts present at genesis. */
+
+ accounts: AnySDKType[];
+}
+
+function createBaseGenesisState(): GenesisState {
+ return {
+ params: undefined,
+ accounts: []
+ };
+}
+
+export const GenesisState = {
+ encode(message: GenesisState, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
+ if (message.params !== undefined) {
+ Params.encode(message.params, writer.uint32(10).fork()).ldelim();
+ }
+
+ for (const v of message.accounts) {
+ Any.encode(v!, writer.uint32(18).fork()).ldelim();
+ }
+
+ return writer;
+ },
+
+ decode(input: _m0.Reader | Uint8Array, length?: number): GenesisState {
+ const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
+ let end = length === undefined ? reader.len : reader.pos + length;
+ const message = createBaseGenesisState();
+
+ while (reader.pos < end) {
+ const tag = reader.uint32();
+
+ switch (tag >>> 3) {
+ case 1:
+ message.params = Params.decode(reader, reader.uint32());
+ break;
+
+ case 2:
+ message.accounts.push(Any.decode(reader, reader.uint32()));
+ break;
+
+ default:
+ reader.skipType(tag & 7);
+ break;
+ }
+ }
+
+ return message;
+ },
+
+ fromPartial(object: Partial): 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;
+ }
+
+};
\ No newline at end of file
diff --git a/examples/contracts/codegen/cosmos/auth/v1beta1/query.lcd.ts b/examples/contracts/codegen/cosmos/auth/v1beta1/query.lcd.ts
new file mode 100644
index 000000000..83fdf31f5
--- /dev/null
+++ b/examples/contracts/codegen/cosmos/auth/v1beta1/query.lcd.ts
@@ -0,0 +1,83 @@
+import { setPaginationParams } from "../../../helpers";
+import { LCDClient } from "@osmonauts/lcd";
+import { QueryAccountsRequest, QueryAccountsResponseSDKType, QueryAccountRequest, QueryAccountResponseSDKType, QueryParamsRequest, QueryParamsResponseSDKType, QueryModuleAccountsRequest, QueryModuleAccountsResponseSDKType, Bech32PrefixRequest, Bech32PrefixResponseSDKType, AddressBytesToStringRequest, AddressBytesToStringResponseSDKType, AddressStringToBytesRequest, AddressStringToBytesResponseSDKType } from "./query";
+export class LCDQueryClient {
+ req: LCDClient;
+
+ constructor({
+ requestClient
+ }: {
+ requestClient: LCDClient;
+ }) {
+ this.req = requestClient;
+ this.accounts = this.accounts.bind(this);
+ this.account = this.account.bind(this);
+ this.params = this.params.bind(this);
+ this.moduleAccounts = this.moduleAccounts.bind(this);
+ this.bech32Prefix = this.bech32Prefix.bind(this);
+ this.addressBytesToString = this.addressBytesToString.bind(this);
+ this.addressStringToBytes = this.addressStringToBytes.bind(this);
+ }
+ /* Accounts returns all the existing accounts
+
+ Since: cosmos-sdk 0.43 */
+
+
+ async accounts(params: QueryAccountsRequest = {
+ pagination: undefined
+ }): Promise {
+ const options: any = {
+ params: {}
+ };
+
+ if (typeof params?.pagination !== "undefined") {
+ setPaginationParams(options, params.pagination);
+ }
+
+ const endpoint = `cosmos/auth/v1beta1/accounts`;
+ return await this.req.get(endpoint, options);
+ }
+ /* Account returns account details based on address. */
+
+
+ async account(params: QueryAccountRequest): Promise {
+ const endpoint = `cosmos/auth/v1beta1/accounts/${params.address}`;
+ return await this.req.get(endpoint);
+ }
+ /* Params queries all parameters. */
+
+
+ async params(_params: QueryParamsRequest = {}): Promise {
+ const endpoint = `cosmos/auth/v1beta1/params`;
+ return await this.req.get(endpoint);
+ }
+ /* ModuleAccounts returns all the existing module accounts. */
+
+
+ async moduleAccounts(_params: QueryModuleAccountsRequest = {}): Promise {
+ const endpoint = `cosmos/auth/v1beta1/module_accounts`;
+ return await this.req.get(endpoint);
+ }
+ /* Bech32 queries bech32Prefix */
+
+
+ async bech32Prefix(_params: Bech32PrefixRequest = {}): Promise {
+ const endpoint = `cosmos/auth/v1beta1/bech32`;
+ return await this.req.get(endpoint);
+ }
+ /* AddressBytesToString converts Account Address bytes to string */
+
+
+ async addressBytesToString(params: AddressBytesToStringRequest): Promise {
+ const endpoint = `cosmos/auth/v1beta1/bech32/${params.addressBytes}`;
+ return await this.req.get(endpoint);
+ }
+ /* AddressStringToBytes converts Address string to bytes */
+
+
+ async addressStringToBytes(params: AddressStringToBytesRequest): Promise {
+ const endpoint = `cosmos/auth/v1beta1/bech32/${params.addressString}`;
+ return await this.req.get(endpoint);
+ }
+
+}
\ No newline at end of file
diff --git a/examples/contracts/codegen/cosmos/auth/v1beta1/query.rpc.query.ts b/examples/contracts/codegen/cosmos/auth/v1beta1/query.rpc.query.ts
new file mode 100644
index 000000000..bd0c78f34
--- /dev/null
+++ b/examples/contracts/codegen/cosmos/auth/v1beta1/query.rpc.query.ts
@@ -0,0 +1,125 @@
+import { Rpc } from "../../../helpers";
+import * as _m0 from "protobufjs/minimal";
+import { QueryClient, createProtobufRpcClient } from "@cosmjs/stargate";
+import { QueryAccountsRequest, QueryAccountsResponse, QueryAccountRequest, QueryAccountResponse, QueryParamsRequest, QueryParamsResponse, QueryModuleAccountsRequest, QueryModuleAccountsResponse, Bech32PrefixRequest, Bech32PrefixResponse, AddressBytesToStringRequest, AddressBytesToStringResponse, AddressStringToBytesRequest, AddressStringToBytesResponse } from "./query";
+/** Query defines the gRPC querier service. */
+
+export interface Query {
+ /**
+ * Accounts returns all the existing accounts
+ *
+ * Since: cosmos-sdk 0.43
+ */
+ accounts(request?: QueryAccountsRequest): Promise;
+ /** Account returns account details based on address. */
+
+ account(request: QueryAccountRequest): Promise;
+ /** Params queries all parameters. */
+
+ params(request?: QueryParamsRequest): Promise;
+ /** ModuleAccounts returns all the existing module accounts. */
+
+ moduleAccounts(request?: QueryModuleAccountsRequest): Promise;
+ /** Bech32 queries bech32Prefix */
+
+ bech32Prefix(request?: Bech32PrefixRequest): Promise;
+ /** AddressBytesToString converts Account Address bytes to string */
+
+ addressBytesToString(request: AddressBytesToStringRequest): Promise;
+ /** AddressStringToBytes converts Address string to bytes */
+
+ addressStringToBytes(request: AddressStringToBytesRequest): Promise;
+}
+export class QueryClientImpl implements Query {
+ private readonly rpc: Rpc;
+
+ constructor(rpc: Rpc) {
+ this.rpc = rpc;
+ this.accounts = this.accounts.bind(this);
+ this.account = this.account.bind(this);
+ this.params = this.params.bind(this);
+ this.moduleAccounts = this.moduleAccounts.bind(this);
+ this.bech32Prefix = this.bech32Prefix.bind(this);
+ this.addressBytesToString = this.addressBytesToString.bind(this);
+ this.addressStringToBytes = this.addressStringToBytes.bind(this);
+ }
+
+ accounts(request: QueryAccountsRequest = {
+ pagination: undefined
+ }): Promise {
+ const data = QueryAccountsRequest.encode(request).finish();
+ const promise = this.rpc.request("cosmos.auth.v1beta1.Query", "Accounts", data);
+ return promise.then(data => QueryAccountsResponse.decode(new _m0.Reader(data)));
+ }
+
+ account(request: QueryAccountRequest): Promise {
+ const data = QueryAccountRequest.encode(request).finish();
+ const promise = this.rpc.request("cosmos.auth.v1beta1.Query", "Account", data);
+ return promise.then(data => QueryAccountResponse.decode(new _m0.Reader(data)));
+ }
+
+ params(request: QueryParamsRequest = {}): Promise {
+ const data = QueryParamsRequest.encode(request).finish();
+ const promise = this.rpc.request("cosmos.auth.v1beta1.Query", "Params", data);
+ return promise.then(data => QueryParamsResponse.decode(new _m0.Reader(data)));
+ }
+
+ moduleAccounts(request: QueryModuleAccountsRequest = {}): Promise {
+ const data = QueryModuleAccountsRequest.encode(request).finish();
+ const promise = this.rpc.request("cosmos.auth.v1beta1.Query", "ModuleAccounts", data);
+ return promise.then(data => QueryModuleAccountsResponse.decode(new _m0.Reader(data)));
+ }
+
+ bech32Prefix(request: Bech32PrefixRequest = {}): Promise {
+ const data = Bech32PrefixRequest.encode(request).finish();
+ const promise = this.rpc.request("cosmos.auth.v1beta1.Query", "Bech32Prefix", data);
+ return promise.then(data => Bech32PrefixResponse.decode(new _m0.Reader(data)));
+ }
+
+ addressBytesToString(request: AddressBytesToStringRequest): Promise {
+ const data = AddressBytesToStringRequest.encode(request).finish();
+ const promise = this.rpc.request("cosmos.auth.v1beta1.Query", "AddressBytesToString", data);
+ return promise.then(data => AddressBytesToStringResponse.decode(new _m0.Reader(data)));
+ }
+
+ addressStringToBytes(request: AddressStringToBytesRequest): Promise {
+ const data = AddressStringToBytesRequest.encode(request).finish();
+ const promise = this.rpc.request("cosmos.auth.v1beta1.Query", "AddressStringToBytes", data);
+ return promise.then(data => AddressStringToBytesResponse.decode(new _m0.Reader(data)));
+ }
+
+}
+export const createRpcQueryExtension = (base: QueryClient) => {
+ const rpc = createProtobufRpcClient(base);
+ const queryService = new QueryClientImpl(rpc);
+ return {
+ accounts(request?: QueryAccountsRequest): Promise {
+ return queryService.accounts(request);
+ },
+
+ account(request: QueryAccountRequest): Promise {
+ return queryService.account(request);
+ },
+
+ params(request?: QueryParamsRequest): Promise {
+ return queryService.params(request);
+ },
+
+ moduleAccounts(request?: QueryModuleAccountsRequest): Promise {
+ return queryService.moduleAccounts(request);
+ },
+
+ bech32Prefix(request?: Bech32PrefixRequest): Promise {
+ return queryService.bech32Prefix(request);
+ },
+
+ addressBytesToString(request: AddressBytesToStringRequest): Promise {
+ return queryService.addressBytesToString(request);
+ },
+
+ addressStringToBytes(request: AddressStringToBytesRequest): Promise {
+ return queryService.addressStringToBytes(request);
+ }
+
+ };
+};
\ No newline at end of file
diff --git a/examples/contracts/codegen/cosmos/auth/v1beta1/query.ts b/examples/contracts/codegen/cosmos/auth/v1beta1/query.ts
new file mode 100644
index 000000000..d26e682dd
--- /dev/null
+++ b/examples/contracts/codegen/cosmos/auth/v1beta1/query.ts
@@ -0,0 +1,771 @@
+import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../base/query/v1beta1/pagination";
+import { Any, AnySDKType } from "../../../google/protobuf/any";
+import { Params, ParamsSDKType } from "./auth";
+import * as _m0 from "protobufjs/minimal";
+/**
+ * QueryAccountsRequest is the request type for the Query/Accounts RPC method.
+ *
+ * Since: cosmos-sdk 0.43
+ */
+
+export interface QueryAccountsRequest {
+ /** pagination defines an optional pagination for the request. */
+ pagination?: PageRequest | undefined;
+}
+/**
+ * QueryAccountsRequest is the request type for the Query/Accounts RPC method.
+ *
+ * Since: cosmos-sdk 0.43
+ */
+
+export interface QueryAccountsRequestSDKType {
+ /** pagination defines an optional pagination for the request. */
+ pagination?: PageRequestSDKType | undefined;
+}
+/**
+ * QueryAccountsResponse is the response type for the Query/Accounts RPC method.
+ *
+ * Since: cosmos-sdk 0.43
+ */
+
+export interface QueryAccountsResponse {
+ /** accounts are the existing accounts */
+ accounts: Any[];
+ /** pagination defines the pagination in the response. */
+
+ pagination?: PageResponse | undefined;
+}
+/**
+ * QueryAccountsResponse is the response type for the Query/Accounts RPC method.
+ *
+ * Since: cosmos-sdk 0.43
+ */
+
+export interface QueryAccountsResponseSDKType {
+ /** accounts are the existing accounts */
+ accounts: AnySDKType[];
+ /** pagination defines the pagination in the response. */
+
+ pagination?: PageResponseSDKType | undefined;
+}
+/** QueryAccountRequest is the request type for the Query/Account RPC method. */
+
+export interface QueryAccountRequest {
+ /** address defines the address to query for. */
+ address: string;
+}
+/** QueryAccountRequest is the request type for the Query/Account RPC method. */
+
+export interface QueryAccountRequestSDKType {
+ /** address defines the address to query for. */
+ address: string;
+}
+/** QueryModuleAccountsRequest is the request type for the Query/ModuleAccounts RPC method. */
+
+export interface QueryModuleAccountsRequest {}
+/** QueryModuleAccountsRequest is the request type for the Query/ModuleAccounts RPC method. */
+
+export interface QueryModuleAccountsRequestSDKType {}
+/** QueryParamsResponse is the response type for the Query/Params RPC method. */
+
+export interface QueryParamsResponse {
+ /** params defines the parameters of the module. */
+ params?: Params | undefined;
+}
+/** QueryParamsResponse is the response type for the Query/Params RPC method. */
+
+export interface QueryParamsResponseSDKType {
+ /** params defines the parameters of the module. */
+ params?: ParamsSDKType | undefined;
+}
+/** QueryAccountResponse is the response type for the Query/Account RPC method. */
+
+export interface QueryAccountResponse {
+ /** account defines the account of the corresponding address. */
+ account?: Any | undefined;
+}
+/** QueryAccountResponse is the response type for the Query/Account RPC method. */
+
+export interface QueryAccountResponseSDKType {
+ /** account defines the account of the corresponding address. */
+ account?: AnySDKType | undefined;
+}
+/** QueryParamsRequest is the request type for the Query/Params RPC method. */
+
+export interface QueryParamsRequest {}
+/** QueryParamsRequest is the request type for the Query/Params RPC method. */
+
+export interface QueryParamsRequestSDKType {}
+/** QueryModuleAccountsResponse is the response type for the Query/ModuleAccounts RPC method. */
+
+export interface QueryModuleAccountsResponse {
+ accounts: Any[];
+}
+/** QueryModuleAccountsResponse is the response type for the Query/ModuleAccounts RPC method. */
+
+export interface QueryModuleAccountsResponseSDKType {
+ accounts: AnySDKType[];
+}
+/** Bech32PrefixRequest is the request type for Bech32Prefix rpc method */
+
+export interface Bech32PrefixRequest {}
+/** Bech32PrefixRequest is the request type for Bech32Prefix rpc method */
+
+export interface Bech32PrefixRequestSDKType {}
+/** Bech32PrefixResponse is the response type for Bech32Prefix rpc method */
+
+export interface Bech32PrefixResponse {
+ bech32Prefix: string;
+}
+/** Bech32PrefixResponse is the response type for Bech32Prefix rpc method */
+
+export interface Bech32PrefixResponseSDKType {
+ bech32_prefix: string;
+}
+/** AddressBytesToStringRequest is the request type for AddressString rpc method */
+
+export interface AddressBytesToStringRequest {
+ addressBytes: Uint8Array;
+}
+/** AddressBytesToStringRequest is the request type for AddressString rpc method */
+
+export interface AddressBytesToStringRequestSDKType {
+ address_bytes: Uint8Array;
+}
+/** AddressBytesToStringResponse is the response type for AddressString rpc method */
+
+export interface AddressBytesToStringResponse {
+ addressString: string;
+}
+/** AddressBytesToStringResponse is the response type for AddressString rpc method */
+
+export interface AddressBytesToStringResponseSDKType {
+ address_string: string;
+}
+/** AddressStringToBytesRequest is the request type for AccountBytes rpc method */
+
+export interface AddressStringToBytesRequest {
+ addressString: string;
+}
+/** AddressStringToBytesRequest is the request type for AccountBytes rpc method */
+
+export interface AddressStringToBytesRequestSDKType {
+ address_string: string;
+}
+/** AddressStringToBytesResponse is the response type for AddressBytes rpc method */
+
+export interface AddressStringToBytesResponse {
+ addressBytes: Uint8Array;
+}
+/** AddressStringToBytesResponse is the response type for AddressBytes rpc method */
+
+export interface AddressStringToBytesResponseSDKType {
+ address_bytes: Uint8Array;
+}
+
+function createBaseQueryAccountsRequest(): QueryAccountsRequest {
+ return {
+ pagination: undefined
+ };
+}
+
+export const QueryAccountsRequest = {
+ encode(message: QueryAccountsRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
+ if (message.pagination !== undefined) {
+ PageRequest.encode(message.pagination, writer.uint32(10).fork()).ldelim();
+ }
+
+ return writer;
+ },
+
+ decode(input: _m0.Reader | Uint8Array, length?: number): QueryAccountsRequest {
+ const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
+ let end = length === undefined ? reader.len : reader.pos + length;
+ const message = createBaseQueryAccountsRequest();
+
+ while (reader.pos < end) {
+ const tag = reader.uint32();
+
+ switch (tag >>> 3) {
+ case 1:
+ message.pagination = PageRequest.decode(reader, reader.uint32());
+ break;
+
+ default:
+ reader.skipType(tag & 7);
+ break;
+ }
+ }
+
+ return message;
+ },
+
+ fromPartial(object: Partial): QueryAccountsRequest {
+ const message = createBaseQueryAccountsRequest();
+ message.pagination = object.pagination !== undefined && object.pagination !== null ? PageRequest.fromPartial(object.pagination) : undefined;
+ return message;
+ }
+
+};
+
+function createBaseQueryAccountsResponse(): QueryAccountsResponse {
+ return {
+ accounts: [],
+ pagination: undefined
+ };
+}
+
+export const QueryAccountsResponse = {
+ encode(message: QueryAccountsResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
+ for (const v of message.accounts) {
+ Any.encode(v!, writer.uint32(10).fork()).ldelim();
+ }
+
+ if (message.pagination !== undefined) {
+ PageResponse.encode(message.pagination, writer.uint32(18).fork()).ldelim();
+ }
+
+ return writer;
+ },
+
+ decode(input: _m0.Reader | Uint8Array, length?: number): QueryAccountsResponse {
+ const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
+ let end = length === undefined ? reader.len : reader.pos + length;
+ const message = createBaseQueryAccountsResponse();
+
+ while (reader.pos < end) {
+ const tag = reader.uint32();
+
+ switch (tag >>> 3) {
+ case 1:
+ message.accounts.push(Any.decode(reader, reader.uint32()));
+ break;
+
+ case 2:
+ message.pagination = PageResponse.decode(reader, reader.uint32());
+ break;
+
+ default:
+ reader.skipType(tag & 7);
+ break;
+ }
+ }
+
+ return message;
+ },
+
+ fromPartial(object: Partial): 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;
+ }
+
+};
+
+function createBaseQueryAccountRequest(): QueryAccountRequest {
+ return {
+ address: ""
+ };
+}
+
+export const QueryAccountRequest = {
+ encode(message: QueryAccountRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
+ if (message.address !== "") {
+ writer.uint32(10).string(message.address);
+ }
+
+ return writer;
+ },
+
+ decode(input: _m0.Reader | Uint8Array, length?: number): QueryAccountRequest {
+ const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
+ let end = length === undefined ? reader.len : reader.pos + length;
+ const message = createBaseQueryAccountRequest();
+
+ while (reader.pos < end) {
+ const tag = reader.uint32();
+
+ switch (tag >>> 3) {
+ case 1:
+ message.address = reader.string();
+ break;
+
+ default:
+ reader.skipType(tag & 7);
+ break;
+ }
+ }
+
+ return message;
+ },
+
+ fromPartial(object: Partial): QueryAccountRequest {
+ const message = createBaseQueryAccountRequest();
+ message.address = object.address ?? "";
+ return message;
+ }
+
+};
+
+function createBaseQueryModuleAccountsRequest(): QueryModuleAccountsRequest {
+ return {};
+}
+
+export const QueryModuleAccountsRequest = {
+ encode(_: QueryModuleAccountsRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
+ return writer;
+ },
+
+ decode(input: _m0.Reader | Uint8Array, length?: number): QueryModuleAccountsRequest {
+ const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
+ let end = length === undefined ? reader.len : reader.pos + length;
+ const message = createBaseQueryModuleAccountsRequest();
+
+ while (reader.pos < end) {
+ const tag = reader.uint32();
+
+ switch (tag >>> 3) {
+ default:
+ reader.skipType(tag & 7);
+ break;
+ }
+ }
+
+ return message;
+ },
+
+ fromPartial(_: Partial): QueryModuleAccountsRequest {
+ const message = createBaseQueryModuleAccountsRequest();
+ return message;
+ }
+
+};
+
+function createBaseQueryParamsResponse(): QueryParamsResponse {
+ return {
+ params: undefined
+ };
+}
+
+export const QueryParamsResponse = {
+ encode(message: QueryParamsResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
+ if (message.params !== undefined) {
+ Params.encode(message.params, writer.uint32(10).fork()).ldelim();
+ }
+
+ return writer;
+ },
+
+ decode(input: _m0.Reader | Uint8Array, length?: number): QueryParamsResponse {
+ const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
+ let end = length === undefined ? reader.len : reader.pos + length;
+ const message = createBaseQueryParamsResponse();
+
+ while (reader.pos < end) {
+ const tag = reader.uint32();
+
+ switch (tag >>> 3) {
+ case 1:
+ message.params = Params.decode(reader, reader.uint32());
+ break;
+
+ default:
+ reader.skipType(tag & 7);
+ break;
+ }
+ }
+
+ return message;
+ },
+
+ fromPartial(object: Partial): QueryParamsResponse {
+ const message = createBaseQueryParamsResponse();
+ message.params = object.params !== undefined && object.params !== null ? Params.fromPartial(object.params) : undefined;
+ return message;
+ }
+
+};
+
+function createBaseQueryAccountResponse(): QueryAccountResponse {
+ return {
+ account: undefined
+ };
+}
+
+export const QueryAccountResponse = {
+ encode(message: QueryAccountResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
+ if (message.account !== undefined) {
+ Any.encode(message.account, writer.uint32(10).fork()).ldelim();
+ }
+
+ return writer;
+ },
+
+ decode(input: _m0.Reader | Uint8Array, length?: number): QueryAccountResponse {
+ const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
+ let end = length === undefined ? reader.len : reader.pos + length;
+ const message = createBaseQueryAccountResponse();
+
+ while (reader.pos < end) {
+ const tag = reader.uint32();
+
+ switch (tag >>> 3) {
+ case 1:
+ message.account = Any.decode(reader, reader.uint32());
+ break;
+
+ default:
+ reader.skipType(tag & 7);
+ break;
+ }
+ }
+
+ return message;
+ },
+
+ fromPartial(object: Partial): QueryAccountResponse {
+ const message = createBaseQueryAccountResponse();
+ message.account = object.account !== undefined && object.account !== null ? Any.fromPartial(object.account) : undefined;
+ return message;
+ }
+
+};
+
+function createBaseQueryParamsRequest(): QueryParamsRequest {
+ return {};
+}
+
+export const QueryParamsRequest = {
+ encode(_: QueryParamsRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
+ return writer;
+ },
+
+ decode(input: _m0.Reader | Uint8Array, length?: number): QueryParamsRequest {
+ const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
+ let end = length === undefined ? reader.len : reader.pos + length;
+ const message = createBaseQueryParamsRequest();
+
+ while (reader.pos < end) {
+ const tag = reader.uint32();
+
+ switch (tag >>> 3) {
+ default:
+ reader.skipType(tag & 7);
+ break;
+ }
+ }
+
+ return message;
+ },
+
+ fromPartial(_: Partial): QueryParamsRequest {
+ const message = createBaseQueryParamsRequest();
+ return message;
+ }
+
+};
+
+function createBaseQueryModuleAccountsResponse(): QueryModuleAccountsResponse {
+ return {
+ accounts: []
+ };
+}
+
+export const QueryModuleAccountsResponse = {
+ encode(message: QueryModuleAccountsResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
+ for (const v of message.accounts) {
+ Any.encode(v!, writer.uint32(10).fork()).ldelim();
+ }
+
+ return writer;
+ },
+
+ decode(input: _m0.Reader | Uint8Array, length?: number): QueryModuleAccountsResponse {
+ const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
+ let end = length === undefined ? reader.len : reader.pos + length;
+ const message = createBaseQueryModuleAccountsResponse();
+
+ while (reader.pos < end) {
+ const tag = reader.uint32();
+
+ switch (tag >>> 3) {
+ case 1:
+ message.accounts.push(Any.decode(reader, reader.uint32()));
+ break;
+
+ default:
+ reader.skipType(tag & 7);
+ break;
+ }
+ }
+
+ return message;
+ },
+
+ fromPartial(object: Partial): QueryModuleAccountsResponse {
+ const message = createBaseQueryModuleAccountsResponse();
+ message.accounts = object.accounts?.map(e => Any.fromPartial(e)) || [];
+ return message;
+ }
+
+};
+
+function createBaseBech32PrefixRequest(): Bech32PrefixRequest {
+ return {};
+}
+
+export const Bech32PrefixRequest = {
+ encode(_: Bech32PrefixRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
+ return writer;
+ },
+
+ decode(input: _m0.Reader | Uint8Array, length?: number): Bech32PrefixRequest {
+ const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
+ let end = length === undefined ? reader.len : reader.pos + length;
+ const message = createBaseBech32PrefixRequest();
+
+ while (reader.pos < end) {
+ const tag = reader.uint32();
+
+ switch (tag >>> 3) {
+ default:
+ reader.skipType(tag & 7);
+ break;
+ }
+ }
+
+ return message;
+ },
+
+ fromPartial(_: Partial): Bech32PrefixRequest {
+ const message = createBaseBech32PrefixRequest();
+ return message;
+ }
+
+};
+
+function createBaseBech32PrefixResponse(): Bech32PrefixResponse {
+ return {
+ bech32Prefix: ""
+ };
+}
+
+export const Bech32PrefixResponse = {
+ encode(message: Bech32PrefixResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
+ if (message.bech32Prefix !== "") {
+ writer.uint32(10).string(message.bech32Prefix);
+ }
+
+ return writer;
+ },
+
+ decode(input: _m0.Reader | Uint8Array, length?: number): Bech32PrefixResponse {
+ const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
+ let end = length === undefined ? reader.len : reader.pos + length;
+ const message = createBaseBech32PrefixResponse();
+
+ while (reader.pos < end) {
+ const tag = reader.uint32();
+
+ switch (tag >>> 3) {
+ case 1:
+ message.bech32Prefix = reader.string();
+ break;
+
+ default:
+ reader.skipType(tag & 7);
+ break;
+ }
+ }
+
+ return message;
+ },
+
+ fromPartial(object: Partial): Bech32PrefixResponse {
+ const message = createBaseBech32PrefixResponse();
+ message.bech32Prefix = object.bech32Prefix ?? "";
+ return message;
+ }
+
+};
+
+function createBaseAddressBytesToStringRequest(): AddressBytesToStringRequest {
+ return {
+ addressBytes: new Uint8Array()
+ };
+}
+
+export const AddressBytesToStringRequest = {
+ encode(message: AddressBytesToStringRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
+ if (message.addressBytes.length !== 0) {
+ writer.uint32(10).bytes(message.addressBytes);
+ }
+
+ return writer;
+ },
+
+ decode(input: _m0.Reader | Uint8Array, length?: number): AddressBytesToStringRequest {
+ const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
+ let end = length === undefined ? reader.len : reader.pos + length;
+ const message = createBaseAddressBytesToStringRequest();
+
+ while (reader.pos < end) {
+ const tag = reader.uint32();
+
+ switch (tag >>> 3) {
+ case 1:
+ message.addressBytes = reader.bytes();
+ break;
+
+ default:
+ reader.skipType(tag & 7);
+ break;
+ }
+ }
+
+ return message;
+ },
+
+ fromPartial(object: Partial): AddressBytesToStringRequest {
+ const message = createBaseAddressBytesToStringRequest();
+ message.addressBytes = object.addressBytes ?? new Uint8Array();
+ return message;
+ }
+
+};
+
+function createBaseAddressBytesToStringResponse(): AddressBytesToStringResponse {
+ return {
+ addressString: ""
+ };
+}
+
+export const AddressBytesToStringResponse = {
+ encode(message: AddressBytesToStringResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
+ if (message.addressString !== "") {
+ writer.uint32(10).string(message.addressString);
+ }
+
+ return writer;
+ },
+
+ decode(input: _m0.Reader | Uint8Array, length?: number): AddressBytesToStringResponse {
+ const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
+ let end = length === undefined ? reader.len : reader.pos + length;
+ const message = createBaseAddressBytesToStringResponse();
+
+ while (reader.pos < end) {
+ const tag = reader.uint32();
+
+ switch (tag >>> 3) {
+ case 1:
+ message.addressString = reader.string();
+ break;
+
+ default:
+ reader.skipType(tag & 7);
+ break;
+ }
+ }
+
+ return message;
+ },
+
+ fromPartial(object: Partial): AddressBytesToStringResponse {
+ const message = createBaseAddressBytesToStringResponse();
+ message.addressString = object.addressString ?? "";
+ return message;
+ }
+
+};
+
+function createBaseAddressStringToBytesRequest(): AddressStringToBytesRequest {
+ return {
+ addressString: ""
+ };
+}
+
+export const AddressStringToBytesRequest = {
+ encode(message: AddressStringToBytesRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
+ if (message.addressString !== "") {
+ writer.uint32(10).string(message.addressString);
+ }
+
+ return writer;
+ },
+
+ decode(input: _m0.Reader | Uint8Array, length?: number): AddressStringToBytesRequest {
+ const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
+ let end = length === undefined ? reader.len : reader.pos + length;
+ const message = createBaseAddressStringToBytesRequest();
+
+ while (reader.pos < end) {
+ const tag = reader.uint32();
+
+ switch (tag >>> 3) {
+ case 1:
+ message.addressString = reader.string();
+ break;
+
+ default:
+ reader.skipType(tag & 7);
+ break;
+ }
+ }
+
+ return message;
+ },
+
+ fromPartial(object: Partial): AddressStringToBytesRequest {
+ const message = createBaseAddressStringToBytesRequest();
+ message.addressString = object.addressString ?? "";
+ return message;
+ }
+
+};
+
+function createBaseAddressStringToBytesResponse(): AddressStringToBytesResponse {
+ return {
+ addressBytes: new Uint8Array()
+ };
+}
+
+export const AddressStringToBytesResponse = {
+ encode(message: AddressStringToBytesResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
+ if (message.addressBytes.length !== 0) {
+ writer.uint32(10).bytes(message.addressBytes);
+ }
+
+ return writer;
+ },
+
+ decode(input: _m0.Reader | Uint8Array, length?: number): AddressStringToBytesResponse {
+ const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
+ let end = length === undefined ? reader.len : reader.pos + length;
+ const message = createBaseAddressStringToBytesResponse();
+
+ while (reader.pos < end) {
+ const tag = reader.uint32();
+
+ switch (tag >>> 3) {
+ case 1:
+ message.addressBytes = reader.bytes();
+ break;
+
+ default:
+ reader.skipType(tag & 7);
+ break;
+ }
+ }
+
+ return message;
+ },
+
+ fromPartial(object: Partial): AddressStringToBytesResponse {
+ const message = createBaseAddressStringToBytesResponse();
+ message.addressBytes = object.addressBytes ?? new Uint8Array();
+ return message;
+ }
+
+};
\ No newline at end of file
diff --git a/examples/contracts/codegen/cosmos/authz/v1beta1/authz.ts b/examples/contracts/codegen/cosmos/authz/v1beta1/authz.ts
new file mode 100644
index 000000000..519cb7f87
--- /dev/null
+++ b/examples/contracts/codegen/cosmos/authz/v1beta1/authz.ts
@@ -0,0 +1,306 @@
+import { Any, AnySDKType } from "../../../google/protobuf/any";
+import { Timestamp } from "../../../google/protobuf/timestamp";
+import * as _m0 from "protobufjs/minimal";
+import { toTimestamp, fromTimestamp } from "../../../helpers";
+/**
+ * GenericAuthorization gives the grantee unrestricted permissions to execute
+ * the provided method on behalf of the granter's account.
+ */
+
+export interface GenericAuthorization {
+ /** Msg, identified by it's type URL, to grant unrestricted permissions to execute */
+ msg: string;
+}
+/**
+ * GenericAuthorization gives the grantee unrestricted permissions to execute
+ * the provided method on behalf of the granter's account.
+ */
+
+export interface GenericAuthorizationSDKType {
+ /** Msg, identified by it's type URL, to grant unrestricted permissions to execute */
+ msg: string;
+}
+/**
+ * Grant gives permissions to execute
+ * the provide method with expiration time.
+ */
+
+export interface Grant {
+ authorization?: Any | undefined;
+ /**
+ * time when the grant will expire and will be pruned. If null, then the grant
+ * doesn't have a time expiration (other conditions in `authorization`
+ * may apply to invalidate the grant)
+ */
+
+ expiration?: Date | undefined;
+}
+/**
+ * Grant gives permissions to execute
+ * the provide method with expiration time.
+ */
+
+export interface GrantSDKType {
+ authorization?: AnySDKType | undefined;
+ /**
+ * time when the grant will expire and will be pruned. If null, then the grant
+ * doesn't have a time expiration (other conditions in `authorization`
+ * may apply to invalidate the grant)
+ */
+
+ expiration?: Date | undefined;
+}
+/**
+ * GrantAuthorization extends a grant with both the addresses of the grantee and granter.
+ * It is used in genesis.proto and query.proto
+ */
+
+export interface GrantAuthorization {
+ granter: string;
+ grantee: string;
+ authorization?: Any | undefined;
+ expiration?: Date | undefined;
+}
+/**
+ * GrantAuthorization extends a grant with both the addresses of the grantee and granter.
+ * It is used in genesis.proto and query.proto
+ */
+
+export interface GrantAuthorizationSDKType {
+ granter: string;
+ grantee: string;
+ authorization?: AnySDKType | undefined;
+ expiration?: Date | undefined;
+}
+/** GrantQueueItem contains the list of TypeURL of a sdk.Msg. */
+
+export interface GrantQueueItem {
+ /** msg_type_urls contains the list of TypeURL of a sdk.Msg. */
+ msgTypeUrls: string[];
+}
+/** GrantQueueItem contains the list of TypeURL of a sdk.Msg. */
+
+export interface GrantQueueItemSDKType {
+ /** msg_type_urls contains the list of TypeURL of a sdk.Msg. */
+ msg_type_urls: string[];
+}
+
+function createBaseGenericAuthorization(): GenericAuthorization {
+ return {
+ msg: ""
+ };
+}
+
+export const GenericAuthorization = {
+ encode(message: GenericAuthorization, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
+ if (message.msg !== "") {
+ writer.uint32(10).string(message.msg);
+ }
+
+ return writer;
+ },
+
+ decode(input: _m0.Reader | Uint8Array, length?: number): GenericAuthorization {
+ const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
+ let end = length === undefined ? reader.len : reader.pos + length;
+ const message = createBaseGenericAuthorization();
+
+ while (reader.pos < end) {
+ const tag = reader.uint32();
+
+ switch (tag >>> 3) {
+ case 1:
+ message.msg = reader.string();
+ break;
+
+ default:
+ reader.skipType(tag & 7);
+ break;
+ }
+ }
+
+ return message;
+ },
+
+ fromPartial(object: Partial): GenericAuthorization {
+ const message = createBaseGenericAuthorization();
+ message.msg = object.msg ?? "";
+ return message;
+ }
+
+};
+
+function createBaseGrant(): Grant {
+ return {
+ authorization: undefined,
+ expiration: undefined
+ };
+}
+
+export const Grant = {
+ encode(message: Grant, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
+ if (message.authorization !== undefined) {
+ Any.encode(message.authorization, writer.uint32(10).fork()).ldelim();
+ }
+
+ if (message.expiration !== undefined) {
+ Timestamp.encode(toTimestamp(message.expiration), writer.uint32(18).fork()).ldelim();
+ }
+
+ return writer;
+ },
+
+ decode(input: _m0.Reader | Uint8Array, length?: number): Grant {
+ const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
+ let end = length === undefined ? reader.len : reader.pos + length;
+ const message = createBaseGrant();
+
+ while (reader.pos < end) {
+ const tag = reader.uint32();
+
+ switch (tag >>> 3) {
+ case 1:
+ message.authorization = Any.decode(reader, reader.uint32());
+ break;
+
+ case 2:
+ message.expiration = fromTimestamp(Timestamp.decode(reader, reader.uint32()));
+ break;
+
+ default:
+ reader.skipType(tag & 7);
+ break;
+ }
+ }
+
+ return message;
+ },
+
+ fromPartial(object: Partial): Grant {
+ const message = createBaseGrant();
+ message.authorization = object.authorization !== undefined && object.authorization !== null ? Any.fromPartial(object.authorization) : undefined;
+ message.expiration = object.expiration ?? undefined;
+ return message;
+ }
+
+};
+
+function createBaseGrantAuthorization(): GrantAuthorization {
+ return {
+ granter: "",
+ grantee: "",
+ authorization: undefined,
+ expiration: undefined
+ };
+}
+
+export const GrantAuthorization = {
+ encode(message: GrantAuthorization, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
+ 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()).ldelim();
+ }
+
+ if (message.expiration !== undefined) {
+ Timestamp.encode(toTimestamp(message.expiration), writer.uint32(34).fork()).ldelim();
+ }
+
+ return writer;
+ },
+
+ decode(input: _m0.Reader | Uint8Array, length?: number): GrantAuthorization {
+ const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
+ let end = length === undefined ? reader.len : reader.pos + length;
+ const message = createBaseGrantAuthorization();
+
+ while (reader.pos < end) {
+ const tag = reader.uint32();
+
+ switch (tag >>> 3) {
+ case 1:
+ message.granter = reader.string();
+ break;
+
+ case 2:
+ message.grantee = reader.string();
+ break;
+
+ case 3:
+ message.authorization = Any.decode(reader, reader.uint32());
+ break;
+
+ case 4:
+ message.expiration = fromTimestamp(Timestamp.decode(reader, reader.uint32()));
+ break;
+
+ default:
+ reader.skipType(tag & 7);
+ break;
+ }
+ }
+
+ return message;
+ },
+
+ fromPartial(object: Partial): 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 createBaseGrantQueueItem(): GrantQueueItem {
+ return {
+ msgTypeUrls: []
+ };
+}
+
+export const GrantQueueItem = {
+ encode(message: GrantQueueItem, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
+ for (const v of message.msgTypeUrls) {
+ writer.uint32(10).string(v!);
+ }
+
+ return writer;
+ },
+
+ decode(input: _m0.Reader | Uint8Array, length?: number): GrantQueueItem {
+ const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
+ let end = length === undefined ? reader.len : reader.pos + length;
+ const message = createBaseGrantQueueItem();
+
+ while (reader.pos < end) {
+ const tag = reader.uint32();
+
+ switch (tag >>> 3) {
+ case 1:
+ message.msgTypeUrls.push(reader.string());
+ break;
+
+ default:
+ reader.skipType(tag & 7);
+ break;
+ }
+ }
+
+ return message;
+ },
+
+ fromPartial(object: Partial): GrantQueueItem {
+ const message = createBaseGrantQueueItem();
+ message.msgTypeUrls = object.msgTypeUrls?.map(e => e) || [];
+ return message;
+ }
+
+};
\ No newline at end of file
diff --git a/examples/contracts/codegen/cosmos/authz/v1beta1/event.ts b/examples/contracts/codegen/cosmos/authz/v1beta1/event.ts
new file mode 100644
index 000000000..4ca6f0c5e
--- /dev/null
+++ b/examples/contracts/codegen/cosmos/authz/v1beta1/event.ts
@@ -0,0 +1,179 @@
+import * as _m0 from "protobufjs/minimal";
+/** EventGrant is emitted on Msg/Grant */
+
+export interface EventGrant {
+ /** Msg type URL for which an autorization is granted */
+ msgTypeUrl: string;
+ /** Granter account address */
+
+ granter: string;
+ /** Grantee account address */
+
+ grantee: string;
+}
+/** EventGrant is emitted on Msg/Grant */
+
+export interface EventGrantSDKType {
+ /** Msg type URL for which an autorization is granted */
+ msg_type_url: string;
+ /** Granter account address */
+
+ granter: string;
+ /** Grantee account address */
+
+ grantee: string;
+}
+/** EventRevoke is emitted on Msg/Revoke */
+
+export interface EventRevoke {
+ /** Msg type URL for which an autorization is revoked */
+ msgTypeUrl: string;
+ /** Granter account address */
+
+ granter: string;
+ /** Grantee account address */
+
+ grantee: string;
+}
+/** EventRevoke is emitted on Msg/Revoke */
+
+export interface EventRevokeSDKType {
+ /** Msg type URL for which an autorization is revoked */
+ msg_type_url: string;
+ /** Granter account address */
+
+ granter: string;
+ /** Grantee account address */
+
+ grantee: string;
+}
+
+function createBaseEventGrant(): EventGrant {
+ return {
+ msgTypeUrl: "",
+ granter: "",
+ grantee: ""
+ };
+}
+
+export const EventGrant = {
+ encode(message: EventGrant, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
+ if (message.msgTypeUrl !== "") {
+ writer.uint32(18).string(message.msgTypeUrl);
+ }
+
+ if (message.granter !== "") {
+ writer.uint32(26).string(message.granter);
+ }
+
+ if (message.grantee !== "") {
+ writer.uint32(34).string(message.grantee);
+ }
+
+ return writer;
+ },
+
+ decode(input: _m0.Reader | Uint8Array, length?: number): EventGrant {
+ const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
+ let end = length === undefined ? reader.len : reader.pos + length;
+ const message = createBaseEventGrant();
+
+ while (reader.pos < end) {
+ const tag = reader.uint32();
+
+ switch (tag >>> 3) {
+ case 2:
+ message.msgTypeUrl = reader.string();
+ break;
+
+ case 3:
+ message.granter = reader.string();
+ break;
+
+ case 4:
+ message.grantee = reader.string();
+ break;
+
+ default:
+ reader.skipType(tag & 7);
+ break;
+ }
+ }
+
+ return message;
+ },
+
+ fromPartial(object: Partial): EventGrant {
+ const message = createBaseEventGrant();
+ message.msgTypeUrl = object.msgTypeUrl ?? "";
+ message.granter = object.granter ?? "";
+ message.grantee = object.grantee ?? "";
+ return message;
+ }
+
+};
+
+function createBaseEventRevoke(): EventRevoke {
+ return {
+ msgTypeUrl: "",
+ granter: "",
+ grantee: ""
+ };
+}
+
+export const EventRevoke = {
+ encode(message: EventRevoke, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
+ if (message.msgTypeUrl !== "") {
+ writer.uint32(18).string(message.msgTypeUrl);
+ }
+
+ if (message.granter !== "") {
+ writer.uint32(26).string(message.granter);
+ }
+
+ if (message.grantee !== "") {
+ writer.uint32(34).string(message.grantee);
+ }
+
+ return writer;
+ },
+
+ decode(input: _m0.Reader | Uint8Array, length?: number): EventRevoke {
+ const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
+ let end = length === undefined ? reader.len : reader.pos + length;
+ const message = createBaseEventRevoke();
+
+ while (reader.pos < end) {
+ const tag = reader.uint32();
+
+ switch (tag >>> 3) {
+ case 2:
+ message.msgTypeUrl = reader.string();
+ break;
+
+ case 3:
+ message.granter = reader.string();
+ break;
+
+ case 4:
+ message.grantee = reader.string();
+ break;
+
+ default:
+ reader.skipType(tag & 7);
+ break;
+ }
+ }
+
+ return message;
+ },
+
+ fromPartial(object: Partial): EventRevoke {
+ const message = createBaseEventRevoke();
+ message.msgTypeUrl = object.msgTypeUrl ?? "";
+ message.granter = object.granter ?? "";
+ message.grantee = object.grantee ?? "";
+ return message;
+ }
+
+};
\ No newline at end of file
diff --git a/examples/contracts/codegen/cosmos/authz/v1beta1/genesis.ts b/examples/contracts/codegen/cosmos/authz/v1beta1/genesis.ts
new file mode 100644
index 000000000..9f09b9813
--- /dev/null
+++ b/examples/contracts/codegen/cosmos/authz/v1beta1/genesis.ts
@@ -0,0 +1,57 @@
+import { GrantAuthorization, GrantAuthorizationSDKType } from "./authz";
+import * as _m0 from "protobufjs/minimal";
+/** GenesisState defines the authz module's genesis state. */
+
+export interface GenesisState {
+ authorization: GrantAuthorization[];
+}
+/** GenesisState defines the authz module's genesis state. */
+
+export interface GenesisStateSDKType {
+ authorization: GrantAuthorizationSDKType[];
+}
+
+function createBaseGenesisState(): GenesisState {
+ return {
+ authorization: []
+ };
+}
+
+export const GenesisState = {
+ encode(message: GenesisState, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
+ for (const v of message.authorization) {
+ GrantAuthorization.encode(v!, writer.uint32(10).fork()).ldelim();
+ }
+
+ return writer;
+ },
+
+ decode(input: _m0.Reader | Uint8Array, length?: number): GenesisState {
+ const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
+ let end = length === undefined ? reader.len : reader.pos + length;
+ const message = createBaseGenesisState();
+
+ while (reader.pos < end) {
+ const tag = reader.uint32();
+
+ switch (tag >>> 3) {
+ case 1:
+ message.authorization.push(GrantAuthorization.decode(reader, reader.uint32()));
+ break;
+
+ default:
+ reader.skipType(tag & 7);
+ break;
+ }
+ }
+
+ return message;
+ },
+
+ fromPartial(object: Partial): GenesisState {
+ const message = createBaseGenesisState();
+ message.authorization = object.authorization?.map(e => GrantAuthorization.fromPartial(e)) || [];
+ return message;
+ }
+
+};
\ No newline at end of file
diff --git a/examples/contracts/codegen/cosmos/authz/v1beta1/query.lcd.ts b/examples/contracts/codegen/cosmos/authz/v1beta1/query.lcd.ts
new file mode 100644
index 000000000..0a8df3591
--- /dev/null
+++ b/examples/contracts/codegen/cosmos/authz/v1beta1/query.lcd.ts
@@ -0,0 +1,79 @@
+import { setPaginationParams } from "../../../helpers";
+import { LCDClient } from "@osmonauts/lcd";
+import { QueryGrantsRequest, QueryGrantsResponseSDKType, QueryGranterGrantsRequest, QueryGranterGrantsResponseSDKType, QueryGranteeGrantsRequest, QueryGranteeGrantsResponseSDKType } from "./query";
+export class LCDQueryClient {
+ req: LCDClient;
+
+ constructor({
+ requestClient
+ }: {
+ requestClient: LCDClient;
+ }) {
+ this.req = requestClient;
+ this.grants = this.grants.bind(this);
+ this.granterGrants = this.granterGrants.bind(this);
+ this.granteeGrants = this.granteeGrants.bind(this);
+ }
+ /* Returns list of `Authorization`, granted to the grantee by the granter. */
+
+
+ async grants(params: QueryGrantsRequest): Promise {
+ const options: any = {
+ params: {}
+ };
+
+ if (typeof params?.granter !== "undefined") {
+ options.params.granter = params.granter;
+ }
+
+ if (typeof params?.grantee !== "undefined") {
+ options.params.grantee = params.grantee;
+ }
+
+ if (typeof params?.msgTypeUrl !== "undefined") {
+ options.params.msg_type_url = params.msgTypeUrl;
+ }
+
+ if (typeof params?.pagination !== "undefined") {
+ setPaginationParams(options, params.pagination);
+ }
+
+ const endpoint = `cosmos/authz/v1beta1/grants`;
+ return await this.req.get(endpoint, options);
+ }
+ /* GranterGrants returns list of `GrantAuthorization`, granted by granter.
+
+ Since: cosmos-sdk 0.46 */
+
+
+ async granterGrants(params: QueryGranterGrantsRequest): Promise {
+ const options: any = {
+ params: {}
+ };
+
+ if (typeof params?.pagination !== "undefined") {
+ setPaginationParams(options, params.pagination);
+ }
+
+ const endpoint = `cosmos/authz/v1beta1/grants/granter/${params.granter}`;
+ return await this.req.get(endpoint, options);
+ }
+ /* GranteeGrants returns a list of `GrantAuthorization` by grantee.
+
+ Since: cosmos-sdk 0.46 */
+
+
+ async granteeGrants(params: QueryGranteeGrantsRequest): Promise {
+ const options: any = {
+ params: {}
+ };
+
+ if (typeof params?.pagination !== "undefined") {
+ setPaginationParams(options, params.pagination);
+ }
+
+ const endpoint = `cosmos/authz/v1beta1/grants/grantee/${params.grantee}`;
+ return await this.req.get(endpoint, options);
+ }
+
+}
\ No newline at end of file
diff --git a/examples/contracts/codegen/cosmos/authz/v1beta1/query.rpc.query.ts b/examples/contracts/codegen/cosmos/authz/v1beta1/query.rpc.query.ts
new file mode 100644
index 000000000..c2fda460f
--- /dev/null
+++ b/examples/contracts/codegen/cosmos/authz/v1beta1/query.rpc.query.ts
@@ -0,0 +1,71 @@
+import { Rpc } from "../../../helpers";
+import * as _m0 from "protobufjs/minimal";
+import { QueryClient, createProtobufRpcClient } from "@cosmjs/stargate";
+import { QueryGrantsRequest, QueryGrantsResponse, QueryGranterGrantsRequest, QueryGranterGrantsResponse, QueryGranteeGrantsRequest, QueryGranteeGrantsResponse } from "./query";
+/** Query defines the gRPC querier service. */
+
+export interface Query {
+ /** Returns list of `Authorization`, granted to the grantee by the granter. */
+ grants(request: QueryGrantsRequest): Promise;
+ /**
+ * GranterGrants returns list of `GrantAuthorization`, granted by granter.
+ *
+ * Since: cosmos-sdk 0.46
+ */
+
+ granterGrants(request: QueryGranterGrantsRequest): Promise;
+ /**
+ * GranteeGrants returns a list of `GrantAuthorization` by grantee.
+ *
+ * Since: cosmos-sdk 0.46
+ */
+
+ granteeGrants(request: QueryGranteeGrantsRequest): Promise;
+}
+export class QueryClientImpl implements Query {
+ private readonly rpc: Rpc;
+
+ constructor(rpc: Rpc) {
+ this.rpc = rpc;
+ this.grants = this.grants.bind(this);
+ this.granterGrants = this.granterGrants.bind(this);
+ this.granteeGrants = this.granteeGrants.bind(this);
+ }
+
+ grants(request: QueryGrantsRequest): Promise {
+ const data = QueryGrantsRequest.encode(request).finish();
+ const promise = this.rpc.request("cosmos.authz.v1beta1.Query", "Grants", data);
+ return promise.then(data => QueryGrantsResponse.decode(new _m0.Reader(data)));
+ }
+
+ granterGrants(request: QueryGranterGrantsRequest): Promise {
+ const data = QueryGranterGrantsRequest.encode(request).finish();
+ const promise = this.rpc.request("cosmos.authz.v1beta1.Query", "GranterGrants", data);
+ return promise.then(data => QueryGranterGrantsResponse.decode(new _m0.Reader(data)));
+ }
+
+ granteeGrants(request: QueryGranteeGrantsRequest): Promise {
+ const data = QueryGranteeGrantsRequest.encode(request).finish();
+ const promise = this.rpc.request("cosmos.authz.v1beta1.Query", "GranteeGrants", data);
+ return promise.then(data => QueryGranteeGrantsResponse.decode(new _m0.Reader(data)));
+ }
+
+}
+export const createRpcQueryExtension = (base: QueryClient) => {
+ const rpc = createProtobufRpcClient(base);
+ const queryService = new QueryClientImpl(rpc);
+ return {
+ grants(request: QueryGrantsRequest): Promise {
+ return queryService.grants(request);
+ },
+
+ granterGrants(request: QueryGranterGrantsRequest): Promise {
+ return queryService.granterGrants(request);
+ },
+
+ granteeGrants(request: QueryGranteeGrantsRequest): Promise {
+ return queryService.granteeGrants(request);
+ }
+
+ };
+};
\ No newline at end of file
diff --git a/examples/contracts/codegen/cosmos/authz/v1beta1/query.ts b/examples/contracts/codegen/cosmos/authz/v1beta1/query.ts
new file mode 100644
index 000000000..cf5557e3b
--- /dev/null
+++ b/examples/contracts/codegen/cosmos/authz/v1beta1/query.ts
@@ -0,0 +1,463 @@
+import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../base/query/v1beta1/pagination";
+import { Grant, GrantSDKType, GrantAuthorization, GrantAuthorizationSDKType } from "./authz";
+import * as _m0 from "protobufjs/minimal";
+/** QueryGrantsRequest is the request type for the Query/Grants RPC method. */
+
+export interface QueryGrantsRequest {
+ granter: string;
+ grantee: string;
+ /** Optional, msg_type_url, when set, will query only grants matching given msg type. */
+
+ msgTypeUrl: string;
+ /** pagination defines an pagination for the request. */
+
+ pagination?: PageRequest | undefined;
+}
+/** QueryGrantsRequest is the request type for the Query/Grants RPC method. */
+
+export interface QueryGrantsRequestSDKType {
+ 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?: PageRequestSDKType | undefined;
+}
+/** QueryGrantsResponse is the response type for the Query/Authorizations RPC method. */
+
+export interface QueryGrantsResponse {
+ /** authorizations is a list of grants granted for grantee by granter. */
+ grants: Grant[];
+ /** pagination defines an pagination for the response. */
+
+ pagination?: PageResponse | undefined;
+}
+/** QueryGrantsResponse is the response type for the Query/Authorizations RPC method. */
+
+export interface QueryGrantsResponseSDKType {
+ /** authorizations is a list of grants granted for grantee by granter. */
+ grants: GrantSDKType[];
+ /** pagination defines an pagination for the response. */
+
+ pagination?: PageResponseSDKType | undefined;
+}
+/** QueryGranterGrantsRequest is the request type for the Query/GranterGrants RPC method. */
+
+export interface QueryGranterGrantsRequest {
+ granter: string;
+ /** pagination defines an pagination for the request. */
+
+ pagination?: PageRequest | undefined;
+}
+/** QueryGranterGrantsRequest is the request type for the Query/GranterGrants RPC method. */
+
+export interface QueryGranterGrantsRequestSDKType {
+ granter: string;
+ /** pagination defines an pagination for the request. */
+
+ pagination?: PageRequestSDKType | undefined;
+}
+/** QueryGranterGrantsResponse is the response type for the Query/GranterGrants RPC method. */
+
+export interface QueryGranterGrantsResponse {
+ /** grants is a list of grants granted by the granter. */
+ grants: GrantAuthorization[];
+ /** pagination defines an pagination for the response. */
+
+ pagination?: PageResponse | undefined;
+}
+/** QueryGranterGrantsResponse is the response type for the Query/GranterGrants RPC method. */
+
+export interface QueryGranterGrantsResponseSDKType {
+ /** grants is a list of grants granted by the granter. */
+ grants: GrantAuthorizationSDKType[];
+ /** pagination defines an pagination for the response. */
+
+ pagination?: PageResponseSDKType | undefined;
+}
+/** QueryGranteeGrantsRequest is the request type for the Query/IssuedGrants RPC method. */
+
+export interface QueryGranteeGrantsRequest {
+ grantee: string;
+ /** pagination defines an pagination for the request. */
+
+ pagination?: PageRequest | undefined;
+}
+/** QueryGranteeGrantsRequest is the request type for the Query/IssuedGrants RPC method. */
+
+export interface QueryGranteeGrantsRequestSDKType {
+ grantee: string;
+ /** pagination defines an pagination for the request. */
+
+ pagination?: PageRequestSDKType | undefined;
+}
+/** QueryGranteeGrantsResponse is the response type for the Query/GranteeGrants RPC method. */
+
+export interface QueryGranteeGrantsResponse {
+ /** grants is a list of grants granted to the grantee. */
+ grants: GrantAuthorization[];
+ /** pagination defines an pagination for the response. */
+
+ pagination?: PageResponse | undefined;
+}
+/** QueryGranteeGrantsResponse is the response type for the Query/GranteeGrants RPC method. */
+
+export interface QueryGranteeGrantsResponseSDKType {
+ /** grants is a list of grants granted to the grantee. */
+ grants: GrantAuthorizationSDKType[];
+ /** pagination defines an pagination for the response. */
+
+ pagination?: PageResponseSDKType | undefined;
+}
+
+function createBaseQueryGrantsRequest(): QueryGrantsRequest {
+ return {
+ granter: "",
+ grantee: "",
+ msgTypeUrl: "",
+ pagination: undefined
+ };
+}
+
+export const QueryGrantsRequest = {
+ encode(message: QueryGrantsRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
+ if (message.granter !== "") {
+ writer.uint32(10).string(message.granter);
+ }
+
+ if (message.grantee !== "") {
+ writer.uint32(18).string(message.grantee);
+ }
+
+ if (message.msgTypeUrl !== "") {
+ writer.uint32(26).string(message.msgTypeUrl);
+ }
+
+ if (message.pagination !== undefined) {
+ PageRequest.encode(message.pagination, writer.uint32(34).fork()).ldelim();
+ }
+
+ return writer;
+ },
+
+ decode(input: _m0.Reader | Uint8Array, length?: number): QueryGrantsRequest {
+ const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
+ let end = length === undefined ? reader.len : reader.pos + length;
+ const message = createBaseQueryGrantsRequest();
+
+ while (reader.pos < end) {
+ const tag = reader.uint32();
+
+ switch (tag >>> 3) {
+ case 1:
+ message.granter = reader.string();
+ break;
+
+ case 2:
+ message.grantee = reader.string();
+ break;
+
+ case 3:
+ message.msgTypeUrl = reader.string();
+ break;
+
+ case 4:
+ message.pagination = PageRequest.decode(reader, reader.uint32());
+ break;
+
+ default:
+ reader.skipType(tag & 7);
+ break;
+ }
+ }
+
+ return message;
+ },
+
+ fromPartial(object: Partial): QueryGrantsRequest {
+ const message = createBaseQueryGrantsRequest();
+ message.granter = object.granter ?? "";
+ message.grantee = object.grantee ?? "";
+ message.msgTypeUrl = object.msgTypeUrl ?? "";
+ message.pagination = object.pagination !== undefined && object.pagination !== null ? PageRequest.fromPartial(object.pagination) : undefined;
+ return message;
+ }
+
+};
+
+function createBaseQueryGrantsResponse(): QueryGrantsResponse {
+ return {
+ grants: [],
+ pagination: undefined
+ };
+}
+
+export const QueryGrantsResponse = {
+ encode(message: QueryGrantsResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
+ for (const v of message.grants) {
+ Grant.encode(v!, writer.uint32(10).fork()).ldelim();
+ }
+
+ if (message.pagination !== undefined) {
+ PageResponse.encode(message.pagination, writer.uint32(18).fork()).ldelim();
+ }
+
+ return writer;
+ },
+
+ decode(input: _m0.Reader | Uint8Array, length?: number): QueryGrantsResponse {
+ const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
+ let end = length === undefined ? reader.len : reader.pos + length;
+ const message = createBaseQueryGrantsResponse();
+
+ while (reader.pos < end) {
+ const tag = reader.uint32();
+
+ switch (tag >>> 3) {
+ case 1:
+ message.grants.push(Grant.decode(reader, reader.uint32()));
+ break;
+
+ case 2:
+ message.pagination = PageResponse.decode(reader, reader.uint32());
+ break;
+
+ default:
+ reader.skipType(tag & 7);
+ break;
+ }
+ }
+
+ return message;
+ },
+
+ fromPartial(object: Partial): 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;
+ }
+
+};
+
+function createBaseQueryGranterGrantsRequest(): QueryGranterGrantsRequest {
+ return {
+ granter: "",
+ pagination: undefined
+ };
+}
+
+export const QueryGranterGrantsRequest = {
+ encode(message: QueryGranterGrantsRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
+ if (message.granter !== "") {
+ writer.uint32(10).string(message.granter);
+ }
+
+ if (message.pagination !== undefined) {
+ PageRequest.encode(message.pagination, writer.uint32(18).fork()).ldelim();
+ }
+
+ return writer;
+ },
+
+ decode(input: _m0.Reader | Uint8Array, length?: number): QueryGranterGrantsRequest {
+ const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
+ let end = length === undefined ? reader.len : reader.pos + length;
+ const message = createBaseQueryGranterGrantsRequest();
+
+ while (reader.pos < end) {
+ const tag = reader.uint32();
+
+ switch (tag >>> 3) {
+ case 1:
+ message.granter = reader.string();
+ break;
+
+ case 2:
+ message.pagination = PageRequest.decode(reader, reader.uint32());
+ break;
+
+ default:
+ reader.skipType(tag & 7);
+ break;
+ }
+ }
+
+ return message;
+ },
+
+ fromPartial(object: Partial): QueryGranterGrantsRequest {
+ const message = createBaseQueryGranterGrantsRequest();
+ message.granter = object.granter ?? "";
+ message.pagination = object.pagination !== undefined && object.pagination !== null ? PageRequest.fromPartial(object.pagination) : undefined;
+ return message;
+ }
+
+};
+
+function createBaseQueryGranterGrantsResponse(): QueryGranterGrantsResponse {
+ return {
+ grants: [],
+ pagination: undefined
+ };
+}
+
+export const QueryGranterGrantsResponse = {
+ encode(message: QueryGranterGrantsResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
+ for (const v of message.grants) {
+ GrantAuthorization.encode(v!, writer.uint32(10).fork()).ldelim();
+ }
+
+ if (message.pagination !== undefined) {
+ PageResponse.encode(message.pagination, writer.uint32(18).fork()).ldelim();
+ }
+
+ return writer;
+ },
+
+ decode(input: _m0.Reader | Uint8Array, length?: number): QueryGranterGrantsResponse {
+ const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
+ let end = length === undefined ? reader.len : reader.pos + length;
+ const message = createBaseQueryGranterGrantsResponse();
+
+ while (reader.pos < end) {
+ const tag = reader.uint32();
+
+ switch (tag >>> 3) {
+ case 1:
+ message.grants.push(GrantAuthorization.decode(reader, reader.uint32()));
+ break;
+
+ case 2:
+ message.pagination = PageResponse.decode(reader, reader.uint32());
+ break;
+
+ default:
+ reader.skipType(tag & 7);
+ break;
+ }
+ }
+
+ return message;
+ },
+
+ fromPartial(object: Partial): 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;
+ }
+
+};
+
+function createBaseQueryGranteeGrantsRequest(): QueryGranteeGrantsRequest {
+ return {
+ grantee: "",
+ pagination: undefined
+ };
+}
+
+export const QueryGranteeGrantsRequest = {
+ encode(message: QueryGranteeGrantsRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
+ if (message.grantee !== "") {
+ writer.uint32(10).string(message.grantee);
+ }
+
+ if (message.pagination !== undefined) {
+ PageRequest.encode(message.pagination, writer.uint32(18).fork()).ldelim();
+ }
+
+ return writer;
+ },
+
+ decode(input: _m0.Reader | Uint8Array, length?: number): QueryGranteeGrantsRequest {
+ const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
+ let end = length === undefined ? reader.len : reader.pos + length;
+ const message = createBaseQueryGranteeGrantsRequest();
+
+ while (reader.pos < end) {
+ const tag = reader.uint32();
+
+ switch (tag >>> 3) {
+ case 1:
+ message.grantee = reader.string();
+ break;
+
+ case 2:
+ message.pagination = PageRequest.decode(reader, reader.uint32());
+ break;
+
+ default:
+ reader.skipType(tag & 7);
+ break;
+ }
+ }
+
+ return message;
+ },
+
+ fromPartial(object: Partial): QueryGranteeGrantsRequest {
+ const message = createBaseQueryGranteeGrantsRequest();
+ message.grantee = object.grantee ?? "";
+ message.pagination = object.pagination !== undefined && object.pagination !== null ? PageRequest.fromPartial(object.pagination) : undefined;
+ return message;
+ }
+
+};
+
+function createBaseQueryGranteeGrantsResponse(): QueryGranteeGrantsResponse {
+ return {
+ grants: [],
+ pagination: undefined
+ };
+}
+
+export const QueryGranteeGrantsResponse = {
+ encode(message: QueryGranteeGrantsResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
+ for (const v of message.grants) {
+ GrantAuthorization.encode(v!, writer.uint32(10).fork()).ldelim();
+ }
+
+ if (message.pagination !== undefined) {
+ PageResponse.encode(message.pagination, writer.uint32(18).fork()).ldelim();
+ }
+
+ return writer;
+ },
+
+ decode(input: _m0.Reader | Uint8Array, length?: number): QueryGranteeGrantsResponse {
+ const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
+ let end = length === undefined ? reader.len : reader.pos + length;
+ const message = createBaseQueryGranteeGrantsResponse();
+
+ while (reader.pos < end) {
+ const tag = reader.uint32();
+
+ switch (tag >>> 3) {
+ case 1:
+ message.grants.push(GrantAuthorization.decode(reader, reader.uint32()));
+ break;
+
+ case 2:
+ message.pagination = PageResponse.decode(reader, reader.uint32());
+ break;
+
+ default:
+ reader.skipType(tag & 7);
+ break;
+ }
+ }
+
+ return message;
+ },
+
+ fromPartial(object: Partial): 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;
+ }
+
+};
\ No newline at end of file
diff --git a/examples/contracts/codegen/cosmos/authz/v1beta1/tx.amino.ts b/examples/contracts/codegen/cosmos/authz/v1beta1/tx.amino.ts
new file mode 100644
index 000000000..da254bafc
--- /dev/null
+++ b/examples/contracts/codegen/cosmos/authz/v1beta1/tx.amino.ts
@@ -0,0 +1,128 @@
+import { AminoMsg } from "@cosmjs/amino";
+import { MsgGrant, MsgExec, MsgRevoke } from "./tx";
+export interface AminoMsgGrant extends AminoMsg {
+ type: "cosmos-sdk/MsgGrant";
+ value: {
+ granter: string;
+ grantee: string;
+ grant: {
+ authorization: {
+ type_url: string;
+ value: Uint8Array;
+ };
+ expiration: {
+ seconds: string;
+ nanos: number;
+ };
+ };
+ };
+}
+export interface AminoMsgExec extends AminoMsg {
+ type: "cosmos-sdk/MsgExec";
+ value: {
+ grantee: string;
+ msgs: {
+ type_url: string;
+ value: Uint8Array;
+ }[];
+ };
+}
+export interface AminoMsgRevoke extends AminoMsg {
+ type: "cosmos-sdk/MsgRevoke";
+ value: {
+ granter: string;
+ grantee: string;
+ msg_type_url: string;
+ };
+}
+export const AminoConverter = {
+ "/cosmos.authz.v1beta1.MsgGrant": {
+ aminoType: "cosmos-sdk/MsgGrant",
+ toAmino: ({
+ granter,
+ grantee,
+ grant
+ }: MsgGrant): AminoMsgGrant["value"] => {
+ return {
+ granter,
+ grantee,
+ grant: {
+ authorization: {
+ type_url: grant.authorization.typeUrl,
+ value: grant.authorization.value
+ },
+ expiration: grant.expiration
+ }
+ };
+ },
+ fromAmino: ({
+ granter,
+ grantee,
+ grant
+ }: AminoMsgGrant["value"]): MsgGrant => {
+ return {
+ granter,
+ grantee,
+ grant: {
+ authorization: {
+ typeUrl: grant.authorization.type_url,
+ value: grant.authorization.value
+ },
+ expiration: grant.expiration
+ }
+ };
+ }
+ },
+ "/cosmos.authz.v1beta1.MsgExec": {
+ aminoType: "cosmos-sdk/MsgExec",
+ toAmino: ({
+ grantee,
+ msgs
+ }: MsgExec): AminoMsgExec["value"] => {
+ return {
+ grantee,
+ msgs: msgs.map(el0 => ({
+ type_url: el0.typeUrl,
+ value: el0.value
+ }))
+ };
+ },
+ fromAmino: ({
+ grantee,
+ msgs
+ }: AminoMsgExec["value"]): MsgExec => {
+ return {
+ grantee,
+ msgs: msgs.map(el0 => ({
+ typeUrl: el0.type_url,
+ value: el0.value
+ }))
+ };
+ }
+ },
+ "/cosmos.authz.v1beta1.MsgRevoke": {
+ aminoType: "cosmos-sdk/MsgRevoke",
+ toAmino: ({
+ granter,
+ grantee,
+ msgTypeUrl
+ }: MsgRevoke): AminoMsgRevoke["value"] => {
+ return {
+ granter,
+ grantee,
+ msg_type_url: msgTypeUrl
+ };
+ },
+ fromAmino: ({
+ granter,
+ grantee,
+ msg_type_url
+ }: AminoMsgRevoke["value"]): MsgRevoke => {
+ return {
+ granter,
+ grantee,
+ msgTypeUrl: msg_type_url
+ };
+ }
+ }
+};
\ No newline at end of file
diff --git a/examples/contracts/codegen/cosmos/authz/v1beta1/tx.registry.ts b/examples/contracts/codegen/cosmos/authz/v1beta1/tx.registry.ts
new file mode 100644
index 000000000..c4c1a539f
--- /dev/null
+++ b/examples/contracts/codegen/cosmos/authz/v1beta1/tx.registry.ts
@@ -0,0 +1,79 @@
+import { GeneratedType, Registry } from "@cosmjs/proto-signing";
+import { MsgGrant, MsgExec, MsgRevoke } from "./tx";
+export const registry: ReadonlyArray<[string, GeneratedType]> = [["/cosmos.authz.v1beta1.MsgGrant", MsgGrant], ["/cosmos.authz.v1beta1.MsgExec", MsgExec], ["/cosmos.authz.v1beta1.MsgRevoke", MsgRevoke]];
+export const load = (protoRegistry: Registry) => {
+ registry.forEach(([typeUrl, mod]) => {
+ protoRegistry.register(typeUrl, mod);
+ });
+};
+export const MessageComposer = {
+ encoded: {
+ grant(value: MsgGrant) {
+ return {
+ typeUrl: "/cosmos.authz.v1beta1.MsgGrant",
+ value: MsgGrant.encode(value).finish()
+ };
+ },
+
+ exec(value: MsgExec) {
+ return {
+ typeUrl: "/cosmos.authz.v1beta1.MsgExec",
+ value: MsgExec.encode(value).finish()
+ };
+ },
+
+ revoke(value: MsgRevoke) {
+ return {
+ typeUrl: "/cosmos.authz.v1beta1.MsgRevoke",
+ value: MsgRevoke.encode(value).finish()
+ };
+ }
+
+ },
+ withTypeUrl: {
+ grant(value: MsgGrant) {
+ return {
+ typeUrl: "/cosmos.authz.v1beta1.MsgGrant",
+ value
+ };
+ },
+
+ exec(value: MsgExec) {
+ return {
+ typeUrl: "/cosmos.authz.v1beta1.MsgExec",
+ value
+ };
+ },
+
+ revoke(value: MsgRevoke) {
+ return {
+ typeUrl: "/cosmos.authz.v1beta1.MsgRevoke",
+ value
+ };
+ }
+
+ },
+ fromPartial: {
+ grant(value: MsgGrant) {
+ return {
+ typeUrl: "/cosmos.authz.v1beta1.MsgGrant",
+ value: MsgGrant.fromPartial(value)
+ };
+ },
+
+ exec(value: MsgExec) {
+ return {
+ typeUrl: "/cosmos.authz.v1beta1.MsgExec",
+ value: MsgExec.fromPartial(value)
+ };
+ },
+
+ revoke(value: MsgRevoke) {
+ return {
+ typeUrl: "/cosmos.authz.v1beta1.MsgRevoke",
+ value: MsgRevoke.fromPartial(value)
+ };
+ }
+
+ }
+};
\ No newline at end of file
diff --git a/examples/contracts/codegen/cosmos/authz/v1beta1/tx.rpc.msg.ts b/examples/contracts/codegen/cosmos/authz/v1beta1/tx.rpc.msg.ts
new file mode 100644
index 000000000..63499c426
--- /dev/null
+++ b/examples/contracts/codegen/cosmos/authz/v1beta1/tx.rpc.msg.ts
@@ -0,0 +1,56 @@
+import { Rpc } from "../../../helpers";
+import * as _m0 from "protobufjs/minimal";
+import { MsgGrant, MsgGrantResponse, MsgExec, MsgExecResponse, MsgRevoke, MsgRevokeResponse } from "./tx";
+/** Msg defines the authz Msg service. */
+
+export interface Msg {
+ /**
+ * Grant grants the provided authorization to the grantee on the granter's
+ * account with the provided expiration time. If there is already a grant
+ * for the given (granter, grantee, Authorization) triple, then the grant
+ * will be overwritten.
+ */
+ grant(request: MsgGrant): Promise;
+ /**
+ * Exec attempts to execute the provided messages using
+ * authorizations granted to the grantee. Each message should have only
+ * one signer corresponding to the granter of the authorization.
+ */
+
+ exec(request: MsgExec): Promise;
+ /**
+ * Revoke revokes any authorization corresponding to the provided method name on the
+ * granter's account that has been granted to the grantee.
+ */
+
+ revoke(request: MsgRevoke): Promise;
+}
+export class MsgClientImpl implements Msg {
+ private readonly rpc: Rpc;
+
+ constructor(rpc: Rpc) {
+ this.rpc = rpc;
+ this.grant = this.grant.bind(this);
+ this.exec = this.exec.bind(this);
+ this.revoke = this.revoke.bind(this);
+ }
+
+ grant(request: MsgGrant): Promise {
+ const data = MsgGrant.encode(request).finish();
+ const promise = this.rpc.request("cosmos.authz.v1beta1.Msg", "Grant", data);
+ return promise.then(data => MsgGrantResponse.decode(new _m0.Reader(data)));
+ }
+
+ exec(request: MsgExec): Promise {
+ const data = MsgExec.encode(request).finish();
+ const promise = this.rpc.request("cosmos.authz.v1beta1.Msg", "Exec", data);
+ return promise.then(data => MsgExecResponse.decode(new _m0.Reader(data)));
+ }
+
+ revoke(request: MsgRevoke): Promise {
+ const data = MsgRevoke.encode(request).finish();
+ const promise = this.rpc.request("cosmos.authz.v1beta1.Msg", "Revoke", data);
+ return promise.then(data => MsgRevokeResponse.decode(new _m0.Reader(data)));
+ }
+
+}
\ No newline at end of file
diff --git a/examples/contracts/codegen/cosmos/authz/v1beta1/tx.ts b/examples/contracts/codegen/cosmos/authz/v1beta1/tx.ts
new file mode 100644
index 000000000..105936746
--- /dev/null
+++ b/examples/contracts/codegen/cosmos/authz/v1beta1/tx.ts
@@ -0,0 +1,395 @@
+import { Grant, GrantSDKType } from "./authz";
+import { Any, AnySDKType } from "../../../google/protobuf/any";
+import * as _m0 from "protobufjs/minimal";
+/**
+ * MsgGrant is a request type for Grant method. It declares authorization to the grantee
+ * on behalf of the granter with the provided expiration time.
+ */
+
+export interface MsgGrant {
+ granter: string;
+ grantee: string;
+ grant?: Grant | undefined;
+}
+/**
+ * MsgGrant is a request type for Grant method. It declares authorization to the grantee
+ * on behalf of the granter with the provided expiration time.
+ */
+
+export interface MsgGrantSDKType {
+ granter: string;
+ grantee: string;
+ grant?: GrantSDKType | undefined;
+}
+/** MsgExecResponse defines the Msg/MsgExecResponse response type. */
+
+export interface MsgExecResponse {
+ results: Uint8Array[];
+}
+/** MsgExecResponse defines the Msg/MsgExecResponse response type. */
+
+export interface MsgExecResponseSDKType {
+ results: Uint8Array[];
+}
+/**
+ * MsgExec attempts to execute the provided messages using
+ * authorizations granted to the grantee. Each message should have only
+ * one signer corresponding to the granter of the authorization.
+ */
+
+export interface 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[];
+}
+/**
+ * MsgExec attempts to execute the provided messages using
+ * authorizations granted to the grantee. Each message should have only
+ * one signer corresponding to the granter of the authorization.
+ */
+
+export interface MsgExecSDKType {
+ 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: AnySDKType[];
+}
+/** MsgGrantResponse defines the Msg/MsgGrant response type. */
+
+export interface MsgGrantResponse {}
+/** MsgGrantResponse defines the Msg/MsgGrant response type. */
+
+export interface MsgGrantResponseSDKType {}
+/**
+ * MsgRevoke revokes any authorization with the provided sdk.Msg type on the
+ * granter's account with that has been granted to the grantee.
+ */
+
+export interface MsgRevoke {
+ granter: string;
+ grantee: string;
+ msgTypeUrl: string;
+}
+/**
+ * MsgRevoke revokes any authorization with the provided sdk.Msg type on the
+ * granter's account with that has been granted to the grantee.
+ */
+
+export interface MsgRevokeSDKType {
+ granter: string;
+ grantee: string;
+ msg_type_url: string;
+}
+/** MsgRevokeResponse defines the Msg/MsgRevokeResponse response type. */
+
+export interface MsgRevokeResponse {}
+/** MsgRevokeResponse defines the Msg/MsgRevokeResponse response type. */
+
+export interface MsgRevokeResponseSDKType {}
+
+function createBaseMsgGrant(): MsgGrant {
+ return {
+ granter: "",
+ grantee: "",
+ grant: undefined
+ };
+}
+
+export const MsgGrant = {
+ encode(message: MsgGrant, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
+ 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()).ldelim();
+ }
+
+ return writer;
+ },
+
+ decode(input: _m0.Reader | Uint8Array, length?: number): MsgGrant {
+ const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
+ let end = length === undefined ? reader.len : reader.pos + length;
+ const message = createBaseMsgGrant();
+
+ while (reader.pos < end) {
+ const tag = reader.uint32();
+
+ switch (tag >>> 3) {
+ case 1:
+ message.granter = reader.string();
+ break;
+
+ case 2:
+ message.grantee = reader.string();
+ break;
+
+ case 3:
+ message.grant = Grant.decode(reader, reader.uint32());
+ break;
+
+ default:
+ reader.skipType(tag & 7);
+ break;
+ }
+ }
+
+ return message;
+ },
+
+ fromPartial(object: Partial): 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;
+ }
+
+};
+
+function createBaseMsgExecResponse(): MsgExecResponse {
+ return {
+ results: []
+ };
+}
+
+export const MsgExecResponse = {
+ encode(message: MsgExecResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
+ for (const v of message.results) {
+ writer.uint32(10).bytes(v!);
+ }
+
+ return writer;
+ },
+
+ decode(input: _m0.Reader | Uint8Array, length?: number): MsgExecResponse {
+ const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
+ let end = length === undefined ? reader.len : reader.pos + length;
+ const message = createBaseMsgExecResponse();
+
+ while (reader.pos < end) {
+ const tag = reader.uint32();
+
+ switch (tag >>> 3) {
+ case 1:
+ message.results.push(reader.bytes());
+ break;
+
+ default:
+ reader.skipType(tag & 7);
+ break;
+ }
+ }
+
+ return message;
+ },
+
+ fromPartial(object: Partial): MsgExecResponse {
+ const message = createBaseMsgExecResponse();
+ message.results = object.results?.map(e => e) || [];
+ return message;
+ }
+
+};
+
+function createBaseMsgExec(): MsgExec {
+ return {
+ grantee: "",
+ msgs: []
+ };
+}
+
+export const MsgExec = {
+ encode(message: MsgExec, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
+ if (message.grantee !== "") {
+ writer.uint32(10).string(message.grantee);
+ }
+
+ for (const v of message.msgs) {
+ Any.encode(v!, writer.uint32(18).fork()).ldelim();
+ }
+
+ return writer;
+ },
+
+ decode(input: _m0.Reader | Uint8Array, length?: number): MsgExec {
+ const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
+ let end = length === undefined ? reader.len : reader.pos + length;
+ const message = createBaseMsgExec();
+
+ while (reader.pos < end) {
+ const tag = reader.uint32();
+
+ switch (tag >>> 3) {
+ case 1:
+ message.grantee = reader.string();
+ break;
+
+ case 2:
+ message.msgs.push(Any.decode(reader, reader.uint32()));
+ break;
+
+ default:
+ reader.skipType(tag & 7);
+ break;
+ }
+ }
+
+ return message;
+ },
+
+ fromPartial(object: Partial): MsgExec {
+ const message = createBaseMsgExec();
+ message.grantee = object.grantee ?? "";
+ message.msgs = object.msgs?.map(e => Any.fromPartial(e)) || [];
+ return message;
+ }
+
+};
+
+function createBaseMsgGrantResponse(): MsgGrantResponse {
+ return {};
+}
+
+export const MsgGrantResponse = {
+ encode(_: MsgGrantResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
+ return writer;
+ },
+
+ decode(input: _m0.Reader | Uint8Array, length?: number): MsgGrantResponse {
+ const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
+ let end = length === undefined ? reader.len : reader.pos + length;
+ const message = createBaseMsgGrantResponse();
+
+ while (reader.pos < end) {
+ const tag = reader.uint32();
+
+ switch (tag >>> 3) {
+ default:
+ reader.skipType(tag & 7);
+ break;
+ }
+ }
+
+ return message;
+ },
+
+ fromPartial(_: Partial): MsgGrantResponse {
+ const message = createBaseMsgGrantResponse();
+ return message;
+ }
+
+};
+
+function createBaseMsgRevoke(): MsgRevoke {
+ return {
+ granter: "",
+ grantee: "",
+ msgTypeUrl: ""
+ };
+}
+
+export const MsgRevoke = {
+ encode(message: MsgRevoke, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
+ if (message.granter !== "") {
+ writer.uint32(10).string(message.granter);
+ }
+
+ if (message.grantee !== "") {
+ writer.uint32(18).string(message.grantee);
+ }
+
+ if (message.msgTypeUrl !== "") {
+ writer.uint32(26).string(message.msgTypeUrl);
+ }
+
+ return writer;
+ },
+
+ decode(input: _m0.Reader | Uint8Array, length?: number): MsgRevoke {
+ const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
+ let end = length === undefined ? reader.len : reader.pos + length;
+ const message = createBaseMsgRevoke();
+
+ while (reader.pos < end) {
+ const tag = reader.uint32();
+
+ switch (tag >>> 3) {
+ case 1:
+ message.granter = reader.string();
+ break;
+
+ case 2:
+ message.grantee = reader.string();
+ break;
+
+ case 3:
+ message.msgTypeUrl = reader.string();
+ break;
+
+ default:
+ reader.skipType(tag & 7);
+ break;
+ }
+ }
+
+ return message;
+ },
+
+ fromPartial(object: Partial): MsgRevoke {
+ const message = createBaseMsgRevoke();
+ message.granter = object.granter ?? "";
+ message.grantee = object.grantee ?? "";
+ message.msgTypeUrl = object.msgTypeUrl ?? "";
+ return message;
+ }
+
+};
+
+function createBaseMsgRevokeResponse(): MsgRevokeResponse {
+ return {};
+}
+
+export const MsgRevokeResponse = {
+ encode(_: MsgRevokeResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
+ return writer;
+ },
+
+ decode(input: _m0.Reader | Uint8Array, length?: number): MsgRevokeResponse {
+ const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
+ let end = length === undefined ? reader.len : reader.pos + length;
+ const message = createBaseMsgRevokeResponse();
+
+ while (reader.pos < end) {
+ const tag = reader.uint32();
+
+ switch (tag >>> 3) {
+ default:
+ reader.skipType(tag & 7);
+ break;
+ }
+ }
+
+ return message;
+ },
+
+ fromPartial(_: Partial): MsgRevokeResponse {
+ const message = createBaseMsgRevokeResponse();
+ return message;
+ }
+
+};
\ No newline at end of file
diff --git a/examples/contracts/codegen/cosmos/bank/v1beta1/authz.ts b/examples/contracts/codegen/cosmos/bank/v1beta1/authz.ts
new file mode 100644
index 000000000..09806a64a
--- /dev/null
+++ b/examples/contracts/codegen/cosmos/bank/v1beta1/authz.ts
@@ -0,0 +1,67 @@
+import { Coin, CoinSDKType } from "../../base/v1beta1/coin";
+import * as _m0 from "protobufjs/minimal";
+/**
+ * SendAuthorization allows the grantee to spend up to spend_limit coins from
+ * the granter's account.
+ *
+ * Since: cosmos-sdk 0.43
+ */
+
+export interface SendAuthorization {
+ spendLimit: Coin[];
+}
+/**
+ * SendAuthorization allows the grantee to spend up to spend_limit coins from
+ * the granter's account.
+ *
+ * Since: cosmos-sdk 0.43
+ */
+
+export interface SendAuthorizationSDKType {
+ spend_limit: CoinSDKType[];
+}
+
+function createBaseSendAuthorization(): SendAuthorization {
+ return {
+ spendLimit: []
+ };
+}
+
+export const SendAuthorization = {
+ encode(message: SendAuthorization, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
+ for (const v of message.spendLimit) {
+ Coin.encode(v!, writer.uint32(10).fork()).ldelim();
+ }
+
+ return writer;
+ },
+
+ decode(input: _m0.Reader | Uint8Array, length?: number): SendAuthorization {
+ const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
+ let end = length === undefined ? reader.len : reader.pos + length;
+ const message = createBaseSendAuthorization();
+
+ while (reader.pos < end) {
+ const tag = reader.uint32();
+
+ switch (tag >>> 3) {
+ case 1:
+ message.spendLimit.push(Coin.decode(reader, reader.uint32()));
+ break;
+
+ default:
+ reader.skipType(tag & 7);
+ break;
+ }
+ }
+
+ return message;
+ },
+
+ fromPartial(object: Partial): SendAuthorization {
+ const message = createBaseSendAuthorization();
+ message.spendLimit = object.spendLimit?.map(e => Coin.fromPartial(e)) || [];
+ return message;
+ }
+
+};
\ No newline at end of file
diff --git a/examples/contracts/codegen/cosmos/bank/v1beta1/bank.ts b/examples/contracts/codegen/cosmos/bank/v1beta1/bank.ts
new file mode 100644
index 000000000..409c9e29d
--- /dev/null
+++ b/examples/contracts/codegen/cosmos/bank/v1beta1/bank.ts
@@ -0,0 +1,665 @@
+import { Coin, CoinSDKType } from "../../base/v1beta1/coin";
+import * as _m0 from "protobufjs/minimal";
+/** Params defines the parameters for the bank module. */
+
+export interface Params {
+ sendEnabled: SendEnabled[];
+ defaultSendEnabled: boolean;
+}
+/** Params defines the parameters for the bank module. */
+
+export interface ParamsSDKType {
+ send_enabled: SendEnabledSDKType[];
+ default_send_enabled: boolean;
+}
+/**
+ * SendEnabled maps coin denom to a send_enabled status (whether a denom is
+ * sendable).
+ */
+
+export interface SendEnabled {
+ denom: string;
+ enabled: boolean;
+}
+/**
+ * SendEnabled maps coin denom to a send_enabled status (whether a denom is
+ * sendable).
+ */
+
+export interface SendEnabledSDKType {
+ denom: string;
+ enabled: boolean;
+}
+/** Input models transaction input. */
+
+export interface Input {
+ address: string;
+ coins: Coin[];
+}
+/** Input models transaction input. */
+
+export interface InputSDKType {
+ address: string;
+ coins: CoinSDKType[];
+}
+/** Output models transaction outputs. */
+
+export interface Output {
+ address: string;
+ coins: Coin[];
+}
+/** Output models transaction outputs. */
+
+export interface OutputSDKType {
+ address: string;
+ coins: CoinSDKType[];
+}
+/**
+ * Supply represents a struct that passively keeps track of the total supply
+ * amounts in the network.
+ * This message is deprecated now that supply is indexed by denom.
+ */
+
+/** @deprecated */
+
+export interface Supply {
+ total: Coin[];
+}
+/**
+ * Supply represents a struct that passively keeps track of the total supply
+ * amounts in the network.
+ * This message is deprecated now that supply is indexed by denom.
+ */
+
+/** @deprecated */
+
+export interface SupplySDKType {
+ total: CoinSDKType[];
+}
+/**
+ * DenomUnit represents a struct that describes a given
+ * denomination unit of the basic token.
+ */
+
+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 = 10^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[];
+}
+/**
+ * DenomUnit represents a struct that describes a given
+ * denomination unit of the basic token.
+ */
+
+export interface DenomUnitSDKType {
+ /** 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 = 10^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[];
+}
+/**
+ * Metadata represents a struct that describes
+ * a basic token.
+ */
+
+export interface Metadata {
+ description: string;
+ /** denom_units represents the list of DenomUnit's for a given coin */
+
+ denomUnits: 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;
+ /**
+ * URI to a document (on or off-chain) that contains additional information. Optional.
+ *
+ * Since: cosmos-sdk 0.46
+ */
+
+ uri: string;
+ /**
+ * URIHash is a sha256 hash of a document pointed by URI. It's used to verify that
+ * the document didn't change. Optional.
+ *
+ * Since: cosmos-sdk 0.46
+ */
+
+ uriHash: string;
+}
+/**
+ * Metadata represents a struct that describes
+ * a basic token.
+ */
+
+export interface MetadataSDKType {
+ description: string;
+ /** denom_units represents the list of DenomUnit's for a given coin */
+
+ denom_units: DenomUnitSDKType[];
+ /** 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;
+ /**
+ * URI to a document (on or off-chain) that contains additional information. Optional.
+ *
+ * Since: cosmos-sdk 0.46
+ */
+
+ uri: string;
+ /**
+ * URIHash is a sha256 hash of a document pointed by URI. It's used to verify that
+ * the document didn't change. Optional.
+ *
+ * Since: cosmos-sdk 0.46
+ */
+
+ uri_hash: string;
+}
+
+function createBaseParams(): Params {
+ return {
+ sendEnabled: [],
+ defaultSendEnabled: false
+ };
+}
+
+export const Params = {
+ encode(message: Params, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
+ for (const v of message.sendEnabled) {
+ SendEnabled.encode(v!, writer.uint32(10).fork()).ldelim();
+ }
+
+ if (message.defaultSendEnabled === true) {
+ writer.uint32(16).bool(message.defaultSendEnabled);
+ }
+
+ return writer;
+ },
+
+ decode(input: _m0.Reader | Uint8Array, length?: number): Params {
+ const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
+ let end = length === undefined ? reader.len : reader.pos + length;
+ const message = createBaseParams();
+
+ while (reader.pos < end) {
+ const tag = reader.uint32();
+
+ switch (tag >>> 3) {
+ case 1:
+ message.sendEnabled.push(SendEnabled.decode(reader, reader.uint32()));
+ break;
+
+ case 2:
+ message.defaultSendEnabled = reader.bool();
+ break;
+
+ default:
+ reader.skipType(tag & 7);
+ break;
+ }
+ }
+
+ return message;
+ },
+
+ fromPartial(object: Partial): Params {
+ const message = createBaseParams();
+ message.sendEnabled = object.sendEnabled?.map(e => SendEnabled.fromPartial(e)) || [];
+ message.defaultSendEnabled = object.defaultSendEnabled ?? false;
+ return message;
+ }
+
+};
+
+function createBaseSendEnabled(): SendEnabled {
+ return {
+ denom: "",
+ enabled: false
+ };
+}
+
+export const SendEnabled = {
+ encode(message: SendEnabled, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
+ if (message.denom !== "") {
+ writer.uint32(10).string(message.denom);
+ }
+
+ if (message.enabled === true) {
+ writer.uint32(16).bool(message.enabled);
+ }
+
+ return writer;
+ },
+
+ decode(input: _m0.Reader | Uint8Array, length?: number): SendEnabled {
+ const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
+ let end = length === undefined ? reader.len : reader.pos + length;
+ const message = createBaseSendEnabled();
+
+ while (reader.pos < end) {
+ const tag = reader.uint32();
+
+ switch (tag >>> 3) {
+ case 1:
+ message.denom = reader.string();
+ break;
+
+ case 2:
+ message.enabled = reader.bool();
+ break;
+
+ default:
+ reader.skipType(tag & 7);
+ break;
+ }
+ }
+
+ return message;
+ },
+
+ fromPartial(object: Partial): SendEnabled {
+ const message = createBaseSendEnabled();
+ message.denom = object.denom ?? "";
+ message.enabled = object.enabled ?? false;
+ return message;
+ }
+
+};
+
+function createBaseInput(): Input {
+ return {
+ address: "",
+ coins: []
+ };
+}
+
+export const Input = {
+ encode(message: Input, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
+ if (message.address !== "") {
+ writer.uint32(10).string(message.address);
+ }
+
+ for (const v of message.coins) {
+ Coin.encode(v!, writer.uint32(18).fork()).ldelim();
+ }
+
+ return writer;
+ },
+
+ decode(input: _m0.Reader | Uint8Array, length?: number): Input {
+ const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
+ let end = length === undefined ? reader.len : reader.pos + length;
+ const message = createBaseInput();
+
+ while (reader.pos < end) {
+ const tag = reader.uint32();
+
+ switch (tag >>> 3) {
+ case 1:
+ message.address = reader.string();
+ break;
+
+ case 2:
+ message.coins.push(Coin.decode(reader, reader.uint32()));
+ break;
+
+ default:
+ reader.skipType(tag & 7);
+ break;
+ }
+ }
+
+ return message;
+ },
+
+ fromPartial(object: Partial ): Input {
+ const message = createBaseInput();
+ message.address = object.address ?? "";
+ message.coins = object.coins?.map(e => Coin.fromPartial(e)) || [];
+ return message;
+ }
+
+};
+
+function createBaseOutput(): Output {
+ return {
+ address: "",
+ coins: []
+ };
+}
+
+export const Output = {
+ encode(message: Output, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
+ if (message.address !== "") {
+ writer.uint32(10).string(message.address);
+ }
+
+ for (const v of message.coins) {
+ Coin.encode(v!, writer.uint32(18).fork()).ldelim();
+ }
+
+ return writer;
+ },
+
+ decode(input: _m0.Reader | Uint8Array, length?: number): Output {
+ const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
+ let end = length === undefined ? reader.len : reader.pos + length;
+ const message = createBaseOutput();
+
+ while (reader.pos < end) {
+ const tag = reader.uint32();
+
+ switch (tag >>> 3) {
+ case 1:
+ message.address = reader.string();
+ break;
+
+ case 2:
+ message.coins.push(Coin.decode(reader, reader.uint32()));
+ break;
+
+ default:
+ reader.skipType(tag & 7);
+ break;
+ }
+ }
+
+ return message;
+ },
+
+ fromPartial(object: Partial): Output {
+ const message = createBaseOutput();
+ message.address = object.address ?? "";
+ message.coins = object.coins?.map(e => Coin.fromPartial(e)) || [];
+ return message;
+ }
+
+};
+
+function createBaseSupply(): Supply {
+ return {
+ total: []
+ };
+}
+
+export const Supply = {
+ encode(message: Supply, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
+ for (const v of message.total) {
+ Coin.encode(v!, writer.uint32(10).fork()).ldelim();
+ }
+
+ return writer;
+ },
+
+ decode(input: _m0.Reader | Uint8Array, length?: number): Supply {
+ const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
+ let end = length === undefined ? reader.len : reader.pos + length;
+ const message = createBaseSupply();
+
+ while (reader.pos < end) {
+ const tag = reader.uint32();
+
+ switch (tag >>> 3) {
+ case 1:
+ message.total.push(Coin.decode(reader, reader.uint32()));
+ break;
+
+ default:
+ reader.skipType(tag & 7);
+ break;
+ }
+ }
+
+ return message;
+ },
+
+ fromPartial(object: Partial): Supply {
+ const message = createBaseSupply();
+ message.total = object.total?.map(e => Coin.fromPartial(e)) || [];
+ return message;
+ }
+
+};
+
+function createBaseDenomUnit(): DenomUnit {
+ return {
+ denom: "",
+ exponent: 0,
+ aliases: []
+ };
+}
+
+export const DenomUnit = {
+ encode(message: DenomUnit, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
+ 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: _m0.Reader | Uint8Array, length?: number): DenomUnit {
+ const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
+ let end = length === undefined ? reader.len : reader.pos + length;
+ const message = createBaseDenomUnit();
+
+ while (reader.pos < end) {
+ const tag = reader.uint32();
+
+ switch (tag >>> 3) {
+ case 1:
+ message.denom = reader.string();
+ break;
+
+ case 2:
+ message.exponent = reader.uint32();
+ break;
+
+ case 3:
+ message.aliases.push(reader.string());
+ break;
+
+ default:
+ reader.skipType(tag & 7);
+ break;
+ }
+ }
+
+ return message;
+ },
+
+ fromPartial(object: Partial): DenomUnit {
+ const message = createBaseDenomUnit();
+ message.denom = object.denom ?? "";
+ message.exponent = object.exponent ?? 0;
+ message.aliases = object.aliases?.map(e => e) || [];
+ return message;
+ }
+
+};
+
+function createBaseMetadata(): Metadata {
+ return {
+ description: "",
+ denomUnits: [],
+ base: "",
+ display: "",
+ name: "",
+ symbol: "",
+ uri: "",
+ uriHash: ""
+ };
+}
+
+export const Metadata = {
+ encode(message: Metadata, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
+ if (message.description !== "") {
+ writer.uint32(10).string(message.description);
+ }
+
+ for (const v of message.denomUnits) {
+ DenomUnit.encode(v!, writer.uint32(18).fork()).ldelim();
+ }
+
+ 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);
+ }
+
+ if (message.uri !== "") {
+ writer.uint32(58).string(message.uri);
+ }
+
+ if (message.uriHash !== "") {
+ writer.uint32(66).string(message.uriHash);
+ }
+
+ return writer;
+ },
+
+ decode(input: _m0.Reader | Uint8Array, length?: number): Metadata {
+ const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
+ let end = length === undefined ? reader.len : reader.pos + length;
+ const message = createBaseMetadata();
+
+ while (reader.pos < end) {
+ const tag = reader.uint32();
+
+ switch (tag >>> 3) {
+ case 1:
+ message.description = reader.string();
+ break;
+
+ case 2:
+ message.denomUnits.push(DenomUnit.decode(reader, reader.uint32()));
+ break;
+
+ case 3:
+ message.base = reader.string();
+ break;
+
+ case 4:
+ message.display = reader.string();
+ break;
+
+ case 5:
+ message.name = reader.string();
+ break;
+
+ case 6:
+ message.symbol = reader.string();
+ break;
+
+ case 7:
+ message.uri = reader.string();
+ break;
+
+ case 8:
+ message.uriHash = reader.string();
+ break;
+
+ default:
+ reader.skipType(tag & 7);
+ break;
+ }
+ }
+
+ return message;
+ },
+
+ fromPartial(object: Partial): Metadata {
+ const message = createBaseMetadata();
+ message.description = object.description ?? "";
+ message.denomUnits = object.denomUnits?.map(e => DenomUnit.fromPartial(e)) || [];
+ message.base = object.base ?? "";
+ message.display = object.display ?? "";
+ message.name = object.name ?? "";
+ message.symbol = object.symbol ?? "";
+ message.uri = object.uri ?? "";
+ message.uriHash = object.uriHash ?? "";
+ return message;
+ }
+
+};
\ No newline at end of file
diff --git a/examples/contracts/codegen/cosmos/bank/v1beta1/genesis.ts b/examples/contracts/codegen/cosmos/bank/v1beta1/genesis.ts
new file mode 100644
index 000000000..da2f39609
--- /dev/null
+++ b/examples/contracts/codegen/cosmos/bank/v1beta1/genesis.ts
@@ -0,0 +1,193 @@
+import { Params, ParamsSDKType, Metadata, MetadataSDKType } from "./bank";
+import { Coin, CoinSDKType } from "../../base/v1beta1/coin";
+import * as _m0 from "protobufjs/minimal";
+/** GenesisState defines the bank module's genesis state. */
+
+export interface GenesisState {
+ /** params defines all the paramaters of the module. */
+ params?: Params | undefined;
+ /** 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. */
+
+ denomMetadata: Metadata[];
+}
+/** GenesisState defines the bank module's genesis state. */
+
+export interface GenesisStateSDKType {
+ /** params defines all the paramaters of the module. */
+ params?: ParamsSDKType | undefined;
+ /** balances is an array containing the balances of all the accounts. */
+
+ balances: BalanceSDKType[];
+ /**
+ * 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: CoinSDKType[];
+ /** denom_metadata defines the metadata of the differents coins. */
+
+ denom_metadata: MetadataSDKType[];
+}
+/**
+ * Balance defines an account address and balance pair used in the bank module's
+ * genesis state.
+ */
+
+export interface Balance {
+ /** address is the address of the balance holder. */
+ address: string;
+ /** coins defines the different coins this balance holds. */
+
+ coins: Coin[];
+}
+/**
+ * Balance defines an account address and balance pair used in the bank module's
+ * genesis state.
+ */
+
+export interface BalanceSDKType {
+ /** address is the address of the balance holder. */
+ address: string;
+ /** coins defines the different coins this balance holds. */
+
+ coins: CoinSDKType[];
+}
+
+function createBaseGenesisState(): GenesisState {
+ return {
+ params: undefined,
+ balances: [],
+ supply: [],
+ denomMetadata: []
+ };
+}
+
+export const GenesisState = {
+ encode(message: GenesisState, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
+ if (message.params !== undefined) {
+ Params.encode(message.params, writer.uint32(10).fork()).ldelim();
+ }
+
+ for (const v of message.balances) {
+ Balance.encode(v!, writer.uint32(18).fork()).ldelim();
+ }
+
+ for (const v of message.supply) {
+ Coin.encode(v!, writer.uint32(26).fork()).ldelim();
+ }
+
+ for (const v of message.denomMetadata) {
+ Metadata.encode(v!, writer.uint32(34).fork()).ldelim();
+ }
+
+ return writer;
+ },
+
+ decode(input: _m0.Reader | Uint8Array, length?: number): GenesisState {
+ const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
+ let end = length === undefined ? reader.len : reader.pos + length;
+ const message = createBaseGenesisState();
+
+ while (reader.pos < end) {
+ const tag = reader.uint32();
+
+ switch (tag >>> 3) {
+ case 1:
+ message.params = Params.decode(reader, reader.uint32());
+ break;
+
+ case 2:
+ message.balances.push(Balance.decode(reader, reader.uint32()));
+ break;
+
+ case 3:
+ message.supply.push(Coin.decode(reader, reader.uint32()));
+ break;
+
+ case 4:
+ message.denomMetadata.push(Metadata.decode(reader, reader.uint32()));
+ break;
+
+ default:
+ reader.skipType(tag & 7);
+ break;
+ }
+ }
+
+ return message;
+ },
+
+ fromPartial(object: Partial): 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.denomMetadata = object.denomMetadata?.map(e => Metadata.fromPartial(e)) || [];
+ return message;
+ }
+
+};
+
+function createBaseBalance(): Balance {
+ return {
+ address: "",
+ coins: []
+ };
+}
+
+export const Balance = {
+ encode(message: Balance, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
+ if (message.address !== "") {
+ writer.uint32(10).string(message.address);
+ }
+
+ for (const v of message.coins) {
+ Coin.encode(v!, writer.uint32(18).fork()).ldelim();
+ }
+
+ return writer;
+ },
+
+ decode(input: _m0.Reader | Uint8Array, length?: number): Balance {
+ const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
+ let end = length === undefined ? reader.len : reader.pos + length;
+ const message = createBaseBalance();
+
+ while (reader.pos < end) {
+ const tag = reader.uint32();
+
+ switch (tag >>> 3) {
+ case 1:
+ message.address = reader.string();
+ break;
+
+ case 2:
+ message.coins.push(Coin.decode(reader, reader.uint32()));
+ break;
+
+ default:
+ reader.skipType(tag & 7);
+ break;
+ }
+ }
+
+ return message;
+ },
+
+ fromPartial(object: Partial): Balance {
+ const message = createBaseBalance();
+ message.address = object.address ?? "";
+ message.coins = object.coins?.map(e => Coin.fromPartial(e)) || [];
+ return message;
+ }
+
+};
\ No newline at end of file
diff --git a/examples/contracts/codegen/cosmos/bank/v1beta1/query.lcd.ts b/examples/contracts/codegen/cosmos/bank/v1beta1/query.lcd.ts
new file mode 100644
index 000000000..7535655dc
--- /dev/null
+++ b/examples/contracts/codegen/cosmos/bank/v1beta1/query.lcd.ts
@@ -0,0 +1,150 @@
+import { setPaginationParams } from "../../../helpers";
+import { LCDClient } from "@osmonauts/lcd";
+import { QueryBalanceRequest, QueryBalanceResponseSDKType, QueryAllBalancesRequest, QueryAllBalancesResponseSDKType, QuerySpendableBalancesRequest, QuerySpendableBalancesResponseSDKType, QueryTotalSupplyRequest, QueryTotalSupplyResponseSDKType, QuerySupplyOfRequest, QuerySupplyOfResponseSDKType, QueryParamsRequest, QueryParamsResponseSDKType, QueryDenomMetadataRequest, QueryDenomMetadataResponseSDKType, QueryDenomsMetadataRequest, QueryDenomsMetadataResponseSDKType, QueryDenomOwnersRequest, QueryDenomOwnersResponseSDKType } from "./query";
+export class LCDQueryClient {
+ req: LCDClient;
+
+ constructor({
+ requestClient
+ }: {
+ requestClient: LCDClient;
+ }) {
+ this.req = requestClient;
+ this.balance = this.balance.bind(this);
+ this.allBalances = this.allBalances.bind(this);
+ this.spendableBalances = this.spendableBalances.bind(this);
+ this.totalSupply = this.totalSupply.bind(this);
+ this.supplyOf = this.supplyOf.bind(this);
+ this.params = this.params.bind(this);
+ this.denomMetadata = this.denomMetadata.bind(this);
+ this.denomsMetadata = this.denomsMetadata.bind(this);
+ this.denomOwners = this.denomOwners.bind(this);
+ }
+ /* Balance queries the balance of a single coin for a single account. */
+
+
+ async balance(params: QueryBalanceRequest): Promise {
+ const options: any = {
+ params: {}
+ };
+
+ if (typeof params?.denom !== "undefined") {
+ options.params.denom = params.denom;
+ }
+
+ const endpoint = `cosmos/bank/v1beta1/balances/${params.address}/by_denom`;
+ return await this.req.get(endpoint, options);
+ }
+ /* AllBalances queries the balance of all coins for a single account. */
+
+
+ async allBalances(params: QueryAllBalancesRequest): Promise {
+ const options: any = {
+ params: {}
+ };
+
+ if (typeof params?.pagination !== "undefined") {
+ setPaginationParams(options, params.pagination);
+ }
+
+ const endpoint = `cosmos/bank/v1beta1/balances/${params.address}`;
+ return await this.req.get(endpoint, options);
+ }
+ /* SpendableBalances queries the spenable balance of all coins for a single
+ account. */
+
+
+ async spendableBalances(params: QuerySpendableBalancesRequest): Promise {
+ const options: any = {
+ params: {}
+ };
+
+ if (typeof params?.pagination !== "undefined") {
+ setPaginationParams(options, params.pagination);
+ }
+
+ const endpoint = `cosmos/bank/v1beta1/spendable_balances/${params.address}`;
+ return await this.req.get(endpoint, options);
+ }
+ /* TotalSupply queries the total supply of all coins. */
+
+
+ async totalSupply(params: QueryTotalSupplyRequest = {
+ pagination: undefined
+ }): Promise {
+ const options: any = {
+ params: {}
+ };
+
+ if (typeof params?.pagination !== "undefined") {
+ setPaginationParams(options, params.pagination);
+ }
+
+ const endpoint = `cosmos/bank/v1beta1/supply`;
+ return await this.req.get(endpoint, options);
+ }
+ /* SupplyOf queries the supply of a single coin. */
+
+
+ async supplyOf(params: QuerySupplyOfRequest): Promise {
+ const options: any = {
+ params: {}
+ };
+
+ if (typeof params?.denom !== "undefined") {
+ options.params.denom = params.denom;
+ }
+
+ const endpoint = `cosmos/bank/v1beta1/supply/by_denom`;
+ return await this.req.get(endpoint, options);
+ }
+ /* Params queries the parameters of x/bank module. */
+
+
+ async params(_params: QueryParamsRequest = {}): Promise {
+ const endpoint = `cosmos/bank/v1beta1/params`;
+ return await this.req.get(endpoint);
+ }
+ /* DenomsMetadata queries the client metadata of a given coin denomination. */
+
+
+ async denomMetadata(params: QueryDenomMetadataRequest): Promise {
+ const endpoint = `cosmos/bank/v1beta1/denoms_metadata/${params.denom}`;
+ return await this.req.get(endpoint);
+ }
+ /* DenomsMetadata queries the client metadata for all registered coin
+ denominations. */
+
+
+ async denomsMetadata(params: QueryDenomsMetadataRequest = {
+ pagination: undefined
+ }): Promise {
+ const options: any = {
+ params: {}
+ };
+
+ if (typeof params?.pagination !== "undefined") {
+ setPaginationParams(options, params.pagination);
+ }
+
+ const endpoint = `cosmos/bank/v1beta1/denoms_metadata`;
+ return await this.req.get(endpoint, options);
+ }
+ /* DenomOwners queries for all account addresses that own a particular token
+ denomination. */
+
+
+ async denomOwners(params: QueryDenomOwnersRequest): Promise {
+ const options: any = {
+ params: {}
+ };
+
+ if (typeof params?.pagination !== "undefined") {
+ setPaginationParams(options, params.pagination);
+ }
+
+ const endpoint = `cosmos/bank/v1beta1/denom_owners/${params.denom}`;
+ return await this.req.get(endpoint, options);
+ }
+
+}
\ No newline at end of file
diff --git a/examples/contracts/codegen/cosmos/bank/v1beta1/query.rpc.query.ts b/examples/contracts/codegen/cosmos/bank/v1beta1/query.rpc.query.ts
new file mode 100644
index 000000000..a60bbc8c7
--- /dev/null
+++ b/examples/contracts/codegen/cosmos/bank/v1beta1/query.rpc.query.ts
@@ -0,0 +1,160 @@
+import { Rpc } from "../../../helpers";
+import * as _m0 from "protobufjs/minimal";
+import { QueryClient, createProtobufRpcClient } from "@cosmjs/stargate";
+import { QueryBalanceRequest, QueryBalanceResponse, QueryAllBalancesRequest, QueryAllBalancesResponse, QuerySpendableBalancesRequest, QuerySpendableBalancesResponse, QueryTotalSupplyRequest, QueryTotalSupplyResponse, QuerySupplyOfRequest, QuerySupplyOfResponse, QueryParamsRequest, QueryParamsResponse, QueryDenomMetadataRequest, QueryDenomMetadataResponse, QueryDenomsMetadataRequest, QueryDenomsMetadataResponse, QueryDenomOwnersRequest, QueryDenomOwnersResponse } from "./query";
+/** Query defines the gRPC querier service. */
+
+export interface Query {
+ /** Balance queries the balance of a single coin for a single account. */
+ balance(request: QueryBalanceRequest): Promise;
+ /** AllBalances queries the balance of all coins for a single account. */
+
+ allBalances(request: QueryAllBalancesRequest): Promise;
+ /**
+ * SpendableBalances queries the spenable balance of all coins for a single
+ * account.
+ */
+
+ spendableBalances(request: QuerySpendableBalancesRequest): Promise;
+ /** TotalSupply queries the total supply of all coins. */
+
+ totalSupply(request?: QueryTotalSupplyRequest): Promise;
+ /** SupplyOf queries the supply of a single coin. */
+
+ supplyOf(request: QuerySupplyOfRequest): Promise;
+ /** Params queries the parameters of x/bank module. */
+
+ params(request?: QueryParamsRequest): Promise;
+ /** DenomsMetadata queries the client metadata of a given coin denomination. */
+
+ denomMetadata(request: QueryDenomMetadataRequest): Promise;
+ /**
+ * DenomsMetadata queries the client metadata for all registered coin
+ * denominations.
+ */
+
+ denomsMetadata(request?: QueryDenomsMetadataRequest): Promise;
+ /**
+ * DenomOwners queries for all account addresses that own a particular token
+ * denomination.
+ */
+
+ denomOwners(request: QueryDenomOwnersRequest): Promise;
+}
+export class QueryClientImpl implements Query {
+ private readonly rpc: Rpc;
+
+ constructor(rpc: Rpc) {
+ this.rpc = rpc;
+ this.balance = this.balance.bind(this);
+ this.allBalances = this.allBalances.bind(this);
+ this.spendableBalances = this.spendableBalances.bind(this);
+ this.totalSupply = this.totalSupply.bind(this);
+ this.supplyOf = this.supplyOf.bind(this);
+ this.params = this.params.bind(this);
+ this.denomMetadata = this.denomMetadata.bind(this);
+ this.denomsMetadata = this.denomsMetadata.bind(this);
+ this.denomOwners = this.denomOwners.bind(this);
+ }
+
+ balance(request: QueryBalanceRequest): Promise {
+ const data = QueryBalanceRequest.encode(request).finish();
+ const promise = this.rpc.request("cosmos.bank.v1beta1.Query", "Balance", data);
+ return promise.then(data => QueryBalanceResponse.decode(new _m0.Reader(data)));
+ }
+
+ allBalances(request: QueryAllBalancesRequest): Promise {
+ const data = QueryAllBalancesRequest.encode(request).finish();
+ const promise = this.rpc.request("cosmos.bank.v1beta1.Query", "AllBalances", data);
+ return promise.then(data => QueryAllBalancesResponse.decode(new _m0.Reader(data)));
+ }
+
+ spendableBalances(request: QuerySpendableBalancesRequest): Promise {
+ const data = QuerySpendableBalancesRequest.encode(request).finish();
+ const promise = this.rpc.request("cosmos.bank.v1beta1.Query", "SpendableBalances", data);
+ return promise.then(data => QuerySpendableBalancesResponse.decode(new _m0.Reader(data)));
+ }
+
+ totalSupply(request: QueryTotalSupplyRequest = {
+ pagination: undefined
+ }): Promise {
+ const data = QueryTotalSupplyRequest.encode(request).finish();
+ const promise = this.rpc.request("cosmos.bank.v1beta1.Query", "TotalSupply", data);
+ return promise.then(data => QueryTotalSupplyResponse.decode(new _m0.Reader(data)));
+ }
+
+ supplyOf(request: QuerySupplyOfRequest): Promise {
+ const data = QuerySupplyOfRequest.encode(request).finish();
+ const promise = this.rpc.request("cosmos.bank.v1beta1.Query", "SupplyOf", data);
+ return promise.then(data => QuerySupplyOfResponse.decode(new _m0.Reader(data)));
+ }
+
+ params(request: QueryParamsRequest = {}): Promise {
+ const data = QueryParamsRequest.encode(request).finish();
+ const promise = this.rpc.request("cosmos.bank.v1beta1.Query", "Params", data);
+ return promise.then(data => QueryParamsResponse.decode(new _m0.Reader(data)));
+ }
+
+ denomMetadata(request: QueryDenomMetadataRequest): Promise {
+ const data = QueryDenomMetadataRequest.encode(request).finish();
+ const promise = this.rpc.request("cosmos.bank.v1beta1.Query", "DenomMetadata", data);
+ return promise.then(data => QueryDenomMetadataResponse.decode(new _m0.Reader(data)));
+ }
+
+ denomsMetadata(request: QueryDenomsMetadataRequest = {
+ pagination: undefined
+ }): Promise {
+ const data = QueryDenomsMetadataRequest.encode(request).finish();
+ const promise = this.rpc.request("cosmos.bank.v1beta1.Query", "DenomsMetadata", data);
+ return promise.then(data => QueryDenomsMetadataResponse.decode(new _m0.Reader(data)));
+ }
+
+ denomOwners(request: QueryDenomOwnersRequest): Promise {
+ const data = QueryDenomOwnersRequest.encode(request).finish();
+ const promise = this.rpc.request("cosmos.bank.v1beta1.Query", "DenomOwners", data);
+ return promise.then(data => QueryDenomOwnersResponse.decode(new _m0.Reader(data)));
+ }
+
+}
+export const createRpcQueryExtension = (base: QueryClient) => {
+ const rpc = createProtobufRpcClient(base);
+ const queryService = new QueryClientImpl(rpc);
+ return {
+ balance(request: QueryBalanceRequest): Promise {
+ return queryService.balance(request);
+ },
+
+ allBalances(request: QueryAllBalancesRequest): Promise {
+ return queryService.allBalances(request);
+ },
+
+ spendableBalances(request: QuerySpendableBalancesRequest): Promise {
+ return queryService.spendableBalances(request);
+ },
+
+ totalSupply(request?: QueryTotalSupplyRequest): Promise {
+ return queryService.totalSupply(request);
+ },
+
+ supplyOf(request: QuerySupplyOfRequest): Promise {
+ return queryService.supplyOf(request);
+ },
+
+ params(request?: QueryParamsRequest): Promise {
+ return queryService.params(request);
+ },
+
+ denomMetadata(request: QueryDenomMetadataRequest): Promise {
+ return queryService.denomMetadata(request);
+ },
+
+ denomsMetadata(request?: QueryDenomsMetadataRequest): Promise {
+ return queryService.denomsMetadata(request);
+ },
+
+ denomOwners(request: QueryDenomOwnersRequest): Promise {
+ return queryService.denomOwners(request);
+ }
+
+ };
+};
\ No newline at end of file
diff --git a/examples/contracts/codegen/cosmos/bank/v1beta1/query.ts b/examples/contracts/codegen/cosmos/bank/v1beta1/query.ts
new file mode 100644
index 000000000..53ecb3fae
--- /dev/null
+++ b/examples/contracts/codegen/cosmos/bank/v1beta1/query.ts
@@ -0,0 +1,1300 @@
+import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../base/query/v1beta1/pagination";
+import { Coin, CoinSDKType } from "../../base/v1beta1/coin";
+import { Params, ParamsSDKType, Metadata, MetadataSDKType } from "./bank";
+import * as _m0 from "protobufjs/minimal";
+/** QueryBalanceRequest is the request type for the Query/Balance RPC method. */
+
+export interface QueryBalanceRequest {
+ /** address is the address to query balances for. */
+ address: string;
+ /** denom is the coin denom to query balances for. */
+
+ denom: string;
+}
+/** QueryBalanceRequest is the request type for the Query/Balance RPC method. */
+
+export interface QueryBalanceRequestSDKType {
+ /** address is the address to query balances for. */
+ address: string;
+ /** denom is the coin denom to query balances for. */
+
+ denom: string;
+}
+/** QueryBalanceResponse is the response type for the Query/Balance RPC method. */
+
+export interface QueryBalanceResponse {
+ /** balance is the balance of the coin. */
+ balance?: Coin | undefined;
+}
+/** QueryBalanceResponse is the response type for the Query/Balance RPC method. */
+
+export interface QueryBalanceResponseSDKType {
+ /** balance is the balance of the coin. */
+ balance?: CoinSDKType | undefined;
+}
+/** QueryBalanceRequest is the request type for the Query/AllBalances RPC method. */
+
+export interface QueryAllBalancesRequest {
+ /** address is the address to query balances for. */
+ address: string;
+ /** pagination defines an optional pagination for the request. */
+
+ pagination?: PageRequest | undefined;
+}
+/** QueryBalanceRequest is the request type for the Query/AllBalances RPC method. */
+
+export interface QueryAllBalancesRequestSDKType {
+ /** address is the address to query balances for. */
+ address: string;
+ /** pagination defines an optional pagination for the request. */
+
+ pagination?: PageRequestSDKType | undefined;
+}
+/**
+ * QueryAllBalancesResponse is the response type for the Query/AllBalances RPC
+ * method.
+ */
+
+export interface QueryAllBalancesResponse {
+ /** balances is the balances of all the coins. */
+ balances: Coin[];
+ /** pagination defines the pagination in the response. */
+
+ pagination?: PageResponse | undefined;
+}
+/**
+ * QueryAllBalancesResponse is the response type for the Query/AllBalances RPC
+ * method.
+ */
+
+export interface QueryAllBalancesResponseSDKType {
+ /** balances is the balances of all the coins. */
+ balances: CoinSDKType[];
+ /** pagination defines the pagination in the response. */
+
+ pagination?: PageResponseSDKType | undefined;
+}
+/**
+ * QuerySpendableBalancesRequest defines the gRPC request structure for querying
+ * an account's spendable balances.
+ */
+
+export interface QuerySpendableBalancesRequest {
+ /** address is the address to query spendable balances for. */
+ address: string;
+ /** pagination defines an optional pagination for the request. */
+
+ pagination?: PageRequest | undefined;
+}
+/**
+ * QuerySpendableBalancesRequest defines the gRPC request structure for querying
+ * an account's spendable balances.
+ */
+
+export interface QuerySpendableBalancesRequestSDKType {
+ /** address is the address to query spendable balances for. */
+ address: string;
+ /** pagination defines an optional pagination for the request. */
+
+ pagination?: PageRequestSDKType | undefined;
+}
+/**
+ * QuerySpendableBalancesResponse defines the gRPC response structure for querying
+ * an account's spendable balances.
+ */
+
+export interface QuerySpendableBalancesResponse {
+ /** balances is the spendable balances of all the coins. */
+ balances: Coin[];
+ /** pagination defines the pagination in the response. */
+
+ pagination?: PageResponse | undefined;
+}
+/**
+ * QuerySpendableBalancesResponse defines the gRPC response structure for querying
+ * an account's spendable balances.
+ */
+
+export interface QuerySpendableBalancesResponseSDKType {
+ /** balances is the spendable balances of all the coins. */
+ balances: CoinSDKType[];
+ /** pagination defines the pagination in the response. */
+
+ pagination?: PageResponseSDKType | undefined;
+}
+/**
+ * QueryTotalSupplyRequest is the request type for the Query/TotalSupply RPC
+ * method.
+ */
+
+export interface QueryTotalSupplyRequest {
+ /**
+ * pagination defines an optional pagination for the request.
+ *
+ * Since: cosmos-sdk 0.43
+ */
+ pagination?: PageRequest | undefined;
+}
+/**
+ * QueryTotalSupplyRequest is the request type for the Query/TotalSupply RPC
+ * method.
+ */
+
+export interface QueryTotalSupplyRequestSDKType {
+ /**
+ * pagination defines an optional pagination for the request.
+ *
+ * Since: cosmos-sdk 0.43
+ */
+ pagination?: PageRequestSDKType | undefined;
+}
+/**
+ * QueryTotalSupplyResponse is the response type for the Query/TotalSupply RPC
+ * method
+ */
+
+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 | undefined;
+}
+/**
+ * QueryTotalSupplyResponse is the response type for the Query/TotalSupply RPC
+ * method
+ */
+
+export interface QueryTotalSupplyResponseSDKType {
+ /** supply is the supply of the coins */
+ supply: CoinSDKType[];
+ /**
+ * pagination defines the pagination in the response.
+ *
+ * Since: cosmos-sdk 0.43
+ */
+
+ pagination?: PageResponseSDKType | undefined;
+}
+/** QuerySupplyOfRequest is the request type for the Query/SupplyOf RPC method. */
+
+export interface QuerySupplyOfRequest {
+ /** denom is the coin denom to query balances for. */
+ denom: string;
+}
+/** QuerySupplyOfRequest is the request type for the Query/SupplyOf RPC method. */
+
+export interface QuerySupplyOfRequestSDKType {
+ /** denom is the coin denom to query balances for. */
+ denom: string;
+}
+/** QuerySupplyOfResponse is the response type for the Query/SupplyOf RPC method. */
+
+export interface QuerySupplyOfResponse {
+ /** amount is the supply of the coin. */
+ amount?: Coin | undefined;
+}
+/** QuerySupplyOfResponse is the response type for the Query/SupplyOf RPC method. */
+
+export interface QuerySupplyOfResponseSDKType {
+ /** amount is the supply of the coin. */
+ amount?: CoinSDKType | undefined;
+}
+/** QueryParamsRequest defines the request type for querying x/bank parameters. */
+
+export interface QueryParamsRequest {}
+/** QueryParamsRequest defines the request type for querying x/bank parameters. */
+
+export interface QueryParamsRequestSDKType {}
+/** QueryParamsResponse defines the response type for querying x/bank parameters. */
+
+export interface QueryParamsResponse {
+ params?: Params | undefined;
+}
+/** QueryParamsResponse defines the response type for querying x/bank parameters. */
+
+export interface QueryParamsResponseSDKType {
+ params?: ParamsSDKType | undefined;
+}
+/** QueryDenomsMetadataRequest is the request type for the Query/DenomsMetadata RPC method. */
+
+export interface QueryDenomsMetadataRequest {
+ /** pagination defines an optional pagination for the request. */
+ pagination?: PageRequest | undefined;
+}
+/** QueryDenomsMetadataRequest is the request type for the Query/DenomsMetadata RPC method. */
+
+export interface QueryDenomsMetadataRequestSDKType {
+ /** pagination defines an optional pagination for the request. */
+ pagination?: PageRequestSDKType | undefined;
+}
+/**
+ * QueryDenomsMetadataResponse is the response type for the Query/DenomsMetadata RPC
+ * method.
+ */
+
+export interface QueryDenomsMetadataResponse {
+ /** metadata provides the client information for all the registered tokens. */
+ metadatas: Metadata[];
+ /** pagination defines the pagination in the response. */
+
+ pagination?: PageResponse | undefined;
+}
+/**
+ * QueryDenomsMetadataResponse is the response type for the Query/DenomsMetadata RPC
+ * method.
+ */
+
+export interface QueryDenomsMetadataResponseSDKType {
+ /** metadata provides the client information for all the registered tokens. */
+ metadatas: MetadataSDKType[];
+ /** pagination defines the pagination in the response. */
+
+ pagination?: PageResponseSDKType | undefined;
+}
+/** QueryDenomMetadataRequest is the request type for the Query/DenomMetadata RPC method. */
+
+export interface QueryDenomMetadataRequest {
+ /** denom is the coin denom to query the metadata for. */
+ denom: string;
+}
+/** QueryDenomMetadataRequest is the request type for the Query/DenomMetadata RPC method. */
+
+export interface QueryDenomMetadataRequestSDKType {
+ /** denom is the coin denom to query the metadata for. */
+ denom: string;
+}
+/**
+ * QueryDenomMetadataResponse is the response type for the Query/DenomMetadata RPC
+ * method.
+ */
+
+export interface QueryDenomMetadataResponse {
+ /** metadata describes and provides all the client information for the requested token. */
+ metadata?: Metadata | undefined;
+}
+/**
+ * QueryDenomMetadataResponse is the response type for the Query/DenomMetadata RPC
+ * method.
+ */
+
+export interface QueryDenomMetadataResponseSDKType {
+ /** metadata describes and provides all the client information for the requested token. */
+ metadata?: MetadataSDKType | undefined;
+}
+/**
+ * QueryDenomOwnersRequest defines the request type for the DenomOwners RPC query,
+ * which queries for a paginated set of all account holders of a particular
+ * denomination.
+ */
+
+export interface QueryDenomOwnersRequest {
+ /** denom defines the coin denomination to query all account holders for. */
+ denom: string;
+ /** pagination defines an optional pagination for the request. */
+
+ pagination?: PageRequest | undefined;
+}
+/**
+ * QueryDenomOwnersRequest defines the request type for the DenomOwners RPC query,
+ * which queries for a paginated set of all account holders of a particular
+ * denomination.
+ */
+
+export interface QueryDenomOwnersRequestSDKType {
+ /** denom defines the coin denomination to query all account holders for. */
+ denom: string;
+ /** pagination defines an optional pagination for the request. */
+
+ pagination?: PageRequestSDKType | undefined;
+}
+/**
+ * DenomOwner defines structure representing an account that owns or holds a
+ * particular denominated token. It contains the account address and account
+ * balance of the denominated token.
+ */
+
+export interface DenomOwner {
+ /** address defines the address that owns a particular denomination. */
+ address: string;
+ /** balance is the balance of the denominated coin for an account. */
+
+ balance?: Coin | undefined;
+}
+/**
+ * DenomOwner defines structure representing an account that owns or holds a
+ * particular denominated token. It contains the account address and account
+ * balance of the denominated token.
+ */
+
+export interface DenomOwnerSDKType {
+ /** address defines the address that owns a particular denomination. */
+ address: string;
+ /** balance is the balance of the denominated coin for an account. */
+
+ balance?: CoinSDKType | undefined;
+}
+/** QueryDenomOwnersResponse defines the RPC response of a DenomOwners RPC query. */
+
+export interface QueryDenomOwnersResponse {
+ denomOwners: DenomOwner[];
+ /** pagination defines the pagination in the response. */
+
+ pagination?: PageResponse | undefined;
+}
+/** QueryDenomOwnersResponse defines the RPC response of a DenomOwners RPC query. */
+
+export interface QueryDenomOwnersResponseSDKType {
+ denom_owners: DenomOwnerSDKType[];
+ /** pagination defines the pagination in the response. */
+
+ pagination?: PageResponseSDKType | undefined;
+}
+
+function createBaseQueryBalanceRequest(): QueryBalanceRequest {
+ return {
+ address: "",
+ denom: ""
+ };
+}
+
+export const QueryBalanceRequest = {
+ encode(message: QueryBalanceRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
+ if (message.address !== "") {
+ writer.uint32(10).string(message.address);
+ }
+
+ if (message.denom !== "") {
+ writer.uint32(18).string(message.denom);
+ }
+
+ return writer;
+ },
+
+ decode(input: _m0.Reader | Uint8Array, length?: number): QueryBalanceRequest {
+ const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
+ let end = length === undefined ? reader.len : reader.pos + length;
+ const message = createBaseQueryBalanceRequest();
+
+ while (reader.pos < end) {
+ const tag = reader.uint32();
+
+ switch (tag >>> 3) {
+ case 1:
+ message.address = reader.string();
+ break;
+
+ case 2:
+ message.denom = reader.string();
+ break;
+
+ default:
+ reader.skipType(tag & 7);
+ break;
+ }
+ }
+
+ return message;
+ },
+
+ fromPartial(object: Partial): QueryBalanceRequest {
+ const message = createBaseQueryBalanceRequest();
+ message.address = object.address ?? "";
+ message.denom = object.denom ?? "";
+ return message;
+ }
+
+};
+
+function createBaseQueryBalanceResponse(): QueryBalanceResponse {
+ return {
+ balance: undefined
+ };
+}
+
+export const QueryBalanceResponse = {
+ encode(message: QueryBalanceResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
+ if (message.balance !== undefined) {
+ Coin.encode(message.balance, writer.uint32(10).fork()).ldelim();
+ }
+
+ return writer;
+ },
+
+ decode(input: _m0.Reader | Uint8Array, length?: number): QueryBalanceResponse {
+ const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
+ let end = length === undefined ? reader.len : reader.pos + length;
+ const message = createBaseQueryBalanceResponse();
+
+ while (reader.pos < end) {
+ const tag = reader.uint32();
+
+ switch (tag >>> 3) {
+ case 1:
+ message.balance = Coin.decode(reader, reader.uint32());
+ break;
+
+ default:
+ reader.skipType(tag & 7);
+ break;
+ }
+ }
+
+ return message;
+ },
+
+ fromPartial(object: Partial): QueryBalanceResponse {
+ const message = createBaseQueryBalanceResponse();
+ message.balance = object.balance !== undefined && object.balance !== null ? Coin.fromPartial(object.balance) : undefined;
+ return message;
+ }
+
+};
+
+function createBaseQueryAllBalancesRequest(): QueryAllBalancesRequest {
+ return {
+ address: "",
+ pagination: undefined
+ };
+}
+
+export const QueryAllBalancesRequest = {
+ encode(message: QueryAllBalancesRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
+ if (message.address !== "") {
+ writer.uint32(10).string(message.address);
+ }
+
+ if (message.pagination !== undefined) {
+ PageRequest.encode(message.pagination, writer.uint32(18).fork()).ldelim();
+ }
+
+ return writer;
+ },
+
+ decode(input: _m0.Reader | Uint8Array, length?: number): QueryAllBalancesRequest {
+ const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
+ let end = length === undefined ? reader.len : reader.pos + length;
+ const message = createBaseQueryAllBalancesRequest();
+
+ while (reader.pos < end) {
+ const tag = reader.uint32();
+
+ switch (tag >>> 3) {
+ case 1:
+ message.address = reader.string();
+ break;
+
+ case 2:
+ message.pagination = PageRequest.decode(reader, reader.uint32());
+ break;
+
+ default:
+ reader.skipType(tag & 7);
+ break;
+ }
+ }
+
+ return message;
+ },
+
+ fromPartial(object: Partial): QueryAllBalancesRequest {
+ const message = createBaseQueryAllBalancesRequest();
+ message.address = object.address ?? "";
+ message.pagination = object.pagination !== undefined && object.pagination !== null ? PageRequest.fromPartial(object.pagination) : undefined;
+ return message;
+ }
+
+};
+
+function createBaseQueryAllBalancesResponse(): QueryAllBalancesResponse {
+ return {
+ balances: [],
+ pagination: undefined
+ };
+}
+
+export const QueryAllBalancesResponse = {
+ encode(message: QueryAllBalancesResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
+ for (const v of message.balances) {
+ Coin.encode(v!, writer.uint32(10).fork()).ldelim();
+ }
+
+ if (message.pagination !== undefined) {
+ PageResponse.encode(message.pagination, writer.uint32(18).fork()).ldelim();
+ }
+
+ return writer;
+ },
+
+ decode(input: _m0.Reader | Uint8Array, length?: number): QueryAllBalancesResponse {
+ const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
+ let end = length === undefined ? reader.len : reader.pos + length;
+ const message = createBaseQueryAllBalancesResponse();
+
+ while (reader.pos < end) {
+ const tag = reader.uint32();
+
+ switch (tag >>> 3) {
+ case 1:
+ message.balances.push(Coin.decode(reader, reader.uint32()));
+ break;
+
+ case 2:
+ message.pagination = PageResponse.decode(reader, reader.uint32());
+ break;
+
+ default:
+ reader.skipType(tag & 7);
+ break;
+ }
+ }
+
+ return message;
+ },
+
+ fromPartial(object: Partial): 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;
+ }
+
+};
+
+function createBaseQuerySpendableBalancesRequest(): QuerySpendableBalancesRequest {
+ return {
+ address: "",
+ pagination: undefined
+ };
+}
+
+export const QuerySpendableBalancesRequest = {
+ encode(message: QuerySpendableBalancesRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
+ if (message.address !== "") {
+ writer.uint32(10).string(message.address);
+ }
+
+ if (message.pagination !== undefined) {
+ PageRequest.encode(message.pagination, writer.uint32(18).fork()).ldelim();
+ }
+
+ return writer;
+ },
+
+ decode(input: _m0.Reader | Uint8Array, length?: number): QuerySpendableBalancesRequest {
+ const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
+ let end = length === undefined ? reader.len : reader.pos + length;
+ const message = createBaseQuerySpendableBalancesRequest();
+
+ while (reader.pos < end) {
+ const tag = reader.uint32();
+
+ switch (tag >>> 3) {
+ case 1:
+ message.address = reader.string();
+ break;
+
+ case 2:
+ message.pagination = PageRequest.decode(reader, reader.uint32());
+ break;
+
+ default:
+ reader.skipType(tag & 7);
+ break;
+ }
+ }
+
+ return message;
+ },
+
+ fromPartial(object: Partial): QuerySpendableBalancesRequest {
+ const message = createBaseQuerySpendableBalancesRequest();
+ message.address = object.address ?? "";
+ message.pagination = object.pagination !== undefined && object.pagination !== null ? PageRequest.fromPartial(object.pagination) : undefined;
+ return message;
+ }
+
+};
+
+function createBaseQuerySpendableBalancesResponse(): QuerySpendableBalancesResponse {
+ return {
+ balances: [],
+ pagination: undefined
+ };
+}
+
+export const QuerySpendableBalancesResponse = {
+ encode(message: QuerySpendableBalancesResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
+ for (const v of message.balances) {
+ Coin.encode(v!, writer.uint32(10).fork()).ldelim();
+ }
+
+ if (message.pagination !== undefined) {
+ PageResponse.encode(message.pagination, writer.uint32(18).fork()).ldelim();
+ }
+
+ return writer;
+ },
+
+ decode(input: _m0.Reader | Uint8Array, length?: number): QuerySpendableBalancesResponse {
+ const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
+ let end = length === undefined ? reader.len : reader.pos + length;
+ const message = createBaseQuerySpendableBalancesResponse();
+
+ while (reader.pos < end) {
+ const tag = reader.uint32();
+
+ switch (tag >>> 3) {
+ case 1:
+ message.balances.push(Coin.decode(reader, reader.uint32()));
+ break;
+
+ case 2:
+ message.pagination = PageResponse.decode(reader, reader.uint32());
+ break;
+
+ default:
+ reader.skipType(tag & 7);
+ break;
+ }
+ }
+
+ return message;
+ },
+
+ fromPartial(object: Partial): 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;
+ }
+
+};
+
+function createBaseQueryTotalSupplyRequest(): QueryTotalSupplyRequest {
+ return {
+ pagination: undefined
+ };
+}
+
+export const QueryTotalSupplyRequest = {
+ encode(message: QueryTotalSupplyRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
+ if (message.pagination !== undefined) {
+ PageRequest.encode(message.pagination, writer.uint32(10).fork()).ldelim();
+ }
+
+ return writer;
+ },
+
+ decode(input: _m0.Reader | Uint8Array, length?: number): QueryTotalSupplyRequest {
+ const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
+ let end = length === undefined ? reader.len : reader.pos + length;
+ const message = createBaseQueryTotalSupplyRequest();
+
+ while (reader.pos < end) {
+ const tag = reader.uint32();
+
+ switch (tag >>> 3) {
+ case 1:
+ message.pagination = PageRequest.decode(reader, reader.uint32());
+ break;
+
+ default:
+ reader.skipType(tag & 7);
+ break;
+ }
+ }
+
+ return message;
+ },
+
+ fromPartial(object: Partial): QueryTotalSupplyRequest {
+ const message = createBaseQueryTotalSupplyRequest();
+ message.pagination = object.pagination !== undefined && object.pagination !== null ? PageRequest.fromPartial(object.pagination) : undefined;
+ return message;
+ }
+
+};
+
+function createBaseQueryTotalSupplyResponse(): QueryTotalSupplyResponse {
+ return {
+ supply: [],
+ pagination: undefined
+ };
+}
+
+export const QueryTotalSupplyResponse = {
+ encode(message: QueryTotalSupplyResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
+ for (const v of message.supply) {
+ Coin.encode(v!, writer.uint32(10).fork()).ldelim();
+ }
+
+ if (message.pagination !== undefined) {
+ PageResponse.encode(message.pagination, writer.uint32(18).fork()).ldelim();
+ }
+
+ return writer;
+ },
+
+ decode(input: _m0.Reader | Uint8Array, length?: number): QueryTotalSupplyResponse {
+ const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
+ let end = length === undefined ? reader.len : reader.pos + length;
+ const message = createBaseQueryTotalSupplyResponse();
+
+ while (reader.pos < end) {
+ const tag = reader.uint32();
+
+ switch (tag >>> 3) {
+ case 1:
+ message.supply.push(Coin.decode(reader, reader.uint32()));
+ break;
+
+ case 2:
+ message.pagination = PageResponse.decode(reader, reader.uint32());
+ break;
+
+ default:
+ reader.skipType(tag & 7);
+ break;
+ }
+ }
+
+ return message;
+ },
+
+ fromPartial(object: Partial): 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;
+ }
+
+};
+
+function createBaseQuerySupplyOfRequest(): QuerySupplyOfRequest {
+ return {
+ denom: ""
+ };
+}
+
+export const QuerySupplyOfRequest = {
+ encode(message: QuerySupplyOfRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
+ if (message.denom !== "") {
+ writer.uint32(10).string(message.denom);
+ }
+
+ return writer;
+ },
+
+ decode(input: _m0.Reader | Uint8Array, length?: number): QuerySupplyOfRequest {
+ const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
+ let end = length === undefined ? reader.len : reader.pos + length;
+ const message = createBaseQuerySupplyOfRequest();
+
+ while (reader.pos < end) {
+ const tag = reader.uint32();
+
+ switch (tag >>> 3) {
+ case 1:
+ message.denom = reader.string();
+ break;
+
+ default:
+ reader.skipType(tag & 7);
+ break;
+ }
+ }
+
+ return message;
+ },
+
+ fromPartial(object: Partial): QuerySupplyOfRequest {
+ const message = createBaseQuerySupplyOfRequest();
+ message.denom = object.denom ?? "";
+ return message;
+ }
+
+};
+
+function createBaseQuerySupplyOfResponse(): QuerySupplyOfResponse {
+ return {
+ amount: undefined
+ };
+}
+
+export const QuerySupplyOfResponse = {
+ encode(message: QuerySupplyOfResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
+ if (message.amount !== undefined) {
+ Coin.encode(message.amount, writer.uint32(10).fork()).ldelim();
+ }
+
+ return writer;
+ },
+
+ decode(input: _m0.Reader | Uint8Array, length?: number): QuerySupplyOfResponse {
+ const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
+ let end = length === undefined ? reader.len : reader.pos + length;
+ const message = createBaseQuerySupplyOfResponse();
+
+ while (reader.pos < end) {
+ const tag = reader.uint32();
+
+ switch (tag >>> 3) {
+ case 1:
+ message.amount = Coin.decode(reader, reader.uint32());
+ break;
+
+ default:
+ reader.skipType(tag & 7);
+ break;
+ }
+ }
+
+ return message;
+ },
+
+ fromPartial(object: Partial): QuerySupplyOfResponse {
+ const message = createBaseQuerySupplyOfResponse();
+ message.amount = object.amount !== undefined && object.amount !== null ? Coin.fromPartial(object.amount) : undefined;
+ return message;
+ }
+
+};
+
+function createBaseQueryParamsRequest(): QueryParamsRequest {
+ return {};
+}
+
+export const QueryParamsRequest = {
+ encode(_: QueryParamsRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
+ return writer;
+ },
+
+ decode(input: _m0.Reader | Uint8Array, length?: number): QueryParamsRequest {
+ const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
+ let end = length === undefined ? reader.len : reader.pos + length;
+ const message = createBaseQueryParamsRequest();
+
+ while (reader.pos < end) {
+ const tag = reader.uint32();
+
+ switch (tag >>> 3) {
+ default:
+ reader.skipType(tag & 7);
+ break;
+ }
+ }
+
+ return message;
+ },
+
+ fromPartial(_: Partial): QueryParamsRequest {
+ const message = createBaseQueryParamsRequest();
+ return message;
+ }
+
+};
+
+function createBaseQueryParamsResponse(): QueryParamsResponse {
+ return {
+ params: undefined
+ };
+}
+
+export const QueryParamsResponse = {
+ encode(message: QueryParamsResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
+ if (message.params !== undefined) {
+ Params.encode(message.params, writer.uint32(10).fork()).ldelim();
+ }
+
+ return writer;
+ },
+
+ decode(input: _m0.Reader | Uint8Array, length?: number): QueryParamsResponse {
+ const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
+ let end = length === undefined ? reader.len : reader.pos + length;
+ const message = createBaseQueryParamsResponse();
+
+ while (reader.pos < end) {
+ const tag = reader.uint32();
+
+ switch (tag >>> 3) {
+ case 1:
+ message.params = Params.decode(reader, reader.uint32());
+ break;
+
+ default:
+ reader.skipType(tag & 7);
+ break;
+ }
+ }
+
+ return message;
+ },
+
+ fromPartial(object: Partial): QueryParamsResponse {
+ const message = createBaseQueryParamsResponse();
+ message.params = object.params !== undefined && object.params !== null ? Params.fromPartial(object.params) : undefined;
+ return message;
+ }
+
+};
+
+function createBaseQueryDenomsMetadataRequest(): QueryDenomsMetadataRequest {
+ return {
+ pagination: undefined
+ };
+}
+
+export const QueryDenomsMetadataRequest = {
+ encode(message: QueryDenomsMetadataRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
+ if (message.pagination !== undefined) {
+ PageRequest.encode(message.pagination, writer.uint32(10).fork()).ldelim();
+ }
+
+ return writer;
+ },
+
+ decode(input: _m0.Reader | Uint8Array, length?: number): QueryDenomsMetadataRequest {
+ const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
+ let end = length === undefined ? reader.len : reader.pos + length;
+ const message = createBaseQueryDenomsMetadataRequest();
+
+ while (reader.pos < end) {
+ const tag = reader.uint32();
+
+ switch (tag >>> 3) {
+ case 1:
+ message.pagination = PageRequest.decode(reader, reader.uint32());
+ break;
+
+ default:
+ reader.skipType(tag & 7);
+ break;
+ }
+ }
+
+ return message;
+ },
+
+ fromPartial(object: Partial): QueryDenomsMetadataRequest {
+ const message = createBaseQueryDenomsMetadataRequest();
+ message.pagination = object.pagination !== undefined && object.pagination !== null ? PageRequest.fromPartial(object.pagination) : undefined;
+ return message;
+ }
+
+};
+
+function createBaseQueryDenomsMetadataResponse(): QueryDenomsMetadataResponse {
+ return {
+ metadatas: [],
+ pagination: undefined
+ };
+}
+
+export const QueryDenomsMetadataResponse = {
+ encode(message: QueryDenomsMetadataResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
+ for (const v of message.metadatas) {
+ Metadata.encode(v!, writer.uint32(10).fork()).ldelim();
+ }
+
+ if (message.pagination !== undefined) {
+ PageResponse.encode(message.pagination, writer.uint32(18).fork()).ldelim();
+ }
+
+ return writer;
+ },
+
+ decode(input: _m0.Reader | Uint8Array, length?: number): QueryDenomsMetadataResponse {
+ const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
+ let end = length === undefined ? reader.len : reader.pos + length;
+ const message = createBaseQueryDenomsMetadataResponse();
+
+ while (reader.pos < end) {
+ const tag = reader.uint32();
+
+ switch (tag >>> 3) {
+ case 1:
+ message.metadatas.push(Metadata.decode(reader, reader.uint32()));
+ break;
+
+ case 2:
+ message.pagination = PageResponse.decode(reader, reader.uint32());
+ break;
+
+ default:
+ reader.skipType(tag & 7);
+ break;
+ }
+ }
+
+ return message;
+ },
+
+ fromPartial(object: Partial): 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;
+ }
+
+};
+
+function createBaseQueryDenomMetadataRequest(): QueryDenomMetadataRequest {
+ return {
+ denom: ""
+ };
+}
+
+export const QueryDenomMetadataRequest = {
+ encode(message: QueryDenomMetadataRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
+ if (message.denom !== "") {
+ writer.uint32(10).string(message.denom);
+ }
+
+ return writer;
+ },
+
+ decode(input: _m0.Reader | Uint8Array, length?: number): QueryDenomMetadataRequest {
+ const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
+ let end = length === undefined ? reader.len : reader.pos + length;
+ const message = createBaseQueryDenomMetadataRequest();
+
+ while (reader.pos < end) {
+ const tag = reader.uint32();
+
+ switch (tag >>> 3) {
+ case 1:
+ message.denom = reader.string();
+ break;
+
+ default:
+ reader.skipType(tag & 7);
+ break;
+ }
+ }
+
+ return message;
+ },
+
+ fromPartial(object: Partial): QueryDenomMetadataRequest {
+ const message = createBaseQueryDenomMetadataRequest();
+ message.denom = object.denom ?? "";
+ return message;
+ }
+
+};
+
+function createBaseQueryDenomMetadataResponse(): QueryDenomMetadataResponse {
+ return {
+ metadata: undefined
+ };
+}
+
+export const QueryDenomMetadataResponse = {
+ encode(message: QueryDenomMetadataResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
+ if (message.metadata !== undefined) {
+ Metadata.encode(message.metadata, writer.uint32(10).fork()).ldelim();
+ }
+
+ return writer;
+ },
+
+ decode(input: _m0.Reader | Uint8Array, length?: number): QueryDenomMetadataResponse {
+ const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
+ let end = length === undefined ? reader.len : reader.pos + length;
+ const message = createBaseQueryDenomMetadataResponse();
+
+ while (reader.pos < end) {
+ const tag = reader.uint32();
+
+ switch (tag >>> 3) {
+ case 1:
+ message.metadata = Metadata.decode(reader, reader.uint32());
+ break;
+
+ default:
+ reader.skipType(tag & 7);
+ break;
+ }
+ }
+
+ return message;
+ },
+
+ fromPartial(object: Partial): QueryDenomMetadataResponse {
+ const message = createBaseQueryDenomMetadataResponse();
+ message.metadata = object.metadata !== undefined && object.metadata !== null ? Metadata.fromPartial(object.metadata) : undefined;
+ return message;
+ }
+
+};
+
+function createBaseQueryDenomOwnersRequest(): QueryDenomOwnersRequest {
+ return {
+ denom: "",
+ pagination: undefined
+ };
+}
+
+export const QueryDenomOwnersRequest = {
+ encode(message: QueryDenomOwnersRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
+ if (message.denom !== "") {
+ writer.uint32(10).string(message.denom);
+ }
+
+ if (message.pagination !== undefined) {
+ PageRequest.encode(message.pagination, writer.uint32(18).fork()).ldelim();
+ }
+
+ return writer;
+ },
+
+ decode(input: _m0.Reader | Uint8Array, length?: number): QueryDenomOwnersRequest {
+ const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
+ let end = length === undefined ? reader.len : reader.pos + length;
+ const message = createBaseQueryDenomOwnersRequest();
+
+ while (reader.pos < end) {
+ const tag = reader.uint32();
+
+ switch (tag >>> 3) {
+ case 1:
+ message.denom = reader.string();
+ break;
+
+ case 2:
+ message.pagination = PageRequest.decode(reader, reader.uint32());
+ break;
+
+ default:
+ reader.skipType(tag & 7);
+ break;
+ }
+ }
+
+ return message;
+ },
+
+ fromPartial(object: Partial): QueryDenomOwnersRequest {
+ const message = createBaseQueryDenomOwnersRequest();
+ message.denom = object.denom ?? "";
+ message.pagination = object.pagination !== undefined && object.pagination !== null ? PageRequest.fromPartial(object.pagination) : undefined;
+ return message;
+ }
+
+};
+
+function createBaseDenomOwner(): DenomOwner {
+ return {
+ address: "",
+ balance: undefined
+ };
+}
+
+export const DenomOwner = {
+ encode(message: DenomOwner, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
+ if (message.address !== "") {
+ writer.uint32(10).string(message.address);
+ }
+
+ if (message.balance !== undefined) {
+ Coin.encode(message.balance, writer.uint32(18).fork()).ldelim();
+ }
+
+ return writer;
+ },
+
+ decode(input: _m0.Reader | Uint8Array, length?: number): DenomOwner {
+ const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
+ let end = length === undefined ? reader.len : reader.pos + length;
+ const message = createBaseDenomOwner();
+
+ while (reader.pos < end) {
+ const tag = reader.uint32();
+
+ switch (tag >>> 3) {
+ case 1:
+ message.address = reader.string();
+ break;
+
+ case 2:
+ message.balance = Coin.decode(reader, reader.uint32());
+ break;
+
+ default:
+ reader.skipType(tag & 7);
+ break;
+ }
+ }
+
+ return message;
+ },
+
+ fromPartial(object: Partial): DenomOwner {
+ const message = createBaseDenomOwner();
+ message.address = object.address ?? "";
+ message.balance = object.balance !== undefined && object.balance !== null ? Coin.fromPartial(object.balance) : undefined;
+ return message;
+ }
+
+};
+
+function createBaseQueryDenomOwnersResponse(): QueryDenomOwnersResponse {
+ return {
+ denomOwners: [],
+ pagination: undefined
+ };
+}
+
+export const QueryDenomOwnersResponse = {
+ encode(message: QueryDenomOwnersResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
+ for (const v of message.denomOwners) {
+ DenomOwner.encode(v!, writer.uint32(10).fork()).ldelim();
+ }
+
+ if (message.pagination !== undefined) {
+ PageResponse.encode(message.pagination, writer.uint32(18).fork()).ldelim();
+ }
+
+ return writer;
+ },
+
+ decode(input: _m0.Reader | Uint8Array, length?: number): QueryDenomOwnersResponse {
+ const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
+ let end = length === undefined ? reader.len : reader.pos + length;
+ const message = createBaseQueryDenomOwnersResponse();
+
+ while (reader.pos < end) {
+ const tag = reader.uint32();
+
+ switch (tag >>> 3) {
+ case 1:
+ message.denomOwners.push(DenomOwner.decode(reader, reader.uint32()));
+ break;
+
+ case 2:
+ message.pagination = PageResponse.decode(reader, reader.uint32());
+ break;
+
+ default:
+ reader.skipType(tag & 7);
+ break;
+ }
+ }
+
+ return message;
+ },
+
+ fromPartial(object: Partial): QueryDenomOwnersResponse {
+ const message = createBaseQueryDenomOwnersResponse();
+ message.denomOwners = object.denomOwners?.map(e => DenomOwner.fromPartial(e)) || [];
+ message.pagination = object.pagination !== undefined && object.pagination !== null ? PageResponse.fromPartial(object.pagination) : undefined;
+ return message;
+ }
+
+};
\ No newline at end of file
diff --git a/examples/contracts/codegen/cosmos/bank/v1beta1/tx.amino.ts b/examples/contracts/codegen/cosmos/bank/v1beta1/tx.amino.ts
new file mode 100644
index 000000000..ea2280ee0
--- /dev/null
+++ b/examples/contracts/codegen/cosmos/bank/v1beta1/tx.amino.ts
@@ -0,0 +1,110 @@
+import { AminoMsg } from "@cosmjs/amino";
+import { MsgSend, MsgMultiSend } from "./tx";
+export interface AminoMsgSend extends AminoMsg {
+ type: "cosmos-sdk/MsgSend";
+ value: {
+ from_address: string;
+ to_address: string;
+ amount: {
+ denom: string;
+ amount: string;
+ }[];
+ };
+}
+export interface AminoMsgMultiSend extends AminoMsg {
+ type: "cosmos-sdk/MsgMultiSend";
+ value: {
+ inputs: {
+ address: string;
+ coins: {
+ denom: string;
+ amount: string;
+ }[];
+ }[];
+ outputs: {
+ address: string;
+ coins: {
+ denom: string;
+ amount: string;
+ }[];
+ }[];
+ };
+}
+export const AminoConverter = {
+ "/cosmos.bank.v1beta1.MsgSend": {
+ aminoType: "cosmos-sdk/MsgSend",
+ toAmino: ({
+ fromAddress,
+ toAddress,
+ amount
+ }: MsgSend): AminoMsgSend["value"] => {
+ return {
+ from_address: fromAddress,
+ to_address: toAddress,
+ amount: amount.map(el0 => ({
+ denom: el0.denom,
+ amount: el0.amount
+ }))
+ };
+ },
+ fromAmino: ({
+ from_address,
+ to_address,
+ amount
+ }: AminoMsgSend["value"]): MsgSend => {
+ return {
+ fromAddress: from_address,
+ toAddress: to_address,
+ amount: amount.map(el0 => ({
+ denom: el0.denom,
+ amount: el0.amount
+ }))
+ };
+ }
+ },
+ "/cosmos.bank.v1beta1.MsgMultiSend": {
+ aminoType: "cosmos-sdk/MsgMultiSend",
+ toAmino: ({
+ inputs,
+ outputs
+ }: MsgMultiSend): AminoMsgMultiSend["value"] => {
+ return {
+ inputs: inputs.map(el0 => ({
+ address: el0.address,
+ coins: el0.coins.map(el1 => ({
+ denom: el1.denom,
+ amount: el1.amount
+ }))
+ })),
+ outputs: outputs.map(el0 => ({
+ address: el0.address,
+ coins: el0.coins.map(el1 => ({
+ denom: el1.denom,
+ amount: el1.amount
+ }))
+ }))
+ };
+ },
+ fromAmino: ({
+ inputs,
+ outputs
+ }: AminoMsgMultiSend["value"]): MsgMultiSend => {
+ return {
+ inputs: inputs.map(el0 => ({
+ address: el0.address,
+ coins: el0.coins.map(el1 => ({
+ denom: el1.denom,
+ amount: el1.amount
+ }))
+ })),
+ outputs: outputs.map(el0 => ({
+ address: el0.address,
+ coins: el0.coins.map(el1 => ({
+ denom: el1.denom,
+ amount: el1.amount
+ }))
+ }))
+ };
+ }
+ }
+};
\ No newline at end of file
diff --git a/examples/contracts/codegen/cosmos/bank/v1beta1/tx.registry.ts b/examples/contracts/codegen/cosmos/bank/v1beta1/tx.registry.ts
new file mode 100644
index 000000000..5bc1dee0f
--- /dev/null
+++ b/examples/contracts/codegen/cosmos/bank/v1beta1/tx.registry.ts
@@ -0,0 +1,58 @@
+import { GeneratedType, Registry } from "@cosmjs/proto-signing";
+import { MsgSend, MsgMultiSend } from "./tx";
+export const registry: ReadonlyArray<[string, GeneratedType]> = [["/cosmos.bank.v1beta1.MsgSend", MsgSend], ["/cosmos.bank.v1beta1.MsgMultiSend", MsgMultiSend]];
+export const load = (protoRegistry: Registry) => {
+ registry.forEach(([typeUrl, mod]) => {
+ protoRegistry.register(typeUrl, mod);
+ });
+};
+export const MessageComposer = {
+ encoded: {
+ send(value: MsgSend) {
+ return {
+ typeUrl: "/cosmos.bank.v1beta1.MsgSend",
+ value: MsgSend.encode(value).finish()
+ };
+ },
+
+ multiSend(value: MsgMultiSend) {
+ return {
+ typeUrl: "/cosmos.bank.v1beta1.MsgMultiSend",
+ value: MsgMultiSend.encode(value).finish()
+ };
+ }
+
+ },
+ withTypeUrl: {
+ send(value: MsgSend) {
+ return {
+ typeUrl: "/cosmos.bank.v1beta1.MsgSend",
+ value
+ };
+ },
+
+ multiSend(value: MsgMultiSend) {
+ return {
+ typeUrl: "/cosmos.bank.v1beta1.MsgMultiSend",
+ value
+ };
+ }
+
+ },
+ fromPartial: {
+ send(value: MsgSend) {
+ return {
+ typeUrl: "/cosmos.bank.v1beta1.MsgSend",
+ value: MsgSend.fromPartial(value)
+ };
+ },
+
+ multiSend(value: MsgMultiSend) {
+ return {
+ typeUrl: "/cosmos.bank.v1beta1.MsgMultiSend",
+ value: MsgMultiSend.fromPartial(value)
+ };
+ }
+
+ }
+};
\ No newline at end of file
diff --git a/examples/contracts/codegen/cosmos/bank/v1beta1/tx.rpc.msg.ts b/examples/contracts/codegen/cosmos/bank/v1beta1/tx.rpc.msg.ts
new file mode 100644
index 000000000..4112bb9d2
--- /dev/null
+++ b/examples/contracts/codegen/cosmos/bank/v1beta1/tx.rpc.msg.ts
@@ -0,0 +1,34 @@
+import { Rpc } from "../../../helpers";
+import * as _m0 from "protobufjs/minimal";
+import { MsgSend, MsgSendResponse, MsgMultiSend, MsgMultiSendResponse } from "./tx";
+/** Msg defines the bank Msg service. */
+
+export interface Msg {
+ /** Send defines a method for sending coins from one account to another account. */
+ send(request: MsgSend): Promise;
+ /** MultiSend defines a method for sending coins from some accounts to other accounts. */
+
+ multiSend(request: MsgMultiSend): Promise;
+}
+export class MsgClientImpl implements Msg {
+ private readonly rpc: Rpc;
+
+ constructor(rpc: Rpc) {
+ this.rpc = rpc;
+ this.send = this.send.bind(this);
+ this.multiSend = this.multiSend.bind(this);
+ }
+
+ send(request: MsgSend): Promise {
+ const data = MsgSend.encode(request).finish();
+ const promise = this.rpc.request("cosmos.bank.v1beta1.Msg", "Send", data);
+ return promise.then(data => MsgSendResponse.decode(new _m0.Reader(data)));
+ }
+
+ multiSend(request: MsgMultiSend): Promise {
+ const data = MsgMultiSend.encode(request).finish();
+ const promise = this.rpc.request("cosmos.bank.v1beta1.Msg", "MultiSend", data);
+ return promise.then(data => MsgMultiSendResponse.decode(new _m0.Reader(data)));
+ }
+
+}
\ No newline at end of file
diff --git a/examples/contracts/codegen/cosmos/bank/v1beta1/tx.ts b/examples/contracts/codegen/cosmos/bank/v1beta1/tx.ts
new file mode 100644
index 000000000..8763f6b60
--- /dev/null
+++ b/examples/contracts/codegen/cosmos/bank/v1beta1/tx.ts
@@ -0,0 +1,229 @@
+import { Coin, CoinSDKType } from "../../base/v1beta1/coin";
+import { Input, InputSDKType, Output, OutputSDKType } from "./bank";
+import * as _m0 from "protobufjs/minimal";
+/** MsgSend represents a message to send coins from one account to another. */
+
+export interface MsgSend {
+ fromAddress: string;
+ toAddress: string;
+ amount: Coin[];
+}
+/** MsgSend represents a message to send coins from one account to another. */
+
+export interface MsgSendSDKType {
+ from_address: string;
+ to_address: string;
+ amount: CoinSDKType[];
+}
+/** MsgSendResponse defines the Msg/Send response type. */
+
+export interface MsgSendResponse {}
+/** MsgSendResponse defines the Msg/Send response type. */
+
+export interface MsgSendResponseSDKType {}
+/** MsgMultiSend represents an arbitrary multi-in, multi-out send message. */
+
+export interface MsgMultiSend {
+ inputs: Input[];
+ outputs: Output[];
+}
+/** MsgMultiSend represents an arbitrary multi-in, multi-out send message. */
+
+export interface MsgMultiSendSDKType {
+ inputs: InputSDKType[];
+ outputs: OutputSDKType[];
+}
+/** MsgMultiSendResponse defines the Msg/MultiSend response type. */
+
+export interface MsgMultiSendResponse {}
+/** MsgMultiSendResponse defines the Msg/MultiSend response type. */
+
+export interface MsgMultiSendResponseSDKType {}
+
+function createBaseMsgSend(): MsgSend {
+ return {
+ fromAddress: "",
+ toAddress: "",
+ amount: []
+ };
+}
+
+export const MsgSend = {
+ encode(message: MsgSend, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
+ if (message.fromAddress !== "") {
+ writer.uint32(10).string(message.fromAddress);
+ }
+
+ if (message.toAddress !== "") {
+ writer.uint32(18).string(message.toAddress);
+ }
+
+ for (const v of message.amount) {
+ Coin.encode(v!, writer.uint32(26).fork()).ldelim();
+ }
+
+ return writer;
+ },
+
+ decode(input: _m0.Reader | Uint8Array, length?: number): MsgSend {
+ const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
+ let end = length === undefined ? reader.len : reader.pos + length;
+ const message = createBaseMsgSend();
+
+ while (reader.pos < end) {
+ const tag = reader.uint32();
+
+ switch (tag >>> 3) {
+ case 1:
+ message.fromAddress = reader.string();
+ break;
+
+ case 2:
+ message.toAddress = reader.string();
+ break;
+
+ case 3:
+ message.amount.push(Coin.decode(reader, reader.uint32()));
+ break;
+
+ default:
+ reader.skipType(tag & 7);
+ break;
+ }
+ }
+
+ return message;
+ },
+
+ fromPartial(object: Partial): MsgSend {
+ const message = createBaseMsgSend();
+ message.fromAddress = object.fromAddress ?? "";
+ message.toAddress = object.toAddress ?? "";
+ message.amount = object.amount?.map(e => Coin.fromPartial(e)) || [];
+ return message;
+ }
+
+};
+
+function createBaseMsgSendResponse(): MsgSendResponse {
+ return {};
+}
+
+export const MsgSendResponse = {
+ encode(_: MsgSendResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
+ return writer;
+ },
+
+ decode(input: _m0.Reader | Uint8Array, length?: number): MsgSendResponse {
+ const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
+ let end = length === undefined ? reader.len : reader.pos + length;
+ const message = createBaseMsgSendResponse();
+
+ while (reader.pos < end) {
+ const tag = reader.uint32();
+
+ switch (tag >>> 3) {
+ default:
+ reader.skipType(tag & 7);
+ break;
+ }
+ }
+
+ return message;
+ },
+
+ fromPartial(_: Partial): MsgSendResponse {
+ const message = createBaseMsgSendResponse();
+ return message;
+ }
+
+};
+
+function createBaseMsgMultiSend(): MsgMultiSend {
+ return {
+ inputs: [],
+ outputs: []
+ };
+}
+
+export const MsgMultiSend = {
+ encode(message: MsgMultiSend, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
+ for (const v of message.inputs) {
+ Input.encode(v!, writer.uint32(10).fork()).ldelim();
+ }
+
+ for (const v of message.outputs) {
+ Output.encode(v!, writer.uint32(18).fork()).ldelim();
+ }
+
+ return writer;
+ },
+
+ decode(input: _m0.Reader | Uint8Array, length?: number): MsgMultiSend {
+ const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
+ let end = length === undefined ? reader.len : reader.pos + length;
+ const message = createBaseMsgMultiSend();
+
+ while (reader.pos < end) {
+ const tag = reader.uint32();
+
+ switch (tag >>> 3) {
+ case 1:
+ message.inputs.push(Input.decode(reader, reader.uint32()));
+ break;
+
+ case 2:
+ message.outputs.push(Output.decode(reader, reader.uint32()));
+ break;
+
+ default:
+ reader.skipType(tag & 7);
+ break;
+ }
+ }
+
+ return message;
+ },
+
+ fromPartial(object: Partial): MsgMultiSend {
+ const message = createBaseMsgMultiSend();
+ message.inputs = object.inputs?.map(e => Input.fromPartial(e)) || [];
+ message.outputs = object.outputs?.map(e => Output.fromPartial(e)) || [];
+ return message;
+ }
+
+};
+
+function createBaseMsgMultiSendResponse(): MsgMultiSendResponse {
+ return {};
+}
+
+export const MsgMultiSendResponse = {
+ encode(_: MsgMultiSendResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
+ return writer;
+ },
+
+ decode(input: _m0.Reader | Uint8Array, length?: number): MsgMultiSendResponse {
+ const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
+ let end = length === undefined ? reader.len : reader.pos + length;
+ const message = createBaseMsgMultiSendResponse();
+
+ while (reader.pos < end) {
+ const tag = reader.uint32();
+
+ switch (tag >>> 3) {
+ default:
+ reader.skipType(tag & 7);
+ break;
+ }
+ }
+
+ return message;
+ },
+
+ fromPartial(_: Partial): MsgMultiSendResponse {
+ const message = createBaseMsgMultiSendResponse();
+ return message;
+ }
+
+};
\ No newline at end of file
diff --git a/examples/contracts/codegen/cosmos/base/abci/v1beta1/abci.ts b/examples/contracts/codegen/cosmos/base/abci/v1beta1/abci.ts
new file mode 100644
index 000000000..d95c9ff4e
--- /dev/null
+++ b/examples/contracts/codegen/cosmos/base/abci/v1beta1/abci.ts
@@ -0,0 +1,1106 @@
+import { Any, AnySDKType } from "../../../../google/protobuf/any";
+import { Event, EventSDKType } from "../../../../tendermint/abci/types";
+import * as _m0 from "protobufjs/minimal";
+import { Long } from "../../../../helpers";
+/**
+ * TxResponse defines a structure containing relevant tx data and metadata. The
+ * tags are stringified and the log is JSON decoded.
+ */
+
+export interface TxResponse {
+ /** The block height */
+ height: Long;
+ /** 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.
+ */
+
+ rawLog: 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. */
+
+ gasWanted: Long;
+ /** Amount of gas consumed by transaction. */
+
+ gasUsed: Long;
+ /** The request transaction bytes. */
+
+ tx?: Any | undefined;
+ /**
+ * 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[];
+}
+/**
+ * TxResponse defines a structure containing relevant tx data and metadata. The
+ * tags are stringified and the log is JSON decoded.
+ */
+
+export interface TxResponseSDKType {
+ /** The block height */
+ height: Long;
+ /** 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: ABCIMessageLogSDKType[];
+ /** Additional information. May be non-deterministic. */
+
+ info: string;
+ /** Amount of gas requested for transaction. */
+
+ gas_wanted: Long;
+ /** Amount of gas consumed by transaction. */
+
+ gas_used: Long;
+ /** The request transaction bytes. */
+
+ tx?: AnySDKType | undefined;
+ /**
+ * 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: EventSDKType[];
+}
+/** ABCIMessageLog defines a structure containing an indexed tx ABCI message log. */
+
+export interface ABCIMessageLog {
+ msgIndex: number;
+ log: string;
+ /**
+ * Events contains a slice of Event objects that were emitted during some
+ * execution.
+ */
+
+ events: StringEvent[];
+}
+/** ABCIMessageLog defines a structure containing an indexed tx ABCI message log. */
+
+export interface ABCIMessageLogSDKType {
+ msg_index: number;
+ log: string;
+ /**
+ * Events contains a slice of Event objects that were emitted during some
+ * execution.
+ */
+
+ events: StringEventSDKType[];
+}
+/**
+ * StringEvent defines en Event object wrapper where all the attributes
+ * contain key/value pairs that are strings instead of raw bytes.
+ */
+
+export interface StringEvent {
+ type: string;
+ attributes: Attribute[];
+}
+/**
+ * StringEvent defines en Event object wrapper where all the attributes
+ * contain key/value pairs that are strings instead of raw bytes.
+ */
+
+export interface StringEventSDKType {
+ type: string;
+ attributes: AttributeSDKType[];
+}
+/**
+ * Attribute defines an attribute wrapper where the key and value are
+ * strings instead of raw bytes.
+ */
+
+export interface Attribute {
+ key: string;
+ value: string;
+}
+/**
+ * Attribute defines an attribute wrapper where the key and value are
+ * strings instead of raw bytes.
+ */
+
+export interface AttributeSDKType {
+ key: string;
+ value: string;
+}
+/** GasInfo defines tx execution gas context. */
+
+export interface GasInfo {
+ /** GasWanted is the maximum units of work we allow this tx to perform. */
+ gasWanted: Long;
+ /** GasUsed is the amount of gas actually consumed. */
+
+ gasUsed: Long;
+}
+/** GasInfo defines tx execution gas context. */
+
+export interface GasInfoSDKType {
+ /** GasWanted is the maximum units of work we allow this tx to perform. */
+ gas_wanted: Long;
+ /** GasUsed is the amount of gas actually consumed. */
+
+ gas_used: Long;
+}
+/** Result is the union of ResponseFormat and ResponseCheckTx. */
+
+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.
+ * Deprecated. This field is still populated, but prefer msg_response instead
+ * because it also contains the Msg response typeURL.
+ */
+
+ /** @deprecated */
+ 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[];
+ /**
+ * msg_responses contains the Msg handler responses type packed in Anys.
+ *
+ * Since: cosmos-sdk 0.46
+ */
+
+ msgResponses: Any[];
+}
+/** Result is the union of ResponseFormat and ResponseCheckTx. */
+
+export interface ResultSDKType {
+ /**
+ * Data is any data returned from message or handler execution. It MUST be
+ * length prefixed in order to separate data from multiple message executions.
+ * Deprecated. This field is still populated, but prefer msg_response instead
+ * because it also contains the Msg response typeURL.
+ */
+
+ /** @deprecated */
+ 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: EventSDKType[];
+ /**
+ * msg_responses contains the Msg handler responses type packed in Anys.
+ *
+ * Since: cosmos-sdk 0.46
+ */
+
+ msg_responses: AnySDKType[];
+}
+/**
+ * SimulationResponse defines the response generated when a transaction is
+ * successfully simulated.
+ */
+
+export interface SimulationResponse {
+ gasInfo?: GasInfo | undefined;
+ result?: Result | undefined;
+}
+/**
+ * SimulationResponse defines the response generated when a transaction is
+ * successfully simulated.
+ */
+
+export interface SimulationResponseSDKType {
+ gas_info?: GasInfoSDKType | undefined;
+ result?: ResultSDKType | undefined;
+}
+/**
+ * MsgData defines the data returned in a Result object during message
+ * execution.
+ */
+
+/** @deprecated */
+
+export interface MsgData {
+ msgType: string;
+ data: Uint8Array;
+}
+/**
+ * MsgData defines the data returned in a Result object during message
+ * execution.
+ */
+
+/** @deprecated */
+
+export interface MsgDataSDKType {
+ msg_type: string;
+ data: Uint8Array;
+}
+/**
+ * TxMsgData defines a list of MsgData. A transaction will have a MsgData object
+ * for each message.
+ */
+
+export interface TxMsgData {
+ /** data field is deprecated and not populated. */
+
+ /** @deprecated */
+ data: MsgData[];
+ /**
+ * msg_responses contains the Msg handler responses packed into Anys.
+ *
+ * Since: cosmos-sdk 0.46
+ */
+
+ msgResponses: Any[];
+}
+/**
+ * TxMsgData defines a list of MsgData. A transaction will have a MsgData object
+ * for each message.
+ */
+
+export interface TxMsgDataSDKType {
+ /** data field is deprecated and not populated. */
+
+ /** @deprecated */
+ data: MsgDataSDKType[];
+ /**
+ * msg_responses contains the Msg handler responses packed into Anys.
+ *
+ * Since: cosmos-sdk 0.46
+ */
+
+ msg_responses: AnySDKType[];
+}
+/** SearchTxsResult defines a structure for querying txs pageable */
+
+export interface SearchTxsResult {
+ /** Count of all txs */
+ totalCount: Long;
+ /** Count of txs in current page */
+
+ count: Long;
+ /** Index of current page, start from 1 */
+
+ pageNumber: Long;
+ /** Count of total pages */
+
+ pageTotal: Long;
+ /** Max count txs per page */
+
+ limit: Long;
+ /** List of txs in current page */
+
+ txs: TxResponse[];
+}
+/** SearchTxsResult defines a structure for querying txs pageable */
+
+export interface SearchTxsResultSDKType {
+ /** Count of all txs */
+ total_count: Long;
+ /** Count of txs in current page */
+
+ count: Long;
+ /** Index of current page, start from 1 */
+
+ page_number: Long;
+ /** Count of total pages */
+
+ page_total: Long;
+ /** Max count txs per page */
+
+ limit: Long;
+ /** List of txs in current page */
+
+ txs: TxResponseSDKType[];
+}
+
+function createBaseTxResponse(): TxResponse {
+ return {
+ height: Long.ZERO,
+ txhash: "",
+ codespace: "",
+ code: 0,
+ data: "",
+ rawLog: "",
+ logs: [],
+ info: "",
+ gasWanted: Long.ZERO,
+ gasUsed: Long.ZERO,
+ tx: undefined,
+ timestamp: "",
+ events: []
+ };
+}
+
+export const TxResponse = {
+ encode(message: TxResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
+ if (!message.height.isZero()) {
+ 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.rawLog !== "") {
+ writer.uint32(50).string(message.rawLog);
+ }
+
+ for (const v of message.logs) {
+ ABCIMessageLog.encode(v!, writer.uint32(58).fork()).ldelim();
+ }
+
+ if (message.info !== "") {
+ writer.uint32(66).string(message.info);
+ }
+
+ if (!message.gasWanted.isZero()) {
+ writer.uint32(72).int64(message.gasWanted);
+ }
+
+ if (!message.gasUsed.isZero()) {
+ writer.uint32(80).int64(message.gasUsed);
+ }
+
+ if (message.tx !== undefined) {
+ Any.encode(message.tx, writer.uint32(90).fork()).ldelim();
+ }
+
+ if (message.timestamp !== "") {
+ writer.uint32(98).string(message.timestamp);
+ }
+
+ for (const v of message.events) {
+ Event.encode(v!, writer.uint32(106).fork()).ldelim();
+ }
+
+ return writer;
+ },
+
+ decode(input: _m0.Reader | Uint8Array, length?: number): TxResponse {
+ const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
+ let end = length === undefined ? reader.len : reader.pos + length;
+ const message = createBaseTxResponse();
+
+ while (reader.pos < end) {
+ const tag = reader.uint32();
+
+ switch (tag >>> 3) {
+ case 1:
+ message.height = (reader.int64() as Long);
+ break;
+
+ case 2:
+ message.txhash = reader.string();
+ break;
+
+ case 3:
+ message.codespace = reader.string();
+ break;
+
+ case 4:
+ message.code = reader.uint32();
+ break;
+
+ case 5:
+ message.data = reader.string();
+ break;
+
+ case 6:
+ message.rawLog = reader.string();
+ break;
+
+ case 7:
+ message.logs.push(ABCIMessageLog.decode(reader, reader.uint32()));
+ break;
+
+ case 8:
+ message.info = reader.string();
+ break;
+
+ case 9:
+ message.gasWanted = (reader.int64() as Long);
+ break;
+
+ case 10:
+ message.gasUsed = (reader.int64() as Long);
+ break;
+
+ case 11:
+ message.tx = Any.decode(reader, reader.uint32());
+ break;
+
+ case 12:
+ message.timestamp = reader.string();
+ break;
+
+ case 13:
+ message.events.push(Event.decode(reader, reader.uint32()));
+ break;
+
+ default:
+ reader.skipType(tag & 7);
+ break;
+ }
+ }
+
+ return message;
+ },
+
+ fromPartial(object: Partial): TxResponse {
+ const message = createBaseTxResponse();
+ message.height = object.height !== undefined && object.height !== null ? Long.fromValue(object.height) : Long.ZERO;
+ message.txhash = object.txhash ?? "";
+ message.codespace = object.codespace ?? "";
+ message.code = object.code ?? 0;
+ message.data = object.data ?? "";
+ message.rawLog = object.rawLog ?? "";
+ message.logs = object.logs?.map(e => ABCIMessageLog.fromPartial(e)) || [];
+ message.info = object.info ?? "";
+ message.gasWanted = object.gasWanted !== undefined && object.gasWanted !== null ? Long.fromValue(object.gasWanted) : Long.ZERO;
+ message.gasUsed = object.gasUsed !== undefined && object.gasUsed !== null ? Long.fromValue(object.gasUsed) : Long.ZERO;
+ 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;
+ }
+
+};
+
+function createBaseABCIMessageLog(): ABCIMessageLog {
+ return {
+ msgIndex: 0,
+ log: "",
+ events: []
+ };
+}
+
+export const ABCIMessageLog = {
+ encode(message: ABCIMessageLog, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
+ if (message.msgIndex !== 0) {
+ writer.uint32(8).uint32(message.msgIndex);
+ }
+
+ if (message.log !== "") {
+ writer.uint32(18).string(message.log);
+ }
+
+ for (const v of message.events) {
+ StringEvent.encode(v!, writer.uint32(26).fork()).ldelim();
+ }
+
+ return writer;
+ },
+
+ decode(input: _m0.Reader | Uint8Array, length?: number): ABCIMessageLog {
+ const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
+ let end = length === undefined ? reader.len : reader.pos + length;
+ const message = createBaseABCIMessageLog();
+
+ while (reader.pos < end) {
+ const tag = reader.uint32();
+
+ switch (tag >>> 3) {
+ case 1:
+ message.msgIndex = reader.uint32();
+ break;
+
+ case 2:
+ message.log = reader.string();
+ break;
+
+ case 3:
+ message.events.push(StringEvent.decode(reader, reader.uint32()));
+ break;
+
+ default:
+ reader.skipType(tag & 7);
+ break;
+ }
+ }
+
+ return message;
+ },
+
+ fromPartial(object: Partial): ABCIMessageLog {
+ const message = createBaseABCIMessageLog();
+ message.msgIndex = object.msgIndex ?? 0;
+ message.log = object.log ?? "";
+ message.events = object.events?.map(e => StringEvent.fromPartial(e)) || [];
+ return message;
+ }
+
+};
+
+function createBaseStringEvent(): StringEvent {
+ return {
+ type: "",
+ attributes: []
+ };
+}
+
+export const StringEvent = {
+ encode(message: StringEvent, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
+ if (message.type !== "") {
+ writer.uint32(10).string(message.type);
+ }
+
+ for (const v of message.attributes) {
+ Attribute.encode(v!, writer.uint32(18).fork()).ldelim();
+ }
+
+ return writer;
+ },
+
+ decode(input: _m0.Reader | Uint8Array, length?: number): StringEvent {
+ const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
+ let end = length === undefined ? reader.len : reader.pos + length;
+ const message = createBaseStringEvent();
+
+ while (reader.pos < end) {
+ const tag = reader.uint32();
+
+ switch (tag >>> 3) {
+ case 1:
+ message.type = reader.string();
+ break;
+
+ case 2:
+ message.attributes.push(Attribute.decode(reader, reader.uint32()));
+ break;
+
+ default:
+ reader.skipType(tag & 7);
+ break;
+ }
+ }
+
+ return message;
+ },
+
+ fromPartial(object: Partial): StringEvent {
+ const message = createBaseStringEvent();
+ message.type = object.type ?? "";
+ message.attributes = object.attributes?.map(e => Attribute.fromPartial(e)) || [];
+ return message;
+ }
+
+};
+
+function createBaseAttribute(): Attribute {
+ return {
+ key: "",
+ value: ""
+ };
+}
+
+export const Attribute = {
+ encode(message: Attribute, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
+ if (message.key !== "") {
+ writer.uint32(10).string(message.key);
+ }
+
+ if (message.value !== "") {
+ writer.uint32(18).string(message.value);
+ }
+
+ return writer;
+ },
+
+ decode(input: _m0.Reader | Uint8Array, length?: number): Attribute {
+ const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
+ let end = length === undefined ? reader.len : reader.pos + length;
+ const message = createBaseAttribute();
+
+ while (reader.pos < end) {
+ const tag = reader.uint32();
+
+ switch (tag >>> 3) {
+ case 1:
+ message.key = reader.string();
+ break;
+
+ case 2:
+ message.value = reader.string();
+ break;
+
+ default:
+ reader.skipType(tag & 7);
+ break;
+ }
+ }
+
+ return message;
+ },
+
+ fromPartial(object: Partial): Attribute {
+ const message = createBaseAttribute();
+ message.key = object.key ?? "";
+ message.value = object.value ?? "";
+ return message;
+ }
+
+};
+
+function createBaseGasInfo(): GasInfo {
+ return {
+ gasWanted: Long.UZERO,
+ gasUsed: Long.UZERO
+ };
+}
+
+export const GasInfo = {
+ encode(message: GasInfo, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
+ if (!message.gasWanted.isZero()) {
+ writer.uint32(8).uint64(message.gasWanted);
+ }
+
+ if (!message.gasUsed.isZero()) {
+ writer.uint32(16).uint64(message.gasUsed);
+ }
+
+ return writer;
+ },
+
+ decode(input: _m0.Reader | Uint8Array, length?: number): GasInfo {
+ const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
+ let end = length === undefined ? reader.len : reader.pos + length;
+ const message = createBaseGasInfo();
+
+ while (reader.pos < end) {
+ const tag = reader.uint32();
+
+ switch (tag >>> 3) {
+ case 1:
+ message.gasWanted = (reader.uint64() as Long);
+ break;
+
+ case 2:
+ message.gasUsed = (reader.uint64() as Long);
+ break;
+
+ default:
+ reader.skipType(tag & 7);
+ break;
+ }
+ }
+
+ return message;
+ },
+
+ fromPartial(object: Partial): GasInfo {
+ const message = createBaseGasInfo();
+ message.gasWanted = object.gasWanted !== undefined && object.gasWanted !== null ? Long.fromValue(object.gasWanted) : Long.UZERO;
+ message.gasUsed = object.gasUsed !== undefined && object.gasUsed !== null ? Long.fromValue(object.gasUsed) : Long.UZERO;
+ return message;
+ }
+
+};
+
+function createBaseResult(): Result {
+ return {
+ data: new Uint8Array(),
+ log: "",
+ events: [],
+ msgResponses: []
+ };
+}
+
+export const Result = {
+ encode(message: Result, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
+ 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()).ldelim();
+ }
+
+ for (const v of message.msgResponses) {
+ Any.encode(v!, writer.uint32(34).fork()).ldelim();
+ }
+
+ return writer;
+ },
+
+ decode(input: _m0.Reader | Uint8Array, length?: number): Result {
+ const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
+ let end = length === undefined ? reader.len : reader.pos + length;
+ const message = createBaseResult();
+
+ while (reader.pos < end) {
+ const tag = reader.uint32();
+
+ switch (tag >>> 3) {
+ case 1:
+ message.data = reader.bytes();
+ break;
+
+ case 2:
+ message.log = reader.string();
+ break;
+
+ case 3:
+ message.events.push(Event.decode(reader, reader.uint32()));
+ break;
+
+ case 4:
+ message.msgResponses.push(Any.decode(reader, reader.uint32()));
+ break;
+
+ default:
+ reader.skipType(tag & 7);
+ break;
+ }
+ }
+
+ return message;
+ },
+
+ fromPartial(object: Partial): Result {
+ const message = createBaseResult();
+ message.data = object.data ?? new Uint8Array();
+ message.log = object.log ?? "";
+ message.events = object.events?.map(e => Event.fromPartial(e)) || [];
+ message.msgResponses = object.msgResponses?.map(e => Any.fromPartial(e)) || [];
+ return message;
+ }
+
+};
+
+function createBaseSimulationResponse(): SimulationResponse {
+ return {
+ gasInfo: undefined,
+ result: undefined
+ };
+}
+
+export const SimulationResponse = {
+ encode(message: SimulationResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
+ if (message.gasInfo !== undefined) {
+ GasInfo.encode(message.gasInfo, writer.uint32(10).fork()).ldelim();
+ }
+
+ if (message.result !== undefined) {
+ Result.encode(message.result, writer.uint32(18).fork()).ldelim();
+ }
+
+ return writer;
+ },
+
+ decode(input: _m0.Reader | Uint8Array, length?: number): SimulationResponse {
+ const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
+ let end = length === undefined ? reader.len : reader.pos + length;
+ const message = createBaseSimulationResponse();
+
+ while (reader.pos < end) {
+ const tag = reader.uint32();
+
+ switch (tag >>> 3) {
+ case 1:
+ message.gasInfo = GasInfo.decode(reader, reader.uint32());
+ break;
+
+ case 2:
+ message.result = Result.decode(reader, reader.uint32());
+ break;
+
+ default:
+ reader.skipType(tag & 7);
+ break;
+ }
+ }
+
+ return message;
+ },
+
+ fromPartial(object: Partial): SimulationResponse {
+ const message = createBaseSimulationResponse();
+ message.gasInfo = object.gasInfo !== undefined && object.gasInfo !== null ? GasInfo.fromPartial(object.gasInfo) : undefined;
+ message.result = object.result !== undefined && object.result !== null ? Result.fromPartial(object.result) : undefined;
+ return message;
+ }
+
+};
+
+function createBaseMsgData(): MsgData {
+ return {
+ msgType: "",
+ data: new Uint8Array()
+ };
+}
+
+export const MsgData = {
+ encode(message: MsgData, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
+ if (message.msgType !== "") {
+ writer.uint32(10).string(message.msgType);
+ }
+
+ if (message.data.length !== 0) {
+ writer.uint32(18).bytes(message.data);
+ }
+
+ return writer;
+ },
+
+ decode(input: _m0.Reader | Uint8Array, length?: number): MsgData {
+ const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
+ let end = length === undefined ? reader.len : reader.pos + length;
+ const message = createBaseMsgData();
+
+ while (reader.pos < end) {
+ const tag = reader.uint32();
+
+ switch (tag >>> 3) {
+ case 1:
+ message.msgType = reader.string();
+ break;
+
+ case 2:
+ message.data = reader.bytes();
+ break;
+
+ default:
+ reader.skipType(tag & 7);
+ break;
+ }
+ }
+
+ return message;
+ },
+
+ fromPartial(object: Partial): MsgData {
+ const message = createBaseMsgData();
+ message.msgType = object.msgType ?? "";
+ message.data = object.data ?? new Uint8Array();
+ return message;
+ }
+
+};
+
+function createBaseTxMsgData(): TxMsgData {
+ return {
+ data: [],
+ msgResponses: []
+ };
+}
+
+export const TxMsgData = {
+ encode(message: TxMsgData, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
+ for (const v of message.data) {
+ MsgData.encode(v!, writer.uint32(10).fork()).ldelim();
+ }
+
+ for (const v of message.msgResponses) {
+ Any.encode(v!, writer.uint32(18).fork()).ldelim();
+ }
+
+ return writer;
+ },
+
+ decode(input: _m0.Reader | Uint8Array, length?: number): TxMsgData {
+ const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
+ let end = length === undefined ? reader.len : reader.pos + length;
+ const message = createBaseTxMsgData();
+
+ while (reader.pos < end) {
+ const tag = reader.uint32();
+
+ switch (tag >>> 3) {
+ case 1:
+ message.data.push(MsgData.decode(reader, reader.uint32()));
+ break;
+
+ case 2:
+ message.msgResponses.push(Any.decode(reader, reader.uint32()));
+ break;
+
+ default:
+ reader.skipType(tag & 7);
+ break;
+ }
+ }
+
+ return message;
+ },
+
+ fromPartial(object: Partial): TxMsgData {
+ const message = createBaseTxMsgData();
+ message.data = object.data?.map(e => MsgData.fromPartial(e)) || [];
+ message.msgResponses = object.msgResponses?.map(e => Any.fromPartial(e)) || [];
+ return message;
+ }
+
+};
+
+function createBaseSearchTxsResult(): SearchTxsResult {
+ return {
+ totalCount: Long.UZERO,
+ count: Long.UZERO,
+ pageNumber: Long.UZERO,
+ pageTotal: Long.UZERO,
+ limit: Long.UZERO,
+ txs: []
+ };
+}
+
+export const SearchTxsResult = {
+ encode(message: SearchTxsResult, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
+ if (!message.totalCount.isZero()) {
+ writer.uint32(8).uint64(message.totalCount);
+ }
+
+ if (!message.count.isZero()) {
+ writer.uint32(16).uint64(message.count);
+ }
+
+ if (!message.pageNumber.isZero()) {
+ writer.uint32(24).uint64(message.pageNumber);
+ }
+
+ if (!message.pageTotal.isZero()) {
+ writer.uint32(32).uint64(message.pageTotal);
+ }
+
+ if (!message.limit.isZero()) {
+ writer.uint32(40).uint64(message.limit);
+ }
+
+ for (const v of message.txs) {
+ TxResponse.encode(v!, writer.uint32(50).fork()).ldelim();
+ }
+
+ return writer;
+ },
+
+ decode(input: _m0.Reader | Uint8Array, length?: number): SearchTxsResult {
+ const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
+ let end = length === undefined ? reader.len : reader.pos + length;
+ const message = createBaseSearchTxsResult();
+
+ while (reader.pos < end) {
+ const tag = reader.uint32();
+
+ switch (tag >>> 3) {
+ case 1:
+ message.totalCount = (reader.uint64() as Long);
+ break;
+
+ case 2:
+ message.count = (reader.uint64() as Long);
+ break;
+
+ case 3:
+ message.pageNumber = (reader.uint64() as Long);
+ break;
+
+ case 4:
+ message.pageTotal = (reader.uint64() as Long);
+ break;
+
+ case 5:
+ message.limit = (reader.uint64() as Long);
+ break;
+
+ case 6:
+ message.txs.push(TxResponse.decode(reader, reader.uint32()));
+ break;
+
+ default:
+ reader.skipType(tag & 7);
+ break;
+ }
+ }
+
+ return message;
+ },
+
+ fromPartial(object: Partial): SearchTxsResult {
+ const message = createBaseSearchTxsResult();
+ message.totalCount = object.totalCount !== undefined && object.totalCount !== null ? Long.fromValue(object.totalCount) : Long.UZERO;
+ message.count = object.count !== undefined && object.count !== null ? Long.fromValue(object.count) : Long.UZERO;
+ message.pageNumber = object.pageNumber !== undefined && object.pageNumber !== null ? Long.fromValue(object.pageNumber) : Long.UZERO;
+ message.pageTotal = object.pageTotal !== undefined && object.pageTotal !== null ? Long.fromValue(object.pageTotal) : Long.UZERO;
+ message.limit = object.limit !== undefined && object.limit !== null ? Long.fromValue(object.limit) : Long.UZERO;
+ message.txs = object.txs?.map(e => TxResponse.fromPartial(e)) || [];
+ return message;
+ }
+
+};
\ No newline at end of file
diff --git a/examples/contracts/codegen/cosmos/base/kv/v1beta1/kv.ts b/examples/contracts/codegen/cosmos/base/kv/v1beta1/kv.ts
new file mode 100644
index 000000000..90713754f
--- /dev/null
+++ b/examples/contracts/codegen/cosmos/base/kv/v1beta1/kv.ts
@@ -0,0 +1,123 @@
+import * as _m0 from "protobufjs/minimal";
+/** Pairs defines a repeated slice of Pair objects. */
+
+export interface Pairs {
+ pairs: Pair[];
+}
+/** Pairs defines a repeated slice of Pair objects. */
+
+export interface PairsSDKType {
+ pairs: PairSDKType[];
+}
+/** Pair defines a key/value bytes tuple. */
+
+export interface Pair {
+ key: Uint8Array;
+ value: Uint8Array;
+}
+/** Pair defines a key/value bytes tuple. */
+
+export interface PairSDKType {
+ key: Uint8Array;
+ value: Uint8Array;
+}
+
+function createBasePairs(): Pairs {
+ return {
+ pairs: []
+ };
+}
+
+export const Pairs = {
+ encode(message: Pairs, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
+ for (const v of message.pairs) {
+ Pair.encode(v!, writer.uint32(10).fork()).ldelim();
+ }
+
+ return writer;
+ },
+
+ decode(input: _m0.Reader | Uint8Array, length?: number): Pairs {
+ const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
+ let end = length === undefined ? reader.len : reader.pos + length;
+ const message = createBasePairs();
+
+ while (reader.pos < end) {
+ const tag = reader.uint32();
+
+ switch (tag >>> 3) {
+ case 1:
+ message.pairs.push(Pair.decode(reader, reader.uint32()));
+ break;
+
+ default:
+ reader.skipType(tag & 7);
+ break;
+ }
+ }
+
+ return message;
+ },
+
+ fromPartial(object: Partial): Pairs {
+ const message = createBasePairs();
+ message.pairs = object.pairs?.map(e => Pair.fromPartial(e)) || [];
+ return message;
+ }
+
+};
+
+function createBasePair(): Pair {
+ return {
+ key: new Uint8Array(),
+ value: new Uint8Array()
+ };
+}
+
+export const Pair = {
+ encode(message: Pair, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
+ 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: _m0.Reader | Uint8Array, length?: number): Pair {
+ const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
+ let end = length === undefined ? reader.len : reader.pos + length;
+ const message = createBasePair();
+
+ while (reader.pos < end) {
+ const tag = reader.uint32();
+
+ switch (tag >>> 3) {
+ case 1:
+ message.key = reader.bytes();
+ break;
+
+ case 2:
+ message.value = reader.bytes();
+ break;
+
+ default:
+ reader.skipType(tag & 7);
+ break;
+ }
+ }
+
+ return message;
+ },
+
+ fromPartial(object: Partial): Pair {
+ const message = createBasePair();
+ message.key = object.key ?? new Uint8Array();
+ message.value = object.value ?? new Uint8Array();
+ return message;
+ }
+
+};
\ No newline at end of file
diff --git a/examples/contracts/codegen/cosmos/base/query/v1beta1/pagination.ts b/examples/contracts/codegen/cosmos/base/query/v1beta1/pagination.ts
new file mode 100644
index 000000000..b99bc3762
--- /dev/null
+++ b/examples/contracts/codegen/cosmos/base/query/v1beta1/pagination.ts
@@ -0,0 +1,282 @@
+import * as _m0 from "protobufjs/minimal";
+import { Long } from "../../../../helpers";
+/**
+ * PageRequest is to be embedded in gRPC request messages for efficient
+ * pagination. Ex:
+ *
+ * message SomeRequest {
+ * Foo some_parameter = 1;
+ * PageRequest pagination = 2;
+ * }
+ */
+
+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: Long;
+ /**
+ * 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: Long;
+ /**
+ * 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.
+ */
+
+ countTotal: boolean;
+ /**
+ * reverse is set to true if results are to be returned in the descending order.
+ *
+ * Since: cosmos-sdk 0.43
+ */
+
+ reverse: boolean;
+}
+/**
+ * PageRequest is to be embedded in gRPC request messages for efficient
+ * pagination. Ex:
+ *
+ * message SomeRequest {
+ * Foo some_parameter = 1;
+ * PageRequest pagination = 2;
+ * }
+ */
+
+export interface PageRequestSDKType {
+ /**
+ * 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: Long;
+ /**
+ * 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: Long;
+ /**
+ * 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;
+}
+/**
+ * PageResponse is to be embedded in gRPC response messages where the
+ * corresponding request message has used PageRequest.
+ *
+ * message SomeResponse {
+ * repeated Bar results = 1;
+ * PageResponse page = 2;
+ * }
+ */
+
+export interface PageResponse {
+ /**
+ * next_key is the key to be passed to PageRequest.key to
+ * query the next page most efficiently. It will be empty if
+ * there are no more results.
+ */
+ nextKey: Uint8Array;
+ /**
+ * total is total number of results available if PageRequest.count_total
+ * was set, its value is undefined otherwise
+ */
+
+ total: Long;
+}
+/**
+ * PageResponse is to be embedded in gRPC response messages where the
+ * corresponding request message has used PageRequest.
+ *
+ * message SomeResponse {
+ * repeated Bar results = 1;
+ * PageResponse page = 2;
+ * }
+ */
+
+export interface PageResponseSDKType {
+ /**
+ * next_key is the key to be passed to PageRequest.key to
+ * query the next page most efficiently. It will be empty if
+ * there are no more results.
+ */
+ next_key: Uint8Array;
+ /**
+ * total is total number of results available if PageRequest.count_total
+ * was set, its value is undefined otherwise
+ */
+
+ total: Long;
+}
+
+function createBasePageRequest(): PageRequest {
+ return {
+ key: new Uint8Array(),
+ offset: Long.UZERO,
+ limit: Long.UZERO,
+ countTotal: false,
+ reverse: false
+ };
+}
+
+export const PageRequest = {
+ encode(message: PageRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
+ if (message.key.length !== 0) {
+ writer.uint32(10).bytes(message.key);
+ }
+
+ if (!message.offset.isZero()) {
+ writer.uint32(16).uint64(message.offset);
+ }
+
+ if (!message.limit.isZero()) {
+ writer.uint32(24).uint64(message.limit);
+ }
+
+ if (message.countTotal === true) {
+ writer.uint32(32).bool(message.countTotal);
+ }
+
+ if (message.reverse === true) {
+ writer.uint32(40).bool(message.reverse);
+ }
+
+ return writer;
+ },
+
+ decode(input: _m0.Reader | Uint8Array, length?: number): PageRequest {
+ const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
+ let end = length === undefined ? reader.len : reader.pos + length;
+ const message = createBasePageRequest();
+
+ while (reader.pos < end) {
+ const tag = reader.uint32();
+
+ switch (tag >>> 3) {
+ case 1:
+ message.key = reader.bytes();
+ break;
+
+ case 2:
+ message.offset = (reader.uint64() as Long);
+ break;
+
+ case 3:
+ message.limit = (reader.uint64() as Long);
+ break;
+
+ case 4:
+ message.countTotal = reader.bool();
+ break;
+
+ case 5:
+ message.reverse = reader.bool();
+ break;
+
+ default:
+ reader.skipType(tag & 7);
+ break;
+ }
+ }
+
+ return message;
+ },
+
+ fromPartial(object: Partial): PageRequest {
+ const message = createBasePageRequest();
+ message.key = object.key ?? new Uint8Array();
+ message.offset = object.offset !== undefined && object.offset !== null ? Long.fromValue(object.offset) : Long.UZERO;
+ message.limit = object.limit !== undefined && object.limit !== null ? Long.fromValue(object.limit) : Long.UZERO;
+ message.countTotal = object.countTotal ?? false;
+ message.reverse = object.reverse ?? false;
+ return message;
+ }
+
+};
+
+function createBasePageResponse(): PageResponse {
+ return {
+ nextKey: new Uint8Array(),
+ total: Long.UZERO
+ };
+}
+
+export const PageResponse = {
+ encode(message: PageResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
+ if (message.nextKey.length !== 0) {
+ writer.uint32(10).bytes(message.nextKey);
+ }
+
+ if (!message.total.isZero()) {
+ writer.uint32(16).uint64(message.total);
+ }
+
+ return writer;
+ },
+
+ decode(input: _m0.Reader | Uint8Array, length?: number): PageResponse {
+ const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
+ let end = length === undefined ? reader.len : reader.pos + length;
+ const message = createBasePageResponse();
+
+ while (reader.pos < end) {
+ const tag = reader.uint32();
+
+ switch (tag >>> 3) {
+ case 1:
+ message.nextKey = reader.bytes();
+ break;
+
+ case 2:
+ message.total = (reader.uint64() as Long);
+ break;
+
+ default:
+ reader.skipType(tag & 7);
+ break;
+ }
+ }
+
+ return message;
+ },
+
+ fromPartial(object: Partial): PageResponse {
+ const message = createBasePageResponse();
+ message.nextKey = object.nextKey ?? new Uint8Array();
+ message.total = object.total !== undefined && object.total !== null ? Long.fromValue(object.total) : Long.UZERO;
+ return message;
+ }
+
+};
\ No newline at end of file
diff --git a/examples/contracts/codegen/cosmos/base/reflection/v1beta1/reflection.ts b/examples/contracts/codegen/cosmos/base/reflection/v1beta1/reflection.ts
new file mode 100644
index 000000000..7846ab5e2
--- /dev/null
+++ b/examples/contracts/codegen/cosmos/base/reflection/v1beta1/reflection.ts
@@ -0,0 +1,222 @@
+import * as _m0 from "protobufjs/minimal";
+/** ListAllInterfacesRequest is the request type of the ListAllInterfaces RPC. */
+
+export interface ListAllInterfacesRequest {}
+/** ListAllInterfacesRequest is the request type of the ListAllInterfaces RPC. */
+
+export interface ListAllInterfacesRequestSDKType {}
+/** ListAllInterfacesResponse is the response type of the ListAllInterfaces RPC. */
+
+export interface ListAllInterfacesResponse {
+ /** interface_names is an array of all the registered interfaces. */
+ interfaceNames: string[];
+}
+/** ListAllInterfacesResponse is the response type of the ListAllInterfaces RPC. */
+
+export interface ListAllInterfacesResponseSDKType {
+ /** interface_names is an array of all the registered interfaces. */
+ interface_names: string[];
+}
+/**
+ * ListImplementationsRequest is the request type of the ListImplementations
+ * RPC.
+ */
+
+export interface ListImplementationsRequest {
+ /** interface_name defines the interface to query the implementations for. */
+ interfaceName: string;
+}
+/**
+ * ListImplementationsRequest is the request type of the ListImplementations
+ * RPC.
+ */
+
+export interface ListImplementationsRequestSDKType {
+ /** interface_name defines the interface to query the implementations for. */
+ interface_name: string;
+}
+/**
+ * ListImplementationsResponse is the response type of the ListImplementations
+ * RPC.
+ */
+
+export interface ListImplementationsResponse {
+ implementationMessageNames: string[];
+}
+/**
+ * ListImplementationsResponse is the response type of the ListImplementations
+ * RPC.
+ */
+
+export interface ListImplementationsResponseSDKType {
+ implementation_message_names: string[];
+}
+
+function createBaseListAllInterfacesRequest(): ListAllInterfacesRequest {
+ return {};
+}
+
+export const ListAllInterfacesRequest = {
+ encode(_: ListAllInterfacesRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
+ return writer;
+ },
+
+ decode(input: _m0.Reader | Uint8Array, length?: number): ListAllInterfacesRequest {
+ const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
+ let end = length === undefined ? reader.len : reader.pos + length;
+ const message = createBaseListAllInterfacesRequest();
+
+ while (reader.pos < end) {
+ const tag = reader.uint32();
+
+ switch (tag >>> 3) {
+ default:
+ reader.skipType(tag & 7);
+ break;
+ }
+ }
+
+ return message;
+ },
+
+ fromPartial(_: Partial): ListAllInterfacesRequest {
+ const message = createBaseListAllInterfacesRequest();
+ return message;
+ }
+
+};
+
+function createBaseListAllInterfacesResponse(): ListAllInterfacesResponse {
+ return {
+ interfaceNames: []
+ };
+}
+
+export const ListAllInterfacesResponse = {
+ encode(message: ListAllInterfacesResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
+ for (const v of message.interfaceNames) {
+ writer.uint32(10).string(v!);
+ }
+
+ return writer;
+ },
+
+ decode(input: _m0.Reader | Uint8Array, length?: number): ListAllInterfacesResponse {
+ const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
+ let end = length === undefined ? reader.len : reader.pos + length;
+ const message = createBaseListAllInterfacesResponse();
+
+ while (reader.pos < end) {
+ const tag = reader.uint32();
+
+ switch (tag >>> 3) {
+ case 1:
+ message.interfaceNames.push(reader.string());
+ break;
+
+ default:
+ reader.skipType(tag & 7);
+ break;
+ }
+ }
+
+ return message;
+ },
+
+ fromPartial(object: Partial): ListAllInterfacesResponse {
+ const message = createBaseListAllInterfacesResponse();
+ message.interfaceNames = object.interfaceNames?.map(e => e) || [];
+ return message;
+ }
+
+};
+
+function createBaseListImplementationsRequest(): ListImplementationsRequest {
+ return {
+ interfaceName: ""
+ };
+}
+
+export const ListImplementationsRequest = {
+ encode(message: ListImplementationsRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
+ if (message.interfaceName !== "") {
+ writer.uint32(10).string(message.interfaceName);
+ }
+
+ return writer;
+ },
+
+ decode(input: _m0.Reader | Uint8Array, length?: number): ListImplementationsRequest {
+ const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
+ let end = length === undefined ? reader.len : reader.pos + length;
+ const message = createBaseListImplementationsRequest();
+
+ while (reader.pos < end) {
+ const tag = reader.uint32();
+
+ switch (tag >>> 3) {
+ case 1:
+ message.interfaceName = reader.string();
+ break;
+
+ default:
+ reader.skipType(tag & 7);
+ break;
+ }
+ }
+
+ return message;
+ },
+
+ fromPartial(object: Partial): ListImplementationsRequest {
+ const message = createBaseListImplementationsRequest();
+ message.interfaceName = object.interfaceName ?? "";
+ return message;
+ }
+
+};
+
+function createBaseListImplementationsResponse(): ListImplementationsResponse {
+ return {
+ implementationMessageNames: []
+ };
+}
+
+export const ListImplementationsResponse = {
+ encode(message: ListImplementationsResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
+ for (const v of message.implementationMessageNames) {
+ writer.uint32(10).string(v!);
+ }
+
+ return writer;
+ },
+
+ decode(input: _m0.Reader | Uint8Array, length?: number): ListImplementationsResponse {
+ const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
+ let end = length === undefined ? reader.len : reader.pos + length;
+ const message = createBaseListImplementationsResponse();
+
+ while (reader.pos < end) {
+ const tag = reader.uint32();
+
+ switch (tag >>> 3) {
+ case 1:
+ message.implementationMessageNames.push(reader.string());
+ break;
+
+ default:
+ reader.skipType(tag & 7);
+ break;
+ }
+ }
+
+ return message;
+ },
+
+ fromPartial(object: Partial): ListImplementationsResponse {
+ const message = createBaseListImplementationsResponse();
+ message.implementationMessageNames = object.implementationMessageNames?.map(e => e) || [];
+ return message;
+ }
+
+};
\ No newline at end of file
diff --git a/examples/contracts/codegen/cosmos/base/reflection/v2alpha1/reflection.ts b/examples/contracts/codegen/cosmos/base/reflection/v2alpha1/reflection.ts
new file mode 100644
index 000000000..693dc5a95
--- /dev/null
+++ b/examples/contracts/codegen/cosmos/base/reflection/v2alpha1/reflection.ts
@@ -0,0 +1,1707 @@
+import * as _m0 from "protobufjs/minimal";
+/** AppDescriptor describes a cosmos-sdk based application */
+
+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 | undefined;
+ /** chain provides the chain descriptor */
+
+ chain?: ChainDescriptor | undefined;
+ /** codec provides metadata information regarding codec related types */
+
+ codec?: CodecDescriptor | undefined;
+ /** configuration provides metadata information regarding the sdk.Config type */
+
+ configuration?: ConfigurationDescriptor | undefined;
+ /** query_services provides metadata information regarding the available queriable endpoints */
+
+ queryServices?: QueryServicesDescriptor | undefined;
+ /** tx provides metadata information regarding how to send transactions to the given application */
+
+ tx?: TxDescriptor | undefined;
+}
+/** AppDescriptor describes a cosmos-sdk based application */
+
+export interface AppDescriptorSDKType {
+ /**
+ * AuthnDescriptor provides information on how to authenticate transactions on the application
+ * NOTE: experimental and subject to change in future releases.
+ */
+ authn?: AuthnDescriptorSDKType | undefined;
+ /** chain provides the chain descriptor */
+
+ chain?: ChainDescriptorSDKType | undefined;
+ /** codec provides metadata information regarding codec related types */
+
+ codec?: CodecDescriptorSDKType | undefined;
+ /** configuration provides metadata information regarding the sdk.Config type */
+
+ configuration?: ConfigurationDescriptorSDKType | undefined;
+ /** query_services provides metadata information regarding the available queriable endpoints */
+
+ query_services?: QueryServicesDescriptorSDKType | undefined;
+ /** tx provides metadata information regarding how to send transactions to the given application */
+
+ tx?: TxDescriptorSDKType | undefined;
+}
+/** TxDescriptor describes the accepted transaction type */
+
+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[];
+}
+/** TxDescriptor describes the accepted transaction type */
+
+export interface TxDescriptorSDKType {
+ /**
+ * 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: MsgDescriptorSDKType[];
+}
+/**
+ * AuthnDescriptor provides information on how to sign transactions without relying
+ * on the online RPCs GetTxMetadata and CombineUnsignedTxAndSignatures
+ */
+
+export interface AuthnDescriptor {
+ /** sign_modes defines the supported signature algorithm */
+ signModes: SigningModeDescriptor[];
+}
+/**
+ * AuthnDescriptor provides information on how to sign transactions without relying
+ * on the online RPCs GetTxMetadata and CombineUnsignedTxAndSignatures
+ */
+
+export interface AuthnDescriptorSDKType {
+ /** sign_modes defines the supported signature algorithm */
+ sign_modes: SigningModeDescriptorSDKType[];
+}
+/**
+ * SigningModeDescriptor provides information on a signing flow of the application
+ * NOTE(fdymylja): here we could go as far as providing an entire flow on how
+ * to sign a message given a SigningModeDescriptor, but it's better to think about
+ * this another time
+ */
+
+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
+ */
+
+ authnInfoProviderMethodFullname: string;
+}
+/**
+ * SigningModeDescriptor provides information on a signing flow of the application
+ * NOTE(fdymylja): here we could go as far as providing an entire flow on how
+ * to sign a message given a SigningModeDescriptor, but it's better to think about
+ * this another time
+ */
+
+export interface SigningModeDescriptorSDKType {
+ /** 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;
+}
+/** ChainDescriptor describes chain information of the application */
+
+export interface ChainDescriptor {
+ /** id is the chain id */
+ id: string;
+}
+/** ChainDescriptor describes chain information of the application */
+
+export interface ChainDescriptorSDKType {
+ /** id is the chain id */
+ id: string;
+}
+/** CodecDescriptor describes the registered interfaces and provides metadata information on the types */
+
+export interface CodecDescriptor {
+ /** interfaces is a list of the registerted interfaces descriptors */
+ interfaces: InterfaceDescriptor[];
+}
+/** CodecDescriptor describes the registered interfaces and provides metadata information on the types */
+
+export interface CodecDescriptorSDKType {
+ /** interfaces is a list of the registerted interfaces descriptors */
+ interfaces: InterfaceDescriptorSDKType[];
+}
+/** InterfaceDescriptor describes the implementation of an interface */
+
+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
+ */
+
+ interfaceAcceptingMessages: InterfaceAcceptingMessageDescriptor[];
+ /** interface_implementers is a list of the descriptors of the interface implementers */
+
+ interfaceImplementers: InterfaceImplementerDescriptor[];
+}
+/** InterfaceDescriptor describes the implementation of an interface */
+
+export interface InterfaceDescriptorSDKType {
+ /** 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: InterfaceAcceptingMessageDescriptorSDKType[];
+ /** interface_implementers is a list of the descriptors of the interface implementers */
+
+ interface_implementers: InterfaceImplementerDescriptorSDKType[];
+}
+/** InterfaceImplementerDescriptor describes an interface implementer */
+
+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
+ */
+
+ typeUrl: string;
+}
+/** InterfaceImplementerDescriptor describes an interface implementer */
+
+export interface InterfaceImplementerDescriptorSDKType {
+ /** 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;
+}
+/**
+ * InterfaceAcceptingMessageDescriptor describes a protobuf message which contains
+ * an interface represented as a google.protobuf.Any
+ */
+
+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)
+ */
+
+ fieldDescriptorNames: string[];
+}
+/**
+ * InterfaceAcceptingMessageDescriptor describes a protobuf message which contains
+ * an interface represented as a google.protobuf.Any
+ */
+
+export interface InterfaceAcceptingMessageDescriptorSDKType {
+ /** 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[];
+}
+/** ConfigurationDescriptor contains metadata information on the sdk.Config */
+
+export interface ConfigurationDescriptor {
+ /** bech32_account_address_prefix is the account address prefix */
+ bech32AccountAddressPrefix: string;
+}
+/** ConfigurationDescriptor contains metadata information on the sdk.Config */
+
+export interface ConfigurationDescriptorSDKType {
+ /** bech32_account_address_prefix is the account address prefix */
+ bech32_account_address_prefix: string;
+}
+/** MsgDescriptor describes a cosmos-sdk message that can be delivered with a transaction */
+
+export interface MsgDescriptor {
+ /** msg_type_url contains the TypeURL of a sdk.Msg. */
+ msgTypeUrl: string;
+}
+/** MsgDescriptor describes a cosmos-sdk message that can be delivered with a transaction */
+
+export interface MsgDescriptorSDKType {
+ /** msg_type_url contains the TypeURL of a sdk.Msg. */
+ msg_type_url: string;
+}
+/** GetAuthnDescriptorRequest is the request used for the GetAuthnDescriptor RPC */
+
+export interface GetAuthnDescriptorRequest {}
+/** GetAuthnDescriptorRequest is the request used for the GetAuthnDescriptor RPC */
+
+export interface GetAuthnDescriptorRequestSDKType {}
+/** GetAuthnDescriptorResponse is the response returned by the GetAuthnDescriptor RPC */
+
+export interface GetAuthnDescriptorResponse {
+ /** authn describes how to authenticate to the application when sending transactions */
+ authn?: AuthnDescriptor | undefined;
+}
+/** GetAuthnDescriptorResponse is the response returned by the GetAuthnDescriptor RPC */
+
+export interface GetAuthnDescriptorResponseSDKType {
+ /** authn describes how to authenticate to the application when sending transactions */
+ authn?: AuthnDescriptorSDKType | undefined;
+}
+/** GetChainDescriptorRequest is the request used for the GetChainDescriptor RPC */
+
+export interface GetChainDescriptorRequest {}
+/** GetChainDescriptorRequest is the request used for the GetChainDescriptor RPC */
+
+export interface GetChainDescriptorRequestSDKType {}
+/** GetChainDescriptorResponse is the response returned by the GetChainDescriptor RPC */
+
+export interface GetChainDescriptorResponse {
+ /** chain describes application chain information */
+ chain?: ChainDescriptor | undefined;
+}
+/** GetChainDescriptorResponse is the response returned by the GetChainDescriptor RPC */
+
+export interface GetChainDescriptorResponseSDKType {
+ /** chain describes application chain information */
+ chain?: ChainDescriptorSDKType | undefined;
+}
+/** GetCodecDescriptorRequest is the request used for the GetCodecDescriptor RPC */
+
+export interface GetCodecDescriptorRequest {}
+/** GetCodecDescriptorRequest is the request used for the GetCodecDescriptor RPC */
+
+export interface GetCodecDescriptorRequestSDKType {}
+/** GetCodecDescriptorResponse is the response returned by the GetCodecDescriptor RPC */
+
+export interface GetCodecDescriptorResponse {
+ /** codec describes the application codec such as registered interfaces and implementations */
+ codec?: CodecDescriptor | undefined;
+}
+/** GetCodecDescriptorResponse is the response returned by the GetCodecDescriptor RPC */
+
+export interface GetCodecDescriptorResponseSDKType {
+ /** codec describes the application codec such as registered interfaces and implementations */
+ codec?: CodecDescriptorSDKType | undefined;
+}
+/** GetConfigurationDescriptorRequest is the request used for the GetConfigurationDescriptor RPC */
+
+export interface GetConfigurationDescriptorRequest {}
+/** GetConfigurationDescriptorRequest is the request used for the GetConfigurationDescriptor RPC */
+
+export interface GetConfigurationDescriptorRequestSDKType {}
+/** GetConfigurationDescriptorResponse is the response returned by the GetConfigurationDescriptor RPC */
+
+export interface GetConfigurationDescriptorResponse {
+ /** config describes the application's sdk.Config */
+ config?: ConfigurationDescriptor | undefined;
+}
+/** GetConfigurationDescriptorResponse is the response returned by the GetConfigurationDescriptor RPC */
+
+export interface GetConfigurationDescriptorResponseSDKType {
+ /** config describes the application's sdk.Config */
+ config?: ConfigurationDescriptorSDKType | undefined;
+}
+/** GetQueryServicesDescriptorRequest is the request used for the GetQueryServicesDescriptor RPC */
+
+export interface GetQueryServicesDescriptorRequest {}
+/** GetQueryServicesDescriptorRequest is the request used for the GetQueryServicesDescriptor RPC */
+
+export interface GetQueryServicesDescriptorRequestSDKType {}
+/** GetQueryServicesDescriptorResponse is the response returned by the GetQueryServicesDescriptor RPC */
+
+export interface GetQueryServicesDescriptorResponse {
+ /** queries provides information on the available queryable services */
+ queries?: QueryServicesDescriptor | undefined;
+}
+/** GetQueryServicesDescriptorResponse is the response returned by the GetQueryServicesDescriptor RPC */
+
+export interface GetQueryServicesDescriptorResponseSDKType {
+ /** queries provides information on the available queryable services */
+ queries?: QueryServicesDescriptorSDKType | undefined;
+}
+/** GetTxDescriptorRequest is the request used for the GetTxDescriptor RPC */
+
+export interface GetTxDescriptorRequest {}
+/** GetTxDescriptorRequest is the request used for the GetTxDescriptor RPC */
+
+export interface GetTxDescriptorRequestSDKType {}
+/** GetTxDescriptorResponse is the response returned by the GetTxDescriptor RPC */
+
+export interface GetTxDescriptorResponse {
+ /**
+ * tx provides information on msgs that can be forwarded to the application
+ * alongside the accepted transaction protobuf type
+ */
+ tx?: TxDescriptor | undefined;
+}
+/** GetTxDescriptorResponse is the response returned by the GetTxDescriptor RPC */
+
+export interface GetTxDescriptorResponseSDKType {
+ /**
+ * tx provides information on msgs that can be forwarded to the application
+ * alongside the accepted transaction protobuf type
+ */
+ tx?: TxDescriptorSDKType | undefined;
+}
+/** QueryServicesDescriptor contains the list of cosmos-sdk queriable services */
+
+export interface QueryServicesDescriptor {
+ /** query_services is a list of cosmos-sdk QueryServiceDescriptor */
+ queryServices: QueryServiceDescriptor[];
+}
+/** QueryServicesDescriptor contains the list of cosmos-sdk queriable services */
+
+export interface QueryServicesDescriptorSDKType {
+ /** query_services is a list of cosmos-sdk QueryServiceDescriptor */
+ query_services: QueryServiceDescriptorSDKType[];
+}
+/** QueryServiceDescriptor describes a cosmos-sdk queryable service */
+
+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 */
+
+ isModule: boolean;
+ /** methods provides a list of query service methods */
+
+ methods: QueryMethodDescriptor[];
+}
+/** QueryServiceDescriptor describes a cosmos-sdk queryable service */
+
+export interface QueryServiceDescriptorSDKType {
+ /** 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: QueryMethodDescriptorSDKType[];
+}
+/**
+ * QueryMethodDescriptor describes a queryable method of a query service
+ * no other info is provided beside method name and tendermint queryable path
+ * because it would be redundant with the grpc reflection service
+ */
+
+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
+ */
+
+ fullQueryPath: string;
+}
+/**
+ * QueryMethodDescriptor describes a queryable method of a query service
+ * no other info is provided beside method name and tendermint queryable path
+ * because it would be redundant with the grpc reflection service
+ */
+
+export interface QueryMethodDescriptorSDKType {
+ /** 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;
+}
+
+function createBaseAppDescriptor(): AppDescriptor {
+ return {
+ authn: undefined,
+ chain: undefined,
+ codec: undefined,
+ configuration: undefined,
+ queryServices: undefined,
+ tx: undefined
+ };
+}
+
+export const AppDescriptor = {
+ encode(message: AppDescriptor, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
+ if (message.authn !== undefined) {
+ AuthnDescriptor.encode(message.authn, writer.uint32(10).fork()).ldelim();
+ }
+
+ if (message.chain !== undefined) {
+ ChainDescriptor.encode(message.chain, writer.uint32(18).fork()).ldelim();
+ }
+
+ if (message.codec !== undefined) {
+ CodecDescriptor.encode(message.codec, writer.uint32(26).fork()).ldelim();
+ }
+
+ if (message.configuration !== undefined) {
+ ConfigurationDescriptor.encode(message.configuration, writer.uint32(34).fork()).ldelim();
+ }
+
+ if (message.queryServices !== undefined) {
+ QueryServicesDescriptor.encode(message.queryServices, writer.uint32(42).fork()).ldelim();
+ }
+
+ if (message.tx !== undefined) {
+ TxDescriptor.encode(message.tx, writer.uint32(50).fork()).ldelim();
+ }
+
+ return writer;
+ },
+
+ decode(input: _m0.Reader | Uint8Array, length?: number): AppDescriptor {
+ const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
+ let end = length === undefined ? reader.len : reader.pos + length;
+ const message = createBaseAppDescriptor();
+
+ while (reader.pos < end) {
+ const tag = reader.uint32();
+
+ switch (tag >>> 3) {
+ case 1:
+ message.authn = AuthnDescriptor.decode(reader, reader.uint32());
+ break;
+
+ case 2:
+ message.chain = ChainDescriptor.decode(reader, reader.uint32());
+ break;
+
+ case 3:
+ message.codec = CodecDescriptor.decode(reader, reader.uint32());
+ break;
+
+ case 4:
+ message.configuration = ConfigurationDescriptor.decode(reader, reader.uint32());
+ break;
+
+ case 5:
+ message.queryServices = QueryServicesDescriptor.decode(reader, reader.uint32());
+ break;
+
+ case 6:
+ message.tx = TxDescriptor.decode(reader, reader.uint32());
+ break;
+
+ default:
+ reader.skipType(tag & 7);
+ break;
+ }
+ }
+
+ return message;
+ },
+
+ fromPartial(object: Partial): 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.queryServices = object.queryServices !== undefined && object.queryServices !== null ? QueryServicesDescriptor.fromPartial(object.queryServices) : undefined;
+ message.tx = object.tx !== undefined && object.tx !== null ? TxDescriptor.fromPartial(object.tx) : undefined;
+ return message;
+ }
+
+};
+
+function createBaseTxDescriptor(): TxDescriptor {
+ return {
+ fullname: "",
+ msgs: []
+ };
+}
+
+export const TxDescriptor = {
+ encode(message: TxDescriptor, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
+ if (message.fullname !== "") {
+ writer.uint32(10).string(message.fullname);
+ }
+
+ for (const v of message.msgs) {
+ MsgDescriptor.encode(v!, writer.uint32(18).fork()).ldelim();
+ }
+
+ return writer;
+ },
+
+ decode(input: _m0.Reader | Uint8Array, length?: number): TxDescriptor {
+ const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
+ let end = length === undefined ? reader.len : reader.pos + length;
+ const message = createBaseTxDescriptor();
+
+ while (reader.pos < end) {
+ const tag = reader.uint32();
+
+ switch (tag >>> 3) {
+ case 1:
+ message.fullname = reader.string();
+ break;
+
+ case 2:
+ message.msgs.push(MsgDescriptor.decode(reader, reader.uint32()));
+ break;
+
+ default:
+ reader.skipType(tag & 7);
+ break;
+ }
+ }
+
+ return message;
+ },
+
+ fromPartial(object: Partial): TxDescriptor {
+ const message = createBaseTxDescriptor();
+ message.fullname = object.fullname ?? "";
+ message.msgs = object.msgs?.map(e => MsgDescriptor.fromPartial(e)) || [];
+ return message;
+ }
+
+};
+
+function createBaseAuthnDescriptor(): AuthnDescriptor {
+ return {
+ signModes: []
+ };
+}
+
+export const AuthnDescriptor = {
+ encode(message: AuthnDescriptor, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
+ for (const v of message.signModes) {
+ SigningModeDescriptor.encode(v!, writer.uint32(10).fork()).ldelim();
+ }
+
+ return writer;
+ },
+
+ decode(input: _m0.Reader | Uint8Array, length?: number): AuthnDescriptor {
+ const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
+ let end = length === undefined ? reader.len : reader.pos + length;
+ const message = createBaseAuthnDescriptor();
+
+ while (reader.pos < end) {
+ const tag = reader.uint32();
+
+ switch (tag >>> 3) {
+ case 1:
+ message.signModes.push(SigningModeDescriptor.decode(reader, reader.uint32()));
+ break;
+
+ default:
+ reader.skipType(tag & 7);
+ break;
+ }
+ }
+
+ return message;
+ },
+
+ fromPartial(object: Partial): AuthnDescriptor {
+ const message = createBaseAuthnDescriptor();
+ message.signModes = object.signModes?.map(e => SigningModeDescriptor.fromPartial(e)) || [];
+ return message;
+ }
+
+};
+
+function createBaseSigningModeDescriptor(): SigningModeDescriptor {
+ return {
+ name: "",
+ number: 0,
+ authnInfoProviderMethodFullname: ""
+ };
+}
+
+export const SigningModeDescriptor = {
+ encode(message: SigningModeDescriptor, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
+ if (message.name !== "") {
+ writer.uint32(10).string(message.name);
+ }
+
+ if (message.number !== 0) {
+ writer.uint32(16).int32(message.number);
+ }
+
+ if (message.authnInfoProviderMethodFullname !== "") {
+ writer.uint32(26).string(message.authnInfoProviderMethodFullname);
+ }
+
+ return writer;
+ },
+
+ decode(input: _m0.Reader | Uint8Array, length?: number): SigningModeDescriptor {
+ const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
+ let end = length === undefined ? reader.len : reader.pos + length;
+ const message = createBaseSigningModeDescriptor();
+
+ while (reader.pos < end) {
+ const tag = reader.uint32();
+
+ switch (tag >>> 3) {
+ case 1:
+ message.name = reader.string();
+ break;
+
+ case 2:
+ message.number = reader.int32();
+ break;
+
+ case 3:
+ message.authnInfoProviderMethodFullname = reader.string();
+ break;
+
+ default:
+ reader.skipType(tag & 7);
+ break;
+ }
+ }
+
+ return message;
+ },
+
+ fromPartial(object: Partial): SigningModeDescriptor {
+ const message = createBaseSigningModeDescriptor();
+ message.name = object.name ?? "";
+ message.number = object.number ?? 0;
+ message.authnInfoProviderMethodFullname = object.authnInfoProviderMethodFullname ?? "";
+ return message;
+ }
+
+};
+
+function createBaseChainDescriptor(): ChainDescriptor {
+ return {
+ id: ""
+ };
+}
+
+export const ChainDescriptor = {
+ encode(message: ChainDescriptor, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
+ if (message.id !== "") {
+ writer.uint32(10).string(message.id);
+ }
+
+ return writer;
+ },
+
+ decode(input: _m0.Reader | Uint8Array, length?: number): ChainDescriptor {
+ const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
+ let end = length === undefined ? reader.len : reader.pos + length;
+ const message = createBaseChainDescriptor();
+
+ while (reader.pos < end) {
+ const tag = reader.uint32();
+
+ switch (tag >>> 3) {
+ case 1:
+ message.id = reader.string();
+ break;
+
+ default:
+ reader.skipType(tag & 7);
+ break;
+ }
+ }
+
+ return message;
+ },
+
+ fromPartial(object: Partial): ChainDescriptor {
+ const message = createBaseChainDescriptor();
+ message.id = object.id ?? "";
+ return message;
+ }
+
+};
+
+function createBaseCodecDescriptor(): CodecDescriptor {
+ return {
+ interfaces: []
+ };
+}
+
+export const CodecDescriptor = {
+ encode(message: CodecDescriptor, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
+ for (const v of message.interfaces) {
+ InterfaceDescriptor.encode(v!, writer.uint32(10).fork()).ldelim();
+ }
+
+ return writer;
+ },
+
+ decode(input: _m0.Reader | Uint8Array, length?: number): CodecDescriptor {
+ const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
+ let end = length === undefined ? reader.len : reader.pos + length;
+ const message = createBaseCodecDescriptor();
+
+ while (reader.pos < end) {
+ const tag = reader.uint32();
+
+ switch (tag >>> 3) {
+ case 1:
+ message.interfaces.push(InterfaceDescriptor.decode(reader, reader.uint32()));
+ break;
+
+ default:
+ reader.skipType(tag & 7);
+ break;
+ }
+ }
+
+ return message;
+ },
+
+ fromPartial(object: Partial): CodecDescriptor {
+ const message = createBaseCodecDescriptor();
+ message.interfaces = object.interfaces?.map(e => InterfaceDescriptor.fromPartial(e)) || [];
+ return message;
+ }
+
+};
+
+function createBaseInterfaceDescriptor(): InterfaceDescriptor {
+ return {
+ fullname: "",
+ interfaceAcceptingMessages: [],
+ interfaceImplementers: []
+ };
+}
+
+export const InterfaceDescriptor = {
+ encode(message: InterfaceDescriptor, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
+ if (message.fullname !== "") {
+ writer.uint32(10).string(message.fullname);
+ }
+
+ for (const v of message.interfaceAcceptingMessages) {
+ InterfaceAcceptingMessageDescriptor.encode(v!, writer.uint32(18).fork()).ldelim();
+ }
+
+ for (const v of message.interfaceImplementers) {
+ InterfaceImplementerDescriptor.encode(v!, writer.uint32(26).fork()).ldelim();
+ }
+
+ return writer;
+ },
+
+ decode(input: _m0.Reader | Uint8Array, length?: number): InterfaceDescriptor {
+ const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
+ let end = length === undefined ? reader.len : reader.pos + length;
+ const message = createBaseInterfaceDescriptor();
+
+ while (reader.pos < end) {
+ const tag = reader.uint32();
+
+ switch (tag >>> 3) {
+ case 1:
+ message.fullname = reader.string();
+ break;
+
+ case 2:
+ message.interfaceAcceptingMessages.push(InterfaceAcceptingMessageDescriptor.decode(reader, reader.uint32()));
+ break;
+
+ case 3:
+ message.interfaceImplementers.push(InterfaceImplementerDescriptor.decode(reader, reader.uint32()));
+ break;
+
+ default:
+ reader.skipType(tag & 7);
+ break;
+ }
+ }
+
+ return message;
+ },
+
+ fromPartial(object: Partial): InterfaceDescriptor {
+ const message = createBaseInterfaceDescriptor();
+ message.fullname = object.fullname ?? "";
+ message.interfaceAcceptingMessages = object.interfaceAcceptingMessages?.map(e => InterfaceAcceptingMessageDescriptor.fromPartial(e)) || [];
+ message.interfaceImplementers = object.interfaceImplementers?.map(e => InterfaceImplementerDescriptor.fromPartial(e)) || [];
+ return message;
+ }
+
+};
+
+function createBaseInterfaceImplementerDescriptor(): InterfaceImplementerDescriptor {
+ return {
+ fullname: "",
+ typeUrl: ""
+ };
+}
+
+export const InterfaceImplementerDescriptor = {
+ encode(message: InterfaceImplementerDescriptor, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
+ if (message.fullname !== "") {
+ writer.uint32(10).string(message.fullname);
+ }
+
+ if (message.typeUrl !== "") {
+ writer.uint32(18).string(message.typeUrl);
+ }
+
+ return writer;
+ },
+
+ decode(input: _m0.Reader | Uint8Array, length?: number): InterfaceImplementerDescriptor {
+ const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
+ let end = length === undefined ? reader.len : reader.pos + length;
+ const message = createBaseInterfaceImplementerDescriptor();
+
+ while (reader.pos < end) {
+ const tag = reader.uint32();
+
+ switch (tag >>> 3) {
+ case 1:
+ message.fullname = reader.string();
+ break;
+
+ case 2:
+ message.typeUrl = reader.string();
+ break;
+
+ default:
+ reader.skipType(tag & 7);
+ break;
+ }
+ }
+
+ return message;
+ },
+
+ fromPartial(object: Partial): InterfaceImplementerDescriptor {
+ const message = createBaseInterfaceImplementerDescriptor();
+ message.fullname = object.fullname ?? "";
+ message.typeUrl = object.typeUrl ?? "";
+ return message;
+ }
+
+};
+
+function createBaseInterfaceAcceptingMessageDescriptor(): InterfaceAcceptingMessageDescriptor {
+ return {
+ fullname: "",
+ fieldDescriptorNames: []
+ };
+}
+
+export const InterfaceAcceptingMessageDescriptor = {
+ encode(message: InterfaceAcceptingMessageDescriptor, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
+ if (message.fullname !== "") {
+ writer.uint32(10).string(message.fullname);
+ }
+
+ for (const v of message.fieldDescriptorNames) {
+ writer.uint32(18).string(v!);
+ }
+
+ return writer;
+ },
+
+ decode(input: _m0.Reader | Uint8Array, length?: number): InterfaceAcceptingMessageDescriptor {
+ const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
+ let end = length === undefined ? reader.len : reader.pos + length;
+ const message = createBaseInterfaceAcceptingMessageDescriptor();
+
+ while (reader.pos < end) {
+ const tag = reader.uint32();
+
+ switch (tag >>> 3) {
+ case 1:
+ message.fullname = reader.string();
+ break;
+
+ case 2:
+ message.fieldDescriptorNames.push(reader.string());
+ break;
+
+ default:
+ reader.skipType(tag & 7);
+ break;
+ }
+ }
+
+ return message;
+ },
+
+ fromPartial(object: Partial): InterfaceAcceptingMessageDescriptor {
+ const message = createBaseInterfaceAcceptingMessageDescriptor();
+ message.fullname = object.fullname ?? "";
+ message.fieldDescriptorNames = object.fieldDescriptorNames?.map(e => e) || [];
+ return message;
+ }
+
+};
+
+function createBaseConfigurationDescriptor(): ConfigurationDescriptor {
+ return {
+ bech32AccountAddressPrefix: ""
+ };
+}
+
+export const ConfigurationDescriptor = {
+ encode(message: ConfigurationDescriptor, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
+ if (message.bech32AccountAddressPrefix !== "") {
+ writer.uint32(10).string(message.bech32AccountAddressPrefix);
+ }
+
+ return writer;
+ },
+
+ decode(input: _m0.Reader | Uint8Array, length?: number): ConfigurationDescriptor {
+ const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
+ let end = length === undefined ? reader.len : reader.pos + length;
+ const message = createBaseConfigurationDescriptor();
+
+ while (reader.pos < end) {
+ const tag = reader.uint32();
+
+ switch (tag >>> 3) {
+ case 1:
+ message.bech32AccountAddressPrefix = reader.string();
+ break;
+
+ default:
+ reader.skipType(tag & 7);
+ break;
+ }
+ }
+
+ return message;
+ },
+
+ fromPartial(object: Partial): ConfigurationDescriptor {
+ const message = createBaseConfigurationDescriptor();
+ message.bech32AccountAddressPrefix = object.bech32AccountAddressPrefix ?? "";
+ return message;
+ }
+
+};
+
+function createBaseMsgDescriptor(): MsgDescriptor {
+ return {
+ msgTypeUrl: ""
+ };
+}
+
+export const MsgDescriptor = {
+ encode(message: MsgDescriptor, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
+ if (message.msgTypeUrl !== "") {
+ writer.uint32(10).string(message.msgTypeUrl);
+ }
+
+ return writer;
+ },
+
+ decode(input: _m0.Reader | Uint8Array, length?: number): MsgDescriptor {
+ const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
+ let end = length === undefined ? reader.len : reader.pos + length;
+ const message = createBaseMsgDescriptor();
+
+ while (reader.pos < end) {
+ const tag = reader.uint32();
+
+ switch (tag >>> 3) {
+ case 1:
+ message.msgTypeUrl = reader.string();
+ break;
+
+ default:
+ reader.skipType(tag & 7);
+ break;
+ }
+ }
+
+ return message;
+ },
+
+ fromPartial(object: Partial): MsgDescriptor {
+ const message = createBaseMsgDescriptor();
+ message.msgTypeUrl = object.msgTypeUrl ?? "";
+ return message;
+ }
+
+};
+
+function createBaseGetAuthnDescriptorRequest(): GetAuthnDescriptorRequest {
+ return {};
+}
+
+export const GetAuthnDescriptorRequest = {
+ encode(_: GetAuthnDescriptorRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
+ return writer;
+ },
+
+ decode(input: _m0.Reader | Uint8Array, length?: number): GetAuthnDescriptorRequest {
+ const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
+ let end = length === undefined ? reader.len : reader.pos + length;
+ const message = createBaseGetAuthnDescriptorRequest();
+
+ while (reader.pos < end) {
+ const tag = reader.uint32();
+
+ switch (tag >>> 3) {
+ default:
+ reader.skipType(tag & 7);
+ break;
+ }
+ }
+
+ return message;
+ },
+
+ fromPartial(_: Partial): GetAuthnDescriptorRequest {
+ const message = createBaseGetAuthnDescriptorRequest();
+ return message;
+ }
+
+};
+
+function createBaseGetAuthnDescriptorResponse(): GetAuthnDescriptorResponse {
+ return {
+ authn: undefined
+ };
+}
+
+export const GetAuthnDescriptorResponse = {
+ encode(message: GetAuthnDescriptorResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
+ if (message.authn !== undefined) {
+ AuthnDescriptor.encode(message.authn, writer.uint32(10).fork()).ldelim();
+ }
+
+ return writer;
+ },
+
+ decode(input: _m0.Reader | Uint8Array, length?: number): GetAuthnDescriptorResponse {
+ const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
+ let end = length === undefined ? reader.len : reader.pos + length;
+ const message = createBaseGetAuthnDescriptorResponse();
+
+ while (reader.pos < end) {
+ const tag = reader.uint32();
+
+ switch (tag >>> 3) {
+ case 1:
+ message.authn = AuthnDescriptor.decode(reader, reader.uint32());
+ break;
+
+ default:
+ reader.skipType(tag & 7);
+ break;
+ }
+ }
+
+ return message;
+ },
+
+ fromPartial(object: Partial): GetAuthnDescriptorResponse {
+ const message = createBaseGetAuthnDescriptorResponse();
+ message.authn = object.authn !== undefined && object.authn !== null ? AuthnDescriptor.fromPartial(object.authn) : undefined;
+ return message;
+ }
+
+};
+
+function createBaseGetChainDescriptorRequest(): GetChainDescriptorRequest {
+ return {};
+}
+
+export const GetChainDescriptorRequest = {
+ encode(_: GetChainDescriptorRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
+ return writer;
+ },
+
+ decode(input: _m0.Reader | Uint8Array, length?: number): GetChainDescriptorRequest {
+ const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
+ let end = length === undefined ? reader.len : reader.pos + length;
+ const message = createBaseGetChainDescriptorRequest();
+
+ while (reader.pos < end) {
+ const tag = reader.uint32();
+
+ switch (tag >>> 3) {
+ default:
+ reader.skipType(tag & 7);
+ break;
+ }
+ }
+
+ return message;
+ },
+
+ fromPartial(_: Partial): GetChainDescriptorRequest {
+ const message = createBaseGetChainDescriptorRequest();
+ return message;
+ }
+
+};
+
+function createBaseGetChainDescriptorResponse(): GetChainDescriptorResponse {
+ return {
+ chain: undefined
+ };
+}
+
+export const GetChainDescriptorResponse = {
+ encode(message: GetChainDescriptorResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
+ if (message.chain !== undefined) {
+ ChainDescriptor.encode(message.chain, writer.uint32(10).fork()).ldelim();
+ }
+
+ return writer;
+ },
+
+ decode(input: _m0.Reader | Uint8Array, length?: number): GetChainDescriptorResponse {
+ const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
+ let end = length === undefined ? reader.len : reader.pos + length;
+ const message = createBaseGetChainDescriptorResponse();
+
+ while (reader.pos < end) {
+ const tag = reader.uint32();
+
+ switch (tag >>> 3) {
+ case 1:
+ message.chain = ChainDescriptor.decode(reader, reader.uint32());
+ break;
+
+ default:
+ reader.skipType(tag & 7);
+ break;
+ }
+ }
+
+ return message;
+ },
+
+ fromPartial(object: Partial): GetChainDescriptorResponse {
+ const message = createBaseGetChainDescriptorResponse();
+ message.chain = object.chain !== undefined && object.chain !== null ? ChainDescriptor.fromPartial(object.chain) : undefined;
+ return message;
+ }
+
+};
+
+function createBaseGetCodecDescriptorRequest(): GetCodecDescriptorRequest {
+ return {};
+}
+
+export const GetCodecDescriptorRequest = {
+ encode(_: GetCodecDescriptorRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
+ return writer;
+ },
+
+ decode(input: _m0.Reader | Uint8Array, length?: number): GetCodecDescriptorRequest {
+ const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
+ let end = length === undefined ? reader.len : reader.pos + length;
+ const message = createBaseGetCodecDescriptorRequest();
+
+ while (reader.pos < end) {
+ const tag = reader.uint32();
+
+ switch (tag >>> 3) {
+ default:
+ reader.skipType(tag & 7);
+ break;
+ }
+ }
+
+ return message;
+ },
+
+ fromPartial(_: Partial): GetCodecDescriptorRequest {
+ const message = createBaseGetCodecDescriptorRequest();
+ return message;
+ }
+
+};
+
+function createBaseGetCodecDescriptorResponse(): GetCodecDescriptorResponse {
+ return {
+ codec: undefined
+ };
+}
+
+export const GetCodecDescriptorResponse = {
+ encode(message: GetCodecDescriptorResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
+ if (message.codec !== undefined) {
+ CodecDescriptor.encode(message.codec, writer.uint32(10).fork()).ldelim();
+ }
+
+ return writer;
+ },
+
+ decode(input: _m0.Reader | Uint8Array, length?: number): GetCodecDescriptorResponse {
+ const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
+ let end = length === undefined ? reader.len : reader.pos + length;
+ const message = createBaseGetCodecDescriptorResponse();
+
+ while (reader.pos < end) {
+ const tag = reader.uint32();
+
+ switch (tag >>> 3) {
+ case 1:
+ message.codec = CodecDescriptor.decode(reader, reader.uint32());
+ break;
+
+ default:
+ reader.skipType(tag & 7);
+ break;
+ }
+ }
+
+ return message;
+ },
+
+ fromPartial(object: Partial): GetCodecDescriptorResponse {
+ const message = createBaseGetCodecDescriptorResponse();
+ message.codec = object.codec !== undefined && object.codec !== null ? CodecDescriptor.fromPartial(object.codec) : undefined;
+ return message;
+ }
+
+};
+
+function createBaseGetConfigurationDescriptorRequest(): GetConfigurationDescriptorRequest {
+ return {};
+}
+
+export const GetConfigurationDescriptorRequest = {
+ encode(_: GetConfigurationDescriptorRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
+ return writer;
+ },
+
+ decode(input: _m0.Reader | Uint8Array, length?: number): GetConfigurationDescriptorRequest {
+ const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
+ let end = length === undefined ? reader.len : reader.pos + length;
+ const message = createBaseGetConfigurationDescriptorRequest();
+
+ while (reader.pos < end) {
+ const tag = reader.uint32();
+
+ switch (tag >>> 3) {
+ default:
+ reader.skipType(tag & 7);
+ break;
+ }
+ }
+
+ return message;
+ },
+
+ fromPartial(_: Partial): GetConfigurationDescriptorRequest {
+ const message = createBaseGetConfigurationDescriptorRequest();
+ return message;
+ }
+
+};
+
+function createBaseGetConfigurationDescriptorResponse(): GetConfigurationDescriptorResponse {
+ return {
+ config: undefined
+ };
+}
+
+export const GetConfigurationDescriptorResponse = {
+ encode(message: GetConfigurationDescriptorResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
+ if (message.config !== undefined) {
+ ConfigurationDescriptor.encode(message.config, writer.uint32(10).fork()).ldelim();
+ }
+
+ return writer;
+ },
+
+ decode(input: _m0.Reader | Uint8Array, length?: number): GetConfigurationDescriptorResponse {
+ const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
+ let end = length === undefined ? reader.len : reader.pos + length;
+ const message = createBaseGetConfigurationDescriptorResponse();
+
+ while (reader.pos < end) {
+ const tag = reader.uint32();
+
+ switch (tag >>> 3) {
+ case 1:
+ message.config = ConfigurationDescriptor.decode(reader, reader.uint32());
+ break;
+
+ default:
+ reader.skipType(tag & 7);
+ break;
+ }
+ }
+
+ return message;
+ },
+
+ fromPartial(object: Partial